mirror of
https://github.com/reactos/reactos.git
synced 2026-05-24 16:20:07 +08:00
[FREELDR:XBOX] Fix compilation dependencies and linking for the XBOX build (#8510)
CORE-16216
machpc.c:
- Surround more PC-specific routines in `#if !defined(SARCH_XBOX)`,
so that they aren't compiled for XBOX.
- In particular since commit 246f2d29db (PR #8418), the PC-specific
`DiskGetConfigType()` was compiled at the same time as the XBOX one.
This is now fixed.
machxbox.c
- Add a dummy `ChainLoadBiosBootSectorCode()` to make freeldr exports working.
xboxdisk.c
- Minimal Disk I/O error support routines.
- Add a dummy `DiskResetController()`, invoked in pchw.c
- Add a dummy `DiskStopFloppyMotor()`, needed for entry.S/linux.S
miscboot.c
- Still compile `LoadAndBootSector()` (avoids lots of changes elsewhere),
but display an error message if it's run, and directly return with an error.
pcat.cmake
- Remove unnecessary dependencies on pcdisk.c and pcvesa.c
This commit is contained in:
@@ -100,6 +100,9 @@ typedef struct _PNP_DOCK_INFO
|
||||
} PNP_DOCK_INFO, *PPNP_DOCK_INFO;
|
||||
#include <poppack.h>
|
||||
|
||||
/* 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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user