1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #include <asm/addrspace.h>
17 #include <asm/asm.h>
18 #include <asm/mipsregs.h>
19 #include <asm/regdef.h>
20 #include <asm/stackframe.h>
21
22 #include <asm/dec/interrupts.h>
23 #include <asm/dec/ioasic_addrs.h>
24 #include <asm/dec/ioasic_ints.h>
25 #include <asm/dec/kn01.h>
26 #include <asm/dec/kn02.h>
27 #include <asm/dec/kn02xa.h>
28 #include <asm/dec/kn03.h>
29
30 #define KN02_CSR_BASE CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR)
31 #define KN02XA_IOASIC_BASE CKSEG1ADDR(KN02XA_SLOT_BASE + IOASIC_IOCTL)
32 #define KN03_IOASIC_BASE CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_IOCTL)
33
34 .text
35 .set noreorder
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 .align 5
126 NESTED(plat_irq_dispatch, PT_SIZE, ra)
127 .set noreorder
128
129
130
131
132 mfc0 t0,CP0_CAUSE # get pending interrupts
133 mfc0 t1,CP0_STATUS
134 #ifdef CONFIG_32BIT
135 lw t2,cpu_fpu_mask
136 #endif
137 andi t0,ST0_IM # CAUSE.CE may be non-zero!
138 and t0,t1 # isolate allowed ones
139
140 beqz t0,spurious
141
142 #ifdef CONFIG_32BIT
143 and t2,t0
144 bnez t2,fpu # handle FPU immediately
145 #endif
146
147
148
149
150
151 #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
152
153 lui t1, %hi(cpu_mask_nr_tbl)
154 addiu t1, %lo(cpu_mask_nr_tbl)
155 #else
156 #error GCC `-msym32' option required for 64-bit DECstation builds
157 #endif
158 1: lw t2,(t1)
159 nop
160 and t2,t0
161 beqz t2,1b
162 addu t1,2*PTRSIZE # delay slot
163
164
165
166
167 lw a0,(-PTRSIZE)(t1)
168 nop
169 bgez a0,handle_it # irq_nr >= 0?
170
171 nop
172 jr a0
173
174 lui t2,(KN03_IOASIC_BASE>>16)&0xffff
175
176
177
178
179
180
181 FEXPORT(kn02_io_int) # 3max
182 lui t0,(KN02_CSR_BASE>>16)&0xffff
183
184 lw t0,(t0)
185 nop
186 andi t1,t0,KN02_IRQ_ALL
187 b 1f
188 srl t0,16 # shift interrupt mask
189
190 FEXPORT(kn02xa_io_int) # 3min/maxine
191 lui t2,(KN02XA_IOASIC_BASE>>16)&0xffff
192
193
194 FEXPORT(kn03_io_int) # 3max+ (t2 loaded earlier)
195 lw t0,IO_REG_SIR(t2) # get status: IOASIC sir
196 lw t1,IO_REG_SIMR(t2) # get mask: IOASIC simr
197 nop
198
199 1: and t0,t1 # mask out allowed ones
200
201 beqz t0,spurious
202
203
204
205
206
207 #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
208
209 lui t1, %hi(asic_mask_nr_tbl)
210 addiu t1, %lo(asic_mask_nr_tbl)
211 #else
212 #error GCC `-msym32' option required for 64-bit DECstation builds
213 #endif
214 2: lw t2,(t1)
215 nop
216 and t2,t0
217 beq zero,t2,2b
218 addu t1,2*PTRSIZE # delay slot
219
220
221
222
223 lw a0,%lo(-PTRSIZE)(t1)
224 nop
225 bgez a0,handle_it # irq_nr >= 0?
226
227 nop
228 jr a0
229 nop # delay slot
230
231
232
233
234
235
236 FEXPORT(cpu_all_int) # HALT, timers, software junk
237 li a0,DEC_CPU_IRQ_BASE
238 srl t0,CAUSEB_IP
239 li t1,CAUSEF_IP>>CAUSEB_IP # mask
240 b 1f
241 li t2,4 # nr of bits / 2
242
243 FEXPORT(kn02_all_int) # impossible ?
244 li a0,KN02_IRQ_BASE
245 li t1,KN02_IRQ_ALL # mask
246 b 1f
247 li t2,4 # nr of bits / 2
248
249 FEXPORT(asic_all_int) # various I/O ASIC junk
250 li a0,IO_IRQ_BASE
251 li t1,IO_IRQ_ALL # mask
252 b 1f
253 li t2,8 # nr of bits / 2
254
255
256
257
258 FEXPORT(asic_dma_int) # I/O ASIC DMA events
259 li a0,IO_IRQ_BASE+IO_INR_DMA
260 srl t0,IO_INR_DMA
261 li t1,IO_IRQ_DMA>>IO_INR_DMA # mask
262 li t2,8 # nr of bits / 2
263
264
265
266
267
268 1: srlv t3,t1,t2
269 2: xor t1,t3
270 and t3,t0,t1
271 beqz t3,3f
272 nop
273 move t0,t3
274 addu a0,t2
275 3: srl t2,1
276 bnez t2,2b
277 srlv t3,t1,t2
278
279 handle_it:
280 j dec_irq_dispatch
281 nop
282
283 #ifdef CONFIG_32BIT
284 fpu:
285 lw t0,fpu_kstat_irq
286 nop
287 lw t1,(t0)
288 nop
289 addu t1,1
290 j handle_fpe_int
291 sw t1,(t0)
292 #endif
293
294 spurious:
295 j spurious_interrupt
296 nop
297 END(plat_irq_dispatch)
298
299
300
301
302
303
304
305 FEXPORT(dec_intr_unimplemented)
306 move a1,t0 # cheats way of printing an arg!
307 PANIC("Unimplemented cpu interrupt! CP0_CAUSE: 0x%08x");
308
309 FEXPORT(asic_intr_unimplemented)
310 move a1,t0 # cheats way of printing an arg!
311 PANIC("Unimplemented asic interrupt! ASIC ISR: 0x%08x");