31 #include <linux/kernel.h>
32 #include <linux/module.h>
34 #include <linux/types.h>
37 #include <linux/pci.h>
39 #include <linux/slab.h>
43 #define PREFIX "ACPI: "
45 #define _COMPONENT ACPI_PCI_COMPONENT
59 static inline char pin_name(
int pin)
73 int bus = dev->
bus->number;
76 spin_lock(&acpi_prt_lock);
78 if ((segment == entry->
id.segment)
79 && (bus == entry->
id.bus)
80 && (device == entry->
id.device)
81 && (pin == entry->
pin)) {
82 spin_unlock(&acpi_prt_lock);
86 spin_unlock(&acpi_prt_lock);
93 .ident =
"Medion MD9580-F laptop",
105 .ident =
"Dell Optiplex GX1",
137 #define PCI_INTX_PIN(c) (c - 'A' + 1)
144 static const struct prt_quirk prt_quirks[] = {
146 "\\_SB_.PCI0.ISA_.LNKA",
147 "\\_SB_.PCI0.ISA_.LNKB"},
162 for (i = 0; i <
ARRAY_SIZE(prt_quirks); i++) {
163 quirk = &prt_quirks[
i];
171 entry->
id.bus == quirk->
bus &&
172 entry->
id.device == quirk->
device &&
173 entry->
pin == quirk->
pin &&
177 "%04x:%02x:%02x PCI INT %c connected to %s; "
179 entry->
id.segment, entry->
id.bus,
180 entry->
id.device, pin_name(entry->
pin),
203 entry->
id.device = (prt->
address >> 16) & 0xFFFF;
204 entry->
pin = prt->
pin + 1;
206 do_prt_fixups(entry, prt);
235 " %04x:%02x:%02x[%c] -> %s[%d]\n",
236 entry->
id.segment, entry->
id.bus,
237 entry->
id.device, pin_name(entry->
pin),
240 spin_lock(&acpi_prt_lock);
242 spin_unlock(&acpi_prt_lock);
275 while (entry && (entry->
length > 0)) {
276 acpi_pci_irq_add_entry(handle, bus, entry);
278 ((
unsigned long)entry + entry->
length);
290 "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n",
292 spin_lock(&acpi_prt_lock);
300 spin_unlock(&acpi_prt_lock);
306 #ifdef CONFIG_X86_IO_APIC
310 static int bridge_has_boot_interrupt_variant(
struct pci_bus *bus)
314 for (bus_it = bus ; bus_it ; bus_it = bus_it->
parent) {
317 if (bus_it->
self->irq_reroute_variant)
318 return bus_it->
self->irq_reroute_variant;
330 static int acpi_reroute_boot_interrupt(
struct pci_dev *dev,
333 if (noioapicquirk || noioapicreroute) {
336 switch (bridge_has_boot_interrupt_variant(dev->
bus)) {
347 dev_info(&dev->
dev,
"PCI IRQ %d -> rerouted to legacy "
348 "IRQ %d\n", entry->
index,
349 (entry->
index % 4) + 16);
353 dev_warn(&dev->
dev,
"Cannot reroute IRQ %d to legacy "
354 "IRQ: unknown mapping\n", entry->
index);
365 u8 bridge_pin, orig_pin =
pin;
367 entry = acpi_pci_irq_find_prt_entry(dev, pin);
369 #ifdef CONFIG_X86_IO_APIC
370 acpi_reroute_boot_interrupt(dev, entry);
373 pci_name(dev), pin_name(pin)));
381 bridge = dev->
bus->self;
387 bridge_pin = bridge->
pin;
390 "No interrupt pin configured for device %s\n",
397 entry = acpi_pci_irq_find_prt_entry(bridge, pin);
400 "Derived GSI for %s INT %c from %s\n",
401 pci_name(dev), pin_name(orig_pin),
407 bridge = dev->
bus->self;
410 dev_warn(&dev->
dev,
"can't derive routing for PCI INT %c\n",
429 "No interrupt pin configured for device %s\n",
434 entry = acpi_pci_irq_lookup(dev, pin);
441 (dev->
class & 0x05) == 0)
449 &triggering, &polarity,
462 dev_warn(&dev->
dev,
"PCI INT %c: no GSI", pin_name(pin));
464 if (dev->
irq > 0 && (dev->
irq <= 0xF) &&
466 printk(
" - using ISA IRQ %d\n", dev->
irq);
479 dev_warn(&dev->
dev,
"PCI INT %c: failed to register GSI\n",
486 snprintf(link_desc,
sizeof(link_desc),
" -> Link[%s]", link);
490 dev_dbg(&dev->
dev,
"PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n",
491 pin_name(pin), link_desc, gsi,
513 entry = acpi_pci_irq_lookup(dev, pin);
527 dev_dbg(&dev->
dev,
"PCI INT %c disabled\n", pin_name(pin));