]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/mips/tx4927/common/tx4927_irq_handler.S
[MIPS] Fix the crime against humanity that mipsIRQ.S is.
[linux-2.6-omap-h63xx.git] / arch / mips / tx4927 / common / tx4927_irq_handler.S
1 /*
2  * linux/arch/mips/tx4927/common/tx4927_irq_handler.S
3  *
4  * Primary interrupt handler for tx4927 based systems
5  *
6  * Author: MontaVista Software, Inc.
7  * Author: jsun@mvista.com or jsun@junsun.net
8  *         source@mvista.com
9  *
10  * Copyright 2001-2002 MontaVista Software Inc.
11  *
12  *  This program is free software; you can redistribute it and/or modify it
13  *  under the terms of the GNU General Public License as published by the
14  *  Free Software Foundation; either version 2 of the License, or (at your
15  *  option) any later version.
16  *
17  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  *  You should have received a copy of the GNU General Public License along
29  *  with this program; if not, write to the Free Software Foundation, Inc.,
30  *  675 Mass Ave, Cambridge, MA 02139, USA.
31  */
32 #include <asm/asm.h>
33 #include <asm/mipsregs.h>
34 #include <asm/addrspace.h>
35 #include <asm/regdef.h>
36 #include <asm/stackframe.h>
37 #include <asm/tx4927/tx4927.h>
38
39                 .align  5
40                 NESTED(tx4927_irq_handler, PT_SIZE, sp)
41                 SAVE_ALL
42                 CLI
43                 .set    at
44
45                 mfc0    t0, CP0_CAUSE
46                 mfc0    t1, CP0_STATUS
47                 and     t0, t1
48
49                 andi    t1, t0, STATUSF_IP7     /* cpu timer */
50                 bnez    t1, ll_ip7
51
52                 /* IP6..IP3 multiplexed -- do not use */
53
54                 andi    t1, t0, STATUSF_IP2     /* tx4927 pic */
55                 bnez    t1, ll_ip2
56
57                 andi    t1, t0, STATUSF_IP0     /* user line 0 */
58                 bnez    t1, ll_ip0
59
60                 andi    t1, t0, STATUSF_IP1     /* user line 1 */
61                 bnez    t1, ll_ip1
62
63                 .set    reorder
64
65                 /* wrong alarm or masked ... */
66                 jal     spurious_interrupt
67                 nop
68                 j       ret_from_irq
69                 END(tx4927_irq_handler)
70
71                 .align  5
72
73
74 ll_ip7:
75                 li      a0, TX4927_IRQ_CPU_TIMER
76                 move    a1, sp
77                 jal     do_IRQ
78                 j       ret_from_irq
79
80 ll_ip2:
81                 jal     tx4927_irq_nested
82                 nop
83                 beqz    v0, goto_spurious_interrupt
84                 nop
85                 move    a0, v0
86                 move    a1, sp
87                 jal     do_IRQ
88                 j       ret_from_irq
89
90 goto_spurious_interrupt:
91         j spurious_interrupt
92         nop
93
94 ll_ip1:
95                 li      a0, TX4927_IRQ_USER1
96                 move    a1, sp
97                 jal     do_IRQ
98                 j       ret_from_irq
99
100 ll_ip0:
101                 li      a0, TX4927_IRQ_USER0
102                 move    a1, sp
103                 jal     do_IRQ
104                 j       ret_from_irq