Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ip22-int.c: Routines for generic manipulation of the INT[23] ASIC |
| 3 | * found on INDY and Indigo2 workstations. |
| 4 | * |
| 5 | * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) |
| 6 | * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org) |
| 7 | * Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu) |
| 8 | * - Indigo2 changes |
| 9 | * - Interrupt handling fixes |
| 10 | * Copyright (C) 2001, 2003 Ladislav Michl (ladis@linux-mips.org) |
| 11 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/types.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/kernel_stat.h> |
| 15 | #include <linux/signal.h> |
| 16 | #include <linux/sched.h> |
| 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/irq.h> |
| 19 | |
| 20 | #include <asm/mipsregs.h> |
| 21 | #include <asm/addrspace.h> |
| 22 | |
| 23 | #include <asm/sgi/ioc.h> |
| 24 | #include <asm/sgi/hpc3.h> |
| 25 | #include <asm/sgi/ip22.h> |
| 26 | |
| 27 | /* #define DEBUG_SGINT */ |
| 28 | |
| 29 | /* So far nothing hangs here */ |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 30 | #undef USE_LIO3_IRQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | struct sgint_regs *sgint; |
| 33 | |
| 34 | static char lc0msk_to_irqnr[256]; |
| 35 | static char lc1msk_to_irqnr[256]; |
| 36 | static char lc2msk_to_irqnr[256]; |
| 37 | static char lc3msk_to_irqnr[256]; |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | extern int ip22_eisa_init(void); |
| 40 | |
| 41 | static void enable_local0_irq(unsigned int irq) |
| 42 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* don't allow mappable interrupt to be enabled from setup_irq, |
| 44 | * we have our own way to do so */ |
| 45 | if (irq != SGI_MAP_0_IRQ) |
| 46 | sgint->imask0 |= (1 << (irq - SGINT_LOCAL0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | static void disable_local0_irq(unsigned int irq) |
| 50 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | sgint->imask0 &= ~(1 << (irq - SGINT_LOCAL0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | static void end_local0_irq (unsigned int irq) |
| 55 | { |
| 56 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) |
| 57 | enable_local0_irq(irq); |
| 58 | } |
| 59 | |
Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 60 | static struct irq_chip ip22_local0_irq_type = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | .typename = "IP22 local 0", |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame^] | 62 | .ack = disable_local0_irq, |
| 63 | .mask = disable_local0_irq, |
| 64 | .mask_ack = disable_local0_irq, |
| 65 | .unmask = enable_local0_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | .end = end_local0_irq, |
| 67 | }; |
| 68 | |
| 69 | static void enable_local1_irq(unsigned int irq) |
| 70 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | /* don't allow mappable interrupt to be enabled from setup_irq, |
| 72 | * we have our own way to do so */ |
| 73 | if (irq != SGI_MAP_1_IRQ) |
| 74 | sgint->imask1 |= (1 << (irq - SGINT_LOCAL1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void disable_local1_irq(unsigned int irq) |
| 78 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | } |
| 81 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | static void end_local1_irq (unsigned int irq) |
| 83 | { |
| 84 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) |
| 85 | enable_local1_irq(irq); |
| 86 | } |
| 87 | |
Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 88 | static struct irq_chip ip22_local1_irq_type = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | .typename = "IP22 local 1", |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame^] | 90 | .ack = disable_local1_irq, |
| 91 | .mask = disable_local1_irq, |
| 92 | .mask_ack = disable_local1_irq, |
| 93 | .unmask = enable_local1_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | .end = end_local1_irq, |
| 95 | }; |
| 96 | |
| 97 | static void enable_local2_irq(unsigned int irq) |
| 98 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | sgint->imask0 |= (1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0)); |
| 100 | sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | void disable_local2_irq(unsigned int irq) |
| 104 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2)); |
| 106 | if (!sgint->cmeimask0) |
| 107 | sgint->imask0 &= ~(1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | } |
| 109 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | static void end_local2_irq (unsigned int irq) |
| 111 | { |
| 112 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) |
| 113 | enable_local2_irq(irq); |
| 114 | } |
| 115 | |
Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 116 | static struct irq_chip ip22_local2_irq_type = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | .typename = "IP22 local 2", |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame^] | 118 | .ack = disable_local2_irq, |
| 119 | .mask = disable_local2_irq, |
| 120 | .mask_ack = disable_local2_irq, |
| 121 | .unmask = enable_local2_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | .end = end_local2_irq, |
| 123 | }; |
| 124 | |
| 125 | static void enable_local3_irq(unsigned int irq) |
| 126 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | sgint->imask1 |= (1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1)); |
| 128 | sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | void disable_local3_irq(unsigned int irq) |
| 132 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3)); |
| 134 | if (!sgint->cmeimask1) |
| 135 | sgint->imask1 &= ~(1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | } |
| 137 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | static void end_local3_irq (unsigned int irq) |
| 139 | { |
| 140 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) |
| 141 | enable_local3_irq(irq); |
| 142 | } |
| 143 | |
Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 144 | static struct irq_chip ip22_local3_irq_type = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | .typename = "IP22 local 3", |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame^] | 146 | .ack = disable_local3_irq, |
| 147 | .mask = disable_local3_irq, |
| 148 | .mask_ack = disable_local3_irq, |
| 149 | .unmask = enable_local3_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | .end = end_local3_irq, |
| 151 | }; |
| 152 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 153 | static void indy_local0_irqdispatch(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | { |
| 155 | u8 mask = sgint->istat0 & sgint->imask0; |
| 156 | u8 mask2; |
| 157 | int irq; |
| 158 | |
| 159 | if (mask & SGINT_ISTAT0_LIO2) { |
| 160 | mask2 = sgint->vmeistat & sgint->cmeimask0; |
| 161 | irq = lc2msk_to_irqnr[mask2]; |
| 162 | } else |
| 163 | irq = lc0msk_to_irqnr[mask]; |
| 164 | |
| 165 | /* if irq == 0, then the interrupt has already been cleared */ |
| 166 | if (irq) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 167 | do_IRQ(irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | } |
| 169 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 170 | static void indy_local1_irqdispatch(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | { |
| 172 | u8 mask = sgint->istat1 & sgint->imask1; |
| 173 | u8 mask2; |
| 174 | int irq; |
| 175 | |
| 176 | if (mask & SGINT_ISTAT1_LIO3) { |
| 177 | mask2 = sgint->vmeistat & sgint->cmeimask1; |
| 178 | irq = lc3msk_to_irqnr[mask2]; |
| 179 | } else |
| 180 | irq = lc1msk_to_irqnr[mask]; |
| 181 | |
| 182 | /* if irq == 0, then the interrupt has already been cleared */ |
| 183 | if (irq) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 184 | do_IRQ(irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | } |
| 186 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 187 | extern void ip22_be_interrupt(int irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 189 | static void indy_buserror_irq(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | { |
| 191 | int irq = SGI_BUSERR_IRQ; |
| 192 | |
| 193 | irq_enter(); |
| 194 | kstat_this_cpu.irqs[irq]++; |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 195 | ip22_be_interrupt(irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | irq_exit(); |
| 197 | } |
| 198 | |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 199 | static struct irqaction local0_cascade = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | .handler = no_action, |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 201 | .flags = IRQF_DISABLED, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | .name = "local0 cascade", |
| 203 | }; |
| 204 | |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 205 | static struct irqaction local1_cascade = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | .handler = no_action, |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 207 | .flags = IRQF_DISABLED, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | .name = "local1 cascade", |
| 209 | }; |
| 210 | |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 211 | static struct irqaction buserr = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | .handler = no_action, |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 213 | .flags = IRQF_DISABLED, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | .name = "Bus Error", |
| 215 | }; |
| 216 | |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 217 | static struct irqaction map0_cascade = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | .handler = no_action, |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 219 | .flags = IRQF_DISABLED, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | .name = "mapable0 cascade", |
| 221 | }; |
| 222 | |
| 223 | #ifdef USE_LIO3_IRQ |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 224 | static struct irqaction map1_cascade = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | .handler = no_action, |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 226 | .flags = IRQF_DISABLED, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | .name = "mapable1 cascade", |
| 228 | }; |
| 229 | #define SGI_INTERRUPTS SGINT_END |
| 230 | #else |
| 231 | #define SGI_INTERRUPTS SGINT_LOCAL3 |
| 232 | #endif |
| 233 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 234 | extern void indy_r4k_timer_interrupt(void); |
| 235 | extern void indy_8254timer_irq(void); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 236 | |
| 237 | /* |
| 238 | * IRQs on the INDY look basically (barring software IRQs which we don't use |
| 239 | * at all) like: |
| 240 | * |
| 241 | * MIPS IRQ Source |
| 242 | * -------- ------ |
| 243 | * 0 Software (ignored) |
| 244 | * 1 Software (ignored) |
| 245 | * 2 Local IRQ level zero |
| 246 | * 3 Local IRQ level one |
| 247 | * 4 8254 Timer zero |
| 248 | * 5 8254 Timer one |
| 249 | * 6 Bus Error |
| 250 | * 7 R4k timer (what we use) |
| 251 | * |
| 252 | * We handle the IRQ according to _our_ priority which is: |
| 253 | * |
| 254 | * Highest ---- R4k Timer |
| 255 | * Local IRQ zero |
| 256 | * Local IRQ one |
| 257 | * Bus Error |
| 258 | * 8254 Timer zero |
| 259 | * Lowest ---- 8254 Timer one |
| 260 | * |
| 261 | * then we just return, if multiple IRQs are pending then we will just take |
| 262 | * another exception, big deal. |
| 263 | */ |
| 264 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 265 | asmlinkage void plat_irq_dispatch(void) |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 266 | { |
| 267 | unsigned int pending = read_c0_cause(); |
| 268 | |
| 269 | /* |
| 270 | * First we check for r4k counter/timer IRQ. |
| 271 | */ |
| 272 | if (pending & CAUSEF_IP7) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 273 | indy_r4k_timer_interrupt(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 274 | else if (pending & CAUSEF_IP2) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 275 | indy_local0_irqdispatch(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 276 | else if (pending & CAUSEF_IP3) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 277 | indy_local1_irqdispatch(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 278 | else if (pending & CAUSEF_IP6) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 279 | indy_buserror_irq(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 280 | else if (pending & (CAUSEF_IP4 | CAUSEF_IP5)) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 281 | indy_8254timer_irq(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 282 | } |
| 283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | extern void mips_cpu_irq_init(unsigned int irq_base); |
| 285 | |
| 286 | void __init arch_init_irq(void) |
| 287 | { |
| 288 | int i; |
| 289 | |
| 290 | /* Init local mask --> irq tables. */ |
| 291 | for (i = 0; i < 256; i++) { |
| 292 | if (i & 0x80) { |
| 293 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 7; |
| 294 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 7; |
| 295 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 7; |
| 296 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 7; |
| 297 | } else if (i & 0x40) { |
| 298 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 6; |
| 299 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 6; |
| 300 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 6; |
| 301 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 6; |
| 302 | } else if (i & 0x20) { |
| 303 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 5; |
| 304 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 5; |
| 305 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 5; |
| 306 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 5; |
| 307 | } else if (i & 0x10) { |
| 308 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 4; |
| 309 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 4; |
| 310 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 4; |
| 311 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 4; |
| 312 | } else if (i & 0x08) { |
| 313 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 3; |
| 314 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 3; |
| 315 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 3; |
| 316 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 3; |
| 317 | } else if (i & 0x04) { |
| 318 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 2; |
| 319 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 2; |
| 320 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 2; |
| 321 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 2; |
| 322 | } else if (i & 0x02) { |
| 323 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 1; |
| 324 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 1; |
| 325 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 1; |
| 326 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 1; |
| 327 | } else if (i & 0x01) { |
| 328 | lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 0; |
| 329 | lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 0; |
| 330 | lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 0; |
| 331 | lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 0; |
| 332 | } else { |
| 333 | lc0msk_to_irqnr[i] = 0; |
| 334 | lc1msk_to_irqnr[i] = 0; |
| 335 | lc2msk_to_irqnr[i] = 0; |
| 336 | lc3msk_to_irqnr[i] = 0; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /* Mask out all interrupts. */ |
| 341 | sgint->imask0 = 0; |
| 342 | sgint->imask1 = 0; |
| 343 | sgint->cmeimask0 = 0; |
| 344 | sgint->cmeimask1 = 0; |
| 345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | /* init CPU irqs */ |
| 347 | mips_cpu_irq_init(SGINT_CPU); |
| 348 | |
| 349 | for (i = SGINT_LOCAL0; i < SGI_INTERRUPTS; i++) { |
Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 350 | struct irq_chip *handler; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
| 352 | if (i < SGINT_LOCAL1) |
| 353 | handler = &ip22_local0_irq_type; |
| 354 | else if (i < SGINT_LOCAL2) |
| 355 | handler = &ip22_local1_irq_type; |
| 356 | else if (i < SGINT_LOCAL3) |
| 357 | handler = &ip22_local2_irq_type; |
| 358 | else |
| 359 | handler = &ip22_local3_irq_type; |
| 360 | |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame^] | 361 | set_irq_chip(i, handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | /* vector handler. this register the IRQ as non-sharable */ |
| 365 | setup_irq(SGI_LOCAL_0_IRQ, &local0_cascade); |
| 366 | setup_irq(SGI_LOCAL_1_IRQ, &local1_cascade); |
| 367 | setup_irq(SGI_BUSERR_IRQ, &buserr); |
| 368 | |
| 369 | /* cascade in cascade. i love Indy ;-) */ |
| 370 | setup_irq(SGI_MAP_0_IRQ, &map0_cascade); |
| 371 | #ifdef USE_LIO3_IRQ |
| 372 | setup_irq(SGI_MAP_1_IRQ, &map1_cascade); |
| 373 | #endif |
| 374 | |
| 375 | #ifdef CONFIG_EISA |
| 376 | if (ip22_is_fullhouse()) /* Only Indigo-2 has EISA stuff */ |
| 377 | ip22_eisa_init (); |
| 378 | #endif |
| 379 | } |