Now the irq is chosen correctly based on which INTx pin is assigned to each pci device.
Also-by: Michael Kelly <[email protected]> --- debian/patches/acpi-init-files.diff | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/debian/patches/acpi-init-files.diff b/debian/patches/acpi-init-files.diff index f45cec9..3f95537 100644 --- a/debian/patches/acpi-init-files.diff +++ b/debian/patches/acpi-init-files.diff @@ -1,6 +1,6 @@ --- /dev/null +++ b/acpi_init.c -@@ -0,0 +1,712 @@ +@@ -0,0 +1,736 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 +#include <acpi/acpi.h> + @@ -35,6 +35,8 @@ +#define LEGACY_ISA_IRQS 8 +#define PCI_IRQ_START 16 + ++#define PCI_INTERRUPT_PIN 0x3d ++ +extern acpi_status acpi_hw_legacy_sleep(u8 sleep_state); + +// Lets keep the ACPI tables in this module @@ -489,6 +491,20 @@ + return AE_OK; +} + ++static int ++acpi_pci_get_device_pin(uint16_t bus, uint16_t dev, uint16_t func) ++{ ++ struct acpi_pci_id pci_id = { ++ .segment = 0, .bus = bus, .device = dev, .function = func ++ }; ++ u64 pci_pin; ++ ++ /* cast to int is safe having read only 8 bits */ ++ return (acpi_os_read_pci_configuration(&pci_id, PCI_INTERRUPT_PIN, &pci_pin, 8) ++ ? -1 ++ : (int)pci_pin); ++} ++ +int +acpi_get_irq_number(uint16_t bus, uint16_t dev, uint16_t func) +{ @@ -498,6 +514,7 @@ + struct acpi_resource *res; + uint8_t *buf; + int srs_count; ++ int pci_pin; + + acpi_handle handle = ACPI_ROOT_OBJECT; + acpi_handle parent_handle = NULL; @@ -522,13 +539,20 @@ + if (ACPI_FAILURE(err)) + return -EIO; + ++ pci_pin = acpi_pci_get_device_pin(bus, dev, func); ++ /* Fail if the device pin used is unknown (0) */ ++ if (pci_pin <= 0) ++ return -EIO; ++ + entry = ACPI_CAST_PTR(struct acpi_pci_routing_table, ACPI_CAST_PTR(u8, buffer.pointer)); + while (entry && (entry->length > 0)) + { + /* Already applies to the bus of the device */ + prt_dev = (entry->address >> 16) & 0xffff; + prt_func = entry->address & 0xffff; -+ if ((prt_dev == dev) && (prt_func == 0xffff)) ++ if ((prt_dev == dev) && (prt_func == 0xffff) ++ /* PCI configuration enumerates pin in use as 1..4 whereas libacpica uses 0..3 */ ++ && (entry->pin == (pci_pin - 1))) + { + if (entry->source[0]) + { -- 2.45.2
