From: Sir Richard Date: Mon, 7 Jun 2010 15:09:44 +0000 (+0000) Subject: [NTOS]: Check registry for our CardList, check if the PCI hardware matches any entry... X-Git-Tag: backups/Ash_Shell@48412~1^2~544 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=2031c565df91719111a121ccf4860ea275858d2d;hp=83c3c7abb26bd8ccdbf4e651496801764cc9bb86 [NTOS]: Check registry for our CardList, check if the PCI hardware matches any entry in there that specifies it has full/extended address decoding, and write the registry flag for it. svn path=/trunk/; revision=47660 --- diff --git a/reactos/hal/halx86/generic/legacy/bussupp.c b/reactos/hal/halx86/generic/legacy/bussupp.c index 3c3516764e6..2ffdef8e761 100644 --- a/reactos/hal/halx86/generic/legacy/bussupp.c +++ b/reactos/hal/halx86/generic/legacy/bussupp.c @@ -352,8 +352,77 @@ HalpIsRecognizedCard(IN PPCI_REGISTRY_INFO_INTERNAL PciRegistryInfo, IN PPCI_COMMON_CONFIG PciData, IN ULONG Flags) { - /* Not yet implemented */ - if (!WarningsGiven[1]++) DbgPrint("HAL: Not checking for PCI Cards with Extended Addressing. Your hardware may malfunction!\n"); + ULONG ElementCount, i; + PPCI_CARD_DESCRIPTOR CardDescriptor; + + /* How many PCI Cards that we know about? */ + ElementCount = PciRegistryInfo->ElementCount; + if (!ElementCount) return FALSE; + + /* Loop all descriptors */ + CardDescriptor = &PciRegistryInfo->CardList[0]; + for (i = 0; i < ElementCount; i++, CardDescriptor++) + { + /* Check for flag match */ + if (CardDescriptor->Flags != Flags) continue; + + /* Check for VID-PID match */ + if ((CardDescriptor->VendorID != PciData->VendorID) || + (CardDescriptor->DeviceID != PciData->DeviceID)) + { + /* Skip */ + continue; + } + + /* Check for revision match, if requested */ + if ((CardDescriptor->Flags & HALP_CHECK_CARD_REVISION_ID) && + (CardDescriptor->RevisionID != PciData->RevisionID)) + { + /* Skip */ + continue; + } + + /* Check what kind of device this is */ + switch (PCI_CONFIGURATION_TYPE(PciData)) + { + /* CardBUS Bridge */ + case PCI_CARDBUS_BRIDGE_TYPE: + + /* This means the real device header is in the device-specific data */ + PciData = (PPCI_COMMON_CONFIG)PciData->DeviceSpecific; + + /* Normal PCI device */ + case PCI_DEVICE_TYPE: + + /* Check for subvendor match, if requested */ + if ((CardDescriptor->Flags & HALP_CHECK_CARD_SUBVENDOR_ID) && + (CardDescriptor->SubsystemVendorID != PciData->u.type0.SubVendorID)) + { + /* Skip */ + continue; + } + + /* Check for subsystem match, if requested */ + if ((CardDescriptor->Flags & HALP_CHECK_CARD_SUBSYSTEM_ID) && + (CardDescriptor->SubsystemID != PciData->u.type0.SubSystemID)) + { + /* Skip */ + continue; + } + + /* You made it! */ + return TRUE; + + /* PCI Bridge -- don't bother */ + case PCI_BRIDGE_TYPE: + default: + + /* Recognize it */ + return TRUE; + } + } + + /* This means the card isn't recognized */ return FALSE; } @@ -598,7 +667,9 @@ HalpInitializePciBus(VOID) if (!ExtendedAddressDecoding) { /* Check for it */ - if (HalpIsRecognizedCard(PciRegistryInfo, PciData, 1)) + if (HalpIsRecognizedCard(PciRegistryInfo, + PciData, + HALP_CARD_FEATURE_FULL_DECODE)) { /* We'll do chipset checks later */ DbgPrint("HAL: Recognized a PCI Card with Extended Address Decoding. This is not supported!\n"); diff --git a/reactos/hal/halx86/include/halp.h b/reactos/hal/halx86/include/halp.h index aa36554c7ec..bc0e8fdfd1f 100644 --- a/reactos/hal/halx86/include/halp.h +++ b/reactos/hal/halx86/include/halp.h @@ -485,6 +485,18 @@ HalpHardwareInterruptLevel( VOID ); +// +// Feature flags +// +#define HALP_CARD_FEATURE_FULL_DECODE 0x0001 + +// +// Match Flags +// +#define HALP_CHECK_CARD_REVISION_ID 0x10000 +#define HALP_CHECK_CARD_SUBVENDOR_ID 0x20000 +#define HALP_CHECK_CARD_SUBSYSTEM_ID 0x40000 + // // Mm PTE/PDE to Hal PTE/PDE //