]> nv-tegra.nvidia Code Review - linux-2.6.git/blob - arch/cris/kernel/irq.c
Merge with /home/shaggy/git/linus-clean/
[linux-2.6.git] / arch / cris / kernel / irq.c
1 /*
2  *
3  *      linux/arch/cris/kernel/irq.c
4  *
5  *      Copyright (c) 2000,2001 Axis Communications AB
6  *
7  *      Authors: Bjorn Wesen (bjornw@axis.com)
8  *
9  * This file contains the code used by various IRQ handling routines:
10  * asking for different IRQ's 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.
14  *
15  */
16
17 /*
18  * IRQ's 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.
20  */
21
22 #include <linux/config.h>
23 #include <linux/module.h>
24 #include <linux/ptrace.h>
25 #include <linux/irq.h>
26
27 #include <linux/kernel_stat.h>
28 #include <linux/signal.h>
29 #include <linux/sched.h>
30 #include <linux/ioport.h>
31 #include <linux/interrupt.h>
32 #include <linux/timex.h>
33 #include <linux/slab.h>
34 #include <linux/random.h>
35 #include <linux/init.h>
36 #include <linux/seq_file.h>
37 #include <linux/errno.h>
38 #include <linux/spinlock.h>
39
40 #include <asm/io.h>
41
42 void ack_bad_irq(unsigned int irq)
43 {
44         printk("unexpected IRQ trap at vector %02x\n", irq);
45 }
46
47 int show_interrupts(struct seq_file *p, void *v)
48 {
49         int i = *(loff_t *) v, j;
50         struct irqaction * action;
51         unsigned long flags;
52
53         if (i == 0) {
54                 seq_printf(p, "           ");
55                 for (j=0; j<NR_CPUS; j++)
56                         if (cpu_online(j))
57                                 seq_printf(p, "CPU%d       ",j);
58                 seq_putc(p, '\n');
59         }
60
61         if (i < NR_IRQS) {
62                 spin_lock_irqsave(&irq_desc[i].lock, flags);
63                 action = irq_desc[i].action;
64                 if (!action)
65                         goto skip;
66                 seq_printf(p, "%3d: ",i);
67 #ifndef CONFIG_SMP
68                 seq_printf(p, "%10u ", kstat_irqs(i));
69 #else
70                 for (j = 0; j < NR_CPUS; j++)
71                         if (cpu_online(j))
72                                 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
73 #endif
74                 seq_printf(p, " %14s", irq_desc[i].handler->typename);
75                 seq_printf(p, "  %s", action->name);
76
77                 for (action=action->next; action; action = action->next)
78                         seq_printf(p, ", %s", action->name);
79
80                 seq_putc(p, '\n');
81 skip:
82                 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
83         }
84         return 0;
85 }
86
87
88 /* called by the assembler IRQ entry functions defined in irq.h
89  * to dispatch the interrupts to registred handlers
90  * interrupts are disabled upon entry - depending on if the
91  * interrupt was registred with SA_INTERRUPT or not, interrupts
92  * are re-enabled or not.
93  */
94
95 asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
96 {
97         unsigned long sp;
98         irq_enter();
99         sp = rdsp();
100         if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
101                 printk("do_IRQ: stack overflow: %lX\n", sp);
102                 show_stack(NULL, (unsigned long *)sp);
103         }
104         __do_IRQ(irq, regs);
105         irq_exit();
106 }
107
108 void weird_irq(void)
109 {
110         local_irq_disable();
111         printk("weird irq\n");
112         while(1);
113 }
114