more changes on original files
[linux-2.4.git] / arch / mips / momentum / jaguar_atx / int-handler.S
1 /*
2  * Copyright 2002 Momentum Computer Inc.
3  * Author: Matthew Dharm <mdharm@momenco.com>
4  *
5  * Based on work:
6  *   Copyright 2001 MontaVista Software Inc.
7  *   Author: jsun@mvista.com or jsun@junsun.net
8  *
9  * First-level interrupt dispatcher for Jaguar-ATX board.
10  *
11  * This program is free software; you can redistribute  it and/or modify it
12  * under  the terms of  the GNU General  Public License as published by the
13  * Free Software Foundation;  either version 2 of the  License, or (at your
14  * option) any later version.
15  */
16 #include <linux/config.h>
17 #include <asm/asm.h>
18 #include <asm/mipsregs.h>
19 #include <asm/addrspace.h>
20 #include <asm/regdef.h>
21 #include <asm/stackframe.h>
22 #include "jaguar_atx_fpga.h"
23
24 /*
25  * First level interrupt dispatcher for Ocelot-CS board
26  */
27                 .align  5
28                 NESTED(jaguar_handle_int, PT_SIZE, sp)
29                 SAVE_ALL
30                 CLI
31                 .set    at
32                 mfc0    t0, CP0_CAUSE  
33                 mfc0    t2, CP0_STATUS
34
35                 and     t0, t2
36         
37                 andi    t1, t0, STATUSF_IP0     /* sw0 software interrupt */
38                 bnez    t1, ll_sw0_irq
39                 andi    t1, t0, STATUSF_IP1     /* sw1 software interrupt */
40                 bnez    t1, ll_sw1_irq
41                 andi    t1, t0, STATUSF_IP2     /* int0 hardware line */
42                 bnez    t1, ll_pcixa_irq
43                 andi    t1, t0, STATUSF_IP3     /* int1 hardware line */
44                 bnez    t1, ll_pcixb_irq
45                 andi    t1, t0, STATUSF_IP4     /* int2 hardware line */
46                 bnez    t1, ll_pcia_irq
47                 andi    t1, t0, STATUSF_IP5     /* int3 hardware line */
48                 bnez    t1, ll_pcib_irq
49                 andi    t1, t0, STATUSF_IP6     /* int4 hardware line */
50                 bnez    t1, ll_uart_irq
51                 andi    t1, t0, STATUSF_IP7     /* cpu timer */
52                 bnez    t1, ll_cputimer_irq
53
54                 nop
55                 nop
56
57                 /* now look at extended interrupts */
58                 mfc0    t0, CP0_CAUSE
59                 cfc0    t1, CP0_S1_INTCONTROL
60
61                 /* shift the mask 8 bits left to line up the bits */
62                 sll     t2, t1, 8
63
64                 and     t0, t2
65                 srl     t0, t0, 16
66
67                 andi    t1, t0, STATUSF_IP8     /* int6 hardware line */
68                 bnez    t1, ll_mv64340_decode_irq
69
70                 nop
71                 nop
72
73                 .set    reorder
74
75                 /* wrong alarm or masked ... */
76                 j       spurious_interrupt
77                 nop
78                 END(jaguar_handle_int)
79
80                 .align  5
81 ll_sw0_irq:
82                 li      a0, 1
83                 move    a1, sp
84                 jal     do_IRQ
85                 j       ret_from_irq
86 ll_sw1_irq:
87                 li      a0, 2
88                 move    a1, sp
89                 jal     do_IRQ
90                 j       ret_from_irq
91 ll_pcixa_irq:
92                 li      a0, 3
93                 move    a1, sp
94                 jal     do_IRQ
95                 j       ret_from_irq
96
97 ll_pcixb_irq:
98                 li      a0, 4
99                 move    a1, sp
100                 jal     do_IRQ
101                 j       ret_from_irq
102
103 ll_pcia_irq:
104                 li      a0, 5
105                 move    a1, sp
106                 jal     do_IRQ
107                 j       ret_from_irq
108         
109 ll_pcib_irq:
110                 li      a0, 6
111                 move    a1, sp
112                 jal     do_IRQ
113                 j       ret_from_irq
114         
115 ll_uart_irq:
116                 li      a0, 7
117                 move    a1, sp
118                 jal     do_IRQ
119                 j       ret_from_irq
120         
121 ll_cputimer_irq:
122                 li      a0, 8
123                 move    a1, sp
124                 jal     do_IRQ
125                 j       ret_from_irq
126         
127 ll_mv64340_decode_irq:
128                 move    a0, sp
129                 jal     ll_mv64340_irq
130                 j       ret_from_irq
131