2 * arch/mips/ddb5074/int-handler.S -- NEC DDB Vrc-5074 interrupt handler
4 * Based on arch/mips/sgi/kernel/indyIRQ.S
6 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
8 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
9 * Sony Software Development Center Europe (SDCE), Brussels
12 #include <asm/mipsregs.h>
13 #include <asm/regdef.h>
14 #include <asm/stackframe.h>
16 /* A lot of complication here is taken away because:
18 * 1) We handle one interrupt and return, sitting in a loop and moving across
19 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
20 * common case is one pending IRQ so optimize in that direction.
22 * 2) We need not check against bits in the status register IRQ mask, that
23 * would make this routine slow as hell.
25 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
26 * between like BSD spl() brain-damage.
28 * Furthermore, the IRQs on the INDY look basically (barring software IRQs
29 * which we don't use at all) like:
33 * 0 Software (ignored)
34 * 1 Software (ignored)
35 * 2 Local IRQ level zero
36 * 3 Local IRQ level one
40 * 7 R4k timer (what we use)
42 * We handle the IRQ according to _our_ priority which is:
44 * Highest ---- R4k Timer
49 * Lowest ---- 8254 Timer one
51 * then we just return, if multiple IRQs are pending then we will just take
52 * another exception, big deal.
59 NESTED(ddbIRQ, PT_SIZE, sp)
63 mfc0 s0, CP0_CAUSE # get irq mask
66 mfc0 t2,CP0_STATUS # get enabled interrupts
67 and s0,t2 # isolate allowed ones
69 /* First we check for r4k counter/timer IRQ. */
70 andi a0, s0, CAUSEF_IP2 # delay slot, check local level zero
72 andi a0, s0, CAUSEF_IP3 # delay slot, check local level one
74 /* Wheee, local level zero interrupt. */
75 jal ddb_local0_irqdispatch
76 move a0, sp # delay slot
83 andi a0, s0, CAUSEF_IP6 # delay slot, check bus error
85 /* Wheee, local level one interrupt. */
87 jal ddb_local1_irqdispatch
97 /* Wheee, an asynchronous bus error... */
106 /* Here by mistake? This is possible, what can happen
107 * is that by the time we take the exception the IRQ
108 * pin goes low, so just leave if this is the case.
110 andi a0, s0, (CAUSEF_IP4 | CAUSEF_IP5)
113 /* Must be one of the 8254 timers... */
115 jal ddb_8254timer_irq