Author: cgutman
Date: Sat Aug 27 01:10:29 2011
New Revision: 53463
URL:
http://svn.reactos.org/svn/reactos?rev=53463&view=rev
Log:
[ACPI]
- Provide a fallback when _BBN isn't implemented for a PCI root bus
- Fixes PCI on QEMU with ACPI enabled
Modified:
trunk/reactos/drivers/bus/acpi/buspdo.c
Modified: trunk/reactos/drivers/bus/acpi/buspdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/buspdo.c?…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] Sat Aug 27 01:10:29 2011
@@ -655,6 +655,7 @@
ULONG ResourceListSize;
ULONG i;
ULONGLONG BusNumber;
+ struct acpi_device *device;
if (!DeviceData->AcpiHandle)
{
@@ -664,31 +665,52 @@
/* 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)
+ if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0)
{
+ acpi_bus_get_device(DeviceData->AcpiHandle, &device);
+
+ AcpiStatus = acpi_evaluate_integer(DeviceData->AcpiHandle, "_BBN",
NULL, &BusNumber);
+ if (AcpiStatus != AE_OK)
+ {
+#if 0
+ if (device->flags.unique_id)
+ {
+ /* FIXME: Try the unique ID */
+ }
+ else
+#endif
+ {
+ BusNumber = 0;
+ DPRINT1("Failed to find a bus number\n");
+ }
+ }
+ else
+ {
+ DPRINT1("Using _BBN for bus number\n");
+ }
+
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;
+ 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 */