diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:00 -0500 |
commit | 7d409d6057c7244f8757ce15245f6df27271be0c (patch) | |
tree | a0eda73330dce6ee77f210c12deb3784b398f1f1 | |
parent | 9f8daccaa05c14e5643bdd4faf5aed9cc8e6f11e (diff) |
x86: add some pirq debugging
we use a few static mapping rules in our pirq routing functions,
and for example regression f3ac84324fd94 was due to the pirq
being out of range of the remapping array. Put in a few
WARN_ON_ONCE() lines so that we get notified about any such
out-of-bound incidents.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/pci/irq.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index 88d8f5c0ecb5..ee524ca5f8c0 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -200,6 +200,7 @@ static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
200 | { | 200 | { |
201 | static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; | 201 | static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; |
202 | 202 | ||
203 | WARN_ON_ONCE(pirq >= 16); | ||
203 | return irqmap[read_config_nybble(router, 0x48, pirq-1)]; | 204 | return irqmap[read_config_nybble(router, 0x48, pirq-1)]; |
204 | } | 205 | } |
205 | 206 | ||
@@ -207,7 +208,8 @@ static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i | |||
207 | { | 208 | { |
208 | static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; | 209 | static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; |
209 | unsigned int val = irqmap[irq]; | 210 | unsigned int val = irqmap[irq]; |
210 | 211 | ||
212 | WARN_ON_ONCE(pirq >= 16); | ||
211 | if (val) { | 213 | if (val) { |
212 | write_config_nybble(router, 0x48, pirq-1, val); | 214 | write_config_nybble(router, 0x48, pirq-1, val); |
213 | return 1; | 215 | return 1; |
@@ -257,12 +259,16 @@ static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i | |||
257 | static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 259 | static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq) |
258 | { | 260 | { |
259 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; | 261 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; |
262 | |||
263 | WARN_ON_ONCE(pirq >= 5); | ||
260 | return read_config_nybble(router, 0x55, pirqmap[pirq-1]); | 264 | return read_config_nybble(router, 0x55, pirqmap[pirq-1]); |
261 | } | 265 | } |
262 | 266 | ||
263 | static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 267 | static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) |
264 | { | 268 | { |
265 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; | 269 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; |
270 | |||
271 | WARN_ON_ONCE(pirq >= 5); | ||
266 | write_config_nybble(router, 0x55, pirqmap[pirq-1], irq); | 272 | write_config_nybble(router, 0x55, pirqmap[pirq-1], irq); |
267 | return 1; | 273 | return 1; |
268 | } | 274 | } |
@@ -275,12 +281,16 @@ static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq | |||
275 | static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 281 | static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) |
276 | { | 282 | { |
277 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; | 283 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; |
284 | |||
285 | WARN_ON_ONCE(pirq >= 4); | ||
278 | return read_config_nybble(router,0x43, pirqmap[pirq-1]); | 286 | return read_config_nybble(router,0x43, pirqmap[pirq-1]); |
279 | } | 287 | } |
280 | 288 | ||
281 | static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 289 | static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) |
282 | { | 290 | { |
283 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; | 291 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; |
292 | |||
293 | WARN_ON_ONCE(pirq >= 4); | ||
284 | write_config_nybble(router, 0x43, pirqmap[pirq-1], irq); | 294 | write_config_nybble(router, 0x43, pirqmap[pirq-1], irq); |
285 | return 1; | 295 | return 1; |
286 | } | 296 | } |
@@ -419,6 +429,7 @@ static int pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i | |||
419 | 429 | ||
420 | static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | 430 | static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) |
421 | { | 431 | { |
432 | WARN_ON_ONCE(pirq >= 9); | ||
422 | if (pirq > 8) { | 433 | if (pirq > 8) { |
423 | printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); | 434 | printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); |
424 | return 0; | 435 | return 0; |
@@ -428,6 +439,7 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
428 | 439 | ||
429 | static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 440 | static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) |
430 | { | 441 | { |
442 | WARN_ON_ONCE(pirq >= 9); | ||
431 | if (pirq > 8) { | 443 | if (pirq > 8) { |
432 | printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); | 444 | printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); |
433 | return 0; | 445 | return 0; |