diff options
Diffstat (limited to 'arch/m68k/mvme147/147ints.c')
-rw-r--r-- | arch/m68k/mvme147/147ints.c | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/arch/m68k/mvme147/147ints.c b/arch/m68k/mvme147/147ints.c new file mode 100644 index 000000000000..69a744ee35a3 --- /dev/null +++ b/arch/m68k/mvme147/147ints.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * arch/m68k/mvme147/147ints.c | ||
3 | * | ||
4 | * Copyright (C) 1997 Richard Hirst [richard@sleepie.demon.co.uk] | ||
5 | * | ||
6 | * based on amiints.c -- Amiga Linux interrupt handling code | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file README.legal in the main directory of this archive | ||
10 | * for more details. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/seq_file.h> | ||
18 | |||
19 | #include <asm/ptrace.h> | ||
20 | #include <asm/system.h> | ||
21 | #include <asm/irq.h> | ||
22 | #include <asm/traps.h> | ||
23 | |||
24 | static irqreturn_t mvme147_defhand (int irq, void *dev_id, struct pt_regs *fp); | ||
25 | |||
26 | /* | ||
27 | * This should ideally be 4 elements only, for speed. | ||
28 | */ | ||
29 | |||
30 | static struct { | ||
31 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
32 | unsigned long flags; | ||
33 | void *dev_id; | ||
34 | const char *devname; | ||
35 | unsigned count; | ||
36 | } irq_tab[256]; | ||
37 | |||
38 | /* | ||
39 | * void mvme147_init_IRQ (void) | ||
40 | * | ||
41 | * Parameters: None | ||
42 | * | ||
43 | * Returns: Nothing | ||
44 | * | ||
45 | * This function is called during kernel startup to initialize | ||
46 | * the mvme147 IRQ handling routines. | ||
47 | */ | ||
48 | |||
49 | void mvme147_init_IRQ (void) | ||
50 | { | ||
51 | int i; | ||
52 | |||
53 | for (i = 0; i < 256; i++) { | ||
54 | irq_tab[i].handler = mvme147_defhand; | ||
55 | irq_tab[i].flags = IRQ_FLG_STD; | ||
56 | irq_tab[i].dev_id = NULL; | ||
57 | irq_tab[i].devname = NULL; | ||
58 | irq_tab[i].count = 0; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | int mvme147_request_irq(unsigned int irq, | ||
63 | irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
64 | unsigned long flags, const char *devname, void *dev_id) | ||
65 | { | ||
66 | if (irq > 255) { | ||
67 | printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname); | ||
68 | return -ENXIO; | ||
69 | } | ||
70 | if (!(irq_tab[irq].flags & IRQ_FLG_STD)) { | ||
71 | if (irq_tab[irq].flags & IRQ_FLG_LOCK) { | ||
72 | printk("%s: IRQ %d from %s is not replaceable\n", | ||
73 | __FUNCTION__, irq, irq_tab[irq].devname); | ||
74 | return -EBUSY; | ||
75 | } | ||
76 | if (flags & IRQ_FLG_REPLACE) { | ||
77 | printk("%s: %s can't replace IRQ %d from %s\n", | ||
78 | __FUNCTION__, devname, irq, irq_tab[irq].devname); | ||
79 | return -EBUSY; | ||
80 | } | ||
81 | } | ||
82 | irq_tab[irq].handler = handler; | ||
83 | irq_tab[irq].flags = flags; | ||
84 | irq_tab[irq].dev_id = dev_id; | ||
85 | irq_tab[irq].devname = devname; | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | void mvme147_free_irq(unsigned int irq, void *dev_id) | ||
90 | { | ||
91 | if (irq > 255) { | ||
92 | printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); | ||
93 | return; | ||
94 | } | ||
95 | if (irq_tab[irq].dev_id != dev_id) | ||
96 | printk("%s: Removing probably wrong IRQ %d from %s\n", | ||
97 | __FUNCTION__, irq, irq_tab[irq].devname); | ||
98 | |||
99 | irq_tab[irq].handler = mvme147_defhand; | ||
100 | irq_tab[irq].flags = IRQ_FLG_STD; | ||
101 | irq_tab[irq].dev_id = NULL; | ||
102 | irq_tab[irq].devname = NULL; | ||
103 | } | ||
104 | |||
105 | irqreturn_t mvme147_process_int (unsigned long vec, struct pt_regs *fp) | ||
106 | { | ||
107 | if (vec > 255) { | ||
108 | printk ("mvme147_process_int: Illegal vector %ld\n", vec); | ||
109 | return IRQ_NONE; | ||
110 | } else { | ||
111 | irq_tab[vec].count++; | ||
112 | irq_tab[vec].handler(vec, irq_tab[vec].dev_id, fp); | ||
113 | return IRQ_HANDLED; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | int show_mvme147_interrupts (struct seq_file *p, void *v) | ||
118 | { | ||
119 | int i; | ||
120 | |||
121 | for (i = 0; i < 256; i++) { | ||
122 | if (irq_tab[i].count) | ||
123 | seq_printf(p, "Vec 0x%02x: %8d %s\n", | ||
124 | i, irq_tab[i].count, | ||
125 | irq_tab[i].devname ? irq_tab[i].devname : "free"); | ||
126 | } | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | |||
131 | static irqreturn_t mvme147_defhand (int irq, void *dev_id, struct pt_regs *fp) | ||
132 | { | ||
133 | printk ("Unknown interrupt 0x%02x\n", irq); | ||
134 | return IRQ_NONE; | ||
135 | } | ||
136 | |||
137 | void mvme147_enable_irq (unsigned int irq) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | |||
142 | void mvme147_disable_irq (unsigned int irq) | ||
143 | { | ||
144 | } | ||
145 | |||