diff options
author | Michal Simek <monstr@monstr.eu> | 2009-03-27 09:25:49 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-03-27 09:25:49 -0400 |
commit | eedbdab99fffb8ed71cac75a722088b8ace2583c (patch) | |
tree | 6f6b11f46a5d1b011a12dd61421cd1f2b10af237 /arch/microblaze/kernel/irq.c | |
parent | 3be100114a352bb4b0eee5b6a847cf4f34ce28b1 (diff) |
microblaze_v8: Interrupt handling and timer support
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Reviewed-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: John Linn <john.linn@xilinx.com>
Acked-by: John Williams <john.williams@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel/irq.c')
-rw-r--r-- | arch/microblaze/kernel/irq.c | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c new file mode 100644 index 000000000000..f688ee93e3b9 --- /dev/null +++ b/arch/microblaze/kernel/irq.c | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu> | ||
3 | * Copyright (C) 2007-2009 PetaLogix | ||
4 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/hardirq.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/irqflags.h> | ||
16 | #include <linux/seq_file.h> | ||
17 | #include <linux/kernel_stat.h> | ||
18 | #include <linux/irq.h> | ||
19 | |||
20 | #include <asm/prom.h> | ||
21 | |||
22 | unsigned int irq_of_parse_and_map(struct device_node *dev, int index) | ||
23 | { | ||
24 | struct of_irq oirq; | ||
25 | |||
26 | if (of_irq_map_one(dev, index, &oirq)) | ||
27 | return NO_IRQ; | ||
28 | |||
29 | return oirq.specifier[0]; | ||
30 | } | ||
31 | EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | ||
32 | |||
33 | /* | ||
34 | * 'what should we do if we get a hw irq event on an illegal vector'. | ||
35 | * each architecture has to answer this themselves. | ||
36 | */ | ||
37 | void ack_bad_irq(unsigned int irq) | ||
38 | { | ||
39 | printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", irq); | ||
40 | } | ||
41 | |||
42 | static u32 concurrent_irq; | ||
43 | |||
44 | void do_IRQ(struct pt_regs *regs) | ||
45 | { | ||
46 | unsigned int irq; | ||
47 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
48 | |||
49 | irq_enter(); | ||
50 | irq = get_irq(regs); | ||
51 | next_irq: | ||
52 | BUG_ON(irq == -1U); | ||
53 | generic_handle_irq(irq); | ||
54 | |||
55 | irq = get_irq(regs); | ||
56 | if (irq != -1U) { | ||
57 | pr_debug("next irq: %d\n", irq); | ||
58 | ++concurrent_irq; | ||
59 | goto next_irq; | ||
60 | } | ||
61 | |||
62 | irq_exit(); | ||
63 | set_irq_regs(old_regs); | ||
64 | } | ||
65 | |||
66 | int show_interrupts(struct seq_file *p, void *v) | ||
67 | { | ||
68 | int i = *(loff_t *) v, j; | ||
69 | struct irqaction *action; | ||
70 | unsigned long flags; | ||
71 | |||
72 | if (i == 0) { | ||
73 | seq_printf(p, " "); | ||
74 | for_each_online_cpu(j) | ||
75 | seq_printf(p, "CPU%-8d", j); | ||
76 | seq_putc(p, '\n'); | ||
77 | } | ||
78 | |||
79 | if (i < nr_irq) { | ||
80 | spin_lock_irqsave(&irq_desc[i].lock, flags); | ||
81 | action = irq_desc[i].action; | ||
82 | if (!action) | ||
83 | goto skip; | ||
84 | seq_printf(p, "%3d: ", i); | ||
85 | #ifndef CONFIG_SMP | ||
86 | seq_printf(p, "%10u ", kstat_irqs(i)); | ||
87 | #else | ||
88 | for_each_online_cpu(j) | ||
89 | seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); | ||
90 | #endif | ||
91 | seq_printf(p, " %8s", irq_desc[i].status & | ||
92 | IRQ_LEVEL ? "level" : "edge"); | ||
93 | seq_printf(p, " %8s", irq_desc[i].chip->name); | ||
94 | seq_printf(p, " %s", action->name); | ||
95 | |||
96 | for (action = action->next; action; action = action->next) | ||
97 | seq_printf(p, ", %s", action->name); | ||
98 | |||
99 | seq_putc(p, '\n'); | ||
100 | skip: | ||
101 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | ||
102 | } | ||
103 | return 0; | ||
104 | } | ||