]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | |
3 | * License. See the file "COPYING" in the main directory of this archive | |
4 | * for more details. | |
5 | * | |
6 | * arch/sh64/kernel/irq.c | |
7 | * | |
8 | * Copyright (C) 2000, 2001 Paolo Alberelli | |
9 | * Copyright (C) 2003 Paul Mundt | |
10 | * | |
11 | */ | |
12 | ||
13 | /* | |
14 | * IRQs are in fact implemented a bit like signal handlers for the kernel. | |
15 | * Naturally it's not a 1:1 relation, but there are similarities. | |
16 | */ | |
17 | ||
18 | #include <linux/config.h> | |
19 | #include <linux/errno.h> | |
20 | #include <linux/kernel_stat.h> | |
21 | #include <linux/signal.h> | |
22 | #include <linux/rwsem.h> | |
23 | #include <linux/sched.h> | |
24 | #include <linux/ioport.h> | |
25 | #include <linux/interrupt.h> | |
26 | #include <linux/timex.h> | |
27 | #include <linux/slab.h> | |
28 | #include <linux/random.h> | |
29 | #include <linux/smp.h> | |
30 | #include <linux/smp_lock.h> | |
31 | #include <linux/init.h> | |
32 | #include <linux/seq_file.h> | |
33 | #include <linux/bitops.h> | |
34 | #include <asm/system.h> | |
35 | #include <asm/io.h> | |
36 | #include <asm/smp.h> | |
37 | #include <asm/pgalloc.h> | |
38 | #include <asm/delay.h> | |
39 | #include <asm/irq.h> | |
40 | #include <linux/irq.h> | |
41 | ||
42 | void ack_bad_irq(unsigned int irq) | |
43 | { | |
44 | printk("unexpected IRQ trap at irq %02x\n", irq); | |
45 | } | |
46 | ||
47 | #if defined(CONFIG_PROC_FS) | |
48 | int show_interrupts(struct seq_file *p, void *v) | |
49 | { | |
50 | int i = *(loff_t *) v, j; | |
51 | struct irqaction * action; | |
52 | unsigned long flags; | |
53 | ||
54 | if (i == 0) { | |
55 | seq_puts(p, " "); | |
56 | for (j=0; j<NR_CPUS; j++) | |
57 | if (cpu_online(j)) | |
58 | seq_printf(p, "CPU%d ",j); | |
59 | seq_putc(p, '\n'); | |
60 | } | |
61 | ||
62 | if (i < NR_IRQS) { | |
63 | spin_lock_irqsave(&irq_desc[i].lock, flags); | |
64 | action = irq_desc[i].action; | |
65 | if (!action) | |
66 | goto unlock; | |
67 | seq_printf(p, "%3d: ",i); | |
68 | seq_printf(p, "%10u ", kstat_irqs(i)); | |
69 | seq_printf(p, " %14s", irq_desc[i].handler->typename); | |
70 | seq_printf(p, " %s", action->name); | |
71 | ||
72 | for (action=action->next; action; action = action->next) | |
73 | seq_printf(p, ", %s", action->name); | |
74 | seq_putc(p, '\n'); | |
75 | unlock: | |
76 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | |
77 | } | |
78 | return 0; | |
79 | } | |
80 | #endif | |
81 | ||
82 | /* | |
83 | * do_NMI handles all Non-Maskable Interrupts. | |
84 | */ | |
85 | asmlinkage void do_NMI(unsigned long vector_num, struct pt_regs * regs) | |
86 | { | |
87 | if (regs->sr & 0x40000000) | |
88 | printk("unexpected NMI trap in system mode\n"); | |
89 | else | |
90 | printk("unexpected NMI trap in user mode\n"); | |
91 | ||
92 | /* No statistics */ | |
93 | } | |
94 | ||
95 | /* | |
96 | * do_IRQ handles all normal device IRQ's. | |
97 | */ | |
98 | asmlinkage int do_IRQ(unsigned long vector_num, struct pt_regs * regs) | |
99 | { | |
100 | int irq; | |
101 | ||
102 | irq_enter(); | |
103 | ||
104 | irq = irq_demux(vector_num); | |
105 | ||
106 | if (irq >= 0) { | |
107 | __do_IRQ(irq, regs); | |
108 | } else { | |
109 | printk("unexpected IRQ trap at vector %03lx\n", vector_num); | |
110 | } | |
111 | ||
112 | irq_exit(); | |
113 | ||
114 | return 1; | |
115 | } | |
116 |