--- cvs/dev/acpica/acpi.c Fri May 12 13:02:18 2006 +++ p4/acpipci/dev/acpica/acpi.c Fri May 12 12:52:51 2006 @@ -1489,23 +1505,38 @@ static int acpi_probe_order(ACPI_HANDLE handle, int *order) { + ACPI_OBJECT_TYPE type; + u_int addr; int ret; /* * 1. I/O port and memory system resource holders * 2. Embedded controllers (to handle early accesses) - * 3. PCI Link Devices + * 3. CPUs + * 4. PCI Link Devices + * 11 - 266. Host-PCI bridges sorted by _ADR */ ret = 0; - if (acpi_MatchHid(handle, "PNP0C01") || acpi_MatchHid(handle, "PNP0C02")) { + AcpiGetType(handle, &type); + if (acpi_MatchHid(handle, "PNP0C01") || acpi_MatchHid(handle, "PNP0C02")) *order = 1; - ret = 1; - } else if (acpi_MatchHid(handle, "PNP0C09")) { + else if (acpi_MatchHid(handle, "PNP0C09")) *order = 2; - ret = 1; - } else if (acpi_MatchHid(handle, "PNP0C0F")) { + else if (type == ACPI_TYPE_PROCESSOR) *order = 3; - ret = 1; + else if (acpi_MatchHid(handle, "PNP0C0F")) + *order = 4; + else if (acpi_MatchHid(handle, "PNP0A03")) { + if (ACPI_SUCCESS(acpi_GetInteger(handle, "_ADR", &addr))) { + *order = 11 + ACPI_ADR_PCI_SLOT(addr) * (PCI_FUNCMAX + 1) + + ACPI_ADR_PCI_FUNC(addr); + printf("Setting probe order for Host-PCI bridge at %d:%d to %d\n", + ACPI_ADR_PCI_SLOT(addr), ACPI_ADR_PCI_FUNC(addr), *order); + } else { + *order = 11; + printf("Setting probe order for Host-PCI bridge at unknown to %d\n", + *order); + } } return (ret); @@ -1554,14 +1585,17 @@ break; /* - * Create a placeholder device for this node. Sort the placeholder - * so that the probe/attach passes will run breadth-first. Orders - * less than 10 are reserved for special objects (i.e., system - * resources). Larger values are used for all other devices. + * Create a placeholder device for this node. Sort the + * placeholder so that the probe/attach passes will run + * breadth-first. Orders less than 10 are reserved for + * special objects (i.e., system resources). Values + * between 10 and 300 are reserved for Host-PCI bridges. + * Larger values are used for all other devices. */ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "scanning '%s'\n", handle_str)); - order = (level + 1) * 10; + order = level * 10 + 300; probe_now = acpi_probe_order(handle, &order); + printf("ACPI: Adding %s order %d\n", handle_str, order); child = BUS_ADD_CHILD(bus, order, NULL, -1); if (child == NULL) break;