diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2008-05-13 12:38:56 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-06-10 13:59:46 -0400 |
commit | 273c11270d3715c4c06d4df1607a1a60034d887b (patch) | |
tree | b29805102ec466ab8ec8e06c8ab756417631fd37 /arch | |
parent | eaf611426d4b9ad0d0a30c0a8d414380128720af (diff) |
x86/PCI: janitor work in irq.c
Wrapped long lines, removed trailing whitespaces, fixed case indentation
inside switch and so.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/pci/irq.c | 511 |
1 files changed, 294 insertions, 217 deletions
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index ca8df9c260bc..c422e10337be 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -11,8 +11,8 @@ | |||
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | #include <linux/dmi.h> | 13 | #include <linux/dmi.h> |
14 | #include <asm/io.h> | 14 | #include <linux/io.h> |
15 | #include <asm/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <asm/io_apic.h> | 16 | #include <asm/io_apic.h> |
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/acpi.h> | 18 | #include <linux/acpi.h> |
@@ -45,7 +45,8 @@ struct irq_router { | |||
45 | char *name; | 45 | char *name; |
46 | u16 vendor, device; | 46 | u16 vendor, device; |
47 | int (*get)(struct pci_dev *router, struct pci_dev *dev, int pirq); | 47 | int (*get)(struct pci_dev *router, struct pci_dev *dev, int pirq); |
48 | int (*set)(struct pci_dev *router, struct pci_dev *dev, int pirq, int new); | 48 | int (*set)(struct pci_dev *router, struct pci_dev *dev, int pirq, |
49 | int new); | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | struct irq_router_handler { | 52 | struct irq_router_handler { |
@@ -61,7 +62,7 @@ void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL; | |||
61 | * and perform checksum verification. | 62 | * and perform checksum verification. |
62 | */ | 63 | */ |
63 | 64 | ||
64 | static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) | 65 | static inline struct irq_routing_table *pirq_check_routing_table(u8 *addr) |
65 | { | 66 | { |
66 | struct irq_routing_table *rt; | 67 | struct irq_routing_table *rt; |
67 | int i; | 68 | int i; |
@@ -74,10 +75,11 @@ static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) | |||
74 | rt->size < sizeof(struct irq_routing_table)) | 75 | rt->size < sizeof(struct irq_routing_table)) |
75 | return NULL; | 76 | return NULL; |
76 | sum = 0; | 77 | sum = 0; |
77 | for (i=0; i < rt->size; i++) | 78 | for (i = 0; i < rt->size; i++) |
78 | sum += addr[i]; | 79 | sum += addr[i]; |
79 | if (!sum) { | 80 | if (!sum) { |
80 | DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", rt); | 81 | DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", |
82 | rt); | ||
81 | return rt; | 83 | return rt; |
82 | } | 84 | } |
83 | return NULL; | 85 | return NULL; |
@@ -100,7 +102,8 @@ static struct irq_routing_table * __init pirq_find_routing_table(void) | |||
100 | return rt; | 102 | return rt; |
101 | printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n"); | 103 | printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n"); |
102 | } | 104 | } |
103 | for(addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) { | 105 | for (addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); |
106 | addr += 16) { | ||
104 | rt = pirq_check_routing_table(addr); | 107 | rt = pirq_check_routing_table(addr); |
105 | if (rt) | 108 | if (rt) |
106 | return rt; | 109 | return rt; |
@@ -122,20 +125,23 @@ static void __init pirq_peer_trick(void) | |||
122 | struct irq_info *e; | 125 | struct irq_info *e; |
123 | 126 | ||
124 | memset(busmap, 0, sizeof(busmap)); | 127 | memset(busmap, 0, sizeof(busmap)); |
125 | for(i=0; i < (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); i++) { | 128 | for (i = 0; i < (rt->size - sizeof(struct irq_routing_table)) / |
129 | sizeof(struct irq_info); i++) { | ||
126 | e = &rt->slots[i]; | 130 | e = &rt->slots[i]; |
127 | #ifdef DEBUG | 131 | #ifdef DEBUG |
128 | { | 132 | { |
129 | int j; | 133 | int j; |
130 | DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot); | 134 | DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, |
131 | for(j=0; j<4; j++) | 135 | e->devfn/8, e->slot); |
132 | DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap); | 136 | for (j = 0; j < 4; j++) |
137 | DBG(" %d:%02x/%04x", j, e->irq[j].link, | ||
138 | e->irq[j].bitmap); | ||
133 | DBG("\n"); | 139 | DBG("\n"); |
134 | } | 140 | } |
135 | #endif | 141 | #endif |
136 | busmap[e->bus] = 1; | 142 | busmap[e->bus] = 1; |
137 | } | 143 | } |
138 | for(i = 1; i < 256; i++) { | 144 | for (i = 1; i < 256; i++) { |
139 | int node; | 145 | int node; |
140 | if (!busmap[i] || pci_find_bus(0, i)) | 146 | if (!busmap[i] || pci_find_bus(0, i)) |
141 | continue; | 147 | continue; |
@@ -174,7 +180,8 @@ void eisa_set_level_irq(unsigned int irq) | |||
174 | * Common IRQ routing practice: nibbles in config space, | 180 | * Common IRQ routing practice: nibbles in config space, |
175 | * offset by some magic constant. | 181 | * offset by some magic constant. |
176 | */ | 182 | */ |
177 | static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr) | 183 | static unsigned int |
184 | read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr) | ||
178 | { | 185 | { |
179 | u8 x; | 186 | u8 x; |
180 | unsigned reg = offset + (nr >> 1); | 187 | unsigned reg = offset + (nr >> 1); |
@@ -183,7 +190,8 @@ static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, | |||
183 | return (nr & 1) ? (x >> 4) : (x & 0xf); | 190 | return (nr & 1) ? (x >> 4) : (x & 0xf); |
184 | } | 191 | } |
185 | 192 | ||
186 | static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr, unsigned int val) | 193 | static void write_config_nybble(struct pci_dev *router, unsigned offset, |
194 | unsigned nr, unsigned int val) | ||
187 | { | 195 | { |
188 | u8 x; | 196 | u8 x; |
189 | unsigned reg = offset + (nr >> 1); | 197 | unsigned reg = offset + (nr >> 1); |
@@ -200,15 +208,18 @@ static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigne | |||
200 | */ | 208 | */ |
201 | static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 209 | static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq) |
202 | { | 210 | { |
203 | static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; | 211 | static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, |
212 | 11, 0, 12, 0, 14, 0, 15 }; | ||
204 | 213 | ||
205 | WARN_ON_ONCE(pirq > 16); | 214 | WARN_ON_ONCE(pirq > 16); |
206 | return irqmap[read_config_nybble(router, 0x48, pirq-1)]; | 215 | return irqmap[read_config_nybble(router, 0x48, pirq-1)]; |
207 | } | 216 | } |
208 | 217 | ||
209 | static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 218 | static int |
219 | pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
210 | { | 220 | { |
211 | static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; | 221 | static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, |
222 | 3, 9, 11, 0, 13, 15 }; | ||
212 | unsigned int val = irqmap[irq]; | 223 | unsigned int val = irqmap[irq]; |
213 | 224 | ||
214 | WARN_ON_ONCE(pirq > 16); | 225 | 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 | return (x < 16) ? x : 0; | 242 | return (x < 16) ? x : 0; |
232 | } | 243 | } |
233 | 244 | ||
234 | static int pirq_piix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 245 | static int |
246 | pirq_piix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
235 | { | 247 | { |
236 | pci_write_config_byte(router, pirq, irq); | 248 | pci_write_config_byte(router, pirq, irq); |
237 | return 1; | 249 | return 1; |
@@ -247,7 +259,8 @@ static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
247 | return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq); | 259 | return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq); |
248 | } | 260 | } |
249 | 261 | ||
250 | static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 262 | static int |
263 | pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
251 | { | 264 | { |
252 | write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq); | 265 | write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq); |
253 | return 1; | 266 | return 1; |
@@ -258,7 +271,8 @@ static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i | |||
258 | * but without the ugly irq number munging. | 271 | * but without the ugly irq number munging. |
259 | * However, for 82C586, nibble map is different . | 272 | * However, for 82C586, nibble map is different . |
260 | */ | 273 | */ |
261 | static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 274 | static int |
275 | pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | ||
262 | { | 276 | { |
263 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; | 277 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; |
264 | 278 | ||
@@ -266,7 +280,8 @@ static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq | |||
266 | return read_config_nybble(router, 0x55, pirqmap[pirq-1]); | 280 | return read_config_nybble(router, 0x55, pirqmap[pirq-1]); |
267 | } | 281 | } |
268 | 282 | ||
269 | static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 283 | static int |
284 | pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
270 | { | 285 | { |
271 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; | 286 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; |
272 | 287 | ||
@@ -285,10 +300,11 @@ static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
285 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; | 300 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; |
286 | 301 | ||
287 | WARN_ON_ONCE(pirq > 4); | 302 | WARN_ON_ONCE(pirq > 4); |
288 | return read_config_nybble(router,0x43, pirqmap[pirq-1]); | 303 | return read_config_nybble(router, 0x43, pirqmap[pirq-1]); |
289 | } | 304 | } |
290 | 305 | ||
291 | static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 306 | static int |
307 | pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
292 | { | 308 | { |
293 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; | 309 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; |
294 | 310 | ||
@@ -306,7 +322,8 @@ static int pirq_opti_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
306 | return read_config_nybble(router, 0xb8, pirq >> 4); | 322 | return read_config_nybble(router, 0xb8, pirq >> 4); |
307 | } | 323 | } |
308 | 324 | ||
309 | static int pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 325 | static int |
326 | pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
310 | { | 327 | { |
311 | write_config_nybble(router, 0xb8, pirq >> 4, irq); | 328 | write_config_nybble(router, 0xb8, pirq >> 4, irq); |
312 | return 1; | 329 | return 1; |
@@ -314,7 +331,7 @@ static int pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq, | |||
314 | 331 | ||
315 | /* | 332 | /* |
316 | * Cyrix: nibble offset 0x5C | 333 | * Cyrix: nibble offset 0x5C |
317 | * 0x5C bits 7:4 is INTB bits 3:0 is INTA | 334 | * 0x5C bits 7:4 is INTB bits 3:0 is INTA |
318 | * 0x5D bits 7:4 is INTD bits 3:0 is INTC | 335 | * 0x5D bits 7:4 is INTD bits 3:0 is INTC |
319 | */ | 336 | */ |
320 | static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 337 | 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 | return read_config_nybble(router, 0x5C, (pirq-1)^1); | 339 | return read_config_nybble(router, 0x5C, (pirq-1)^1); |
323 | } | 340 | } |
324 | 341 | ||
325 | static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 342 | static int |
343 | pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
326 | { | 344 | { |
327 | write_config_nybble(router, 0x5C, (pirq-1)^1, irq); | 345 | write_config_nybble(router, 0x5C, (pirq-1)^1, irq); |
328 | return 1; | 346 | return 1; |
@@ -350,7 +368,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, | |||
350 | * Apparently there are systems implementing PCI routing table using | 368 | * Apparently there are systems implementing PCI routing table using |
351 | * link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D. | 369 | * link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D. |
352 | * We try our best to handle both link mappings. | 370 | * We try our best to handle both link mappings. |
353 | * | 371 | * |
354 | * Currently (2003-05-21) it appears most SiS chipsets follow the | 372 | * Currently (2003-05-21) it appears most SiS chipsets follow the |
355 | * definition of routing registers from the SiS-5595 southbridge. | 373 | * definition of routing registers from the SiS-5595 southbridge. |
356 | * According to the SiS 5595 datasheets the revision id's of the | 374 | * 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 | * | 388 | * |
371 | * 0x62: USBIRQ: | 389 | * 0x62: USBIRQ: |
372 | * bit 6 OHCI function disabled (0), enabled (1) | 390 | * bit 6 OHCI function disabled (0), enabled (1) |
373 | * | 391 | * |
374 | * 0x6a: ACPI/SCI IRQ: bits 4-6 reserved | 392 | * 0x6a: ACPI/SCI IRQ: bits 4-6 reserved |
375 | * | 393 | * |
376 | * 0x7e: Data Acq. Module IRQ - bits 4-6 reserved | 394 | * 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 | return (x & PIRQ_SIS_IRQ_DISABLE) ? 0 : (x & PIRQ_SIS_IRQ_MASK); | 423 | return (x & PIRQ_SIS_IRQ_DISABLE) ? 0 : (x & PIRQ_SIS_IRQ_MASK); |
406 | } | 424 | } |
407 | 425 | ||
408 | static int pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 426 | static int |
427 | pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
409 | { | 428 | { |
410 | u8 x; | 429 | u8 x; |
411 | int reg; | 430 | int reg; |
@@ -439,7 +458,8 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
439 | return read_config_nybble(router, 0x74, pirq-1); | 458 | return read_config_nybble(router, 0x74, pirq-1); |
440 | } | 459 | } |
441 | 460 | ||
442 | static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 461 | static int |
462 | pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
443 | { | 463 | { |
444 | WARN_ON_ONCE(pirq >= 9); | 464 | WARN_ON_ONCE(pirq >= 9); |
445 | if (pirq > 8) { | 465 | if (pirq > 8) { |
@@ -461,13 +481,15 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, | |||
461 | * 0x00 for ACPI (SCI), 0x01 for USB, 0x02 for IDE0, 0x04 for IDE1, | 481 | * 0x00 for ACPI (SCI), 0x01 for USB, 0x02 for IDE0, 0x04 for IDE1, |
462 | * and 0x03 for SMBus. | 482 | * and 0x03 for SMBus. |
463 | */ | 483 | */ |
464 | static int pirq_serverworks_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 484 | static int |
485 | pirq_serverworks_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | ||
465 | { | 486 | { |
466 | outb(pirq, 0xc00); | 487 | outb(pirq, 0xc00); |
467 | return inb(0xc01) & 0xf; | 488 | return inb(0xc01) & 0xf; |
468 | } | 489 | } |
469 | 490 | ||
470 | static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 491 | static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, |
492 | int pirq, int irq) | ||
471 | { | 493 | { |
472 | outb(pirq, 0xc00); | 494 | outb(pirq, 0xc00); |
473 | outb(irq, 0xc01); | 495 | outb(irq, 0xc01); |
@@ -482,27 +504,27 @@ static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, int | |||
482 | * offset 0x56 0-3 PIRQA 4-7 PIRQB | 504 | * offset 0x56 0-3 PIRQA 4-7 PIRQB |
483 | * offset 0x57 0-3 PIRQC 4-7 PIRQD | 505 | * offset 0x57 0-3 PIRQC 4-7 PIRQD |
484 | */ | 506 | */ |
485 | static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 507 | static int |
508 | pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | ||
486 | { | 509 | { |
487 | u8 irq; | 510 | u8 irq; |
488 | irq = 0; | 511 | irq = 0; |
489 | if (pirq <= 4) | 512 | if (pirq <= 4) |
490 | { | ||
491 | irq = read_config_nybble(router, 0x56, pirq - 1); | 513 | irq = read_config_nybble(router, 0x56, pirq - 1); |
492 | } | 514 | printk(KERN_INFO |
493 | printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", | 515 | "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", |
494 | dev->vendor, dev->device, pirq, irq); | 516 | dev->vendor, dev->device, pirq, irq); |
495 | return irq; | 517 | return irq; |
496 | } | 518 | } |
497 | 519 | ||
498 | static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 520 | static int |
521 | pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
499 | { | 522 | { |
500 | printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", | 523 | printk(KERN_INFO |
524 | "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", | ||
501 | dev->vendor, dev->device, pirq, irq); | 525 | dev->vendor, dev->device, pirq, irq); |
502 | if (pirq <= 4) | 526 | if (pirq <= 4) |
503 | { | ||
504 | write_config_nybble(router, 0x56, pirq - 1, irq); | 527 | write_config_nybble(router, 0x56, pirq - 1, irq); |
505 | } | ||
506 | return 1; | 528 | return 1; |
507 | } | 529 | } |
508 | 530 | ||
@@ -528,7 +550,8 @@ static int pirq_pico_set(struct pci_dev *router, struct pci_dev *dev, int pirq, | |||
528 | 550 | ||
529 | #ifdef CONFIG_PCI_BIOS | 551 | #ifdef CONFIG_PCI_BIOS |
530 | 552 | ||
531 | static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 553 | static int |
554 | pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | ||
532 | { | 555 | { |
533 | struct pci_dev *bridge; | 556 | struct pci_dev *bridge; |
534 | int pin = pci_get_interrupt_pin(dev, &bridge); | 557 | 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 | 560 | ||
538 | #endif | 561 | #endif |
539 | 562 | ||
540 | static __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 563 | static __init int |
564 | intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
541 | { | 565 | { |
542 | static struct pci_device_id __initdata pirq_440gx[] = { | 566 | static struct pci_device_id __initdata pirq_440gx[] = { |
543 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0) }, | 567 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, |
544 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2) }, | 568 | PCI_DEVICE_ID_INTEL_82443GX_0) }, |
569 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
570 | PCI_DEVICE_ID_INTEL_82443GX_2) }, | ||
545 | { }, | 571 | { }, |
546 | }; | 572 | }; |
547 | 573 | ||
@@ -549,50 +575,49 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route | |||
549 | if (pci_dev_present(pirq_440gx)) | 575 | if (pci_dev_present(pirq_440gx)) |
550 | return 0; | 576 | return 0; |
551 | 577 | ||
552 | switch(device) | 578 | switch (device) { |
553 | { | 579 | case PCI_DEVICE_ID_INTEL_82371FB_0: |
554 | case PCI_DEVICE_ID_INTEL_82371FB_0: | 580 | case PCI_DEVICE_ID_INTEL_82371SB_0: |
555 | case PCI_DEVICE_ID_INTEL_82371SB_0: | 581 | case PCI_DEVICE_ID_INTEL_82371AB_0: |
556 | case PCI_DEVICE_ID_INTEL_82371AB_0: | 582 | case PCI_DEVICE_ID_INTEL_82371MX: |
557 | case PCI_DEVICE_ID_INTEL_82371MX: | 583 | case PCI_DEVICE_ID_INTEL_82443MX_0: |
558 | case PCI_DEVICE_ID_INTEL_82443MX_0: | 584 | case PCI_DEVICE_ID_INTEL_82801AA_0: |
559 | case PCI_DEVICE_ID_INTEL_82801AA_0: | 585 | case PCI_DEVICE_ID_INTEL_82801AB_0: |
560 | case PCI_DEVICE_ID_INTEL_82801AB_0: | 586 | case PCI_DEVICE_ID_INTEL_82801BA_0: |
561 | case PCI_DEVICE_ID_INTEL_82801BA_0: | 587 | case PCI_DEVICE_ID_INTEL_82801BA_10: |
562 | case PCI_DEVICE_ID_INTEL_82801BA_10: | 588 | case PCI_DEVICE_ID_INTEL_82801CA_0: |
563 | case PCI_DEVICE_ID_INTEL_82801CA_0: | 589 | case PCI_DEVICE_ID_INTEL_82801CA_12: |
564 | case PCI_DEVICE_ID_INTEL_82801CA_12: | 590 | case PCI_DEVICE_ID_INTEL_82801DB_0: |
565 | case PCI_DEVICE_ID_INTEL_82801DB_0: | 591 | case PCI_DEVICE_ID_INTEL_82801E_0: |
566 | case PCI_DEVICE_ID_INTEL_82801E_0: | 592 | case PCI_DEVICE_ID_INTEL_82801EB_0: |
567 | case PCI_DEVICE_ID_INTEL_82801EB_0: | 593 | case PCI_DEVICE_ID_INTEL_ESB_1: |
568 | case PCI_DEVICE_ID_INTEL_ESB_1: | 594 | case PCI_DEVICE_ID_INTEL_ICH6_0: |
569 | case PCI_DEVICE_ID_INTEL_ICH6_0: | 595 | case PCI_DEVICE_ID_INTEL_ICH6_1: |
570 | case PCI_DEVICE_ID_INTEL_ICH6_1: | 596 | case PCI_DEVICE_ID_INTEL_ICH7_0: |
571 | case PCI_DEVICE_ID_INTEL_ICH7_0: | 597 | case PCI_DEVICE_ID_INTEL_ICH7_1: |
572 | case PCI_DEVICE_ID_INTEL_ICH7_1: | 598 | case PCI_DEVICE_ID_INTEL_ICH7_30: |
573 | case PCI_DEVICE_ID_INTEL_ICH7_30: | 599 | case PCI_DEVICE_ID_INTEL_ICH7_31: |
574 | case PCI_DEVICE_ID_INTEL_ICH7_31: | 600 | case PCI_DEVICE_ID_INTEL_ESB2_0: |
575 | case PCI_DEVICE_ID_INTEL_ESB2_0: | 601 | case PCI_DEVICE_ID_INTEL_ICH8_0: |
576 | case PCI_DEVICE_ID_INTEL_ICH8_0: | 602 | case PCI_DEVICE_ID_INTEL_ICH8_1: |
577 | case PCI_DEVICE_ID_INTEL_ICH8_1: | 603 | case PCI_DEVICE_ID_INTEL_ICH8_2: |
578 | case PCI_DEVICE_ID_INTEL_ICH8_2: | 604 | case PCI_DEVICE_ID_INTEL_ICH8_3: |
579 | case PCI_DEVICE_ID_INTEL_ICH8_3: | 605 | case PCI_DEVICE_ID_INTEL_ICH8_4: |
580 | case PCI_DEVICE_ID_INTEL_ICH8_4: | 606 | case PCI_DEVICE_ID_INTEL_ICH9_0: |
581 | case PCI_DEVICE_ID_INTEL_ICH9_0: | 607 | case PCI_DEVICE_ID_INTEL_ICH9_1: |
582 | case PCI_DEVICE_ID_INTEL_ICH9_1: | 608 | case PCI_DEVICE_ID_INTEL_ICH9_2: |
583 | case PCI_DEVICE_ID_INTEL_ICH9_2: | 609 | case PCI_DEVICE_ID_INTEL_ICH9_3: |
584 | case PCI_DEVICE_ID_INTEL_ICH9_3: | 610 | case PCI_DEVICE_ID_INTEL_ICH9_4: |
585 | case PCI_DEVICE_ID_INTEL_ICH9_4: | 611 | case PCI_DEVICE_ID_INTEL_ICH9_5: |
586 | case PCI_DEVICE_ID_INTEL_ICH9_5: | 612 | case PCI_DEVICE_ID_INTEL_TOLAPAI_0: |
587 | case PCI_DEVICE_ID_INTEL_TOLAPAI_0: | 613 | case PCI_DEVICE_ID_INTEL_ICH10_0: |
588 | case PCI_DEVICE_ID_INTEL_ICH10_0: | 614 | case PCI_DEVICE_ID_INTEL_ICH10_1: |
589 | case PCI_DEVICE_ID_INTEL_ICH10_1: | 615 | case PCI_DEVICE_ID_INTEL_ICH10_2: |
590 | case PCI_DEVICE_ID_INTEL_ICH10_2: | 616 | case PCI_DEVICE_ID_INTEL_ICH10_3: |
591 | case PCI_DEVICE_ID_INTEL_ICH10_3: | 617 | r->name = "PIIX/ICH"; |
592 | r->name = "PIIX/ICH"; | 618 | r->get = pirq_piix_get; |
593 | r->get = pirq_piix_get; | 619 | r->set = pirq_piix_set; |
594 | r->set = pirq_piix_set; | 620 | return 1; |
595 | return 1; | ||
596 | } | 621 | } |
597 | return 0; | 622 | return 0; |
598 | } | 623 | } |
@@ -606,7 +631,7 @@ static __init int via_router_probe(struct irq_router *r, | |||
606 | * workarounds for some buggy BIOSes | 631 | * workarounds for some buggy BIOSes |
607 | */ | 632 | */ |
608 | if (device == PCI_DEVICE_ID_VIA_82C586_0) { | 633 | if (device == PCI_DEVICE_ID_VIA_82C586_0) { |
609 | switch(router->device) { | 634 | switch (router->device) { |
610 | case PCI_DEVICE_ID_VIA_82C686: | 635 | case PCI_DEVICE_ID_VIA_82C686: |
611 | /* | 636 | /* |
612 | * Asus k7m bios wrongly reports 82C686A | 637 | * Asus k7m bios wrongly reports 82C686A |
@@ -631,7 +656,7 @@ static __init int via_router_probe(struct irq_router *r, | |||
631 | } | 656 | } |
632 | } | 657 | } |
633 | 658 | ||
634 | switch(device) { | 659 | switch (device) { |
635 | case PCI_DEVICE_ID_VIA_82C586_0: | 660 | case PCI_DEVICE_ID_VIA_82C586_0: |
636 | r->name = "VIA"; | 661 | r->name = "VIA"; |
637 | r->get = pirq_via586_get; | 662 | r->get = pirq_via586_get; |
@@ -652,88 +677,89 @@ static __init int via_router_probe(struct irq_router *r, | |||
652 | return 0; | 677 | return 0; |
653 | } | 678 | } |
654 | 679 | ||
655 | static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 680 | static __init int |
681 | vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
656 | { | 682 | { |
657 | switch(device) | 683 | switch (device) { |
658 | { | 684 | case PCI_DEVICE_ID_VLSI_82C534: |
659 | case PCI_DEVICE_ID_VLSI_82C534: | 685 | r->name = "VLSI 82C534"; |
660 | r->name = "VLSI 82C534"; | 686 | r->get = pirq_vlsi_get; |
661 | r->get = pirq_vlsi_get; | 687 | r->set = pirq_vlsi_set; |
662 | r->set = pirq_vlsi_set; | 688 | return 1; |
663 | return 1; | ||
664 | } | 689 | } |
665 | return 0; | 690 | return 0; |
666 | } | 691 | } |
667 | 692 | ||
668 | 693 | ||
669 | static __init int serverworks_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 694 | static __init int serverworks_router_probe(struct irq_router *r, |
695 | struct pci_dev *router, u16 device) | ||
670 | { | 696 | { |
671 | switch(device) | 697 | switch (device) { |
672 | { | 698 | case PCI_DEVICE_ID_SERVERWORKS_OSB4: |
673 | case PCI_DEVICE_ID_SERVERWORKS_OSB4: | 699 | case PCI_DEVICE_ID_SERVERWORKS_CSB5: |
674 | case PCI_DEVICE_ID_SERVERWORKS_CSB5: | 700 | r->name = "ServerWorks"; |
675 | r->name = "ServerWorks"; | 701 | r->get = pirq_serverworks_get; |
676 | r->get = pirq_serverworks_get; | 702 | r->set = pirq_serverworks_set; |
677 | r->set = pirq_serverworks_set; | 703 | return 1; |
678 | return 1; | ||
679 | } | 704 | } |
680 | return 0; | 705 | return 0; |
681 | } | 706 | } |
682 | 707 | ||
683 | static __init int sis_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 708 | static __init int |
709 | sis_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
684 | { | 710 | { |
685 | if (device != PCI_DEVICE_ID_SI_503) | 711 | if (device != PCI_DEVICE_ID_SI_503) |
686 | return 0; | 712 | return 0; |
687 | 713 | ||
688 | r->name = "SIS"; | 714 | r->name = "SIS"; |
689 | r->get = pirq_sis_get; | 715 | r->get = pirq_sis_get; |
690 | r->set = pirq_sis_set; | 716 | r->set = pirq_sis_set; |
691 | return 1; | 717 | return 1; |
692 | } | 718 | } |
693 | 719 | ||
694 | static __init int cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 720 | static __init int |
721 | cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
695 | { | 722 | { |
696 | switch(device) | 723 | switch (device) { |
697 | { | 724 | case PCI_DEVICE_ID_CYRIX_5520: |
698 | case PCI_DEVICE_ID_CYRIX_5520: | 725 | r->name = "NatSemi"; |
699 | r->name = "NatSemi"; | 726 | r->get = pirq_cyrix_get; |
700 | r->get = pirq_cyrix_get; | 727 | r->set = pirq_cyrix_set; |
701 | r->set = pirq_cyrix_set; | 728 | return 1; |
702 | return 1; | ||
703 | } | 729 | } |
704 | return 0; | 730 | return 0; |
705 | } | 731 | } |
706 | 732 | ||
707 | static __init int opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 733 | static __init int |
734 | opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
708 | { | 735 | { |
709 | switch(device) | 736 | switch (device) { |
710 | { | 737 | case PCI_DEVICE_ID_OPTI_82C700: |
711 | case PCI_DEVICE_ID_OPTI_82C700: | 738 | r->name = "OPTI"; |
712 | r->name = "OPTI"; | 739 | r->get = pirq_opti_get; |
713 | r->get = pirq_opti_get; | 740 | r->set = pirq_opti_set; |
714 | r->set = pirq_opti_set; | 741 | return 1; |
715 | return 1; | ||
716 | } | 742 | } |
717 | return 0; | 743 | return 0; |
718 | } | 744 | } |
719 | 745 | ||
720 | static __init int ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 746 | static __init int |
747 | ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
721 | { | 748 | { |
722 | switch(device) | 749 | switch (device) { |
723 | { | 750 | case PCI_DEVICE_ID_ITE_IT8330G_0: |
724 | case PCI_DEVICE_ID_ITE_IT8330G_0: | 751 | r->name = "ITE"; |
725 | r->name = "ITE"; | 752 | r->get = pirq_ite_get; |
726 | r->get = pirq_ite_get; | 753 | r->set = pirq_ite_set; |
727 | r->set = pirq_ite_set; | 754 | return 1; |
728 | return 1; | ||
729 | } | 755 | } |
730 | return 0; | 756 | return 0; |
731 | } | 757 | } |
732 | 758 | ||
733 | static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 759 | static __init int |
760 | ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
734 | { | 761 | { |
735 | switch(device) | 762 | switch (device) { |
736 | { | ||
737 | case PCI_DEVICE_ID_AL_M1533: | 763 | case PCI_DEVICE_ID_AL_M1533: |
738 | case PCI_DEVICE_ID_AL_M1563: | 764 | case PCI_DEVICE_ID_AL_M1563: |
739 | printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n"); | 765 | 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 | return 0; | 771 | return 0; |
746 | } | 772 | } |
747 | 773 | ||
748 | static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 774 | static __init int |
775 | amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
749 | { | 776 | { |
750 | switch(device) | 777 | switch (device) { |
751 | { | 778 | case PCI_DEVICE_ID_AMD_VIPER_740B: |
752 | case PCI_DEVICE_ID_AMD_VIPER_740B: | 779 | r->name = "AMD756"; |
753 | r->name = "AMD756"; | 780 | break; |
754 | break; | 781 | case PCI_DEVICE_ID_AMD_VIPER_7413: |
755 | case PCI_DEVICE_ID_AMD_VIPER_7413: | 782 | r->name = "AMD766"; |
756 | r->name = "AMD766"; | 783 | break; |
757 | break; | 784 | case PCI_DEVICE_ID_AMD_VIPER_7443: |
758 | case PCI_DEVICE_ID_AMD_VIPER_7443: | 785 | r->name = "AMD768"; |
759 | r->name = "AMD768"; | 786 | break; |
760 | break; | 787 | default: |
761 | default: | 788 | return 0; |
762 | return 0; | ||
763 | } | 789 | } |
764 | r->get = pirq_amd756_get; | 790 | r->get = pirq_amd756_get; |
765 | r->set = pirq_amd756_set; | 791 | r->set = pirq_amd756_set; |
766 | return 1; | 792 | return 1; |
767 | } | 793 | } |
768 | 794 | ||
769 | static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 795 | static __init int |
796 | pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | ||
770 | { | 797 | { |
771 | switch (device) { | 798 | switch (device) { |
772 | case PCI_DEVICE_ID_PICOPOWER_PT86C523: | 799 | case PCI_DEVICE_ID_PICOPOWER_PT86C523: |
@@ -807,7 +834,7 @@ static struct pci_dev *pirq_router_dev; | |||
807 | * FIXME: should we have an option to say "generic for | 834 | * FIXME: should we have an option to say "generic for |
808 | * chipset" ? | 835 | * chipset" ? |
809 | */ | 836 | */ |
810 | 837 | ||
811 | static void __init pirq_find_router(struct irq_router *r) | 838 | static void __init pirq_find_router(struct irq_router *r) |
812 | { | 839 | { |
813 | struct irq_routing_table *rt = pirq_table; | 840 | struct irq_routing_table *rt = pirq_table; |
@@ -826,7 +853,7 @@ static void __init pirq_find_router(struct irq_router *r) | |||
826 | r->name = "default"; | 853 | r->name = "default"; |
827 | r->get = NULL; | 854 | r->get = NULL; |
828 | r->set = NULL; | 855 | r->set = NULL; |
829 | 856 | ||
830 | DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n", | 857 | DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n", |
831 | rt->rtr_vendor, rt->rtr_device); | 858 | rt->rtr_vendor, rt->rtr_device); |
832 | 859 | ||
@@ -837,12 +864,14 @@ static void __init pirq_find_router(struct irq_router *r) | |||
837 | return; | 864 | return; |
838 | } | 865 | } |
839 | 866 | ||
840 | for( h = pirq_routers; h->vendor; h++) { | 867 | for (h = pirq_routers; h->vendor; h++) { |
841 | /* First look for a router match */ | 868 | /* First look for a router match */ |
842 | if (rt->rtr_vendor == h->vendor && h->probe(r, pirq_router_dev, rt->rtr_device)) | 869 | if (rt->rtr_vendor == h->vendor && |
870 | h->probe(r, pirq_router_dev, rt->rtr_device)) | ||
843 | break; | 871 | break; |
844 | /* Fall back to a device match */ | 872 | /* Fall back to a device match */ |
845 | if (pirq_router_dev->vendor == h->vendor && h->probe(r, pirq_router_dev, pirq_router_dev->device)) | 873 | if (pirq_router_dev->vendor == h->vendor && |
874 | h->probe(r, pirq_router_dev, pirq_router_dev->device)) | ||
846 | break; | 875 | break; |
847 | } | 876 | } |
848 | printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n", | 877 | 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 | static struct irq_info *pirq_get_info(struct pci_dev *dev) | 886 | static struct irq_info *pirq_get_info(struct pci_dev *dev) |
858 | { | 887 | { |
859 | struct irq_routing_table *rt = pirq_table; | 888 | struct irq_routing_table *rt = pirq_table; |
860 | int entries = (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); | 889 | int entries = (rt->size - sizeof(struct irq_routing_table)) / |
890 | sizeof(struct irq_info); | ||
861 | struct irq_info *info; | 891 | struct irq_info *info; |
862 | 892 | ||
863 | for (info = rt->slots; entries--; info++) | 893 | for (info = rt->slots; entries--; info++) |
864 | if (info->bus == dev->bus->number && PCI_SLOT(info->devfn) == PCI_SLOT(dev->devfn)) | 894 | if (info->bus == dev->bus->number && |
895 | PCI_SLOT(info->devfn) == PCI_SLOT(dev->devfn)) | ||
865 | return info; | 896 | return info; |
866 | return NULL; | 897 | return NULL; |
867 | } | 898 | } |
@@ -889,7 +920,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
889 | 920 | ||
890 | if (!pirq_table) | 921 | if (!pirq_table) |
891 | return 0; | 922 | return 0; |
892 | 923 | ||
893 | DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin); | 924 | DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin); |
894 | info = pirq_get_info(dev); | 925 | info = pirq_get_info(dev); |
895 | if (!info) { | 926 | if (!info) { |
@@ -902,7 +933,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
902 | DBG(" -> not routed\n" KERN_DEBUG); | 933 | DBG(" -> not routed\n" KERN_DEBUG); |
903 | return 0; | 934 | return 0; |
904 | } | 935 | } |
905 | DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs); | 936 | DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, |
937 | pirq_table->exclusive_irqs); | ||
906 | mask &= pcibios_irq_mask; | 938 | mask &= pcibios_irq_mask; |
907 | 939 | ||
908 | /* Work around broken HP Pavilion Notebooks which assign USB to | 940 | /* 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 | } | 947 | } |
916 | 948 | ||
917 | /* same for Acer Travelmate 360, but with CB and irq 11 -> 10 */ | 949 | /* same for Acer Travelmate 360, but with CB and irq 11 -> 10 */ |
918 | if (acer_tm360_irqrouting && dev->irq == 11 && dev->vendor == PCI_VENDOR_ID_O2) { | 950 | if (acer_tm360_irqrouting && dev->irq == 11 && |
951 | dev->vendor == PCI_VENDOR_ID_O2) { | ||
919 | pirq = 0x68; | 952 | pirq = 0x68; |
920 | mask = 0x400; | 953 | mask = 0x400; |
921 | dev->irq = r->get(pirq_router_dev, dev, pirq); | 954 | 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 | */ | 961 | */ |
929 | newirq = dev->irq; | 962 | newirq = dev->irq; |
930 | if (newirq && !((1 << newirq) & mask)) { | 963 | if (newirq && !((1 << newirq) & mask)) { |
931 | if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0; | 964 | if (pci_probe & PCI_USE_PIRQ_MASK) |
932 | else printk("\n" KERN_WARNING | 965 | newirq = 0; |
933 | "PCI: IRQ %i for device %s doesn't match PIRQ mask " | 966 | else |
934 | "- try pci=usepirqmask\n" KERN_DEBUG, newirq, | 967 | printk("\n" KERN_WARNING |
935 | pci_name(dev)); | 968 | "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n" |
969 | KERN_DEBUG, newirq, | ||
970 | pci_name(dev)); | ||
936 | } | 971 | } |
937 | if (!newirq && assign) { | 972 | if (!newirq && assign) { |
938 | for (i = 0; i < 16; i++) { | 973 | for (i = 0; i < 16; i++) { |
939 | if (!(mask & (1 << i))) | 974 | if (!(mask & (1 << i))) |
940 | continue; | 975 | continue; |
941 | if (pirq_penalty[i] < pirq_penalty[newirq] && can_request_irq(i, IRQF_SHARED)) | 976 | if (pirq_penalty[i] < pirq_penalty[newirq] && |
977 | can_request_irq(i, IRQF_SHARED)) | ||
942 | newirq = i; | 978 | newirq = i; |
943 | } | 979 | } |
944 | } | 980 | } |
@@ -949,12 +985,13 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
949 | irq = pirq & 0xf; | 985 | irq = pirq & 0xf; |
950 | DBG(" -> hardcoded IRQ %d\n", irq); | 986 | DBG(" -> hardcoded IRQ %d\n", irq); |
951 | msg = "Hardcoded"; | 987 | msg = "Hardcoded"; |
952 | } else if ( r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ | 988 | } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ |
953 | ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) { | 989 | ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) { |
954 | DBG(" -> got IRQ %d\n", irq); | 990 | DBG(" -> got IRQ %d\n", irq); |
955 | msg = "Found"; | 991 | msg = "Found"; |
956 | eisa_set_level_irq(irq); | 992 | eisa_set_level_irq(irq); |
957 | } else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { | 993 | } else if (newirq && r->set && |
994 | (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { | ||
958 | DBG(" -> assigning IRQ %d", newirq); | 995 | DBG(" -> assigning IRQ %d", newirq); |
959 | if (r->set(pirq_router_dev, dev, pirq, newirq)) { | 996 | if (r->set(pirq_router_dev, dev, pirq, newirq)) { |
960 | eisa_set_level_irq(newirq); | 997 | eisa_set_level_irq(newirq); |
@@ -972,7 +1009,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
972 | } else | 1009 | } else |
973 | return 0; | 1010 | return 0; |
974 | } | 1011 | } |
975 | printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, pci_name(dev)); | 1012 | printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, |
1013 | pci_name(dev)); | ||
976 | 1014 | ||
977 | /* Update IRQ for all devices with the same pirq value */ | 1015 | /* Update IRQ for all devices with the same pirq value */ |
978 | while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { | 1016 | 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 | if (!info) | 1022 | if (!info) |
985 | continue; | 1023 | continue; |
986 | if (info->irq[pin].link == pirq) { | 1024 | if (info->irq[pin].link == pirq) { |
987 | /* We refuse to override the dev->irq information. Give a warning! */ | 1025 | /* |
988 | if ( dev2->irq && dev2->irq != irq && \ | 1026 | * We refuse to override the dev->irq |
1027 | * information. Give a warning! | ||
1028 | */ | ||
1029 | if (dev2->irq && dev2->irq != irq && \ | ||
989 | (!(pci_probe & PCI_USE_PIRQ_MASK) || \ | 1030 | (!(pci_probe & PCI_USE_PIRQ_MASK) || \ |
990 | ((1 << dev2->irq) & mask)) ) { | 1031 | ((1 << dev2->irq) & mask))) { |
991 | #ifndef CONFIG_PCI_MSI | 1032 | #ifndef CONFIG_PCI_MSI |
992 | printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", | 1033 | printk(KERN_INFO |
993 | pci_name(dev2), dev2->irq, irq); | 1034 | "IRQ routing conflict for %s, have irq %d, want irq %d\n", |
1035 | pci_name(dev2), dev2->irq, irq); | ||
994 | #endif | 1036 | #endif |
995 | continue; | 1037 | continue; |
996 | } | 1038 | } |
997 | dev2->irq = irq; | 1039 | dev2->irq = irq; |
998 | pirq_penalty[irq]++; | 1040 | pirq_penalty[irq]++; |
999 | if (dev != dev2) | 1041 | if (dev != dev2) |
1000 | printk(KERN_INFO "PCI: Sharing IRQ %d with %s\n", irq, pci_name(dev2)); | 1042 | printk(KERN_INFO |
1043 | "PCI: Sharing IRQ %d with %s\n", | ||
1044 | irq, pci_name(dev2)); | ||
1001 | } | 1045 | } |
1002 | } | 1046 | } |
1003 | return 1; | 1047 | return 1; |
@@ -1011,15 +1055,21 @@ static void __init pcibios_fixup_irqs(void) | |||
1011 | DBG(KERN_DEBUG "PCI: IRQ fixup\n"); | 1055 | DBG(KERN_DEBUG "PCI: IRQ fixup\n"); |
1012 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 1056 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
1013 | /* | 1057 | /* |
1014 | * If the BIOS has set an out of range IRQ number, just ignore it. | 1058 | * If the BIOS has set an out of range IRQ number, just |
1015 | * Also keep track of which IRQ's are already in use. | 1059 | * ignore it. Also keep track of which IRQ's are |
1060 | * already in use. | ||
1016 | */ | 1061 | */ |
1017 | if (dev->irq >= 16) { | 1062 | if (dev->irq >= 16) { |
1018 | DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq); | 1063 | DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", |
1064 | pci_name(dev), dev->irq); | ||
1019 | dev->irq = 0; | 1065 | dev->irq = 0; |
1020 | } | 1066 | } |
1021 | /* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */ | 1067 | /* |
1022 | if (pirq_penalty[dev->irq] >= 100 && pirq_penalty[dev->irq] < 100000) | 1068 | * If the IRQ is already assigned to a PCI device, |
1069 | * ignore its ISA use penalty | ||
1070 | */ | ||
1071 | if (pirq_penalty[dev->irq] >= 100 && | ||
1072 | pirq_penalty[dev->irq] < 100000) | ||
1023 | pirq_penalty[dev->irq] = 0; | 1073 | pirq_penalty[dev->irq] = 0; |
1024 | pirq_penalty[dev->irq]++; | 1074 | pirq_penalty[dev->irq]++; |
1025 | } | 1075 | } |
@@ -1031,31 +1081,40 @@ static void __init pcibios_fixup_irqs(void) | |||
1031 | /* | 1081 | /* |
1032 | * Recalculate IRQ numbers if we use the I/O APIC. | 1082 | * Recalculate IRQ numbers if we use the I/O APIC. |
1033 | */ | 1083 | */ |
1034 | if (io_apic_assign_pci_irqs) | 1084 | if (io_apic_assign_pci_irqs) { |
1035 | { | ||
1036 | int irq; | 1085 | int irq; |
1037 | 1086 | ||
1038 | if (pin) { | 1087 | if (pin) { |
1039 | pin--; /* interrupt pins are numbered starting from 1 */ | 1088 | /* |
1040 | irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin); | 1089 | * interrupt pins are numbered starting |
1090 | * from 1 | ||
1091 | */ | ||
1092 | pin--; | ||
1093 | irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, | ||
1094 | PCI_SLOT(dev->devfn), pin); | ||
1041 | /* | 1095 | /* |
1042 | * Busses behind bridges are typically not listed in the MP-table. | 1096 | * Busses behind bridges are typically not listed in the MP-table. |
1043 | * In this case we have to look up the IRQ based on the parent bus, | 1097 | * In this case we have to look up the IRQ based on the parent bus, |
1044 | * parent slot, and pin number. The SMP code detects such bridged | 1098 | * parent slot, and pin number. The SMP code detects such bridged |
1045 | * busses itself so we should get into this branch reliably. | 1099 | * busses itself so we should get into this branch reliably. |
1046 | */ | 1100 | */ |
1047 | if (irq < 0 && dev->bus->parent) { /* go back to the bridge */ | 1101 | if (irq < 0 && dev->bus->parent) { |
1048 | struct pci_dev * bridge = dev->bus->self; | 1102 | /* go back to the bridge */ |
1103 | struct pci_dev *bridge = dev->bus->self; | ||
1049 | 1104 | ||
1050 | pin = (pin + PCI_SLOT(dev->devfn)) % 4; | 1105 | pin = (pin + PCI_SLOT(dev->devfn)) % 4; |
1051 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, | 1106 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, |
1052 | PCI_SLOT(bridge->devfn), pin); | 1107 | PCI_SLOT(bridge->devfn), |
1108 | pin); | ||
1053 | if (irq >= 0) | 1109 | if (irq >= 0) |
1054 | printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", | 1110 | printk(KERN_WARNING |
1055 | pci_name(bridge), 'A' + pin, irq); | 1111 | "PCI: using PPB %s[%c] to get irq %d\n", |
1112 | pci_name(bridge), | ||
1113 | 'A' + pin, irq); | ||
1056 | } | 1114 | } |
1057 | if (irq >= 0) { | 1115 | if (irq >= 0) { |
1058 | printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", | 1116 | printk(KERN_INFO |
1117 | "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", | ||
1059 | pci_name(dev), 'A' + pin, irq); | 1118 | pci_name(dev), 'A' + pin, irq); |
1060 | dev->irq = irq; | 1119 | dev->irq = irq; |
1061 | } | 1120 | } |
@@ -1078,7 +1137,8 @@ static int __init fix_broken_hp_bios_irq9(const struct dmi_system_id *d) | |||
1078 | { | 1137 | { |
1079 | if (!broken_hp_bios_irq9) { | 1138 | if (!broken_hp_bios_irq9) { |
1080 | broken_hp_bios_irq9 = 1; | 1139 | broken_hp_bios_irq9 = 1; |
1081 | printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident); | 1140 | printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", |
1141 | d->ident); | ||
1082 | } | 1142 | } |
1083 | return 0; | 1143 | return 0; |
1084 | } | 1144 | } |
@@ -1091,7 +1151,8 @@ static int __init fix_acer_tm360_irqrouting(const struct dmi_system_id *d) | |||
1091 | { | 1151 | { |
1092 | if (!acer_tm360_irqrouting) { | 1152 | if (!acer_tm360_irqrouting) { |
1093 | acer_tm360_irqrouting = 1; | 1153 | acer_tm360_irqrouting = 1; |
1094 | printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident); | 1154 | printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", |
1155 | d->ident); | ||
1095 | } | 1156 | } |
1096 | return 0; | 1157 | return 0; |
1097 | } | 1158 | } |
@@ -1103,7 +1164,8 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = { | |||
1103 | .matches = { | 1164 | .matches = { |
1104 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | 1165 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
1105 | DMI_MATCH(DMI_BIOS_VERSION, "GE.M1.03"), | 1166 | DMI_MATCH(DMI_BIOS_VERSION, "GE.M1.03"), |
1106 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook Model GE"), | 1167 | DMI_MATCH(DMI_PRODUCT_VERSION, |
1168 | "HP Pavilion Notebook Model GE"), | ||
1107 | DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), | 1169 | DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), |
1108 | }, | 1170 | }, |
1109 | }, | 1171 | }, |
@@ -1138,11 +1200,14 @@ static int __init pcibios_irq_init(void) | |||
1138 | pirq_find_router(&pirq_router); | 1200 | pirq_find_router(&pirq_router); |
1139 | if (pirq_table->exclusive_irqs) { | 1201 | if (pirq_table->exclusive_irqs) { |
1140 | int i; | 1202 | int i; |
1141 | for (i=0; i<16; i++) | 1203 | for (i = 0; i < 16; i++) |
1142 | if (!(pirq_table->exclusive_irqs & (1 << i))) | 1204 | if (!(pirq_table->exclusive_irqs & (1 << i))) |
1143 | pirq_penalty[i] += 100; | 1205 | pirq_penalty[i] += 100; |
1144 | } | 1206 | } |
1145 | /* If we're using the I/O APIC, avoid using the PCI IRQ routing table */ | 1207 | /* |
1208 | * If we're using the I/O APIC, avoid using the PCI IRQ | ||
1209 | * routing table | ||
1210 | */ | ||
1146 | if (io_apic_assign_pci_irqs) | 1211 | if (io_apic_assign_pci_irqs) |
1147 | pirq_table = NULL; | 1212 | pirq_table = NULL; |
1148 | } | 1213 | } |
@@ -1189,33 +1254,40 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1189 | if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) { | 1254 | if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) { |
1190 | char *msg = ""; | 1255 | char *msg = ""; |
1191 | 1256 | ||
1192 | pin--; /* interrupt pins are numbered starting from 1 */ | 1257 | pin--; /* interrupt pins are numbered starting from 1 */ |
1193 | 1258 | ||
1194 | if (io_apic_assign_pci_irqs) { | 1259 | if (io_apic_assign_pci_irqs) { |
1195 | int irq; | 1260 | int irq; |
1196 | 1261 | ||
1197 | irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin); | 1262 | irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, |
1263 | PCI_SLOT(dev->devfn), pin); | ||
1198 | /* | 1264 | /* |
1199 | * Busses behind bridges are typically not listed in the MP-table. | 1265 | * Busses behind bridges are typically not |
1200 | * In this case we have to look up the IRQ based on the parent bus, | 1266 | * listed in the MP-table. In this case we have |
1201 | * parent slot, and pin number. The SMP code detects such bridged | 1267 | * to look up the IRQ based on the parent bus, |
1202 | * busses itself so we should get into this branch reliably. | 1268 | * parent slot, and pin number. The SMP code |
1269 | * detects such bridged busses itself so we | ||
1270 | * should get into this branch reliably. | ||
1203 | */ | 1271 | */ |
1204 | temp_dev = dev; | 1272 | temp_dev = dev; |
1205 | while (irq < 0 && dev->bus->parent) { /* go back to the bridge */ | 1273 | while (irq < 0 && dev->bus->parent) { |
1206 | struct pci_dev * bridge = dev->bus->self; | 1274 | /* go back to the bridge */ |
1275 | struct pci_dev *bridge = dev->bus->self; | ||
1207 | 1276 | ||
1208 | pin = (pin + PCI_SLOT(dev->devfn)) % 4; | 1277 | pin = (pin + PCI_SLOT(dev->devfn)) % 4; |
1209 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, | 1278 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, |
1210 | PCI_SLOT(bridge->devfn), pin); | 1279 | PCI_SLOT(bridge->devfn), pin); |
1211 | if (irq >= 0) | 1280 | if (irq >= 0) |
1212 | printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", | 1281 | printk(KERN_WARNING |
1213 | pci_name(bridge), 'A' + pin, irq); | 1282 | "PCI: using PPB %s[%c] to get irq %d\n", |
1283 | pci_name(bridge), | ||
1284 | 'A' + pin, irq); | ||
1214 | dev = bridge; | 1285 | dev = bridge; |
1215 | } | 1286 | } |
1216 | dev = temp_dev; | 1287 | dev = temp_dev; |
1217 | if (irq >= 0) { | 1288 | if (irq >= 0) { |
1218 | printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", | 1289 | printk(KERN_INFO |
1290 | "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", | ||
1219 | pci_name(dev), 'A' + pin, irq); | 1291 | pci_name(dev), 'A' + pin, irq); |
1220 | dev->irq = irq; | 1292 | dev->irq = irq; |
1221 | return 0; | 1293 | return 0; |
@@ -1226,12 +1298,17 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1226 | else | 1298 | else |
1227 | msg = " Please try using pci=biosirq."; | 1299 | msg = " Please try using pci=biosirq."; |
1228 | 1300 | ||
1229 | /* With IDE legacy devices the IRQ lookup failure is not a problem.. */ | 1301 | /* |
1230 | if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 0x5)) | 1302 | * With IDE legacy devices the IRQ lookup failure is not |
1303 | * a problem.. | ||
1304 | */ | ||
1305 | if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && | ||
1306 | !(dev->class & 0x5)) | ||
1231 | return 0; | 1307 | return 0; |
1232 | 1308 | ||
1233 | printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s.%s\n", | 1309 | printk(KERN_WARNING |
1234 | 'A' + pin, pci_name(dev), msg); | 1310 | "PCI: No IRQ known for interrupt pin %c of device %s.%s\n", |
1311 | 'A' + pin, pci_name(dev), msg); | ||
1235 | } | 1312 | } |
1236 | return 0; | 1313 | return 0; |
1237 | } | 1314 | } |