mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:43:00 +00:00
[ACPI]
- 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:
parent
b0c146ed0c
commit
7f089310e7
1 changed files with 41 additions and 19 deletions
|
@ -655,6 +655,7 @@ Bus_PDO_QueryResources(
|
||||||
ULONG ResourceListSize;
|
ULONG ResourceListSize;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONGLONG BusNumber;
|
ULONGLONG BusNumber;
|
||||||
|
struct acpi_device *device;
|
||||||
|
|
||||||
if (!DeviceData->AcpiHandle)
|
if (!DeviceData->AcpiHandle)
|
||||||
{
|
{
|
||||||
|
@ -664,31 +665,52 @@ Bus_PDO_QueryResources(
|
||||||
/* A bus number resource is not included in the list of current resources
|
/* 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
|
* 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 */
|
* we create a resource list and add a bus number descriptor to it */
|
||||||
AcpiStatus = acpi_evaluate_integer(DeviceData->AcpiHandle, "_BBN", NULL, &BusNumber);
|
if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0)
|
||||||
if (AcpiStatus == AE_OK)
|
|
||||||
{
|
{
|
||||||
|
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);
|
DPRINT1("Found PCI root hub: %d\n", BusNumber);
|
||||||
|
|
||||||
ResourceListSize = sizeof(CM_RESOURCE_LIST);
|
ResourceListSize = sizeof(CM_RESOURCE_LIST);
|
||||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, ResourceListSize);
|
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, ResourceListSize);
|
||||||
if (!ResourceList)
|
if (!ResourceList)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
ResourceList->Count = 1;
|
ResourceList->Count = 1;
|
||||||
ResourceList->List[0].InterfaceType = Internal;
|
ResourceList->List[0].InterfaceType = Internal;
|
||||||
ResourceList->List[0].BusNumber = 0;
|
ResourceList->List[0].BusNumber = 0;
|
||||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||||
ResourceList->List[0].PartialResourceList.Count = 1;
|
ResourceList->List[0].PartialResourceList.Count = 1;
|
||||||
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
|
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
|
||||||
|
|
||||||
ResourceDescriptor->Type = CmResourceTypeBusNumber;
|
ResourceDescriptor->Type = CmResourceTypeBusNumber;
|
||||||
ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||||
ResourceDescriptor->u.BusNumber.Start = BusNumber;
|
ResourceDescriptor->u.BusNumber.Start = BusNumber;
|
||||||
ResourceDescriptor->u.BusNumber.Length = 1;
|
ResourceDescriptor->u.BusNumber.Length = 1;
|
||||||
|
|
||||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get current resources */
|
/* Get current resources */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue