[FREELDR] Add PCI BIOS emulation and PCI bus enumeration for Xbox (#1830)

CORE-16216 CORE-16308
This commit is contained in:
Stanislav Motylkov 2019-08-16 20:14:10 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent 5f7575909f
commit c08beef1cf
5 changed files with 26 additions and 2 deletions

View file

@ -24,6 +24,8 @@
DBG_DEFAULT_CHANNEL(HWDETECT);
FIND_PCI_BIOS FindPciBios = NULL;
static
PPCI_IRQ_ROUTING_TABLE
GetPciIrqRoutingTable(VOID)
@ -75,8 +77,8 @@ GetPciIrqRoutingTable(VOID)
}
static BOOLEAN
FindPciBios(PPCI_REGISTRY_INFO BusData)
BOOLEAN
PcFindPciBios(PPCI_REGISTRY_INFO BusData)
{
REGS RegsIn;
REGS RegsOut;

View file

@ -1353,6 +1353,7 @@ PcHwDetect(VOID)
// TODO: Discover and set the machine type as the Component->Identifier
GetHarddiskConfigurationData = PcGetHarddiskConfigurationData;
FindPciBios = PcFindPciBios;
/* Detect buses */
DetectPciBios(SystemKey, &BusNumber);

View file

@ -23,6 +23,18 @@
DBG_DEFAULT_CHANNEL(HWDETECT);
BOOLEAN
XboxFindPciBios(PPCI_REGISTRY_INFO BusData)
{
/* We emulate PCI BIOS here, there are 2 known working PCI buses on an original Xbox */
BusData->NoBuses = 2;
BusData->MajorRevision = 1;
BusData->MinorRevision = 0;
BusData->HardwareMechanism = 1;
return TRUE;
}
VOID
XboxGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
{
@ -175,8 +187,10 @@ XboxHwDetect(VOID)
FldrCreateSystemKey(&SystemKey);
GetHarddiskConfigurationData = XboxGetHarddiskConfigurationData;
FindPciBios = XboxFindPciBios;
/* TODO: Build actual xbox's hardware configuration tree */
DetectPciBios(SystemKey, &BusNumber);
DetectIsaBios(SystemKey, &BusNumber);
TRACE("DetectHardware() Done\n");

View file

@ -38,6 +38,12 @@ PCM_PARTIAL_RESOURCE_LIST
extern GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData;
typedef
BOOLEAN
(*FIND_PCI_BIOS)(PPCI_REGISTRY_INFO BusData);
extern FIND_PCI_BIOS FindPciBios;
VOID
DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
PCONFIGURATION_COMPONENT_DATA BusKey);

View file

@ -49,6 +49,7 @@ VOID PcVideoPrepareForReactOS(VOID);
VOID PcPrepareForReactOS(VOID);
PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize);
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData);
BOOLEAN DiskResetController(UCHAR DriveNumber);
BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize);