Commit 273c1127 authored by Miklos Vajna's avatar Miklos Vajna Committed by Jesse Barnes

x86/PCI: janitor work in irq.c

Wrapped long lines, removed trailing whitespaces, fixed case indentation
inside switch and so.
Signed-off-by: default avatarMiklos Vajna <vmiklos@frugalware.org>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent eaf61142
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <asm/io.h> #include <linux/io.h>
#include <asm/smp.h> #include <linux/smp.h>
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/acpi.h> #include <linux/acpi.h>
...@@ -45,7 +45,8 @@ struct irq_router { ...@@ -45,7 +45,8 @@ struct irq_router {
char *name; char *name;
u16 vendor, device; u16 vendor, device;
int (*get)(struct pci_dev *router, struct pci_dev *dev, int pirq); int (*get)(struct pci_dev *router, struct pci_dev *dev, int pirq);
int (*set)(struct pci_dev *router, struct pci_dev *dev, int pirq, int new); int (*set)(struct pci_dev *router, struct pci_dev *dev, int pirq,
int new);
}; };
struct irq_router_handler { struct irq_router_handler {
...@@ -61,7 +62,7 @@ void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL; ...@@ -61,7 +62,7 @@ void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL;
* and perform checksum verification. * and perform checksum verification.
*/ */
static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) static inline struct irq_routing_table *pirq_check_routing_table(u8 *addr)
{ {
struct irq_routing_table *rt; struct irq_routing_table *rt;
int i; int i;
...@@ -74,10 +75,11 @@ static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) ...@@ -74,10 +75,11 @@ static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr)
rt->size < sizeof(struct irq_routing_table)) rt->size < sizeof(struct irq_routing_table))
return NULL; return NULL;
sum = 0; sum = 0;
for (i=0; i < rt->size; i++) for (i = 0; i < rt->size; i++)
sum += addr[i]; sum += addr[i];
if (!sum) { if (!sum) {
DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", rt); DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n",
rt);
return rt; return rt;
} }
return NULL; return NULL;
...@@ -100,7 +102,8 @@ static struct irq_routing_table * __init pirq_find_routing_table(void) ...@@ -100,7 +102,8 @@ static struct irq_routing_table * __init pirq_find_routing_table(void)
return rt; return rt;
printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n"); printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n");
} }
for(addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) { for (addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000);
addr += 16) {
rt = pirq_check_routing_table(addr); rt = pirq_check_routing_table(addr);
if (rt) if (rt)
return rt; return rt;
...@@ -122,20 +125,23 @@ static void __init pirq_peer_trick(void) ...@@ -122,20 +125,23 @@ static void __init pirq_peer_trick(void)
struct irq_info *e; struct irq_info *e;
memset(busmap, 0, sizeof(busmap)); memset(busmap, 0, sizeof(busmap));
for(i=0; i < (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); i++) { for (i = 0; i < (rt->size - sizeof(struct irq_routing_table)) /
sizeof(struct irq_info); i++) {
e = &rt->slots[i]; e = &rt->slots[i];
#ifdef DEBUG #ifdef DEBUG
{ {
int j; int j;
DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot); DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus,
for(j=0; j<4; j++) e->devfn/8, e->slot);
DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap); for (j = 0; j < 4; j++)
DBG(" %d:%02x/%04x", j, e->irq[j].link,
e->irq[j].bitmap);
DBG("\n"); DBG("\n");
} }
#endif #endif
busmap[e->bus] = 1; busmap[e->bus] = 1;
} }
for(i = 1; i < 256; i++) { for (i = 1; i < 256; i++) {
int node; int node;
if (!busmap[i] || pci_find_bus(0, i)) if (!busmap[i] || pci_find_bus(0, i))
continue; continue;
...@@ -174,7 +180,8 @@ void eisa_set_level_irq(unsigned int irq) ...@@ -174,7 +180,8 @@ void eisa_set_level_irq(unsigned int irq)
* Common IRQ routing practice: nibbles in config space, * Common IRQ routing practice: nibbles in config space,
* offset by some magic constant. * offset by some magic constant.
*/ */
static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr) static unsigned int
read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr)
{ {
u8 x; u8 x;
unsigned reg = offset + (nr >> 1); unsigned reg = offset + (nr >> 1);
...@@ -183,7 +190,8 @@ static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, ...@@ -183,7 +190,8 @@ static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset,
return (nr & 1) ? (x >> 4) : (x & 0xf); return (nr & 1) ? (x >> 4) : (x & 0xf);
} }
static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr, unsigned int val) static void write_config_nybble(struct pci_dev *router, unsigned offset,
unsigned nr, unsigned int val)
{ {
u8 x; u8 x;
unsigned reg = offset + (nr >> 1); unsigned reg = offset + (nr >> 1);
...@@ -200,15 +208,18 @@ static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigne ...@@ -200,15 +208,18 @@ static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigne
*/ */
static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq) static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ {
static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1,
11, 0, 12, 0, 14, 0, 15 };
WARN_ON_ONCE(pirq > 16); WARN_ON_ONCE(pirq > 16);
return irqmap[read_config_nybble(router, 0x48, pirq-1)]; return irqmap[read_config_nybble(router, 0x48, pirq-1)];
} }
static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1,
3, 9, 11, 0, 13, 15 };
unsigned int val = irqmap[irq]; unsigned int val = irqmap[irq];
WARN_ON_ONCE(pirq > 16); WARN_ON_ONCE(pirq > 16);
...@@ -231,7 +242,8 @@ static int pirq_piix_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -231,7 +242,8 @@ static int pirq_piix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
return (x < 16) ? x : 0; return (x < 16) ? x : 0;
} }
static int pirq_piix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_piix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
pci_write_config_byte(router, pirq, irq); pci_write_config_byte(router, pirq, irq);
return 1; return 1;
...@@ -247,7 +259,8 @@ static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -247,7 +259,8 @@ static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq); return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq);
} }
static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq); write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq);
return 1; return 1;
...@@ -258,7 +271,8 @@ static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i ...@@ -258,7 +271,8 @@ static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i
* but without the ugly irq number munging. * but without the ugly irq number munging.
* However, for 82C586, nibble map is different . * However, for 82C586, nibble map is different .
*/ */
static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq) static int
pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ {
static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 };
...@@ -266,7 +280,8 @@ static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq ...@@ -266,7 +280,8 @@ static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq
return read_config_nybble(router, 0x55, pirqmap[pirq-1]); return read_config_nybble(router, 0x55, pirqmap[pirq-1]);
} }
static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 };
...@@ -285,10 +300,11 @@ static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -285,10 +300,11 @@ static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
WARN_ON_ONCE(pirq > 4); WARN_ON_ONCE(pirq > 4);
return read_config_nybble(router,0x43, pirqmap[pirq-1]); return read_config_nybble(router, 0x43, pirqmap[pirq-1]);
} }
static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
...@@ -306,7 +322,8 @@ static int pirq_opti_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -306,7 +322,8 @@ static int pirq_opti_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
return read_config_nybble(router, 0xb8, pirq >> 4); return read_config_nybble(router, 0xb8, pirq >> 4);
} }
static int pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
write_config_nybble(router, 0xb8, pirq >> 4, irq); write_config_nybble(router, 0xb8, pirq >> 4, irq);
return 1; return 1;
...@@ -314,7 +331,7 @@ static int pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -314,7 +331,7 @@ static int pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
/* /*
* Cyrix: nibble offset 0x5C * Cyrix: nibble offset 0x5C
* 0x5C bits 7:4 is INTB bits 3:0 is INTA * 0x5C bits 7:4 is INTB bits 3:0 is INTA
* 0x5D bits 7:4 is INTD bits 3:0 is INTC * 0x5D bits 7:4 is INTD bits 3:0 is INTC
*/ */
static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq) static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
...@@ -322,7 +339,8 @@ static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -322,7 +339,8 @@ static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
return read_config_nybble(router, 0x5C, (pirq-1)^1); return read_config_nybble(router, 0x5C, (pirq-1)^1);
} }
static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
write_config_nybble(router, 0x5C, (pirq-1)^1, irq); write_config_nybble(router, 0x5C, (pirq-1)^1, irq);
return 1; return 1;
...@@ -350,7 +368,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -350,7 +368,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
* Apparently there are systems implementing PCI routing table using * Apparently there are systems implementing PCI routing table using
* link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D. * link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D.
* We try our best to handle both link mappings. * We try our best to handle both link mappings.
* *
* Currently (2003-05-21) it appears most SiS chipsets follow the * Currently (2003-05-21) it appears most SiS chipsets follow the
* definition of routing registers from the SiS-5595 southbridge. * definition of routing registers from the SiS-5595 southbridge.
* According to the SiS 5595 datasheets the revision id's of the * According to the SiS 5595 datasheets the revision id's of the
...@@ -370,7 +388,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -370,7 +388,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
* *
* 0x62: USBIRQ: * 0x62: USBIRQ:
* bit 6 OHCI function disabled (0), enabled (1) * bit 6 OHCI function disabled (0), enabled (1)
* *
* 0x6a: ACPI/SCI IRQ: bits 4-6 reserved * 0x6a: ACPI/SCI IRQ: bits 4-6 reserved
* *
* 0x7e: Data Acq. Module IRQ - bits 4-6 reserved * 0x7e: Data Acq. Module IRQ - bits 4-6 reserved
...@@ -405,7 +423,8 @@ static int pirq_sis_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -405,7 +423,8 @@ static int pirq_sis_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
return (x & PIRQ_SIS_IRQ_DISABLE) ? 0 : (x & PIRQ_SIS_IRQ_MASK); return (x & PIRQ_SIS_IRQ_DISABLE) ? 0 : (x & PIRQ_SIS_IRQ_MASK);
} }
static int pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
u8 x; u8 x;
int reg; int reg;
...@@ -439,7 +458,8 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -439,7 +458,8 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
return read_config_nybble(router, 0x74, pirq-1); return read_config_nybble(router, 0x74, pirq-1);
} }
static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
WARN_ON_ONCE(pirq >= 9); WARN_ON_ONCE(pirq >= 9);
if (pirq > 8) { if (pirq > 8) {
...@@ -461,13 +481,15 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -461,13 +481,15 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
* 0x00 for ACPI (SCI), 0x01 for USB, 0x02 for IDE0, 0x04 for IDE1, * 0x00 for ACPI (SCI), 0x01 for USB, 0x02 for IDE0, 0x04 for IDE1,
* and 0x03 for SMBus. * and 0x03 for SMBus.
*/ */
static int pirq_serverworks_get(struct pci_dev *router, struct pci_dev *dev, int pirq) static int
pirq_serverworks_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ {
outb(pirq, 0xc00); outb(pirq, 0xc00);
return inb(0xc01) & 0xf; return inb(0xc01) & 0xf;
} }
static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev,
int pirq, int irq)
{ {
outb(pirq, 0xc00); outb(pirq, 0xc00);
outb(irq, 0xc01); outb(irq, 0xc01);
...@@ -482,27 +504,27 @@ static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, int ...@@ -482,27 +504,27 @@ static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, int
* offset 0x56 0-3 PIRQA 4-7 PIRQB * offset 0x56 0-3 PIRQA 4-7 PIRQB
* offset 0x57 0-3 PIRQC 4-7 PIRQD * offset 0x57 0-3 PIRQC 4-7 PIRQD
*/ */
static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq) static int
pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ {
u8 irq; u8 irq;
irq = 0; irq = 0;
if (pirq <= 4) if (pirq <= 4)
{
irq = read_config_nybble(router, 0x56, pirq - 1); irq = read_config_nybble(router, 0x56, pirq - 1);
} printk(KERN_INFO
printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n",
dev->vendor, dev->device, pirq, irq); dev->vendor, dev->device, pirq, irq);
return irq; return irq;
} }
static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", printk(KERN_INFO
"AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n",
dev->vendor, dev->device, pirq, irq); dev->vendor, dev->device, pirq, irq);
if (pirq <= 4) if (pirq <= 4)
{
write_config_nybble(router, 0x56, pirq - 1, irq); write_config_nybble(router, 0x56, pirq - 1, irq);
}
return 1; return 1;
} }
...@@ -528,7 +550,8 @@ static int pirq_pico_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -528,7 +550,8 @@ static int pirq_pico_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
#ifdef CONFIG_PCI_BIOS #ifdef CONFIG_PCI_BIOS
static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int
pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
struct pci_dev *bridge; struct pci_dev *bridge;
int pin = pci_get_interrupt_pin(dev, &bridge); int pin = pci_get_interrupt_pin(dev, &bridge);
...@@ -537,11 +560,14 @@ static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -537,11 +560,14 @@ static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
#endif #endif
static __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
static struct pci_device_id __initdata pirq_440gx[] = { static struct pci_device_id __initdata pirq_440gx[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2) }, PCI_DEVICE_ID_INTEL_82443GX_0) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82443GX_2) },
{ }, { },
}; };
...@@ -549,50 +575,49 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route ...@@ -549,50 +575,49 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
if (pci_dev_present(pirq_440gx)) if (pci_dev_present(pirq_440gx))
return 0; return 0;
switch(device) switch (device) {
{ case PCI_DEVICE_ID_INTEL_82371FB_0:
case PCI_DEVICE_ID_INTEL_82371FB_0: case PCI_DEVICE_ID_INTEL_82371SB_0:
case PCI_DEVICE_ID_INTEL_82371SB_0: case PCI_DEVICE_ID_INTEL_82371AB_0:
case PCI_DEVICE_ID_INTEL_82371AB_0: case PCI_DEVICE_ID_INTEL_82371MX:
case PCI_DEVICE_ID_INTEL_82371MX: case PCI_DEVICE_ID_INTEL_82443MX_0:
case PCI_DEVICE_ID_INTEL_82443MX_0: case PCI_DEVICE_ID_INTEL_82801AA_0:
case PCI_DEVICE_ID_INTEL_82801AA_0: case PCI_DEVICE_ID_INTEL_82801AB_0:
case PCI_DEVICE_ID_INTEL_82801AB_0: case PCI_DEVICE_ID_INTEL_82801BA_0:
case PCI_DEVICE_ID_INTEL_82801BA_0: case PCI_DEVICE_ID_INTEL_82801BA_10:
case PCI_DEVICE_ID_INTEL_82801BA_10: case PCI_DEVICE_ID_INTEL_82801CA_0:
case PCI_DEVICE_ID_INTEL_82801CA_0: case PCI_DEVICE_ID_INTEL_82801CA_12:
case PCI_DEVICE_ID_INTEL_82801CA_12: case PCI_DEVICE_ID_INTEL_82801DB_0:
case PCI_DEVICE_ID_INTEL_82801DB_0: case PCI_DEVICE_ID_INTEL_82801E_0:
case PCI_DEVICE_ID_INTEL_82801E_0: case PCI_DEVICE_ID_INTEL_82801EB_0:
case PCI_DEVICE_ID_INTEL_82801EB_0: case PCI_DEVICE_ID_INTEL_ESB_1:
case PCI_DEVICE_ID_INTEL_ESB_1: case PCI_DEVICE_ID_INTEL_ICH6_0:
case PCI_DEVICE_ID_INTEL_ICH6_0: case PCI_DEVICE_ID_INTEL_ICH6_1:
case PCI_DEVICE_ID_INTEL_ICH6_1: case PCI_DEVICE_ID_INTEL_ICH7_0:
case PCI_DEVICE_ID_INTEL_ICH7_0: case PCI_DEVICE_ID_INTEL_ICH7_1:
case PCI_DEVICE_ID_INTEL_ICH7_1: case PCI_DEVICE_ID_INTEL_ICH7_30:
case PCI_DEVICE_ID_INTEL_ICH7_30: case PCI_DEVICE_ID_INTEL_ICH7_31:
case PCI_DEVICE_ID_INTEL_ICH7_31: case PCI_DEVICE_ID_INTEL_ESB2_0:
case PCI_DEVICE_ID_INTEL_ESB2_0: case PCI_DEVICE_ID_INTEL_ICH8_0:
case PCI_DEVICE_ID_INTEL_ICH8_0: case PCI_DEVICE_ID_INTEL_ICH8_1:
case PCI_DEVICE_ID_INTEL_ICH8_1: case PCI_DEVICE_ID_INTEL_ICH8_2:
case PCI_DEVICE_ID_INTEL_ICH8_2: case PCI_DEVICE_ID_INTEL_ICH8_3:
case PCI_DEVICE_ID_INTEL_ICH8_3: case PCI_DEVICE_ID_INTEL_ICH8_4:
case PCI_DEVICE_ID_INTEL_ICH8_4: case PCI_DEVICE_ID_INTEL_ICH9_0:
case PCI_DEVICE_ID_INTEL_ICH9_0: case PCI_DEVICE_ID_INTEL_ICH9_1:
case PCI_DEVICE_ID_INTEL_ICH9_1: case PCI_DEVICE_ID_INTEL_ICH9_2:
case PCI_DEVICE_ID_INTEL_ICH9_2: case PCI_DEVICE_ID_INTEL_ICH9_3:
case PCI_DEVICE_ID_INTEL_ICH9_3: case PCI_DEVICE_ID_INTEL_ICH9_4:
case PCI_DEVICE_ID_INTEL_ICH9_4: case PCI_DEVICE_ID_INTEL_ICH9_5:
case PCI_DEVICE_ID_INTEL_ICH9_5: case PCI_DEVICE_ID_INTEL_TOLAPAI_0:
case PCI_DEVICE_ID_INTEL_TOLAPAI_0: case PCI_DEVICE_ID_INTEL_ICH10_0:
case PCI_DEVICE_ID_INTEL_ICH10_0: case PCI_DEVICE_ID_INTEL_ICH10_1:
case PCI_DEVICE_ID_INTEL_ICH10_1: case PCI_DEVICE_ID_INTEL_ICH10_2:
case PCI_DEVICE_ID_INTEL_ICH10_2: case PCI_DEVICE_ID_INTEL_ICH10_3:
case PCI_DEVICE_ID_INTEL_ICH10_3: r->name = "PIIX/ICH";
r->name = "PIIX/ICH"; r->get = pirq_piix_get;
r->get = pirq_piix_get; r->set = pirq_piix_set;
r->set = pirq_piix_set; return 1;
return 1;
} }
return 0; return 0;
} }
...@@ -606,7 +631,7 @@ static __init int via_router_probe(struct irq_router *r, ...@@ -606,7 +631,7 @@ static __init int via_router_probe(struct irq_router *r,
* workarounds for some buggy BIOSes * workarounds for some buggy BIOSes
*/ */
if (device == PCI_DEVICE_ID_VIA_82C586_0) { if (device == PCI_DEVICE_ID_VIA_82C586_0) {
switch(router->device) { switch (router->device) {
case PCI_DEVICE_ID_VIA_82C686: case PCI_DEVICE_ID_VIA_82C686:
/* /*
* Asus k7m bios wrongly reports 82C686A * Asus k7m bios wrongly reports 82C686A
...@@ -631,7 +656,7 @@ static __init int via_router_probe(struct irq_router *r, ...@@ -631,7 +656,7 @@ static __init int via_router_probe(struct irq_router *r,
} }
} }
switch(device) { switch (device) {
case PCI_DEVICE_ID_VIA_82C586_0: case PCI_DEVICE_ID_VIA_82C586_0:
r->name = "VIA"; r->name = "VIA";
r->get = pirq_via586_get; r->get = pirq_via586_get;
...@@ -652,88 +677,89 @@ static __init int via_router_probe(struct irq_router *r, ...@@ -652,88 +677,89 @@ static __init int via_router_probe(struct irq_router *r,
return 0; return 0;
} }
static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{ case PCI_DEVICE_ID_VLSI_82C534:
case PCI_DEVICE_ID_VLSI_82C534: r->name = "VLSI 82C534";
r->name = "VLSI 82C534"; r->get = pirq_vlsi_get;
r->get = pirq_vlsi_get; r->set = pirq_vlsi_set;
r->set = pirq_vlsi_set; return 1;
return 1;
} }
return 0; return 0;
} }
static __init int serverworks_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int serverworks_router_probe(struct irq_router *r,
struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{ case PCI_DEVICE_ID_SERVERWORKS_OSB4:
case PCI_DEVICE_ID_SERVERWORKS_OSB4: case PCI_DEVICE_ID_SERVERWORKS_CSB5:
case PCI_DEVICE_ID_SERVERWORKS_CSB5: r->name = "ServerWorks";
r->name = "ServerWorks"; r->get = pirq_serverworks_get;
r->get = pirq_serverworks_get; r->set = pirq_serverworks_set;
r->set = pirq_serverworks_set; return 1;
return 1;
} }
return 0; return 0;
} }
static __init int sis_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
sis_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
if (device != PCI_DEVICE_ID_SI_503) if (device != PCI_DEVICE_ID_SI_503)
return 0; return 0;
r->name = "SIS"; r->name = "SIS";
r->get = pirq_sis_get; r->get = pirq_sis_get;
r->set = pirq_sis_set; r->set = pirq_sis_set;
return 1; return 1;
} }
static __init int cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{ case PCI_DEVICE_ID_CYRIX_5520:
case PCI_DEVICE_ID_CYRIX_5520: r->name = "NatSemi";
r->name = "NatSemi"; r->get = pirq_cyrix_get;
r->get = pirq_cyrix_get; r->set = pirq_cyrix_set;
r->set = pirq_cyrix_set; return 1;
return 1;
} }
return 0; return 0;
} }
static __init int opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{ case PCI_DEVICE_ID_OPTI_82C700:
case PCI_DEVICE_ID_OPTI_82C700: r->name = "OPTI";
r->name = "OPTI"; r->get = pirq_opti_get;
r->get = pirq_opti_get; r->set = pirq_opti_set;
r->set = pirq_opti_set; return 1;
return 1;
} }
return 0; return 0;
} }
static __init int ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{ case PCI_DEVICE_ID_ITE_IT8330G_0:
case PCI_DEVICE_ID_ITE_IT8330G_0: r->name = "ITE";
r->name = "ITE"; r->get = pirq_ite_get;
r->get = pirq_ite_get; r->set = pirq_ite_set;
r->set = pirq_ite_set; return 1;
return 1;
} }
return 0; return 0;
} }
static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{
case PCI_DEVICE_ID_AL_M1533: case PCI_DEVICE_ID_AL_M1533:
case PCI_DEVICE_ID_AL_M1563: case PCI_DEVICE_ID_AL_M1563:
printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n"); printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
...@@ -745,28 +771,29 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, ...@@ -745,28 +771,29 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router,
return 0; return 0;
} }
static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch(device) switch (device) {
{ case PCI_DEVICE_ID_AMD_VIPER_740B:
case PCI_DEVICE_ID_AMD_VIPER_740B: r->name = "AMD756";
r->name = "AMD756"; break;
break; case PCI_DEVICE_ID_AMD_VIPER_7413:
case PCI_DEVICE_ID_AMD_VIPER_7413: r->name = "AMD766";
r->name = "AMD766"; break;
break; case PCI_DEVICE_ID_AMD_VIPER_7443:
case PCI_DEVICE_ID_AMD_VIPER_7443: r->name = "AMD768";
r->name = "AMD768"; break;
break; default:
default: return 0;
return 0;
} }
r->get = pirq_amd756_get; r->get = pirq_amd756_get;
r->set = pirq_amd756_set; r->set = pirq_amd756_set;
return 1; return 1;
} }
static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) static __init int
pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
{ {
switch (device) { switch (device) {
case PCI_DEVICE_ID_PICOPOWER_PT86C523: case PCI_DEVICE_ID_PICOPOWER_PT86C523:
...@@ -807,7 +834,7 @@ static struct pci_dev *pirq_router_dev; ...@@ -807,7 +834,7 @@ static struct pci_dev *pirq_router_dev;
* FIXME: should we have an option to say "generic for * FIXME: should we have an option to say "generic for
* chipset" ? * chipset" ?
*/ */
static void __init pirq_find_router(struct irq_router *r) static void __init pirq_find_router(struct irq_router *r)
{ {
struct irq_routing_table *rt = pirq_table; struct irq_routing_table *rt = pirq_table;
...@@ -826,7 +853,7 @@ static void __init pirq_find_router(struct irq_router *r) ...@@ -826,7 +853,7 @@ static void __init pirq_find_router(struct irq_router *r)
r->name = "default"; r->name = "default";
r->get = NULL; r->get = NULL;
r->set = NULL; r->set = NULL;
DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n", DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n",
rt->rtr_vendor, rt->rtr_device); rt->rtr_vendor, rt->rtr_device);
...@@ -837,12 +864,14 @@ static void __init pirq_find_router(struct irq_router *r) ...@@ -837,12 +864,14 @@ static void __init pirq_find_router(struct irq_router *r)
return; return;
} }
for( h = pirq_routers; h->vendor; h++) { for (h = pirq_routers; h->vendor; h++) {
/* First look for a router match */ /* First look for a router match */
if (rt->rtr_vendor == h->vendor && h->probe(r, pirq_router_dev, rt->rtr_device)) if (rt->rtr_vendor == h->vendor &&
h->probe(r, pirq_router_dev, rt->rtr_device))
break; break;
/* Fall back to a device match */ /* Fall back to a device match */
if (pirq_router_dev->vendor == h->vendor && h->probe(r, pirq_router_dev, pirq_router_dev->device)) if (pirq_router_dev->vendor == h->vendor &&
h->probe(r, pirq_router_dev, pirq_router_dev->device))
break; break;
} }
printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n", printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n",
...@@ -857,11 +886,13 @@ static void __init pirq_find_router(struct irq_router *r) ...@@ -857,11 +886,13 @@ static void __init pirq_find_router(struct irq_router *r)
static struct irq_info *pirq_get_info(struct pci_dev *dev) static struct irq_info *pirq_get_info(struct pci_dev *dev)
{ {
struct irq_routing_table *rt = pirq_table; struct irq_routing_table *rt = pirq_table;
int entries = (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); int entries = (rt->size - sizeof(struct irq_routing_table)) /
sizeof(struct irq_info);
struct irq_info *info; struct irq_info *info;
for (info = rt->slots; entries--; info++) for (info = rt->slots; entries--; info++)
if (info->bus == dev->bus->number && PCI_SLOT(info->devfn) == PCI_SLOT(dev->devfn)) if (info->bus == dev->bus->number &&
PCI_SLOT(info->devfn) == PCI_SLOT(dev->devfn))
return info; return info;
return NULL; return NULL;
} }
...@@ -889,7 +920,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -889,7 +920,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
if (!pirq_table) if (!pirq_table)
return 0; return 0;
DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin); DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
info = pirq_get_info(dev); info = pirq_get_info(dev);
if (!info) { if (!info) {
...@@ -902,7 +933,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -902,7 +933,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
DBG(" -> not routed\n" KERN_DEBUG); DBG(" -> not routed\n" KERN_DEBUG);
return 0; return 0;
} }
DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs); DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask,
pirq_table->exclusive_irqs);
mask &= pcibios_irq_mask; mask &= pcibios_irq_mask;
/* Work around broken HP Pavilion Notebooks which assign USB to /* Work around broken HP Pavilion Notebooks which assign USB to
...@@ -915,7 +947,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -915,7 +947,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
} }
/* same for Acer Travelmate 360, but with CB and irq 11 -> 10 */ /* same for Acer Travelmate 360, but with CB and irq 11 -> 10 */
if (acer_tm360_irqrouting && dev->irq == 11 && dev->vendor == PCI_VENDOR_ID_O2) { if (acer_tm360_irqrouting && dev->irq == 11 &&
dev->vendor == PCI_VENDOR_ID_O2) {
pirq = 0x68; pirq = 0x68;
mask = 0x400; mask = 0x400;
dev->irq = r->get(pirq_router_dev, dev, pirq); dev->irq = r->get(pirq_router_dev, dev, pirq);
...@@ -928,17 +961,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -928,17 +961,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
*/ */
newirq = dev->irq; newirq = dev->irq;
if (newirq && !((1 << newirq) & mask)) { if (newirq && !((1 << newirq) & mask)) {
if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0; if (pci_probe & PCI_USE_PIRQ_MASK)
else printk("\n" KERN_WARNING newirq = 0;
"PCI: IRQ %i for device %s doesn't match PIRQ mask " else
"- try pci=usepirqmask\n" KERN_DEBUG, newirq, printk("\n" KERN_WARNING
pci_name(dev)); "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n"
KERN_DEBUG, newirq,
pci_name(dev));
} }
if (!newirq && assign) { if (!newirq && assign) {
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (!(mask & (1 << i))) if (!(mask & (1 << i)))
continue; continue;
if (pirq_penalty[i] < pirq_penalty[newirq] && can_request_irq(i, IRQF_SHARED)) if (pirq_penalty[i] < pirq_penalty[newirq] &&
can_request_irq(i, IRQF_SHARED))
newirq = i; newirq = i;
} }
} }
...@@ -949,12 +985,13 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -949,12 +985,13 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
irq = pirq & 0xf; irq = pirq & 0xf;
DBG(" -> hardcoded IRQ %d\n", irq); DBG(" -> hardcoded IRQ %d\n", irq);
msg = "Hardcoded"; msg = "Hardcoded";
} else if ( r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) { ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) {
DBG(" -> got IRQ %d\n", irq); DBG(" -> got IRQ %d\n", irq);
msg = "Found"; msg = "Found";
eisa_set_level_irq(irq); eisa_set_level_irq(irq);
} else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { } else if (newirq && r->set &&
(dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
DBG(" -> assigning IRQ %d", newirq); DBG(" -> assigning IRQ %d", newirq);
if (r->set(pirq_router_dev, dev, pirq, newirq)) { if (r->set(pirq_router_dev, dev, pirq, newirq)) {
eisa_set_level_irq(newirq); eisa_set_level_irq(newirq);
...@@ -972,7 +1009,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -972,7 +1009,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
} else } else
return 0; return 0;
} }
printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, pci_name(dev)); printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq,
pci_name(dev));
/* Update IRQ for all devices with the same pirq value */ /* Update IRQ for all devices with the same pirq value */
while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) {
...@@ -984,20 +1022,26 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -984,20 +1022,26 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
if (!info) if (!info)
continue; continue;
if (info->irq[pin].link == pirq) { if (info->irq[pin].link == pirq) {
/* We refuse to override the dev->irq information. Give a warning! */ /*
if ( dev2->irq && dev2->irq != irq && \ * We refuse to override the dev->irq
* information. Give a warning!
*/
if (dev2->irq && dev2->irq != irq && \
(!(pci_probe & PCI_USE_PIRQ_MASK) || \ (!(pci_probe & PCI_USE_PIRQ_MASK) || \
((1 << dev2->irq) & mask)) ) { ((1 << dev2->irq) & mask))) {
#ifndef CONFIG_PCI_MSI #ifndef CONFIG_PCI_MSI
printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", printk(KERN_INFO
pci_name(dev2), dev2->irq, irq); "IRQ routing conflict for %s, have irq %d, want irq %d\n",
pci_name(dev2), dev2->irq, irq);
#endif #endif
continue; continue;
} }
dev2->irq = irq; dev2->irq = irq;
pirq_penalty[irq]++; pirq_penalty[irq]++;
if (dev != dev2) if (dev != dev2)
printk(KERN_INFO "PCI: Sharing IRQ %d with %s\n", irq, pci_name(dev2)); printk(KERN_INFO
"PCI: Sharing IRQ %d with %s\n",
irq, pci_name(dev2));
} }
} }
return 1; return 1;
...@@ -1011,15 +1055,21 @@ static void __init pcibios_fixup_irqs(void) ...@@ -1011,15 +1055,21 @@ static void __init pcibios_fixup_irqs(void)
DBG(KERN_DEBUG "PCI: IRQ fixup\n"); DBG(KERN_DEBUG "PCI: IRQ fixup\n");
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
/* /*
* If the BIOS has set an out of range IRQ number, just ignore it. * If the BIOS has set an out of range IRQ number, just
* Also keep track of which IRQ's are already in use. * ignore it. Also keep track of which IRQ's are
* already in use.
*/ */
if (dev->irq >= 16) { if (dev->irq >= 16) {
DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq); DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n",
pci_name(dev), dev->irq);
dev->irq = 0; dev->irq = 0;
} }
/* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */ /*
if (pirq_penalty[dev->irq] >= 100 && pirq_penalty[dev->irq] < 100000) * If the IRQ is already assigned to a PCI device,
* ignore its ISA use penalty
*/
if (pirq_penalty[dev->irq] >= 100 &&
pirq_penalty[dev->irq] < 100000)
pirq_penalty[dev->irq] = 0; pirq_penalty[dev->irq] = 0;
pirq_penalty[dev->irq]++; pirq_penalty[dev->irq]++;
} }
...@@ -1031,31 +1081,40 @@ static void __init pcibios_fixup_irqs(void) ...@@ -1031,31 +1081,40 @@ static void __init pcibios_fixup_irqs(void)
/* /*
* Recalculate IRQ numbers if we use the I/O APIC. * Recalculate IRQ numbers if we use the I/O APIC.
*/ */
if (io_apic_assign_pci_irqs) if (io_apic_assign_pci_irqs) {
{
int irq; int irq;
if (pin) { if (pin) {
pin--; /* interrupt pins are numbered starting from 1 */ /*
irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin); * interrupt pins are numbered starting
* from 1
*/
pin--;
irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
PCI_SLOT(dev->devfn), pin);
/* /*
* Busses behind bridges are typically not listed in the MP-table. * Busses behind bridges are typically not listed in the MP-table.
* In this case we have to look up the IRQ based on the parent bus, * In this case we have to look up the IRQ based on the parent bus,
* parent slot, and pin number. The SMP code detects such bridged * parent slot, and pin number. The SMP code detects such bridged
* busses itself so we should get into this branch reliably. * busses itself so we should get into this branch reliably.
*/ */
if (irq < 0 && dev->bus->parent) { /* go back to the bridge */ if (irq < 0 && dev->bus->parent) {
struct pci_dev * bridge = dev->bus->self; /* go back to the bridge */
struct pci_dev *bridge = dev->bus->self;
pin = (pin + PCI_SLOT(dev->devfn)) % 4; pin = (pin + PCI_SLOT(dev->devfn)) % 4;
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
PCI_SLOT(bridge->devfn), pin); PCI_SLOT(bridge->devfn),
pin);
if (irq >= 0) if (irq >= 0)
printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", printk(KERN_WARNING
pci_name(bridge), 'A' + pin, irq); "PCI: using PPB %s[%c] to get irq %d\n",
pci_name(bridge),
'A' + pin, irq);
} }
if (irq >= 0) { if (irq >= 0) {
printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", printk(KERN_INFO
"PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
pci_name(dev), 'A' + pin, irq); pci_name(dev), 'A' + pin, irq);
dev->irq = irq; dev->irq = irq;
} }
...@@ -1078,7 +1137,8 @@ static int __init fix_broken_hp_bios_irq9(const struct dmi_system_id *d) ...@@ -1078,7 +1137,8 @@ static int __init fix_broken_hp_bios_irq9(const struct dmi_system_id *d)
{ {
if (!broken_hp_bios_irq9) { if (!broken_hp_bios_irq9) {
broken_hp_bios_irq9 = 1; broken_hp_bios_irq9 = 1;
printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident); printk(KERN_INFO "%s detected - fixing broken IRQ routing\n",
d->ident);
} }
return 0; return 0;
} }
...@@ -1091,7 +1151,8 @@ static int __init fix_acer_tm360_irqrouting(const struct dmi_system_id *d) ...@@ -1091,7 +1151,8 @@ static int __init fix_acer_tm360_irqrouting(const struct dmi_system_id *d)
{ {
if (!acer_tm360_irqrouting) { if (!acer_tm360_irqrouting) {
acer_tm360_irqrouting = 1; acer_tm360_irqrouting = 1;
printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident); printk(KERN_INFO "%s detected - fixing broken IRQ routing\n",
d->ident);
} }
return 0; return 0;
} }
...@@ -1103,7 +1164,8 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = { ...@@ -1103,7 +1164,8 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = {
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_BIOS_VERSION, "GE.M1.03"), DMI_MATCH(DMI_BIOS_VERSION, "GE.M1.03"),
DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook Model GE"), DMI_MATCH(DMI_PRODUCT_VERSION,
"HP Pavilion Notebook Model GE"),
DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
}, },
}, },
...@@ -1138,11 +1200,14 @@ static int __init pcibios_irq_init(void) ...@@ -1138,11 +1200,14 @@ static int __init pcibios_irq_init(void)
pirq_find_router(&pirq_router); pirq_find_router(&pirq_router);
if (pirq_table->exclusive_irqs) { if (pirq_table->exclusive_irqs) {
int i; int i;
for (i=0; i<16; i++) for (i = 0; i < 16; i++)
if (!(pirq_table->exclusive_irqs & (1 << i))) if (!(pirq_table->exclusive_irqs & (1 << i)))
pirq_penalty[i] += 100; pirq_penalty[i] += 100;
} }
/* If we're using the I/O APIC, avoid using the PCI IRQ routing table */ /*
* If we're using the I/O APIC, avoid using the PCI IRQ
* routing table
*/
if (io_apic_assign_pci_irqs) if (io_apic_assign_pci_irqs)
pirq_table = NULL; pirq_table = NULL;
} }
...@@ -1189,33 +1254,40 @@ static int pirq_enable_irq(struct pci_dev *dev) ...@@ -1189,33 +1254,40 @@ static int pirq_enable_irq(struct pci_dev *dev)
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) { if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
char *msg = ""; char *msg = "";
pin--; /* interrupt pins are numbered starting from 1 */ pin--; /* interrupt pins are numbered starting from 1 */
if (io_apic_assign_pci_irqs) { if (io_apic_assign_pci_irqs) {
int irq; int irq;
irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin); irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
PCI_SLOT(dev->devfn), pin);
/* /*
* Busses behind bridges are typically not listed in the MP-table. * Busses behind bridges are typically not
* In this case we have to look up the IRQ based on the parent bus, * listed in the MP-table. In this case we have
* parent slot, and pin number. The SMP code detects such bridged * to look up the IRQ based on the parent bus,
* busses itself so we should get into this branch reliably. * parent slot, and pin number. The SMP code
* detects such bridged busses itself so we
* should get into this branch reliably.
*/ */
temp_dev = dev; temp_dev = dev;
while (irq < 0 && dev->bus->parent) { /* go back to the bridge */ while (irq < 0 && dev->bus->parent) {
struct pci_dev * bridge = dev->bus->self; /* go back to the bridge */
struct pci_dev *bridge = dev->bus->self;
pin = (pin + PCI_SLOT(dev->devfn)) % 4; pin = (pin + PCI_SLOT(dev->devfn)) % 4;
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
PCI_SLOT(bridge->devfn), pin); PCI_SLOT(bridge->devfn), pin);
if (irq >= 0) if (irq >= 0)
printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", printk(KERN_WARNING
pci_name(bridge), 'A' + pin, irq); "PCI: using PPB %s[%c] to get irq %d\n",
pci_name(bridge),
'A' + pin, irq);
dev = bridge; dev = bridge;
} }
dev = temp_dev; dev = temp_dev;
if (irq >= 0) { if (irq >= 0) {
printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", printk(KERN_INFO
"PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
pci_name(dev), 'A' + pin, irq); pci_name(dev), 'A' + pin, irq);
dev->irq = irq; dev->irq = irq;
return 0; return 0;
...@@ -1226,12 +1298,17 @@ static int pirq_enable_irq(struct pci_dev *dev) ...@@ -1226,12 +1298,17 @@ static int pirq_enable_irq(struct pci_dev *dev)
else else
msg = " Please try using pci=biosirq."; msg = " Please try using pci=biosirq.";
/* With IDE legacy devices the IRQ lookup failure is not a problem.. */ /*
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 0x5)) * With IDE legacy devices the IRQ lookup failure is not
* a problem..
*/
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
!(dev->class & 0x5))
return 0; return 0;
printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s.%s\n", printk(KERN_WARNING
'A' + pin, pci_name(dev), msg); "PCI: No IRQ known for interrupt pin %c of device %s.%s\n",
'A' + pin, pci_name(dev), msg);
} }
return 0; return 0;
} }
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