0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <asm/addrspace.h>
0017 #include <asm/asm.h>
0018 #include <asm/mipsregs.h>
0019 #include <asm/regdef.h>
0020 #include <asm/stackframe.h>
0021
0022 #include <asm/dec/interrupts.h>
0023 #include <asm/dec/ioasic_addrs.h>
0024 #include <asm/dec/ioasic_ints.h>
0025 #include <asm/dec/kn01.h>
0026 #include <asm/dec/kn02.h>
0027 #include <asm/dec/kn02xa.h>
0028 #include <asm/dec/kn03.h>
0029
0030 #define KN02_CSR_BASE CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR)
0031 #define KN02XA_IOASIC_BASE CKSEG1ADDR(KN02XA_SLOT_BASE + IOASIC_IOCTL)
0032 #define KN03_IOASIC_BASE CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_IOCTL)
0033
0034 .text
0035 .set noreorder
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125 .align 5
0126 NESTED(plat_irq_dispatch, PT_SIZE, ra)
0127 .set noreorder
0128
0129
0130
0131
0132 mfc0 t0,CP0_CAUSE # get pending interrupts
0133 mfc0 t1,CP0_STATUS
0134 #if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT)
0135 lw t2,cpu_fpu_mask
0136 #endif
0137 andi t0,ST0_IM # CAUSE.CE may be non-zero!
0138 and t0,t1 # isolate allowed ones
0139
0140 beqz t0,spurious
0141
0142 #if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT)
0143 and t2,t0
0144 bnez t2,fpu # handle FPU immediately
0145 #endif
0146
0147
0148
0149
0150 # open coded PTR_LA t1, cpu_mask_nr_tbl
0151 #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
0152 # open coded la t1, cpu_mask_nr_tbl
0153 lui t1, %hi(cpu_mask_nr_tbl)
0154 addiu t1, %lo(cpu_mask_nr_tbl)
0155 #else
0156 #error GCC `-msym32' option required for 64-bit DECstation builds
0157 #endif
0158 1: lw t2,(t1)
0159 nop
0160 and t2,t0
0161 beqz t2,1b
0162 addu t1,2*PTRSIZE # delay slot
0163
0164
0165
0166
0167 lw a0,(-PTRSIZE)(t1)
0168 nop
0169 bgez a0,handle_it # irq_nr >= 0?
0170 # irq_nr < 0: it is an address
0171 nop
0172 jr a0
0173 # a trick to save a branch:
0174 lui t2,(KN03_IOASIC_BASE>>16)&0xffff
0175 # upper part of IOASIC Address
0176
0177
0178
0179
0180
0181 FEXPORT(kn02_io_int) # 3max
0182 lui t0,(KN02_CSR_BASE>>16)&0xffff
0183 # get interrupt status and mask
0184 lw t0,(t0)
0185 nop
0186 andi t1,t0,KN02_IRQ_ALL
0187 b 1f
0188 srl t0,16 # shift interrupt mask
0189
0190 FEXPORT(kn02xa_io_int) # 3min/maxine
0191 lui t2,(KN02XA_IOASIC_BASE>>16)&0xffff
0192 # upper part of IOASIC Address
0193
0194 FEXPORT(kn03_io_int) # 3max+ (t2 loaded earlier)
0195 lw t0,IO_REG_SIR(t2) # get status: IOASIC sir
0196 lw t1,IO_REG_SIMR(t2) # get mask: IOASIC simr
0197 nop
0198
0199 1: and t0,t1 # mask out allowed ones
0200
0201 beqz t0,spurious
0202
0203
0204
0205
0206 # open coded PTR_LA t1,asic_mask_nr_tbl
0207 #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
0208 # open coded la t1, asic_mask_nr_tbl
0209 lui t1, %hi(asic_mask_nr_tbl)
0210 addiu t1, %lo(asic_mask_nr_tbl)
0211 #else
0212 #error GCC `-msym32' option required for 64-bit DECstation builds
0213 #endif
0214 2: lw t2,(t1)
0215 nop
0216 and t2,t0
0217 beq zero,t2,2b
0218 addu t1,2*PTRSIZE # delay slot
0219
0220
0221
0222
0223 lw a0,%lo(-PTRSIZE)(t1)
0224 nop
0225 bgez a0,handle_it # irq_nr >= 0?
0226 # irq_nr < 0: it is an address
0227 nop
0228 jr a0
0229 nop # delay slot
0230
0231
0232
0233
0234
0235
0236 FEXPORT(cpu_all_int) # HALT, timers, software junk
0237 li a0,DEC_CPU_IRQ_BASE
0238 srl t0,CAUSEB_IP
0239 li t1,CAUSEF_IP>>CAUSEB_IP # mask
0240 b 1f
0241 li t2,4 # nr of bits / 2
0242
0243 FEXPORT(kn02_all_int) # impossible ?
0244 li a0,KN02_IRQ_BASE
0245 li t1,KN02_IRQ_ALL # mask
0246 b 1f
0247 li t2,4 # nr of bits / 2
0248
0249 FEXPORT(asic_all_int) # various I/O ASIC junk
0250 li a0,IO_IRQ_BASE
0251 li t1,IO_IRQ_ALL # mask
0252 b 1f
0253 li t2,8 # nr of bits / 2
0254
0255
0256
0257
0258 FEXPORT(asic_dma_int) # I/O ASIC DMA events
0259 li a0,IO_IRQ_BASE+IO_INR_DMA
0260 srl t0,IO_INR_DMA
0261 li t1,IO_IRQ_DMA>>IO_INR_DMA # mask
0262 li t2,8 # nr of bits / 2
0263
0264
0265
0266
0267
0268 1: srlv t3,t1,t2
0269 2: xor t1,t3
0270 and t3,t0,t1
0271 beqz t3,3f
0272 nop
0273 move t0,t3
0274 addu a0,t2
0275 3: srl t2,1
0276 bnez t2,2b
0277 srlv t3,t1,t2
0278
0279 handle_it:
0280 j dec_irq_dispatch
0281 nop
0282
0283 #if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT)
0284 fpu:
0285 lw t0,fpu_kstat_irq
0286 nop
0287 lw t1,(t0)
0288 nop
0289 addu t1,1
0290 j handle_fpe_int
0291 sw t1,(t0)
0292 #endif
0293
0294 spurious:
0295 j spurious_interrupt
0296 nop
0297 END(plat_irq_dispatch)
0298
0299
0300
0301
0302
0303
0304
0305 FEXPORT(dec_intr_unimplemented)
0306 move a1,t0 # cheats way of printing an arg!
0307 ASM_PANIC("Unimplemented cpu interrupt! CP0_CAUSE: 0x%08x");
0308
0309 FEXPORT(asic_intr_unimplemented)
0310 move a1,t0 # cheats way of printing an arg!
0311 ASM_PANIC("Unimplemented asic interrupt! ASIC ISR: 0x%08x");