Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[sfrench/cifs-2.6.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                 j       spurious_interrupt
67                 nop
68                 END(tx4927_irq_handler)
69
70                 .align  5
71
72
73 ll_ip7:
74                 li      a0, TX4927_IRQ_CPU_TIMER
75                 move    a1, sp
76                 jal     do_IRQ
77                 j       ret_from_irq
78
79 ll_ip2:
80                 jal     tx4927_irq_nested
81                 nop
82                 beqz    v0, goto_spurious_interrupt
83                 nop
84                 move    a0, v0
85                 move    a1, sp
86                 jal     do_IRQ
87                 j       ret_from_irq
88
89 goto_spurious_interrupt:
90         j spurious_interrupt
91         nop
92
93 ll_ip1:
94                 li      a0, TX4927_IRQ_USER1
95                 move    a1, sp
96                 jal     do_IRQ
97                 j       ret_from_irq
98
99 ll_ip0:
100                 li      a0, TX4927_IRQ_USER0
101                 move    a1, sp
102                 jal     do_IRQ
103                 j       ret_from_irq