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