- Provide a fallback when _BBN isn't implemented for a PCI root bus
- Fixes PCI on QEMU with ACPI enabled

svn path=/trunk/; revision=53463
This commit is contained in:
Cameron Gutman 2011-08-27 01:10:29 +00:00
parent b0c146ed0c
commit 7f089310e7

View file

@ -655,6 +655,7 @@ Bus_PDO_QueryResources(
ULONG ResourceListSize;
ULONG i;
ULONGLONG BusNumber;
struct acpi_device *device;
if (!DeviceData->AcpiHandle)
{
@ -664,31 +665,52 @@ Bus_PDO_QueryResources(
/* 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;
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;
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;
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;
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
return STATUS_SUCCESS;
}
/* Get current resources */