mm-only debug patch...
[mmotm.git] / arch / cris / kernel / irq.c
blob0ca7d9892cc6d6c5c7bb5f249a5a5151289b980b
1 /*
3 * linux/arch/cris/kernel/irq.c
5 * Copyright (c) 2000,2007 Axis Communications AB
7 * Authors: Bjorn Wesen (bjornw@axis.com)
9 * This file contains the code used by various IRQ handling routines:
10 * asking for different IRQs should be done through these routines
11 * instead of just grabbing them. Thus setups with different IRQ numbers
12 * shouldn't result in any weird surprises, and installing new handlers
13 * should be easier.
18 * IRQs are in fact implemented a bit like signal handlers for the kernel.
19 * Naturally it's not a 1:1 relation, but there are similarities.
22 #include <linux/module.h>
23 #include <linux/ptrace.h>
24 #include <linux/irq.h>
26 #include <linux/kernel_stat.h>
27 #include <linux/signal.h>
28 #include <linux/sched.h>
29 #include <linux/ioport.h>
30 #include <linux/interrupt.h>
31 #include <linux/timex.h>
32 #include <linux/slab.h>
33 #include <linux/random.h>
34 #include <linux/init.h>
35 #include <linux/seq_file.h>
36 #include <linux/errno.h>
37 #include <linux/spinlock.h>
39 #include <asm/io.h>
41 int show_interrupts(struct seq_file *p, void *v)
43 int i = *(loff_t *) v, j;
44 struct irqaction * action;
45 unsigned long flags;
47 if (i == 0) {
48 seq_printf(p, " ");
49 for_each_online_cpu(j)
50 seq_printf(p, "CPU%d ",j);
51 seq_putc(p, '\n');
54 if (i < NR_IRQS) {
55 spin_lock_irqsave(&irq_desc[i].lock, flags);
56 action = irq_desc[i].action;
57 if (!action)
58 goto skip;
59 seq_printf(p, "%3d: ",i);
60 #ifndef CONFIG_SMP
61 seq_printf(p, "%10u ", kstat_irqs(i));
62 #else
63 for_each_online_cpu(j)
64 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
65 #endif
66 seq_printf(p, " %14s", irq_desc[i].chip->typename);
67 seq_printf(p, " %s", action->name);
69 for (action=action->next; action; action = action->next)
70 seq_printf(p, ", %s", action->name);
72 seq_putc(p, '\n');
73 skip:
74 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
76 return 0;
80 /* called by the assembler IRQ entry functions defined in irq.h
81 * to dispatch the interrupts to registered handlers
82 * interrupts are disabled upon entry - depending on if the
83 * interrupt was registered with IRQF_DISABLED or not, interrupts
84 * are re-enabled or not.
87 asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
89 unsigned long sp;
90 struct pt_regs *old_regs = set_irq_regs(regs);
91 irq_enter();
92 sp = rdsp();
93 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
94 printk("do_IRQ: stack overflow: %lX\n", sp);
95 show_stack(NULL, (unsigned long *)sp);
97 __do_IRQ(irq);
98 irq_exit();
99 set_irq_regs(old_regs);
102 void weird_irq(void)
104 local_irq_disable();
105 printk("weird irq\n");
106 while(1);