Commit in freeldr/freeldr on MAIN
machine.c+8-11.2 -> 1.3
arch/i386/machpc.c+2-11.2 -> 1.3
         /machpc.h+2-11.2 -> 1.3
         /machxbox.c+3-11.2 -> 1.3
         /machxbox.h+2-11.2 -> 1.3
         /pccons.c+2-21.1 -> 1.2
         /pcdisk.c+91.1 -> 1.2
         /pcmem.c+2-21.1 -> 1.2
         /xboxdisk.c+47-11.1 -> 1.2
         /xboxfont.c+2-11.1 -> 1.2
         /xboxmem.c+2-11.2 -> 1.3
         /xboxvideo.c+2-11.1 -> 1.2
fs/fs.c+2-11.15 -> 1.16
include/machine.h+7-11.2 -> 1.3
+92-15
14 modified files
Add partition handling for the Xbox

freeldr/freeldr
machine.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- machine.c	9 Nov 2004 23:36:19 -0000	1.2
+++ machine.c	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: machine.c,v 1.2 2004/11/09 23:36:19 gvg Exp $
+/* $Id: machine.c,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -25,6 +25,7 @@
 #undef MachPutCharAttrAtLoc
 #undef MachGetMemoryMap
 #undef MachDiskReadLogicalSectors
+#undef MachDiskGetPartitionEntry
 
 MACHVTBL MachVtbl;
 
@@ -58,4 +59,10 @@
   return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);
 }
 
+BOOL
+MachDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+{
+  return MachVtbl.DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
+}
+
 /* EOF */

freeldr/freeldr/arch/i386
machpc.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- machpc.c	9 Nov 2004 23:36:19 -0000	1.2
+++ machpc.c	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: machpc.c,v 1.2 2004/11/09 23:36:19 gvg Exp $
+/* $Id: machpc.c,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -35,6 +35,7 @@
   MachVtbl.PutCharAttrAtLoc = PcConsPutCharAttrAtLoc;
   MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
   MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
+  MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;
 }
 
 /* EOF */

freeldr/freeldr/arch/i386
machpc.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- machpc.h	9 Nov 2004 23:36:19 -0000	1.2
+++ machpc.h	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: machpc.h,v 1.2 2004/11/09 23:36:19 gvg Exp $
+/* $Id: machpc.h,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -35,6 +35,7 @@
 U32 PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
 
 BOOL PcDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer);
+BOOL PcDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
 
 #endif /* __I386_MACHPC_H_ */
 

freeldr/freeldr/arch/i386
machxbox.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- machxbox.c	9 Nov 2004 23:36:19 -0000	1.2
+++ machxbox.c	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: machxbox.c,v 1.2 2004/11/09 23:36:19 gvg Exp $
+/* $Id: machxbox.c,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -35,4 +35,6 @@
   MachVtbl.PutCharAttrAtLoc = XboxVideoPutCharAttrAtLoc;
   MachVtbl.GetMemoryMap = XboxMemGetMemoryMap;
   MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
+  MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
+
 }

freeldr/freeldr/arch/i386
machxbox.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- machxbox.h	9 Nov 2004 23:36:19 -0000	1.2
+++ machxbox.h	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: machxbox.h,v 1.2 2004/11/09 23:36:19 gvg Exp $
+/* $Id: machxbox.h,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -38,6 +38,7 @@
 U32 XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
 
 BOOL XboxDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer);
+BOOL XboxDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
 
 #endif /* __I386_HWXBOX_H_ */
 

freeldr/freeldr/arch/i386
pccons.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- pccons.c	8 Nov 2004 22:02:47 -0000	1.1
+++ pccons.c	10 Nov 2004 23:45:37 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: pccons.c,v 1.1 2004/11/08 22:02:47 gvg Exp $
+/* $Id: pccons.c,v 1.2 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -18,7 +18,7 @@
  */
 
 #include "freeldr.h"
-#include "mm.h"
+#include "machine.h"
 #include "arch.h"
 #include "debug.h"
 #include "machpc.h"

