aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/apic/io_apic.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 446a931d5f44..09e5c7b4df5a 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -997,7 +997,7 @@ static int pin_2_irq(int idx, int apic, int pin)
997int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, 997int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
998 struct io_apic_irq_attr *irq_attr) 998 struct io_apic_irq_attr *irq_attr)
999{ 999{
1000 int ioapic_idx, i, best_guess = -1; 1000 int irq, i, best_guess = -1;
1001 1001
1002 apic_printk(APIC_DEBUG, 1002 apic_printk(APIC_DEBUG,
1003 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", 1003 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
@@ -1007,41 +1007,46 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
1007 "PCI BIOS passed nonexistent PCI bus %d!\n", bus); 1007 "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
1008 return -1; 1008 return -1;
1009 } 1009 }
1010
1010 for (i = 0; i < mp_irq_entries; i++) { 1011 for (i = 0; i < mp_irq_entries; i++) {
1011 int lbus = mp_irqs[i].srcbus; 1012 int lbus = mp_irqs[i].srcbus;
1013 int ioapic_idx, found = 0;
1014
1015 if (bus != lbus || mp_irqs[i].irqtype != mp_INT ||
1016 slot != ((mp_irqs[i].srcbusirq >> 2) & 0x1f))
1017 continue;
1012 1018
1013 for_each_ioapic(ioapic_idx) 1019 for_each_ioapic(ioapic_idx)
1014 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic || 1020 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic ||
1015 mp_irqs[i].dstapic == MP_APIC_ALL) 1021 mp_irqs[i].dstapic == MP_APIC_ALL) {
1022 found = 1;
1016 break; 1023 break;
1024 }
1025 if (!found)
1026 continue;
1017 1027
1018 if (!test_bit(lbus, mp_bus_not_pci) && 1028 /* Skip ISA IRQs */
1019 mp_irqs[i].irqtype == mp_INT && 1029 irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
1020 (bus == lbus) && 1030 if (ioapic_idx == 0 && !IO_APIC_IRQ(irq))
1021 (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { 1031 continue;
1022 int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
1023
1024 if (!(ioapic_idx || IO_APIC_IRQ(irq)))
1025 continue;
1026 1032
1027 if (pin == (mp_irqs[i].srcbusirq & 3)) { 1033 if (pin == (mp_irqs[i].srcbusirq & 3)) {
1028 set_io_apic_irq_attr(irq_attr, ioapic_idx, 1034 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1029 mp_irqs[i].dstirq, 1035 mp_irqs[i].dstirq,
1030 irq_trigger(i), 1036 irq_trigger(i),
1031 irq_polarity(i)); 1037 irq_polarity(i));
1032 return irq; 1038 return irq;
1033 } 1039 }
1034 /* 1040 /*
1035 * Use the first all-but-pin matching entry as a 1041 * Use the first all-but-pin matching entry as a
1036 * best-guess fuzzy result for broken mptables. 1042 * best-guess fuzzy result for broken mptables.
1037 */ 1043 */
1038 if (best_guess < 0) { 1044 if (best_guess < 0) {
1039 set_io_apic_irq_attr(irq_attr, ioapic_idx, 1045 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1040 mp_irqs[i].dstirq, 1046 mp_irqs[i].dstirq,
1041 irq_trigger(i), 1047 irq_trigger(i),
1042 irq_polarity(i)); 1048 irq_polarity(i));
1043 best_guess = irq; 1049 best_guess = irq;
1044 }
1045 } 1050 }
1046 } 1051 }
1047 return best_guess; 1052 return best_guess;