If a machine uses i8259 as part of its interrupt routing subsystem, it typically has two ways to figure out which i8259 interrupt has happened. 1) through PCI interrupt ack cycle to directly read the IRQ number 2) read i8259 interrupt status registers and figure which one has happened. This patch adds support for those sorry boards which only have option 2) available. While I am here, I also promoted do_IRQ() declaration to a header file, as it is needed by all C-level interrupt dispatching code. Any feedbacks? Jun
--- ./arch/mips64/kernel/i8259.c.orig Mon Aug 5 16:53:33 2002 +++ ./arch/mips64/kernel/i8259.c Fri Dec 13 14:54:09 2002 @@ -14,6 +14,7 @@ #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/spinlock.h> +#include <linux/bitops.h> #include <asm/io.h> @@ -219,6 +220,26 @@ } } +asmlinkage void dispatch_i8259_irq(struct pt_regs *regs) +{ + int isr, irq=-1; + + isr = ~(int)inb(0x20) | cached_21; + if (isr != -1) + irq = ffz (isr); + if (irq == 2) { + isr = ~(int)inb(0xa0) | cached_A1; + if (isr != -1) + irq = 8 + ffz(isr); + } + if (irq == -1) { + printk("We got a spurious i8259 interrupt\n"); + atomic_inc(&irq_err_count); + } else { + do_IRQ(irq,regs); + } +} + void __init init_8259A(int auto_eoi) { unsigned long flags; diff -Nru ./include/asm-mips64/irq.h.orig ./include/asm-mips/irq.h --- ./include/asm-mips64/irq.h.orig Fri Dec 13 10:51:25 2002 +++ ./include/asm-mips64/irq.h Fri Dec 13 14:50:46 2002 @@ -12,6 +12,7 @@ #define _ASM_IRQ_H #include <linux/config.h> +#include <linux/linkage.h> #define NR_IRQS 128 /* Largest number of ints of all machines. */ @@ -36,4 +37,6 @@ extern void init_generic_irq(void); +extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs); + #endif /* _ASM_IRQ_H */