freeldr/freeldr/arch/i386
pcdisk.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- pcdisk.c	9 Nov 2004 23:36:19 -0000	1.1
+++ pcdisk.c	10 Nov 2004 23:45:37 -0000	1.2
@@ -363,3 +363,12 @@
 
 	return TRUE;
 }
+
+BOOL
+PcDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+{
+  /* Just use the standard routine */
+  return DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
+}
+
+/* EOF */

freeldr/freeldr/arch/i386
pcmem.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- pcmem.c	8 Nov 2004 22:02:47 -0000	1.1
+++ pcmem.c	10 Nov 2004 23:45:37 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: pcmem.c,v 1.1 2004/11/08 22:02:47 gvg Exp $
+/* $Id: pcmem.c,v 1.2 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -23,7 +23,7 @@
 #include "freeldr.h"
 #include "arch.h"
 #include "debug.h"
-#include "mm.h"
+#include "machine.h"
 #include "machpc.h"
 #include "portio.h"
 #include "rtl.h"

freeldr/freeldr/arch/i386
xboxdisk.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- xboxdisk.c	9 Nov 2004 23:36:19 -0000	1.1
+++ xboxdisk.c	10 Nov 2004 23:45:37 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: xboxdisk.c,v 1.1 2004/11/09 23:36:19 gvg Exp $
+/* $Id: xboxdisk.c,v 1.2 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -17,12 +17,15 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * Note: mostly ripped from atapi.c
+ *       Some of this code was based on knowledge and/or code developed
+ *       by the Xbox Linux group: http://www.xbox-linux.org
  *
  */
 
 #include "freeldr.h"
 #include "debug.h"
 #include "hardware.h"
+#include "machine.h"
 #include "machxbox.h"
 #include "portio.h"
 #include "rtl.h"
@@ -30,6 +33,24 @@
 #define XBOX_IDE_COMMAND_PORT 0x1f0
 #define XBOX_IDE_CONTROL_PORT 0x170
 
+#define XBOX_SIGNATURE_SECTOR 3
+#define XBOX_SIGNATURE        ('B' | ('R' << 8) | ('F' << 16) | ('R' << 24))
+
+static struct
+{
+  U32 SectorCountBeforePartition;
+  U32 PartitionSectorCount;
+  U8 SystemIndicator;
+} XboxPartitions[] =
+{
+  /* This is in the \Device\Harddisk0\Partition.. order used by the Xbox kernel */
+  { 0x0055F400, 0x0098f800, PARTITION_FAT32  }, /* Store, E: */
+  { 0x00465400, 0x000FA000, PARTITION_FAT_16 }, /* System, C: */
+  { 0x00000400, 0x00177000, PARTITION_FAT_16 }, /* Cache1, X: */
+  { 0x00177400, 0x00177000, PARTITION_FAT_16 }, /* Cache2, Y: */
+  { 0x002EE400, 0x00177000, PARTITION_FAT_16 }  /* Cache3, Z: */
+};
+
 #define  IDE_SECTOR_BUF_SZ         512
 #define  IDE_MAX_POLL_RETRIES      100000
 #define  IDE_MAX_BUSY_RETRIES      50000
@@ -395,4 +416,29 @@
   return TRUE;
 }
 
+BOOL
+XboxDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+{
+  U8 SectorData[IDE_SECTOR_BUF_SZ];
+
+  /* This is the Xbox, chances are that there is a Xbox-standard partitionless
+   * disk in it so let's check that first */
+
+  if (1 <= PartitionNumber && PartitionNumber <= sizeof(XboxPartitions) / sizeof(XboxPartitions[0]) &&
+      MachDiskReadLogicalSectors(DriveNumber, XBOX_SIGNATURE_SECTOR, 1, SectorData))
+    {
+      if (*((PU32) SectorData) == XBOX_SIGNATURE)
+        {
+          memset(PartitionTableEntry, 0, sizeof(PARTITION_TABLE_ENTRY));
+          PartitionTableEntry->SystemIndicator = XboxPartitions[PartitionNumber - 1].SystemIndicator;
+          PartitionTableEntry->SectorCountBeforePartition = XboxPartitions[PartitionNumber - 1].SectorCountBeforePartition;
+          PartitionTableEntry->PartitionSectorCount = XboxPartitions[PartitionNumber - 1].PartitionSectorCount;
+          return TRUE;
+        }
+    }
+
+  /* No magic Xbox partitions. Maybe there's a MBR */
+  return DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
+}
+
 /* EOF */

