[USB]
[reactos.git] / reactos / drivers / bus / acpi / buspdo.c
index 0e149b8..c807f1a 100644 (file)
@@ -1136,6 +1136,12 @@ Bus_PDO_QueryResourceRequirements(
         return Irp->IoStatus.Status;
     }
 
+    /* Handle the PCI root manually */
+    if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0)
+    {
+        return Irp->IoStatus.Status;
+    }
+
     /* Get current resources */
     while (TRUE)
     {
@@ -1315,7 +1321,7 @@ Bus_PDO_QueryResourceRequirements(
                                RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
                                RequirementDescriptor->u.Port.Alignment = io_data->Alignment;
                                RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Minimum;
-                               RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Maximum;
+                               RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Maximum + io_data->AddressLength - 1;
 
                                RequirementDescriptor++;
                                break;
@@ -1330,7 +1336,7 @@ Bus_PDO_QueryResourceRequirements(
                                        RequirementDescriptor->ShareDisposition = CmResourceShareShared;
                                        RequirementDescriptor->Flags = 0;
                                        RequirementDescriptor->u.BusNumber.MinBusNumber = addr16_data->Minimum;
-                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = addr16_data->Maximum;
+                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = addr16_data->Maximum + addr16_data->AddressLength - 1;
                                        RequirementDescriptor->u.BusNumber.Length = addr16_data->AddressLength;
                                }
                                else if (addr16_data->ResourceType == ACPI_IO_RANGE)
@@ -1341,7 +1347,7 @@ Bus_PDO_QueryResourceRequirements(
                                        if (addr16_data->Decode == ACPI_POS_DECODE)
                                                RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
                                        RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr16_data->Minimum;
-                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr16_data->Maximum;
+                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr16_data->Maximum + addr16_data->AddressLength - 1;
                                        RequirementDescriptor->u.Port.Length = addr16_data->AddressLength;
                                }
                                else
@@ -1360,7 +1366,7 @@ Bus_PDO_QueryResourceRequirements(
                                                case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
                                        }
                                        RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr16_data->Minimum;
-                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr16_data->Maximum;
+                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr16_data->Maximum + addr16_data->AddressLength - 1;
                                        RequirementDescriptor->u.Memory.Length = addr16_data->AddressLength;
                                }
                                RequirementDescriptor++;
@@ -1376,7 +1382,7 @@ Bus_PDO_QueryResourceRequirements(
                                        RequirementDescriptor->ShareDisposition = CmResourceShareShared;
                                        RequirementDescriptor->Flags = 0;
                                        RequirementDescriptor->u.BusNumber.MinBusNumber = addr32_data->Minimum;
-                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = addr32_data->Maximum;
+                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = addr32_data->Maximum + addr32_data->AddressLength - 1;
                                        RequirementDescriptor->u.BusNumber.Length = addr32_data->AddressLength;
                                }
                                else if (addr32_data->ResourceType == ACPI_IO_RANGE)
@@ -1387,7 +1393,7 @@ Bus_PDO_QueryResourceRequirements(
                                        if (addr32_data->Decode == ACPI_POS_DECODE)
                                                RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
                                        RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr32_data->Minimum;
-                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr32_data->Maximum;
+                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr32_data->Maximum + addr32_data->AddressLength - 1;
                                        RequirementDescriptor->u.Port.Length = addr32_data->AddressLength;
                                }
                                else
@@ -1406,7 +1412,7 @@ Bus_PDO_QueryResourceRequirements(
                                                case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
                                        }
                                        RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr32_data->Minimum;
-                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr32_data->Maximum;
+                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr32_data->Maximum + addr32_data->AddressLength - 1;
                                        RequirementDescriptor->u.Memory.Length = addr32_data->AddressLength;
                                }
                                RequirementDescriptor++;
@@ -1423,7 +1429,7 @@ Bus_PDO_QueryResourceRequirements(
                                        RequirementDescriptor->ShareDisposition = CmResourceShareShared;
                                        RequirementDescriptor->Flags = 0;
                                        RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Minimum;
-                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Maximum;
+                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Maximum + addr64_data->AddressLength - 1;
                                        RequirementDescriptor->u.BusNumber.Length = addr64_data->AddressLength;
                                }
                                else if (addr64_data->ResourceType == ACPI_IO_RANGE)
@@ -1434,7 +1440,7 @@ Bus_PDO_QueryResourceRequirements(
                                        if (addr64_data->Decode == ACPI_POS_DECODE)
                                                RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
                                        RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Minimum;
-                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Maximum;
+                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Maximum + addr64_data->AddressLength - 1;
                                        RequirementDescriptor->u.Port.Length = addr64_data->AddressLength;
                                }
                                else
@@ -1453,7 +1459,7 @@ Bus_PDO_QueryResourceRequirements(
                                                case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
                                        }       
                                        RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Minimum;
-                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Maximum;
+                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Maximum + addr64_data->AddressLength - 1;
                                        RequirementDescriptor->u.Memory.Length = addr64_data->AddressLength;
                                }
                                RequirementDescriptor++;
@@ -1470,7 +1476,7 @@ Bus_PDO_QueryResourceRequirements(
                                        RequirementDescriptor->ShareDisposition = CmResourceShareShared;
                                        RequirementDescriptor->Flags = 0;
                                        RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Minimum;
-                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Maximum;
+                                       RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Maximum + addr64_data->AddressLength - 1;
                                        RequirementDescriptor->u.BusNumber.Length = addr64_data->AddressLength;
                                }
                                else if (addr64_data->ResourceType == ACPI_IO_RANGE)
@@ -1481,7 +1487,7 @@ Bus_PDO_QueryResourceRequirements(
                                        if (addr64_data->Decode == ACPI_POS_DECODE)
                                                RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
                                        RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Minimum;
-                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Maximum;
+                                       RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Maximum + addr64_data->AddressLength - 1;
                                        RequirementDescriptor->u.Port.Length = addr64_data->AddressLength;
                                }
                                else
@@ -1500,7 +1506,7 @@ Bus_PDO_QueryResourceRequirements(
                                                case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
                                        }       
                                        RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Minimum;
-                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Maximum;
+                                       RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Maximum + addr64_data->AddressLength - 1;
                                        RequirementDescriptor->u.Memory.Length = addr64_data->AddressLength;
                                }
                                RequirementDescriptor++;
@@ -1518,7 +1524,7 @@ Bus_PDO_QueryResourceRequirements(
                                else
                                        RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
                                RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem24_data->Minimum;
-                               RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem24_data->Maximum;
+                               RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem24_data->Maximum + mem24_data->AddressLength - 1;
                                RequirementDescriptor->u.Memory.Length = mem24_data->AddressLength;
 
                                RequirementDescriptor++;
@@ -1536,7 +1542,7 @@ Bus_PDO_QueryResourceRequirements(
                                else
                                        RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
                                RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem32_data->Minimum;
-                               RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem32_data->Maximum;
+                               RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem32_data->Maximum + mem32_data->AddressLength - 1;
                                RequirementDescriptor->u.Memory.Length = mem32_data->AddressLength;
 
                                RequirementDescriptor++;
@@ -1554,7 +1560,7 @@ Bus_PDO_QueryResourceRequirements(
                                else
                                        RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
                                RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = fixedmem32_data->Address;
-                               RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = fixedmem32_data->Address;
+                               RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = fixedmem32_data->Address + fixedmem32_data->AddressLength - 1;
                                RequirementDescriptor->u.Memory.Length = fixedmem32_data->AddressLength;
                 
                                RequirementDescriptor++;