From ae81274578559135a0555cd620ac1a9f4442e60f Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Mon, 2 Nov 2009 21:13:45 +0000 Subject: [PATCH] - Fix a FreeLdr PCI detection bug introduced in revision 10742 5 years ago when PCI detection was added. FindPciBios was setting the HardwareMechanism entry in the PCI_REGISTRY_INFO structure (then called CM_PCI_BUS_DATA) to the wrong register returned from the PCI BIOS: CL instead of AL. CL is the number of the last PCI bus in the system (0 if you only have 1 bus, 1 if you have 2 buses). AL contains bit-fields for PCI characteristics, and HAL checks the 2 first bits to determine the type of the BUS. My VMWare test environment has 2 PCI buses, so the number happened to be correct. This doesn't work if there is only 1 PCI bus, such as in QEMU and Vbox, as we then get an invalid PCI type of 0. Fix this and re-enable the PCI detection in HAL to properly detect the PCI type instead of assuming type 1. svn path=/trunk/; revision=43924 --- reactos/boot/freeldr/freeldr/arch/i386/hwpci.c | 2 +- reactos/hal/halx86/generic/bus/pcibus.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c index a56e12e2dad..611bb10b6c2 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c @@ -132,7 +132,7 @@ FindPciBios(PPCI_REGISTRY_INFO BusData) BusData->NoBuses = RegsOut.b.cl + 1; BusData->MajorRevision = RegsOut.b.bh; BusData->MinorRevision = RegsOut.b.bl; - BusData->HardwareMechanism = RegsOut.b.cl; + BusData->HardwareMechanism = RegsOut.b.al; return TRUE; } diff --git a/reactos/hal/halx86/generic/bus/pcibus.c b/reactos/hal/halx86/generic/bus/pcibus.c index 23fa09d8401..3282803e9f8 100644 --- a/reactos/hal/halx86/generic/bus/pcibus.c +++ b/reactos/hal/halx86/generic/bus/pcibus.c @@ -938,11 +938,7 @@ HalpInitializePciStubs(VOID) ULONG VendorId = 0; /* Query registry information */ -#ifdef WORKED_FOR_ME PciRegistryInfo = HalpQueryPciRegistryInfo(); -#else - PciRegistryInfo = NULL; -#endif if (!PciRegistryInfo) { /* Assume type 1 */