From 91c14f698c303bea0aae6b5d3a0f3cedb8e8760a Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 28 May 2004 17:31:32 +0000 Subject: [PATCH] Don't assume that the current setting (_CRS) of a PCI link device is correct. Instead, check it against the possible settings (_PRS) when the link is probed. This is important when using APIC mode but link devices still have PIC mode settings. This is also what Linux does. Additional prodding by: Len Brown len dot brown at intel dot com --- sys/dev/acpica/acpi_pci_link.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/dev/acpica/acpi_pci_link.c b/sys/dev/acpica/acpi_pci_link.c index 400aa14de3a4..630d11fd3dcb 100644 --- a/sys/dev/acpica/acpi_pci_link.c +++ b/sys/dev/acpica/acpi_pci_link.c @@ -48,7 +48,6 @@ struct acpi_pci_link_entry { TAILQ_ENTRY(acpi_pci_link_entry) links; ACPI_HANDLE handle; UINT8 current_irq; - UINT8 initial_irq; ACPI_RESOURCE possible_resources; UINT8 number_of_interrupts; UINT8 interrupts[MAX_POSSIBLE_INTERRUPTS]; @@ -73,6 +72,9 @@ static struct acpi_prt_entries acpi_prt_entries; static int irq_penalty[MAX_ACPI_INTERRUPTS]; +static int acpi_pci_link_is_valid_irq(struct acpi_pci_link_entry *link, + UINT8 irq); + #define ACPI_STA_PRESENT 0x00000001 #define ACPI_STA_ENABLE 0x00000002 #define ACPI_STA_SHOWINUI 0x00000004 @@ -382,7 +384,12 @@ acpi_pci_link_add_link(ACPI_HANDLE handle, struct acpi_prt_entry *entry) acpi_name(handle), AcpiFormatException(error))); } - link->initial_irq = link->current_irq; + if (!acpi_pci_link_is_valid_irq(link, link->current_irq)) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "initial IRQ %u is invalid for link %s\n", + link->current_irq, acpi_name(handle))); + link->current_irq = 0; + } error = AcpiGetPossibleResources(handle, &buf); if (ACPI_FAILURE(error)) { @@ -525,11 +532,6 @@ acpi_pci_link_is_valid_irq(struct acpi_pci_link_entry *link, UINT8 irq) if (link->interrupts[i] == irq) return (1); } - - /* allow initial IRQ as valid one. */ - if (link->initial_irq == irq) - return (1); - return (0); }