blob: c4a2bfb750a4937eac2b782ee0ae03893096ec09 [file] [log] [blame]
Adrian Bunk88278ca2008-05-19 16:53:02 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * arch/sparc/kernel/sun4d_irq.c:
3 * SS1000/SC2000 interrupt handling.
4 *
5 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 * Heavily based on arch/sparc/kernel/irq.c.
7 */
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/errno.h>
10#include <linux/linkage.h>
11#include <linux/kernel_stat.h>
12#include <linux/signal.h>
13#include <linux/sched.h>
14#include <linux/ptrace.h>
15#include <linux/interrupt.h>
16#include <linux/slab.h>
17#include <linux/random.h>
18#include <linux/init.h>
19#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/spinlock.h>
21#include <linux/seq_file.h>
David S. Miller454eeb22008-08-27 04:05:35 -070022#include <linux/of.h>
23#include <linux/of_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25#include <asm/ptrace.h>
26#include <asm/processor.h>
27#include <asm/system.h>
28#include <asm/psr.h>
29#include <asm/smp.h>
30#include <asm/vaddrs.h>
31#include <asm/timer.h>
32#include <asm/openprom.h>
33#include <asm/oplib.h>
34#include <asm/traps.h>
35#include <asm/irq.h>
36#include <asm/io.h>
37#include <asm/pgalloc.h>
38#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include <asm/sbi.h>
40#include <asm/cacheflush.h>
Al Viro0d844382006-10-08 14:30:44 +010041#include <asm/irq_regs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Al Viro32231a62007-07-21 19:18:57 -070043#include "irq.h"
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045/* If you trust current SCSI layer to handle different SCSI IRQs, enable this. I don't trust it... -jj */
46/* #define DISTRIBUTE_IRQS */
47
48struct sun4d_timer_regs *sun4d_timers;
49#define TIMER_IRQ 10
50
51#define MAX_STATIC_ALLOC 4
52extern struct irqaction static_irqaction[MAX_STATIC_ALLOC];
53extern int static_irq_count;
54unsigned char cpu_leds[32];
55#ifdef CONFIG_SMP
Adrian Bunkc61c65c2008-06-05 11:40:58 -070056static unsigned char sbus_tid[32];
Linus Torvalds1da177e2005-04-16 15:20:36 -070057#endif
58
Bob Breuera54123e2006-03-23 22:36:19 -080059static struct irqaction *irq_action[NR_IRQS];
Linus Torvalds1da177e2005-04-16 15:20:36 -070060extern spinlock_t irq_action_lock;
61
Adrian Bunkc61c65c2008-06-05 11:40:58 -070062static struct sbus_action {
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 struct irqaction *action;
64 /* For SMP this needs to be extended */
65} *sbus_actions;
66
67static int pil_to_sbus[] = {
68 0, 0, 1, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0,
69};
70
71static int sbus_to_pil[] = {
72 0, 2, 3, 5, 7, 9, 11, 13,
73};
74
75static int nsbi;
76#ifdef CONFIG_SMP
77DEFINE_SPINLOCK(sun4d_imsk_lock);
78#endif
79
80int show_sun4d_interrupts(struct seq_file *p, void *v)
81{
82 int i = *(loff_t *) v, j = 0, k = 0, sbusl;
83 struct irqaction * action;
84 unsigned long flags;
85#ifdef CONFIG_SMP
86 int x;
87#endif
88
89 spin_lock_irqsave(&irq_action_lock, flags);
90 if (i < NR_IRQS) {
91 sbusl = pil_to_sbus[i];
92 if (!sbusl) {
93 action = *(i + irq_action);
94 if (!action)
95 goto out_unlock;
96 } else {
97 for (j = 0; j < nsbi; j++) {
98 for (k = 0; k < 4; k++)
99 if ((action = sbus_actions [(j << 5) + (sbusl << 2) + k].action))
100 goto found_it;
101 }
102 goto out_unlock;
103 }
104found_it: seq_printf(p, "%3d: ", i);
105#ifndef CONFIG_SMP
106 seq_printf(p, "%10u ", kstat_irqs(i));
107#else
Andrew Morton394e3902006-03-23 03:01:05 -0800108 for_each_online_cpu(x)
109 seq_printf(p, "%10u ",
110 kstat_cpu(cpu_logical_map(x)).irqs[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111#endif
112 seq_printf(p, "%c %s",
Thomas Gleixner67413202006-07-01 19:29:26 -0700113 (action->flags & IRQF_DISABLED) ? '+' : ' ',
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 action->name);
115 action = action->next;
116 for (;;) {
117 for (; action; action = action->next) {
118 seq_printf(p, ",%s %s",
Thomas Gleixner67413202006-07-01 19:29:26 -0700119 (action->flags & IRQF_DISABLED) ? " +" : "",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 action->name);
121 }
122 if (!sbusl) break;
123 k++;
124 if (k < 4)
125 action = sbus_actions [(j << 5) + (sbusl << 2) + k].action;
126 else {
127 j++;
128 if (j == nsbi) break;
129 k = 0;
130 action = sbus_actions [(j << 5) + (sbusl << 2)].action;
131 }
132 }
133 seq_putc(p, '\n');
134 }
135out_unlock:
136 spin_unlock_irqrestore(&irq_action_lock, flags);
137 return 0;
138}
139
140void sun4d_free_irq(unsigned int irq, void *dev_id)
141{
142 struct irqaction *action, **actionp;
143 struct irqaction *tmp = NULL;
144 unsigned long flags;
145
146 spin_lock_irqsave(&irq_action_lock, flags);
147 if (irq < 15)
148 actionp = irq + irq_action;
149 else
150 actionp = &(sbus_actions[irq - (1 << 5)].action);
151 action = *actionp;
152 if (!action) {
153 printk("Trying to free free IRQ%d\n",irq);
154 goto out_unlock;
155 }
156 if (dev_id) {
157 for (; action; action = action->next) {
158 if (action->dev_id == dev_id)
159 break;
160 tmp = action;
161 }
162 if (!action) {
163 printk("Trying to free free shared IRQ%d\n",irq);
164 goto out_unlock;
165 }
Thomas Gleixner67413202006-07-01 19:29:26 -0700166 } else if (action->flags & IRQF_SHARED) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 printk("Trying to free shared IRQ%d with NULL device ID\n", irq);
168 goto out_unlock;
169 }
170 if (action->flags & SA_STATIC_ALLOC)
171 {
172 /* This interrupt is marked as specially allocated
173 * so it is a bad idea to free it.
174 */
175 printk("Attempt to free statically allocated IRQ%d (%s)\n",
176 irq, action->name);
177 goto out_unlock;
178 }
179
180 if (action && tmp)
181 tmp->next = action->next;
182 else
183 *actionp = action->next;
184
185 spin_unlock_irqrestore(&irq_action_lock, flags);
186
187 synchronize_irq(irq);
188
189 spin_lock_irqsave(&irq_action_lock, flags);
190
191 kfree(action);
192
193 if (!(*actionp))
Al Viro0f516812007-07-21 19:19:38 -0700194 __disable_irq(irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
196out_unlock:
197 spin_unlock_irqrestore(&irq_action_lock, flags);
198}
199
200extern void unexpected_irq(int, void *, struct pt_regs *);
201
202void sun4d_handler_irq(int irq, struct pt_regs * regs)
203{
Al Viro0d844382006-10-08 14:30:44 +0100204 struct pt_regs *old_regs;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 struct irqaction * action;
206 int cpu = smp_processor_id();
207 /* SBUS IRQ level (1 - 7) */
208 int sbusl = pil_to_sbus[irq];
209
210 /* FIXME: Is this necessary?? */
211 cc_get_ipen();
212
213 cc_set_iclr(1 << irq);
214
Al Viro0d844382006-10-08 14:30:44 +0100215 old_regs = set_irq_regs(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 irq_enter();
217 kstat_cpu(cpu).irqs[irq]++;
218 if (!sbusl) {
219 action = *(irq + irq_action);
220 if (!action)
221 unexpected_irq(irq, NULL, regs);
222 do {
Al Viro0d844382006-10-08 14:30:44 +0100223 action->handler(irq, action->dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 action = action->next;
225 } while (action);
226 } else {
227 int bus_mask = bw_get_intr_mask(sbusl) & 0x3ffff;
228 int sbino;
229 struct sbus_action *actionp;
230 unsigned mask, slot;
231 int sbil = (sbusl << 2);
232
233 bw_clear_intr_mask(sbusl, bus_mask);
234
235 /* Loop for each pending SBI */
236 for (sbino = 0; bus_mask; sbino++, bus_mask >>= 1)
237 if (bus_mask & 1) {
238 mask = acquire_sbi(SBI2DEVID(sbino), 0xf << sbil);
239 mask &= (0xf << sbil);
240 actionp = sbus_actions + (sbino << 5) + (sbil);
241 /* Loop for each pending SBI slot */
242 for (slot = (1 << sbil); mask; slot <<= 1, actionp++)
243 if (mask & slot) {
244 mask &= ~slot;
245 action = actionp->action;
246
247 if (!action)
248 unexpected_irq(irq, NULL, regs);
249 do {
Al Viro0d844382006-10-08 14:30:44 +0100250 action->handler(irq, action->dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 action = action->next;
252 } while (action);
253 release_sbi(SBI2DEVID(sbino), slot);
254 }
255 }
256 }
257 irq_exit();
Al Viro0d844382006-10-08 14:30:44 +0100258 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259}
260
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261int sun4d_request_irq(unsigned int irq,
David Howells40220c12006-10-09 12:19:47 +0100262 irq_handler_t handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 unsigned long irqflags, const char * devname, void *dev_id)
264{
265 struct irqaction *action, *tmp = NULL, **actionp;
266 unsigned long flags;
267 int ret;
268
269 if(irq > 14 && irq < (1 << 5)) {
270 ret = -EINVAL;
271 goto out;
272 }
273
274 if (!handler) {
275 ret = -EINVAL;
276 goto out;
277 }
278
279 spin_lock_irqsave(&irq_action_lock, flags);
280
281 if (irq >= (1 << 5))
282 actionp = &(sbus_actions[irq - (1 << 5)].action);
283 else
284 actionp = irq + irq_action;
285 action = *actionp;
286
287 if (action) {
Thomas Gleixner67413202006-07-01 19:29:26 -0700288 if ((action->flags & IRQF_SHARED) && (irqflags & IRQF_SHARED)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 for (tmp = action; tmp->next; tmp = tmp->next);
290 } else {
291 ret = -EBUSY;
292 goto out_unlock;
293 }
Thomas Gleixner67413202006-07-01 19:29:26 -0700294 if ((action->flags & IRQF_DISABLED) ^ (irqflags & IRQF_DISABLED)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
296 ret = -EBUSY;
297 goto out_unlock;
298 }
299 action = NULL; /* Or else! */
300 }
301
302 /* If this is flagged as statically allocated then we use our
303 * private struct which is never freed.
304 */
305 if (irqflags & SA_STATIC_ALLOC) {
306 if (static_irq_count < MAX_STATIC_ALLOC)
307 action = &static_irqaction[static_irq_count++];
308 else
309 printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname);
310 }
311
312 if (action == NULL)
Robert P. J. Day5cbded52006-12-13 00:35:56 -0800313 action = kmalloc(sizeof(struct irqaction),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 GFP_ATOMIC);
315
316 if (!action) {
317 ret = -ENOMEM;
318 goto out_unlock;
319 }
320
321 action->handler = handler;
322 action->flags = irqflags;
323 cpus_clear(action->mask);
324 action->name = devname;
325 action->next = NULL;
326 action->dev_id = dev_id;
327
328 if (tmp)
329 tmp->next = action;
330 else
331 *actionp = action;
332
Al Viro0f516812007-07-21 19:19:38 -0700333 __enable_irq(irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
335 ret = 0;
336out_unlock:
337 spin_unlock_irqrestore(&irq_action_lock, flags);
338out:
339 return ret;
340}
341
342static void sun4d_disable_irq(unsigned int irq)
343{
344#ifdef CONFIG_SMP
345 int tid = sbus_tid[(irq >> 5) - 1];
346 unsigned long flags;
347#endif
348
349 if (irq < NR_IRQS) return;
350#ifdef CONFIG_SMP
351 spin_lock_irqsave(&sun4d_imsk_lock, flags);
352 cc_set_imsk_other(tid, cc_get_imsk_other(tid) | (1 << sbus_to_pil[(irq >> 2) & 7]));
353 spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
354#else
355 cc_set_imsk(cc_get_imsk() | (1 << sbus_to_pil[(irq >> 2) & 7]));
356#endif
357}
358
359static void sun4d_enable_irq(unsigned int irq)
360{
361#ifdef CONFIG_SMP
362 int tid = sbus_tid[(irq >> 5) - 1];
363 unsigned long flags;
364#endif
365
366 if (irq < NR_IRQS) return;
367#ifdef CONFIG_SMP
368 spin_lock_irqsave(&sun4d_imsk_lock, flags);
369 cc_set_imsk_other(tid, cc_get_imsk_other(tid) & ~(1 << sbus_to_pil[(irq >> 2) & 7]));
370 spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
371#else
372 cc_set_imsk(cc_get_imsk() & ~(1 << sbus_to_pil[(irq >> 2) & 7]));
373#endif
374}
375
376#ifdef CONFIG_SMP
377static void sun4d_set_cpu_int(int cpu, int level)
378{
379 sun4d_send_ipi(cpu, level);
380}
381
382static void sun4d_clear_ipi(int cpu, int level)
383{
384}
385
386static void sun4d_set_udt(int cpu)
387{
388}
389
390/* Setup IRQ distribution scheme. */
391void __init sun4d_distribute_irqs(void)
392{
David S. Miller71d37212008-08-27 02:50:57 -0700393 struct device_node *dp;
394
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395#ifdef DISTRIBUTE_IRQS
David S. Miller71d37212008-08-27 02:50:57 -0700396 cpumask_t sbus_serving_map;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397
398 sbus_serving_map = cpu_present_map;
David S. Miller71d37212008-08-27 02:50:57 -0700399 for_each_node_by_name(dp, "sbi") {
400 int board = of_getintprop_default(dp, "board#", 0);
401
402 if ((board * 2) == boot_cpu_id && cpu_isset(board * 2 + 1, cpu_present_map))
403 sbus_tid[board] = (board * 2 + 1);
404 else if (cpu_isset(board * 2, cpu_present_map))
405 sbus_tid[board] = (board * 2);
406 else if (cpu_isset(board * 2 + 1, cpu_present_map))
407 sbus_tid[board] = (board * 2 + 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 else
David S. Miller71d37212008-08-27 02:50:57 -0700409 sbus_tid[board] = 0xff;
410 if (sbus_tid[board] != 0xff)
411 cpu_clear(sbus_tid[board], sbus_serving_map);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412 }
David S. Miller71d37212008-08-27 02:50:57 -0700413 for_each_node_by_name(dp, "sbi") {
414 int board = of_getintprop_default(dp, "board#", 0);
415 if (sbus_tid[board] == 0xff) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 int i = 31;
417
David S. Miller71d37212008-08-27 02:50:57 -0700418 if (cpus_empty(sbus_serving_map))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 sbus_serving_map = cpu_present_map;
David S. Miller71d37212008-08-27 02:50:57 -0700420 while (cpu_isset(i, sbus_serving_map))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 i--;
David S. Miller71d37212008-08-27 02:50:57 -0700422 sbus_tid[board] = i;
423 cpu_clear(i, sbus_serving_map);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 }
David S. Miller71d37212008-08-27 02:50:57 -0700425 }
426 for_each_node_by_name(dp, "sbi") {
427 int devid = of_getintprop_default(dp, "device-id", 0);
428 int board = of_getintprop_default(dp, "board#", 0);
429 printk("sbus%d IRQs directed to CPU%d\n", board, sbus_tid[board]);
430 set_sbi_tid(devid, sbus_tid[board] << 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 }
432#else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 int cpuid = cpu_logical_map(1);
434
435 if (cpuid == -1)
436 cpuid = cpu_logical_map(0);
David S. Miller71d37212008-08-27 02:50:57 -0700437 for_each_node_by_name(dp, "sbi") {
438 int devid = of_getintprop_default(dp, "device-id", 0);
439 int board = of_getintprop_default(dp, "board#", 0);
440 sbus_tid[board] = cpuid;
441 set_sbi_tid(devid, cpuid << 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 }
443 printk("All sbus IRQs directed to CPU%d\n", cpuid);
444#endif
445}
446#endif
447
448static void sun4d_clear_clock_irq(void)
449{
450 volatile unsigned int clear_intr;
451 clear_intr = sun4d_timers->l10_timer_limit;
452}
453
454static void sun4d_clear_profile_irq(int cpu)
455{
456 bw_get_prof_limit(cpu);
457}
458
459static void sun4d_load_profile_irq(int cpu, unsigned int limit)
460{
461 bw_set_prof_limit(cpu, limit);
462}
463
David Howells40220c12006-10-09 12:19:47 +0100464static void __init sun4d_init_timers(irq_handler_t counter_fn)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465{
466 int irq;
467 int cpu;
468 struct resource r;
469 int mid;
470
471 /* Map the User Timer registers. */
472 memset(&r, 0, sizeof(r));
473#ifdef CONFIG_SMP
474 r.start = CSR_BASE(boot_cpu_id)+BW_TIMER_LIMIT;
475#else
476 r.start = CSR_BASE(0)+BW_TIMER_LIMIT;
477#endif
478 r.flags = 0xf;
David S. Miller454eeb22008-08-27 04:05:35 -0700479 sun4d_timers = (struct sun4d_timer_regs *) of_ioremap(&r, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480 PAGE_SIZE, "user timer");
481
482 sun4d_timers->l10_timer_limit = (((1000000/HZ) + 1) << 10);
483 master_l10_counter = &sun4d_timers->l10_cur_count;
484 master_l10_limit = &sun4d_timers->l10_timer_limit;
485
486 irq = request_irq(TIMER_IRQ,
487 counter_fn,
Thomas Gleixner67413202006-07-01 19:29:26 -0700488 (IRQF_DISABLED | SA_STATIC_ALLOC),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 "timer", NULL);
490 if (irq) {
491 prom_printf("time_init: unable to attach IRQ%d\n",TIMER_IRQ);
492 prom_halt();
493 }
494
495 /* Enable user timer free run for CPU 0 in BW */
496 /* bw_set_ctrl(0, bw_get_ctrl(0) | BW_CTRL_USER_TIMER); */
497
498 cpu = 0;
499 while (!cpu_find_by_instance(cpu, NULL, &mid)) {
500 sun4d_load_profile_irq(mid >> 3, 0);
501 cpu++;
502 }
503
504#ifdef CONFIG_SMP
505 {
506 unsigned long flags;
507 extern unsigned long lvl14_save[4];
508 struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (14 - 1)];
509 extern unsigned int real_irq_entry[], smp4d_ticker[];
510 extern unsigned int patchme_maybe_smp_msg[];
511
512 /* Adjust so that we jump directly to smp4d_ticker */
513 lvl14_save[2] += smp4d_ticker - real_irq_entry;
514
515 /* For SMP we use the level 14 ticker, however the bootup code
Simon Arlottd1a78c32007-05-11 13:51:23 -0700516 * has copied the firmware's level 14 vector into the boot cpu's
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 * trap table, we must fix this now or we get squashed.
518 */
519 local_irq_save(flags);
520 patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */
521 trap_table->inst_one = lvl14_save[0];
522 trap_table->inst_two = lvl14_save[1];
523 trap_table->inst_three = lvl14_save[2];
524 trap_table->inst_four = lvl14_save[3];
525 local_flush_cache_all();
526 local_irq_restore(flags);
527 }
528#endif
529}
530
531void __init sun4d_init_sbi_irq(void)
532{
David S. Miller71d37212008-08-27 02:50:57 -0700533 struct device_node *dp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534
535 nsbi = 0;
David S. Miller71d37212008-08-27 02:50:57 -0700536 for_each_node_by_name(dp, "sbi")
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 nsbi++;
Yan Burmanc80892d2006-11-30 17:07:04 -0800538 sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
David S. Millerd4accd62006-11-30 17:11:26 -0800539 if (!sbus_actions) {
540 prom_printf("SUN4D: Cannot allocate sbus_actions, halting.\n");
541 prom_halt();
542 }
David S. Miller71d37212008-08-27 02:50:57 -0700543 for_each_node_by_name(dp, "sbi") {
544 int devid = of_getintprop_default(dp, "device-id", 0);
545 int board = of_getintprop_default(dp, "board#", 0);
546 unsigned int mask;
547
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548#ifdef CONFIG_SMP
David S. Miller71d37212008-08-27 02:50:57 -0700549 {
550 extern unsigned char boot_cpu_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551
David S. Miller71d37212008-08-27 02:50:57 -0700552 set_sbi_tid(devid, boot_cpu_id << 3);
553 sbus_tid[board] = boot_cpu_id;
554 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555#endif
556 /* Get rid of pending irqs from PROM */
David S. Miller71d37212008-08-27 02:50:57 -0700557 mask = acquire_sbi(devid, 0xffffffff);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 if (mask) {
David S. Miller71d37212008-08-27 02:50:57 -0700559 printk ("Clearing pending IRQs %08x on SBI %d\n", mask, board);
560 release_sbi(devid, mask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 }
562 }
563}
564
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565void __init sun4d_init_IRQ(void)
566{
567 local_irq_disable();
568
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 BTFIXUPSET_CALL(enable_irq, sun4d_enable_irq, BTFIXUPCALL_NORM);
570 BTFIXUPSET_CALL(disable_irq, sun4d_disable_irq, BTFIXUPCALL_NORM);
571 BTFIXUPSET_CALL(clear_clock_irq, sun4d_clear_clock_irq, BTFIXUPCALL_NORM);
572 BTFIXUPSET_CALL(clear_profile_irq, sun4d_clear_profile_irq, BTFIXUPCALL_NORM);
573 BTFIXUPSET_CALL(load_profile_irq, sun4d_load_profile_irq, BTFIXUPCALL_NORM);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 sparc_init_timers = sun4d_init_timers;
575#ifdef CONFIG_SMP
576 BTFIXUPSET_CALL(set_cpu_int, sun4d_set_cpu_int, BTFIXUPCALL_NORM);
577 BTFIXUPSET_CALL(clear_cpu_int, sun4d_clear_ipi, BTFIXUPCALL_NOP);
578 BTFIXUPSET_CALL(set_irq_udt, sun4d_set_udt, BTFIXUPCALL_NOP);
579#endif
580 /* Cannot enable interrupts until OBP ticker is disabled. */
581}