2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
5 * ########################################################################
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 * ########################################################################
22 * Interrupt exception dispatch code.
25 #include <linux/autoconf.h>
28 #include <asm/mipsregs.h>
29 #include <asm/regdef.h>
30 #include <asm/stackframe.h>
32 #define STATUS_IE 0x00000001
34 /* A lot of complication here is taken away because:
36 * 1) We handle one interrupt and return, sitting in a loop and moving across
37 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
38 * common case is one pending IRQ so optimize in that direction.
40 * 2) We need not check against bits in the status register IRQ mask, that
41 * would make this routine slow as hell.
43 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
44 * between like BSD spl() brain-damage.
46 * Furthermore, the IRQs on the MIPS board look basically (barring software
47 * IRQs which we don't use at all and all external interrupt sources are
48 * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
52 * 0 Software (ignored)
53 * 1 Software (ignored)
54 * 2 Combined hardware interrupt (hw0)
55 * 3 Hardware (ignored)
56 * 4 Hardware (ignored)
57 * 5 Hardware (ignored)
58 * 6 Hardware (ignored)
59 * 7 R4k timer (what we use)
61 * Note: On the SEAD board thing are a little bit different.
62 * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
65 * We handle the IRQ according to _our_ priority which is:
67 * Highest ---- R4k Timer
68 * Lowest ---- Combined hardware interrupt
70 * then we just return, if multiple IRQs are pending then we will just take
71 * another exception, big deal.
79 NESTED(mipsIRQ, PT_SIZE, sp)
88 /* First we check for r4k counter/timer IRQ. */
89 andi a0, s0, CAUSEF_IP7
94 jal mips_timer_interrupt
101 andi a0, s0, CAUSEF_IP2
106 jal adm5120_hw0_irqdispatch
122 and v0, v0, STATUS_IE
127 LEAF(mips_int_unlock)
129 and a0, a0, STATUS_IE