Linux 2.6.19.7
[linux-2.6/suspend2-2.6.19.git] / arch / cris / kernel / irq.c
blob903ea62c6e21b6ac5fa6ed899cba5c5c261b6015
1 /*
3 * linux/arch/cris/kernel/irq.c
5 * Copyright (c) 2000,2001 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 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.
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.
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 void ack_bad_irq(unsigned int irq)
43 printk("unexpected IRQ trap at vector %02x\n", irq);
46 int show_interrupts(struct seq_file *p, void *v)
48 int i = *(loff_t *) v, j;
49 struct irqaction * action;
50 unsigned long flags;
52 if (i == 0) {
53 seq_printf(p, " ");
54 for_each_online_cpu(j)
55 seq_printf(p, "CPU%d ",j);
56 seq_putc(p, '\n');
59 if (i < NR_IRQS) {
60 spin_lock_irqsave(&irq_desc[i].lock, flags);
61 action = irq_desc[i].action;
62 if (!action)
63 goto skip;
64 seq_printf(p, "%3d: ",i);
65 #ifndef CONFIG_SMP
66 seq_printf(p, "%10u ", kstat_irqs(i));
67 #else
68 for_each_online_cpu(j)
69 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
70 #endif
71 seq_printf(p, " %14s", irq_desc[i].chip->typename);
72 seq_printf(p, " %s", action->name);
74 for (action=action->next; action; action = action->next)
75 seq_printf(p, ", %s", action->name);
77 seq_putc(p, '\n');
78 skip:
79 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
81 return 0;
85 /* called by the assembler IRQ entry functions defined in irq.h
86 * to dispatch the interrupts to registred handlers
87 * interrupts are disabled upon entry - depending on if the
88 * interrupt was registred with IRQF_DISABLED or not, interrupts
89 * are re-enabled or not.
92 asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
94 unsigned long sp;
95 irq_enter();
96 sp = rdsp();
97 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
98 printk("do_IRQ: stack overflow: %lX\n", sp);
99 show_stack(NULL, (unsigned long *)sp);
101 __do_IRQ(irq, regs);
102 irq_exit();
105 void weird_irq(void)
107 local_irq_disable();
108 printk("weird irq\n");
109 while(1);