blob: f257a67bcf933dc3b7d3902b29a9d995f252c2ed [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $Id: irq.c,v 1.114 2001/12/11 04:55:51 davem Exp $
2 * arch/sparc/kernel/irq.c: Interrupt request handling routines. On the
Simon Arlottd1a78c32007-05-11 13:51:23 -07003 * Sparc the IRQs are basically 'cast in stone'
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * and you are supposed to probe the prom's device
5 * node trees to find out who's got which IRQ.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
9 * Copyright (C) 1995,2002 Pete A. Zaitcev (zaitcev@yahoo.com)
10 * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk)
11 * Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org)
12 */
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/ptrace.h>
17#include <linux/errno.h>
18#include <linux/linkage.h>
19#include <linux/kernel_stat.h>
20#include <linux/signal.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/slab.h>
24#include <linux/random.h>
25#include <linux/init.h>
26#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <linux/delay.h>
28#include <linux/threads.h>
29#include <linux/spinlock.h>
30#include <linux/seq_file.h>
31
32#include <asm/ptrace.h>
33#include <asm/processor.h>
34#include <asm/system.h>
35#include <asm/psr.h>
36#include <asm/smp.h>
37#include <asm/vaddrs.h>
38#include <asm/timer.h>
39#include <asm/openprom.h>
40#include <asm/oplib.h>
41#include <asm/traps.h>
42#include <asm/irq.h>
43#include <asm/io.h>
44#include <asm/pgalloc.h>
45#include <asm/pgtable.h>
46#include <asm/pcic.h>
47#include <asm/cacheflush.h>
Al Viro0d844382006-10-08 14:30:44 +010048#include <asm/irq_regs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50#ifdef CONFIG_SMP
51#define SMP_NOP2 "nop; nop;\n\t"
52#define SMP_NOP3 "nop; nop; nop;\n\t"
53#else
54#define SMP_NOP2
55#define SMP_NOP3
56#endif /* SMP */
57unsigned long __local_irq_save(void)
58{
59 unsigned long retval;
60 unsigned long tmp;
61
62 __asm__ __volatile__(
63 "rd %%psr, %0\n\t"
64 SMP_NOP3 /* Sun4m + Cypress + SMP bug */
65 "or %0, %2, %1\n\t"
66 "wr %1, 0, %%psr\n\t"
67 "nop; nop; nop\n"
68 : "=&r" (retval), "=r" (tmp)
69 : "i" (PSR_PIL)
70 : "memory");
71
72 return retval;
73}
74
75void local_irq_enable(void)
76{
77 unsigned long tmp;
78
79 __asm__ __volatile__(
80 "rd %%psr, %0\n\t"
81 SMP_NOP3 /* Sun4m + Cypress + SMP bug */
82 "andn %0, %1, %0\n\t"
83 "wr %0, 0, %%psr\n\t"
84 "nop; nop; nop\n"
85 : "=&r" (tmp)
86 : "i" (PSR_PIL)
87 : "memory");
88}
89
90void local_irq_restore(unsigned long old_psr)
91{
92 unsigned long tmp;
93
94 __asm__ __volatile__(
95 "rd %%psr, %0\n\t"
96 "and %2, %1, %2\n\t"
97 SMP_NOP2 /* Sun4m + Cypress + SMP bug */
98 "andn %0, %1, %0\n\t"
99 "wr %0, %2, %%psr\n\t"
100 "nop; nop; nop\n"
101 : "=&r" (tmp)
102 : "i" (PSR_PIL), "r" (old_psr)
103 : "memory");
104}
105
106EXPORT_SYMBOL(__local_irq_save);
107EXPORT_SYMBOL(local_irq_enable);
108EXPORT_SYMBOL(local_irq_restore);
109
110/*
111 * Dave Redman (djhr@tadpole.co.uk)
112 *
113 * IRQ numbers.. These are no longer restricted to 15..
114 *
115 * this is done to enable SBUS cards and onboard IO to be masked
116 * correctly. using the interrupt level isn't good enough.
117 *
118 * For example:
119 * A device interrupting at sbus level6 and the Floppy both come in
120 * at IRQ11, but enabling and disabling them requires writing to
121 * different bits in the SLAVIO/SEC.
122 *
123 * As a result of these changes sun4m machines could now support
124 * directed CPU interrupts using the existing enable/disable irq code
125 * with tweaks.
126 *
127 */
128
129static void irq_panic(void)
130{
131 extern char *cputypval;
132 prom_printf("machine: %s doesn't have irq handlers defined!\n",cputypval);
133 prom_halt();
134}
135
David Howells40220c12006-10-09 12:19:47 +0100136void (*sparc_init_timers)(irq_handler_t ) =
137 (void (*)(irq_handler_t )) irq_panic;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
139/*
140 * Dave Redman (djhr@tadpole.co.uk)
141 *
142 * There used to be extern calls and hard coded values here.. very sucky!
143 * instead, because some of the devices attach very early, I do something
144 * equally sucky but at least we'll never try to free statically allocated
145 * space or call kmalloc before kmalloc_init :(.
146 *
147 * In fact it's the timer10 that attaches first.. then timer14
148 * then kmalloc_init is called.. then the tty interrupts attach.
149 * hmmm....
150 *
151 */
152#define MAX_STATIC_ALLOC 4
153struct irqaction static_irqaction[MAX_STATIC_ALLOC];
154int static_irq_count;
155
Bob Breuera54123e2006-03-23 22:36:19 -0800156struct {
157 struct irqaction *action;
158 int flags;
159} sparc_irq[NR_IRQS];
160#define SPARC_IRQ_INPROGRESS 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
162/* Used to protect the IRQ action lists */
163DEFINE_SPINLOCK(irq_action_lock);
164
165int show_interrupts(struct seq_file *p, void *v)
166{
167 int i = *(loff_t *) v;
168 struct irqaction * action;
169 unsigned long flags;
170#ifdef CONFIG_SMP
171 int j;
172#endif
173
174 if (sparc_cpu_model == sun4d) {
175 extern int show_sun4d_interrupts(struct seq_file *, void *);
176
177 return show_sun4d_interrupts(p, v);
178 }
179 spin_lock_irqsave(&irq_action_lock, flags);
180 if (i < NR_IRQS) {
Bob Breuera54123e2006-03-23 22:36:19 -0800181 action = sparc_irq[i].action;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 if (!action)
183 goto out_unlock;
184 seq_printf(p, "%3d: ", i);
185#ifndef CONFIG_SMP
186 seq_printf(p, "%10u ", kstat_irqs(i));
187#else
Andrew Morton394e3902006-03-23 03:01:05 -0800188 for_each_online_cpu(j) {
189 seq_printf(p, "%10u ",
Bob Breuera54123e2006-03-23 22:36:19 -0800190 kstat_cpu(j).irqs[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 }
192#endif
193 seq_printf(p, " %c %s",
Thomas Gleixner67413202006-07-01 19:29:26 -0700194 (action->flags & IRQF_DISABLED) ? '+' : ' ',
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 action->name);
196 for (action=action->next; action; action = action->next) {
197 seq_printf(p, ",%s %s",
Thomas Gleixner67413202006-07-01 19:29:26 -0700198 (action->flags & IRQF_DISABLED) ? " +" : "",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 action->name);
200 }
201 seq_putc(p, '\n');
202 }
203out_unlock:
204 spin_unlock_irqrestore(&irq_action_lock, flags);
205 return 0;
206}
207
208void free_irq(unsigned int irq, void *dev_id)
209{
210 struct irqaction * action;
Bob Breuera54123e2006-03-23 22:36:19 -0800211 struct irqaction **actionp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 unsigned long flags;
213 unsigned int cpu_irq;
214
215 if (sparc_cpu_model == sun4d) {
216 extern void sun4d_free_irq(unsigned int, void *);
217
218 sun4d_free_irq(irq, dev_id);
219 return;
220 }
221 cpu_irq = irq & (NR_IRQS - 1);
222 if (cpu_irq > 14) { /* 14 irq levels on the sparc */
223 printk("Trying to free bogus IRQ %d\n", irq);
224 return;
225 }
226
227 spin_lock_irqsave(&irq_action_lock, flags);
228
Bob Breuera54123e2006-03-23 22:36:19 -0800229 actionp = &sparc_irq[cpu_irq].action;
230 action = *actionp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231
232 if (!action->handler) {
233 printk("Trying to free free IRQ%d\n",irq);
234 goto out_unlock;
235 }
236 if (dev_id) {
237 for (; action; action = action->next) {
238 if (action->dev_id == dev_id)
239 break;
Bob Breuera54123e2006-03-23 22:36:19 -0800240 actionp = &action->next;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 }
242 if (!action) {
243 printk("Trying to free free shared IRQ%d\n",irq);
244 goto out_unlock;
245 }
Thomas Gleixner67413202006-07-01 19:29:26 -0700246 } else if (action->flags & IRQF_SHARED) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 printk("Trying to free shared IRQ%d with NULL device ID\n", irq);
248 goto out_unlock;
249 }
250 if (action->flags & SA_STATIC_ALLOC)
251 {
252 /* This interrupt is marked as specially allocated
253 * so it is a bad idea to free it.
254 */
255 printk("Attempt to free statically allocated IRQ%d (%s)\n",
256 irq, action->name);
257 goto out_unlock;
258 }
Bob Breuera54123e2006-03-23 22:36:19 -0800259
260 *actionp = action->next;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261
262 spin_unlock_irqrestore(&irq_action_lock, flags);
263
264 synchronize_irq(irq);
265
266 spin_lock_irqsave(&irq_action_lock, flags);
267
268 kfree(action);
269
Bob Breuera54123e2006-03-23 22:36:19 -0800270 if (!sparc_irq[cpu_irq].action)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 disable_irq(irq);
272
273out_unlock:
274 spin_unlock_irqrestore(&irq_action_lock, flags);
275}
276
277EXPORT_SYMBOL(free_irq);
278
279/*
280 * This is called when we want to synchronize with
281 * interrupts. We may for example tell a device to
282 * stop sending interrupts: but to make sure there
283 * are no interrupts that are executing on another
284 * CPU we need to call this function.
285 */
286#ifdef CONFIG_SMP
287void synchronize_irq(unsigned int irq)
288{
Bob Breuera54123e2006-03-23 22:36:19 -0800289 unsigned int cpu_irq;
290
291 cpu_irq = irq & (NR_IRQS - 1);
292 while (sparc_irq[cpu_irq].flags & SPARC_IRQ_INPROGRESS)
293 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294}
295#endif /* SMP */
296
297void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs)
298{
299 int i;
300 struct irqaction * action;
301 unsigned int cpu_irq;
302
303 cpu_irq = irq & (NR_IRQS - 1);
Bob Breuera54123e2006-03-23 22:36:19 -0800304 action = sparc_irq[cpu_irq].action;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305
306 printk("IO device interrupt, irq = %d\n", irq);
307 printk("PC = %08lx NPC = %08lx FP=%08lx\n", regs->pc,
308 regs->npc, regs->u_regs[14]);
309 if (action) {
310 printk("Expecting: ");
311 for (i = 0; i < 16; i++)
312 if (action->handler)
313 printk("[%s:%d:0x%x] ", action->name,
314 (int) i, (unsigned int) action->handler);
315 }
316 printk("AIEEE\n");
317 panic("bogus interrupt received");
318}
319
320void handler_irq(int irq, struct pt_regs * regs)
321{
Al Viro0d844382006-10-08 14:30:44 +0100322 struct pt_regs *old_regs;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323 struct irqaction * action;
324 int cpu = smp_processor_id();
325#ifdef CONFIG_SMP
326 extern void smp4m_irq_rotate(int cpu);
327#endif
328
Al Viro0d844382006-10-08 14:30:44 +0100329 old_regs = set_irq_regs(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 irq_enter();
331 disable_pil_irq(irq);
332#ifdef CONFIG_SMP
Simon Arlottd1a78c32007-05-11 13:51:23 -0700333 /* Only rotate on lower priority IRQs (scsi, ethernet, etc.). */
Raymond Burns198c1672006-07-17 21:50:55 -0700334 if((sparc_cpu_model==sun4m) && (irq < 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 smp4m_irq_rotate(cpu);
336#endif
Bob Breuera54123e2006-03-23 22:36:19 -0800337 action = sparc_irq[irq].action;
338 sparc_irq[irq].flags |= SPARC_IRQ_INPROGRESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 kstat_cpu(cpu).irqs[irq]++;
340 do {
341 if (!action || !action->handler)
342 unexpected_irq(irq, NULL, regs);
Al Viro0d844382006-10-08 14:30:44 +0100343 action->handler(irq, action->dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 action = action->next;
345 } while (action);
Bob Breuera54123e2006-03-23 22:36:19 -0800346 sparc_irq[irq].flags &= ~SPARC_IRQ_INPROGRESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 enable_pil_irq(irq);
348 irq_exit();
Al Viro0d844382006-10-08 14:30:44 +0100349 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350}
351
352#ifdef CONFIG_BLK_DEV_FD
Krzysztof Heltf6d7b8a2006-10-17 19:23:23 -0700353extern void floppy_interrupt(int irq, void *dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354
355void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
356{
Al Viro0d844382006-10-08 14:30:44 +0100357 struct pt_regs *old_regs;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 int cpu = smp_processor_id();
359
Al Viro0d844382006-10-08 14:30:44 +0100360 old_regs = set_irq_regs(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 disable_pil_irq(irq);
362 irq_enter();
363 kstat_cpu(cpu).irqs[irq]++;
Al Viro0d844382006-10-08 14:30:44 +0100364 floppy_interrupt(irq, dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 irq_exit();
366 enable_pil_irq(irq);
Al Viro0d844382006-10-08 14:30:44 +0100367 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 // XXX Eek, it's totally changed with preempt_count() and such
369 // if (softirq_pending(cpu))
370 // do_softirq();
371}
372#endif
373
Simon Arlottd1a78c32007-05-11 13:51:23 -0700374/* Fast IRQs on the Sparc can only have one routine attached to them,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 * thus no sharing possible.
376 */
377int request_fast_irq(unsigned int irq,
David Howells40220c12006-10-09 12:19:47 +0100378 irq_handler_t handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 unsigned long irqflags, const char *devname)
380{
381 struct irqaction *action;
382 unsigned long flags;
383 unsigned int cpu_irq;
384 int ret;
385#ifdef CONFIG_SMP
386 struct tt_entry *trap_table;
387 extern struct tt_entry trapbase_cpu1, trapbase_cpu2, trapbase_cpu3;
388#endif
389
390 cpu_irq = irq & (NR_IRQS - 1);
391 if(cpu_irq > 14) {
392 ret = -EINVAL;
393 goto out;
394 }
395 if(!handler) {
396 ret = -EINVAL;
397 goto out;
398 }
399
400 spin_lock_irqsave(&irq_action_lock, flags);
401
Bob Breuera54123e2006-03-23 22:36:19 -0800402 action = sparc_irq[cpu_irq].action;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 if(action) {
Thomas Gleixner67413202006-07-01 19:29:26 -0700404 if(action->flags & IRQF_SHARED)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 panic("Trying to register fast irq when already shared.\n");
Thomas Gleixner67413202006-07-01 19:29:26 -0700406 if(irqflags & IRQF_SHARED)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 panic("Trying to register fast irq as shared.\n");
408
409 /* Anyway, someone already owns it so cannot be made fast. */
410 printk("request_fast_irq: Trying to register yet already owned.\n");
411 ret = -EBUSY;
412 goto out_unlock;
413 }
414
415 /* If this is flagged as statically allocated then we use our
416 * private struct which is never freed.
417 */
418 if (irqflags & SA_STATIC_ALLOC) {
419 if (static_irq_count < MAX_STATIC_ALLOC)
420 action = &static_irqaction[static_irq_count++];
421 else
422 printk("Fast IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
423 irq, devname);
424 }
425
426 if (action == NULL)
Robert P. J. Day5cbded52006-12-13 00:35:56 -0800427 action = kmalloc(sizeof(struct irqaction),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 GFP_ATOMIC);
429
430 if (!action) {
431 ret = -ENOMEM;
432 goto out_unlock;
433 }
434
435 /* Dork with trap table if we get this far. */
436#define INSTANTIATE(table) \
437 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \
438 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \
439 SPARC_BRANCH((unsigned long) handler, \
440 (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\
441 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \
442 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
443
444 INSTANTIATE(sparc_ttable)
445#ifdef CONFIG_SMP
446 trap_table = &trapbase_cpu1; INSTANTIATE(trap_table)
447 trap_table = &trapbase_cpu2; INSTANTIATE(trap_table)
448 trap_table = &trapbase_cpu3; INSTANTIATE(trap_table)
449#endif
450#undef INSTANTIATE
451 /*
452 * XXX Correct thing whould be to flush only I- and D-cache lines
453 * which contain the handler in question. But as of time of the
454 * writing we have no CPU-neutral interface to fine-grained flushes.
455 */
456 flush_cache_all();
457
458 action->handler = handler;
459 action->flags = irqflags;
460 cpus_clear(action->mask);
461 action->name = devname;
462 action->dev_id = NULL;
463 action->next = NULL;
464
Bob Breuera54123e2006-03-23 22:36:19 -0800465 sparc_irq[cpu_irq].action = action;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466
467 enable_irq(irq);
468
469 ret = 0;
470out_unlock:
471 spin_unlock_irqrestore(&irq_action_lock, flags);
472out:
473 return ret;
474}
475
476int request_irq(unsigned int irq,
David Howells40220c12006-10-09 12:19:47 +0100477 irq_handler_t handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 unsigned long irqflags, const char * devname, void *dev_id)
479{
Bob Breuera54123e2006-03-23 22:36:19 -0800480 struct irqaction * action, **actionp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 unsigned long flags;
482 unsigned int cpu_irq;
483 int ret;
484
485 if (sparc_cpu_model == sun4d) {
486 extern int sun4d_request_irq(unsigned int,
David Howells40220c12006-10-09 12:19:47 +0100487 irq_handler_t ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 unsigned long, const char *, void *);
489 return sun4d_request_irq(irq, handler, irqflags, devname, dev_id);
490 }
491 cpu_irq = irq & (NR_IRQS - 1);
492 if(cpu_irq > 14) {
493 ret = -EINVAL;
494 goto out;
495 }
496 if (!handler) {
497 ret = -EINVAL;
498 goto out;
499 }
500
501 spin_lock_irqsave(&irq_action_lock, flags);
502
Bob Breuera54123e2006-03-23 22:36:19 -0800503 actionp = &sparc_irq[cpu_irq].action;
504 action = *actionp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 if (action) {
Thomas Gleixner67413202006-07-01 19:29:26 -0700506 if (!(action->flags & IRQF_SHARED) || !(irqflags & IRQF_SHARED)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 ret = -EBUSY;
508 goto out_unlock;
509 }
Thomas Gleixner67413202006-07-01 19:29:26 -0700510 if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511 printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
512 ret = -EBUSY;
513 goto out_unlock;
Bob Breuera54123e2006-03-23 22:36:19 -0800514 }
515 for ( ; action; action = *actionp)
516 actionp = &action->next;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 }
518
519 /* If this is flagged as statically allocated then we use our
520 * private struct which is never freed.
521 */
522 if (irqflags & SA_STATIC_ALLOC) {
523 if (static_irq_count < MAX_STATIC_ALLOC)
524 action = &static_irqaction[static_irq_count++];
525 else
526 printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname);
527 }
528
529 if (action == NULL)
Robert P. J. Day5cbded52006-12-13 00:35:56 -0800530 action = kmalloc(sizeof(struct irqaction),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531 GFP_ATOMIC);
532
533 if (!action) {
534 ret = -ENOMEM;
535 goto out_unlock;
536 }
537
538 action->handler = handler;
539 action->flags = irqflags;
540 cpus_clear(action->mask);
541 action->name = devname;
542 action->next = NULL;
543 action->dev_id = dev_id;
544
Bob Breuera54123e2006-03-23 22:36:19 -0800545 *actionp = action;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546
547 enable_irq(irq);
548
549 ret = 0;
550out_unlock:
551 spin_unlock_irqrestore(&irq_action_lock, flags);
552out:
553 return ret;
554}
555
556EXPORT_SYMBOL(request_irq);
557
558/* We really don't need these at all on the Sparc. We only have
559 * stubs here because they are exported to modules.
560 */
561unsigned long probe_irq_on(void)
562{
563 return 0;
564}
565
566EXPORT_SYMBOL(probe_irq_on);
567
568int probe_irq_off(unsigned long mask)
569{
570 return 0;
571}
572
573EXPORT_SYMBOL(probe_irq_off);
574
575/* djhr
576 * This could probably be made indirect too and assigned in the CPU
577 * bits of the code. That would be much nicer I think and would also
578 * fit in with the idea of being able to tune your kernel for your machine
579 * by removing unrequired machine and device support.
580 *
581 */
582
583void __init init_IRQ(void)
584{
585 extern void sun4c_init_IRQ( void );
586 extern void sun4m_init_IRQ( void );
587 extern void sun4d_init_IRQ( void );
588
589 switch(sparc_cpu_model) {
590 case sun4c:
591 case sun4:
592 sun4c_init_IRQ();
593 break;
594
595 case sun4m:
596#ifdef CONFIG_PCI
597 pcic_probe();
598 if (pcic_present()) {
599 sun4m_pci_init_IRQ();
600 break;
601 }
602#endif
603 sun4m_init_IRQ();
604 break;
605
606 case sun4d:
607 sun4d_init_IRQ();
608 break;
609
610 default:
Simon Arlottd1a78c32007-05-11 13:51:23 -0700611 prom_printf("Cannot initialize IRQs on this Sun machine...");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 break;
613 }
614 btfixup();
615}
616
617void init_irq_proc(void)
618{
619 /* For now, nothing... */
620}