From c8b7335642641bd403aeaa050cf2aa055f43306f Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 7 Nov 2005 21:48:45 +0000 Subject: Work around at least one busted BIOS. If we get a source index in a _PRT entry that is not zero, assume that it is really a hard-wired IRQ (commonly used for APIC routing) and not a source index. In practice, we've only ever seen source indices of 0 for legitimate non-hard-wired _PRT entries. Reviewed by: njl Tested by: Alex Lyashkov shadow at psoft dot net MFC after: 2 weeks --- sys/dev/acpica/acpi.c | 6 +++--- sys/dev/acpica/acpi_pcib.c | 13 ++++++++++++- sys/dev/acpica/acpi_resource.c | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index bb34549..2823f62 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1497,13 +1497,13 @@ acpi_probe_order(ACPI_HANDLE handle, int *order) ret = 0; if (acpi_MatchHid(handle, "PNP0C01") || acpi_MatchHid(handle, "PNP0C02")) { *order = 1; - ret = 1; + ret = 0; } else if (acpi_MatchHid(handle, "PNP0C09")) { *order = 2; - ret = 1; + ret = 0; } else if (acpi_MatchHid(handle, "PNP0C0F")) { *order = 3; - ret = 1; + ret = 0; } return (ret); diff --git a/sys/dev/acpica/acpi_pcib.c b/sys/dev/acpica/acpi_pcib.c index 8994086..bdfe70c 100644 --- a/sys/dev/acpica/acpi_pcib.c +++ b/sys/dev/acpica/acpi_pcib.c @@ -96,6 +96,13 @@ prt_attach_devices(ACPI_PCI_ROUTING_TABLE *entry, void *arg) if (entry->Source == NULL || entry->Source[0] == '\0') return; + /* + * In practice, we only see SourceIndex's of 0 out in the wild. + * When indices != 0 have been found, they've been bugs in the ASL. + */ + if (entry->SourceIndex != 0) + return; + /* Lookup the associated handle and device. */ pcib = (device_t)arg; if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, entry->Source, &handle))) @@ -236,8 +243,12 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin, /* * If source is empty/NULL, the source index is a global IRQ number * and it's hard-wired so we're done. + * + * XXX: If the source index is non-zero, ignore the source device and + * assume that this is a hard-wired entry. */ - if (prt->Source == NULL || prt->Source[0] == '\0') { + if (prt->Source == NULL || prt->Source[0] == '\0' || + prt->SourceIndex != 0) { if (bootverbose) device_printf(pcib, "slot %d INT%c hardwired to IRQ %d\n", pci_get_slot(dev), 'A' + pin, prt->SourceIndex); diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index cde23e2..d671e07 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -168,6 +168,7 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, /* Fetch the device's current resources. */ buf.Length = ACPI_ALLOCATE_BUFFER; + buf.Pointer = NULL; if (ACPI_FAILURE((status = AcpiGetCurrentResources(handle, &buf)))) { if (status != AE_NOT_FOUND) printf("can't fetch resources for %s - %s\n", -- cgit v1.1