Author: sginsberg
Date: Mon Nov 2 19:05:07 2009
New Revision: 43913
URL:
http://svn.reactos.org/svn/reactos?rev=43913&view=rev
Log:
- Fix broken HalpQueryPciRegistryInfo: If it wasn't for the fact that it queried a
subkey incorrectly ('ConfigurationData' instead of 'Configuration Data')
it was setting up the basic structure correctly but forgot to RETURN IT TO THE CALLER.
- Fixes PCI detection detection as HalpInitializePciStubs no longer has to rely on a
'no info = PCI 1' assumption, making PCI 2 detection possible.
- Add support for querying the CurrentControlSet\Control\PnP\PCI\CardList key and
retrieving the card list entries (not used yet). Also add the related keys to hivesys.inf
so there is something to query.
Modified:
trunk/reactos/boot/bootdata/hivesys_i386.inf
trunk/reactos/hal/halx86/generic/bus/pcibus.c
Modified: trunk/reactos/boot/bootdata/hivesys_i386.inf
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys_i386…
==============================================================================
--- trunk/reactos/boot/bootdata/hivesys_i386.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesys_i386.inf [iso-8859-1] Mon Nov 2 19:05:07 2009
@@ -782,6 +782,29 @@
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate
Sorts","00021404",0x00000000,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate
Sorts","00030404",0x00000000,""
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82441FX",0x00030003,\
+01,00,00,00,86,80,37,12,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82439HX",0x00030003,\
+01,00,00,00,86,80,50,12,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82439TX",0x00030003,\
+01,00,00,00,86,80,00,71,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82443LX/EX",0x00030003,\
+01,00,00,00,86,80,80,71,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82443BX1",0x00030003,\
+01,00,00,00,86,80,90,71,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82443BX2",0x00030003,\
+01,00,00,00,86,80,92,71,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel
82443GX",0x00030003,\
+01,00,00,00,86,80,a0,71,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","VIA
Tech1",0x00030003,\
+01,00,00,00,06,11,01,05,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","VIA
Tech2",0x00030003,\
+01,00,00,00,06,11,91,06,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Toshiba",0x00030003,\
+01,00,00,00,79,11,01,06,00,00,00,00,00,00,00,00
+HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Ali",0x00030003,\
+01,00,00,00,b9,10,21,15,00,00,00,00,00,00,00,00
+
HKLM,"SYSTEM\CurrentControlSet\Control\Print","MajorVersion",0x00010001,2
HKLM,"SYSTEM\CurrentControlSet\Control\Print","MinorVersion",0x00010003,0
HKLM,"SYSTEM\CurrentControlSet\Control\Print","PriorityClass",0x00010003,0
Modified: trunk/reactos/hal/halx86/generic/bus/pcibus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bus/pci…
==============================================================================
--- trunk/reactos/hal/halx86/generic/bus/pcibus.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/bus/pcibus.c [iso-8859-1] Mon Nov 2 19:05:07 2009
@@ -703,19 +703,24 @@
HalpQueryPciRegistryInfo(VOID)
{
WCHAR NameBuffer[8];
- OBJECT_ATTRIBUTES ObjectAttributes;
+ OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName, ConfigName, IdentName;
- HANDLE KeyHandle, BusKeyHandle;
+ HANDLE KeyHandle, BusKeyHandle, CardListHandle;
NTSTATUS Status;
- UCHAR KeyBuffer[sizeof(PPCI_REGISTRY_INFO) + 100];
+ UCHAR KeyBuffer[sizeof(CM_FULL_RESOURCE_DESCRIPTOR) + 100];
PKEY_VALUE_FULL_INFORMATION ValueInfo = (PVOID)KeyBuffer;
+ UCHAR PartialKeyBuffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
+ sizeof(PCI_CARD_DESCRIPTOR)];
+ PKEY_VALUE_PARTIAL_INFORMATION PartialValueInfo = (PVOID)PartialKeyBuffer;
+ KEY_FULL_INFORMATION KeyInformation;
ULONG ResultLength;
PWSTR Tag;
- ULONG i;
+ ULONG i, ElementCount;
PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PPCI_REGISTRY_INFO PciRegInfo;
PPCI_REGISTRY_INFO_INTERNAL PciRegistryInfo;
+ PPCI_CARD_DESCRIPTOR CardDescriptor;
/* Setup the object attributes for the key */
RtlInitUnicodeString(&KeyName,
@@ -736,7 +741,7 @@
KeyName.MaximumLength = sizeof(NameBuffer);
/* Setup the configuration and identifier key names */
- RtlInitUnicodeString(&ConfigName, L"ConfigurationData");
+ RtlInitUnicodeString(&ConfigName, L"Configuration Data");
RtlInitUnicodeString(&IdentName, L"Identifier");
/* Keep looping for each ID */
@@ -805,28 +810,120 @@
/* Check if this is our PCI Registry Information */
if (PartialDescriptor->Type == CmResourceTypeDeviceSpecific)
{
- /* Close the key */
- ZwClose(KeyHandle);
-
- /* FIXME: Check PnP\PCI\CardList */
-
- /* Get the PCI information */
- PciRegInfo = (PPCI_REGISTRY_INFO)(PartialDescriptor + 1);
-
- /* Allocate the return structure */
- PciRegistryInfo = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(PCI_REGISTRY_INFO_INTERNAL),
- ' laH');
- if (!PciRegistryInfo) return NULL;
-
- /* Fill it out */
- PciRegistryInfo->HardwareMechanism = PciRegInfo->HardwareMechanism;
- PciRegistryInfo->NoBuses = PciRegInfo->NoBuses;
- PciRegistryInfo->MajorRevision = PciRegInfo->MajorRevision;
- PciRegistryInfo->MinorRevision = PciRegInfo->MinorRevision;
- PciRegistryInfo->ElementCount = 0;
- }
- }
+ /* It is, stop searching */
+ break;
+ }
+ }
+
+ /* Close the key */
+ ZwClose(KeyHandle);
+
+ /* Save the PCI information for later */
+ PciRegInfo = (PPCI_REGISTRY_INFO)(PartialDescriptor + 1);
+
+ /* Assume no Card List entries */
+ ElementCount = 0;
+
+ /* Set up for checking the PCI Card List key */
+ RtlInitUnicodeString(&KeyName,
+ L"\\Registry\\Machine\\System\\CurrentControlSet\\"
+ L"Control\\PnP\\PCI\\CardList");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+
+ /* Attempt to open it */
+ Status = ZwOpenKey(&CardListHandle, KEY_READ, &ObjectAttributes);
+ if (NT_SUCCESS(Status))
+ {
+ /* It exists, so let's query it */
+ Status = ZwQueryKey(CardListHandle,
+ KeyFullInformation,
+ &KeyInformation,
+ sizeof(KEY_FULL_INFORMATION),
+ &ResultLength);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Failed to query, so no info */
+ PciRegistryInfo = NULL;
+ }
+ else
+ {
+ /* Allocate the full structure */
+ PciRegistryInfo =
+ ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(PCI_REGISTRY_INFO_INTERNAL) +
+ (KeyInformation.Values *
+ sizeof(PCI_CARD_DESCRIPTOR)),
+ ' laH');
+ if (PciRegistryInfo)
+ {
+ /* Get the first card descriptor entry */
+ CardDescriptor = (PPCI_CARD_DESCRIPTOR)(PciRegistryInfo + 1);
+
+ /* Loop all the values */
+ for (i = 0; i < KeyInformation.Values; i++)
+ {
+ /* Attempt to get the value */
+ Status = ZwEnumerateValueKey(CardListHandle,
+ i,
+ KeyValuePartialInformation,
+ PartialValueInfo,
+ sizeof(PartialKeyBuffer),
+ &ResultLength);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Something went wrong, stop the search */
+ break;
+ }
+
+ /* Make sure it is correctly sized */
+ if (PartialValueInfo->DataLength == sizeof(PCI_CARD_DESCRIPTOR))
+ {
+ /* Sure is, copy it over */
+ *CardDescriptor = *(PPCI_CARD_DESCRIPTOR)
+ PartialValueInfo->Data;
+
+ /* One more Card List entry */
+ ElementCount++;
+
+ /* Move to the next descriptor */
+ CardDescriptor = (CardDescriptor + 1);
+ }
+ }
+ }
+ }
+
+ /* Close the Card List key */
+ ZwClose(CardListHandle);
+ }
+ else
+ {
+ /* No key, no Card List */
+ PciRegistryInfo = NULL;
+ }
+
+ /* Check if we failed to get the full structure */
+ if (!PciRegistryInfo)
+ {
+ /* Just allocate the basic structure then */
+ PciRegistryInfo = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(PCI_REGISTRY_INFO_INTERNAL),
+ ' laH');
+ if (!PciRegistryInfo) return NULL;
+ }
+
+ /* Save the info we got */
+ PciRegistryInfo->MajorRevision = PciRegInfo->MajorRevision;
+ PciRegistryInfo->MinorRevision = PciRegInfo->MinorRevision;
+ PciRegistryInfo->NoBuses = PciRegInfo->NoBuses;
+ PciRegistryInfo->HardwareMechanism = PciRegInfo->HardwareMechanism;
+ PciRegistryInfo->ElementCount = ElementCount;
+
+ /* Return it */
+ return PciRegistryInfo;
}
VOID
@@ -893,7 +990,7 @@
default:
/* Invalid type */
- DbgPrint("HAL: Unnkown PCI type\n");
+ DbgPrint("HAL: Unknown PCI type\n");
}
/* Loop all possible buses */