From baf4326e49801526e4516e4de7f37b5e51468c49 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Thu, 12 Oct 2006 12:03:04 +0900 Subject: sh: interrupt exception handling rework Kill off interrupt_table for all of the CPU subtypes, we now default in to stepping in to do_IRQ() for _all_ IRQ exceptions and counting the spurious ones, rather than simply flipping on the ones we cared about. This and enabling the IRQ by default automatically has already uncovered a couple of bugs and IRQs that weren't being caught, as well as some that are being generated far too often (SCI Tx Data Empty, for example). The general rationale is to use a marker for interrupt exceptions, test for it in the handle_exception() path, and skip out to do_IRQ() if it's found. Everything else follows the same behaviour of finding the cached EXPEVT value in r2/r2_bank, we just rip out the INTEVT read from entry.S entirely (except for in the kGDB NMI case, which is another matter). Note that while this changes the do_IRQ() semantics regarding r4 handling, they were fundamentally broken anyways (relying entirely on r2_bank for the cached code). With this, we do the INTEVT read from do_IRQ() itself (in the CONFIG_CPU_HAS_INTEVT case), or fall back on r4 for the muxed IRQ number, which should also be closer to what SH-2 and SH-2A want anyways. Signed-off-by: Paul Mundt --- arch/sh/kernel/irq.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'arch/sh/kernel/irq.c') diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c index 3b93682bf18..acf2602569c 100644 --- a/arch/sh/kernel/irq.c +++ b/arch/sh/kernel/irq.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ atomic_t irq_err_count; */ void ack_bad_irq(unsigned int irq) { + atomic_inc(&irq_err_count); printk("unexpected IRQ trap at vector %02x\n", irq); } @@ -85,7 +87,7 @@ asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, struct pt_regs regs) { struct pt_regs *old_regs = set_irq_regs(®s); - int irq = r4; + int irq; #ifdef CONFIG_4KSTACKS union irq_ctx *curctx, *irqctx; #endif @@ -109,20 +111,9 @@ asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, #endif #ifdef CONFIG_CPU_HAS_INTEVT - __asm__ __volatile__ ( -#ifdef CONFIG_CPU_HAS_SR_RB - "stc r2_bank, %0\n\t" + irq = (ctrl_inl(INTEVT) >> 5) - 16; #else - "mov.l @%1, %0\n\t" -#endif - "shlr2 %0\n\t" - "shlr2 %0\n\t" - "shlr %0\n\t" - "add #-16, %0\n\t" - : "=z" (irq), "=r" (r4) - : "1" (INTEVT) - : "memory" - ); + irq = r4; #endif irq = irq_demux(irq); @@ -147,9 +138,9 @@ asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, __asm__ __volatile__ ( "mov %0, r4 \n" "mov r15, r9 \n" - "jsr @%2 \n" + "jsr @%1 \n" /* swith to the irq stack */ - " mov %3, r15 \n" + " mov %2, r15 \n" /* restore the stack (ring zero) */ "mov r9, r15 \n" : /* no outputs */ -- cgit v1.2.3-70-g09d2