[ACPI]
authorCameron Gutman <aicommander@gmail.com>
Wed, 9 Jun 2010 23:02:34 +0000 (23:02 +0000)
committerCameron Gutman <aicommander@gmail.com>
Wed, 9 Jun 2010 23:02:34 +0000 (23:02 +0000)
- Create a resource list for the PCI root bus (even though it doesn't use any resources according to ACPI) and fill it with a bus number resource descriptor
- Fixes PCI device detection with ACPI enabled

svn path=/trunk/; revision=47729

reactos/drivers/bus/acpi/buspdo.c

index 69d7632..d5129ff 100644 (file)
@@ -644,6 +644,37 @@ Bus_PDO_QueryResources(
        ACPI_RESOURCE* resource;
        ULONG ResourceListSize;
        ULONG i;
+       ULONGLONG BusNumber;
+
+    /* A bus number resource is not included in the list of current resources
+     * for the root PCI bus so we manually query one here and if we find it
+     * we create a resource list and add a bus number descriptor to it */
+    AcpiStatus = acpi_evaluate_integer(DeviceData->AcpiHandle, "_BBN", NULL, &BusNumber);
+    if (AcpiStatus == AE_OK)
+    {
+        DPRINT1("Found PCI root hub: %d\n", BusNumber);
+
+       ResourceListSize = sizeof(CM_RESOURCE_LIST);
+       ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, ResourceListSize);
+       if (!ResourceList)
+               return STATUS_INSUFFICIENT_RESOURCES;
+
+       ResourceList->Count = 1;
+       ResourceList->List[0].InterfaceType = Internal;
+       ResourceList->List[0].BusNumber = 0;
+       ResourceList->List[0].PartialResourceList.Version = 1;
+       ResourceList->List[0].PartialResourceList.Revision = 1;
+       ResourceList->List[0].PartialResourceList.Count = 1;
+       ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
+
+       ResourceDescriptor->Type = CmResourceTypeBusNumber;
+       ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
+       ResourceDescriptor->u.BusNumber.Start = BusNumber;
+       ResourceDescriptor->u.BusNumber.Length = 1;
+
+       Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
+       return STATUS_SUCCESS;
+    }
 
     /* Get current resources */
     Buffer.Length = 0;