freeldr/freeldr/arch/i386
xboxfont.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- xboxfont.c	8 Nov 2004 22:02:47 -0000	1.1
+++ xboxfont.c	10 Nov 2004 23:45:37 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: xboxfont.c,v 1.1 2004/11/08 22:02:47 gvg Exp $
+/* $Id: xboxfont.c,v 1.2 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -20,6 +20,7 @@
  */
 
 #include "freeldr.h"
+#include "machine.h"
 #include "machxbox.h"
 
 U8 XboxFont8x16[256 * 16] =

freeldr/freeldr/arch/i386
xboxmem.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- xboxmem.c	9 Nov 2004 23:36:19 -0000	1.2
+++ xboxmem.c	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: xboxmem.c,v 1.2 2004/11/09 23:36:19 gvg Exp $
+/* $Id: xboxmem.c,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -25,6 +25,7 @@
 #include "mm.h"
 #include "rtl.h"
 #include "hardware.h"
+#include "machine.h"
 #include "machxbox.h"
 #include "portio.h"
 

freeldr/freeldr/arch/i386
xboxvideo.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- xboxvideo.c	8 Nov 2004 22:02:47 -0000	1.1
+++ xboxvideo.c	10 Nov 2004 23:45:37 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: xboxvideo.c,v 1.1 2004/11/08 22:02:47 gvg Exp $
+/* $Id: xboxvideo.c,v 1.2 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -23,6 +23,7 @@
 #include "freeldr.h"
 #include "debug.h"
 #include "rtl.h"
+#include "machine.h"
 #include "machxbox.h"
 
 static PVOID FrameBuffer;

freeldr/freeldr/fs
fs.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- fs.c	30 Oct 2004 19:32:29 -0000	1.15
+++ fs.c	10 Nov 2004 23:45:37 -0000	1.16
@@ -29,6 +29,7 @@
 #include <ui.h>
 #include <arch.h>
 #include <debug.h>
+#include <machine.h>
 
 
 /////////////////////////////////////////////////////////////////////////////////////////////
@@ -106,7 +107,7 @@
 	else
 	{
 		// Get requested partition
-		if (DiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
+		if (MachDiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
 		{
 			FileSystemError("Partition not found.");
 			return FALSE;

freeldr/freeldr/include
machine.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- machine.h	9 Nov 2004 23:36:20 -0000	1.2
+++ machine.h	10 Nov 2004 23:45:37 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: machine.h,v 1.2 2004/11/09 23:36:20 gvg Exp $
+/* $Id: machine.h,v 1.3 2004/11/10 23:45:37 gvg Exp $
  *
  *  FreeLoader
  *
@@ -20,6 +20,10 @@
 #ifndef __MACHINE_H_
 #define __MACHINE_H_
 
+#ifndef __DISK_H
+#include "disk.h"
+#endif
+
 #ifndef __MEMORY_H
 #include "mm.h"
 #endif
@@ -33,6 +37,7 @@
   U32 (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
 
   BOOL (*DiskReadLogicalSectors)(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer);
+  BOOL (*DiskGetPartitionEntry)(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
 } MACHVTBL, *PMACHVTBL;
 
 VOID MachInit(VOID);
@@ -44,6 +49,7 @@
 #define MachPutCharAttrAtLoc(Ch, Attr, X, Y)	MachVtbl.PutCharAttrAtLoc((Ch), (Attr), (X), (Y))
 #define MachGetMemoryMap(MMap, Size)		MachVtbl.GetMemoryMap((MMap), (Size))
 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)	MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
+#define MachDiskGetPartitionEntry(Drive, Part, Entry)	MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
 
 #endif /* __MACHINE_H_ */
 
CVSspam 0.2.8