Commit 79598505 authored by Jiang Liu's avatar Jiang Liu Committed by Thomas Gleixner

x86, irq: Reorganize IO_APIC_get_PCI_irq_vector() to prepare for irqdomain

Reorganize function IO_APIC_get_PCI_irq_vector() a bit to better support
coming irqdomain.
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1402302011-23642-16-git-send-email-jiang.liu@linux.intel.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 32f5ef5d
...@@ -997,7 +997,7 @@ static int pin_2_irq(int idx, int apic, int pin) ...@@ -997,7 +997,7 @@ static int pin_2_irq(int idx, int apic, int pin)
int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
struct io_apic_irq_attr *irq_attr) struct io_apic_irq_attr *irq_attr)
{ {
int ioapic_idx, i, best_guess = -1; int irq, i, best_guess = -1;
apic_printk(APIC_DEBUG, apic_printk(APIC_DEBUG,
"querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
...@@ -1007,21 +1007,27 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, ...@@ -1007,21 +1007,27 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
"PCI BIOS passed nonexistent PCI bus %d!\n", bus); "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
return -1; return -1;
} }
for (i = 0; i < mp_irq_entries; i++) { for (i = 0; i < mp_irq_entries; i++) {
int lbus = mp_irqs[i].srcbus; int lbus = mp_irqs[i].srcbus;
int ioapic_idx, found = 0;
if (bus != lbus || mp_irqs[i].irqtype != mp_INT ||
slot != ((mp_irqs[i].srcbusirq >> 2) & 0x1f))
continue;
for_each_ioapic(ioapic_idx) for_each_ioapic(ioapic_idx)
if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic || if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic ||
mp_irqs[i].dstapic == MP_APIC_ALL) mp_irqs[i].dstapic == MP_APIC_ALL) {
found = 1;
break; break;
}
if (!found)
continue;
if (!test_bit(lbus, mp_bus_not_pci) && /* Skip ISA IRQs */
mp_irqs[i].irqtype == mp_INT && irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
(bus == lbus) && if (ioapic_idx == 0 && !IO_APIC_IRQ(irq))
(slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) {
int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
if (!(ioapic_idx || IO_APIC_IRQ(irq)))
continue; continue;
if (pin == (mp_irqs[i].srcbusirq & 3)) { if (pin == (mp_irqs[i].srcbusirq & 3)) {
...@@ -1043,7 +1049,6 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, ...@@ -1043,7 +1049,6 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
best_guess = irq; best_guess = irq;
} }
} }
}
return best_guess; return best_guess;
} }
EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector); EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment