diff --git a/boot/freeldr/freeldr/arch/i386/pc/machpc.c b/boot/freeldr/freeldr/arch/i386/pc/machpc.c index a8082ed79a4..f73110ec1d6 100644 --- a/boot/freeldr/freeldr/arch/i386/pc/machpc.c +++ b/boot/freeldr/freeldr/arch/i386/pc/machpc.c @@ -100,6 +100,9 @@ typedef struct _PNP_DOCK_INFO } PNP_DOCK_INFO, *PPNP_DOCK_INFO; #include +/* FIXME: Abstract things better so we don't need to place define here */ +#if !defined(SARCH_XBOX) + VOID PcGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize) { @@ -385,6 +388,8 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) (*BusNumber)++; } +#endif // !SARCH_XBOX + static VOID InitializeSerialPort(PUCHAR Port, @@ -711,6 +716,8 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, } } +/* FIXME: Abstract things better so we don't need to place define here */ +#if !defined(SARCH_XBOX) static ULONG PcGetSerialPort(ULONG Index, PULONG Irq) @@ -728,6 +735,7 @@ PcGetSerialPort(ULONG Index, PULONG Irq) return (ULONG) *(BasePtr + Index); } +#endif // !SARCH_XBOX /* * Parse the serial mouse detection options. @@ -880,6 +888,9 @@ DetectSerialPorts( } } +/* FIXME: Abstract things better so we don't need to place define here */ +#if !defined(SARCH_XBOX) + static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey) { @@ -971,6 +982,8 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey) TRACE("DetectParallelPorts() done\n"); } +#endif // !SARCH_XBOX + // static BOOLEAN DetectKeyboardDevice(VOID) @@ -1172,6 +1185,9 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey) DetectKeyboardPeripheral(ControllerKey); } +/* FIXME: Abstract things better so we don't need to place define here */ +#if !defined(SARCH_XBOX) + static VOID PS2ControllerWait(VOID) @@ -1672,8 +1688,6 @@ DetectIsaBios( /* FIXME: Detect more ISA devices */ } -/* FIXME: Abstract things better so we don't need to place define here */ -#if !defined(SARCH_XBOX) static UCHAR PcGetFloppyCount(VOID) @@ -1685,7 +1699,6 @@ PcGetFloppyCount(VOID) return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0); } -#endif PCONFIGURATION_COMPONENT_DATA PcHwDetect( @@ -1768,6 +1781,9 @@ VOID __cdecl ChainLoadBiosBootSectorCode( 0x0000, 0x7C00); } +#endif // !SARCH_XBOX + + /******************************************************************************/ /* FIXME: Abstract things better so we don't need to place define here */ @@ -1813,7 +1829,7 @@ MachInit(const char *CmdLine) VOID PcPrepareForReactOS(VOID) { - /* On PC, prepare video and turn off the floppy motor */ + /* Prepare video and turn off the floppy motor */ PcVideoPrepareForReactOS(); DiskStopFloppyMotor(); } diff --git a/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c b/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c index ab3f8020041..7443d7d73ef 100644 --- a/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c +++ b/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c @@ -290,6 +290,13 @@ VOID XboxHwIdle(VOID) /* UNIMPLEMENTED */ } +// FIXME: Dummy to make freeldr exports working. +VOID __cdecl ChainLoadBiosBootSectorCode( + IN UCHAR BootDrive OPTIONAL, + IN ULONG BootPartition OPTIONAL) +{ + /* No-op on XBOX */ +} /******************************************************************************/ @@ -372,11 +379,8 @@ MachInit(const char *CmdLine) VOID XboxPrepareForReactOS(VOID) { - /* On Xbox, prepare video and disk support */ + /* Prepare video and turn off debug messages to screen */ XboxVideoPrepareForReactOS(); - DiskStopFloppyMotor(); - - /* Turn off debug messages to screen */ DebugDisableScreenPort(); } diff --git a/boot/freeldr/freeldr/arch/i386/xbox/xboxdisk.c b/boot/freeldr/freeldr/arch/i386/xbox/xboxdisk.c index a17102da5eb..a8c60bb4e89 100644 --- a/boot/freeldr/freeldr/arch/i386/xbox/xboxdisk.c +++ b/boot/freeldr/freeldr/arch/i386/xbox/xboxdisk.c @@ -20,6 +20,47 @@ static PDEVICE_UNIT HardDrive = NULL; static PDEVICE_UNIT CdDrive = NULL; static BOOLEAN AtaInitialized = FALSE; +/* DISK IO ERROR SUPPORT *****************************************************/ + +static LONG lReportError = 0; // >= 0: display errors; < 0: hide errors. + +LONG DiskReportError(BOOLEAN bShowError) +{ + /* Set the reference count */ + if (bShowError) ++lReportError; + else --lReportError; + return lReportError; +} + +#if 0 // TODO: ATA/IDE error code descriptions. +static PCSTR DiskGetErrorCodeString(ULONG ErrorCode) +{ + switch (ErrorCode) + { + default: return "unknown error code"; + } +} +#endif + +static VOID DiskError(PCSTR ErrorString, ULONG ErrorCode) +{ + CHAR ErrorCodeString[200]; + + if (lReportError < 0) + return; + +#if 0 // TODO: ATA/IDE error code descriptions. + sprintf(ErrorCodeString, "%s\n\nError Code: 0x%lx\nError: %s", + ErrorString, ErrorCode, DiskGetErrorCodeString(ErrorCode)); +#else + UNREFERENCED_PARAMETER(ErrorCode); + sprintf(ErrorCodeString, "%s", ErrorString); +#endif + + ERR("%s\n", ErrorCodeString); + UiMessageBox(ErrorCodeString); +} + /* FUNCTIONS ******************************************************************/ static @@ -77,6 +118,13 @@ XboxDiskDriveNumberToDeviceUnit(UCHAR DriveNumber) return NULL; } +BOOLEAN DiskResetController(UCHAR DriveNumber) +{ + WARN("DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber); + /* No-op on XBOX */ + return TRUE; +} + CONFIGURATION_TYPE DiskGetConfigType( _In_ UCHAR DriveNumber) @@ -93,6 +141,12 @@ DiskGetConfigType( return DiskPeripheral; } +// FIXME: Dummy for entry.S/linux.S +VOID __cdecl DiskStopFloppyMotor(VOID) +{ + /* No-op on XBOX */ +} + BOOLEAN XboxDiskReadLogicalSectors( IN UCHAR DriveNumber, @@ -101,6 +155,7 @@ XboxDiskReadLogicalSectors( OUT PVOID Buffer) { PDEVICE_UNIT DeviceUnit; + BOOLEAN Success; TRACE("XboxDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64u SectorCount: %u Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer); @@ -109,7 +164,10 @@ XboxDiskReadLogicalSectors( if (!DeviceUnit) return FALSE; - return AtaReadLogicalSectors(DeviceUnit, SectorNumber, SectorCount, Buffer); + Success = AtaReadLogicalSectors(DeviceUnit, SectorNumber, SectorCount, Buffer); + if (!Success) + DiskError("Disk Read Failed", -1); + return Success; } BOOLEAN diff --git a/boot/freeldr/freeldr/miscboot.c b/boot/freeldr/freeldr/miscboot.c index 9d9c4bf8efb..a423a34c2c2 100644 --- a/boot/freeldr/freeldr/miscboot.c +++ b/boot/freeldr/freeldr/miscboot.c @@ -38,6 +38,10 @@ LoadAndBootSector( _In_ PCHAR Argv[], _In_ PCHAR Envp[]) { +#if defined(SARCH_XBOX) + UiMessageBox("Boot sector booting is not supported on XBOX."); + return ENOEXEC; +#endif ARC_STATUS Status; PCSTR ArgValue; PCSTR BootPath; diff --git a/boot/freeldr/freeldr/pcat.cmake b/boot/freeldr/freeldr/pcat.cmake index 78121be46f8..374404fb457 100644 --- a/boot/freeldr/freeldr/pcat.cmake +++ b/boot/freeldr/freeldr/pcat.cmake @@ -69,10 +69,8 @@ if(ARCH STREQUAL "i386") # FIXME: Abstract things better so we don't need to include /pc/* here arch/i386/pc/machpc.c # machxbox.c depends on it arch/i386/pc/pcbeep.c # machxbox.c depends on it - arch/i386/pc/pcdisk.c # hwdisk.c depends on it arch/i386/pc/pchw.c # Many files depends on it arch/i386/pc/pcmem.c # hwacpi.c/xboxmem.c depends on it - arch/i386/pc/pcvesa.c # machpc.c depends on it arch/i386/xbox/machxbox.c arch/i386/xbox/xboxcons.c arch/i386/xbox/xboxdisk.c