mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
Add partition handling for the Xbox
svn path=/trunk/; revision=11613
This commit is contained in:
parent
6f9d1917af
commit
2fada79f2e
14 changed files with 92 additions and 15 deletions
|
@ -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 @@ PcMachInit(VOID)
|
|||
MachVtbl.PutCharAttrAtLoc = PcConsPutCharAttrAtLoc;
|
||||
MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
|
||||
MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
|
||||
MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -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 @@ VOID PcConsPutCharAttrAtLoc(int Ch, U8 Attr, unsigned X, unsigned Y);
|
|||
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_ */
|
||||
|
||||
|
|
|
@ -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 @@ XboxMachInit(VOID)
|
|||
MachVtbl.PutCharAttrAtLoc = XboxVideoPutCharAttrAtLoc;
|
||||
MachVtbl.GetMemoryMap = XboxMemGetMemoryMap;
|
||||
MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
|
||||
MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
|
||||
|
||||
}
|
||||
|
|
|
@ -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 @@ PVOID XboxMemReserveMemory(U32 MbToReserve);
|
|||
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_ */
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -363,3 +363,12 @@ BOOL PcDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
PcDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
|
||||
{
|
||||
/* Just use the standard routine */
|
||||
return DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 @@ XboxDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, P
|
|||
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 */
|
||||
|
|
|
@ -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] =
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <ui.h>
|
||||
#include <arch.h>
|
||||
#include <debug.h>
|
||||
#include <machine.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -106,7 +107,7 @@ BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber)
|
|||
else
|
||||
{
|
||||
// Get requested partition
|
||||
if (DiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
|
||||
if (MachDiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
|
||||
{
|
||||
FileSystemError("Partition not found.");
|
||||
return FALSE;
|
||||
|
|
|
@ -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 @@ typedef struct tagMACHVTBL
|
|||
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 @@ extern MACHVTBL MachVtbl;
|
|||
#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_ */
|
||||
|
||||
|
|
|
@ -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 @@ MachDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, P
|
|||
return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);
|
||||
}
|
||||
|
||||
BOOL
|
||||
MachDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
|
||||
{
|
||||
return MachVtbl.DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue