aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/ints.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/kernel/ints.c')
-rw-r--r--arch/m68k/kernel/ints.c297
1 files changed, 0 insertions, 297 deletions
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index cea439f9819b..e2b056b3a314 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -31,20 +31,6 @@ extern u32 auto_irqhandler_fixup[];
31extern u32 user_irqhandler_fixup[]; 31extern u32 user_irqhandler_fixup[];
32extern u16 user_irqvec_fixup[]; 32extern u16 user_irqvec_fixup[];
33 33
34#ifndef CONFIG_GENERIC_HARDIRQS
35/* table for system interrupt handlers */
36static struct irq_data *irq_list[NR_IRQS];
37static struct irq_chip *irq_chip[NR_IRQS];
38static int irq_depth[NR_IRQS];
39
40static inline int irq_set_chip(unsigned int irq, struct irq_chip *chip)
41{
42 irq_chip[irq] = chip;
43 return 0;
44}
45#define irq_set_chip_and_handler(irq, chip, dummy) irq_set_chip(irq, chip)
46#endif /* !CONFIG_GENERIC_HARDIRQS */
47
48static int m68k_first_user_vec; 34static int m68k_first_user_vec;
49 35
50static struct irq_chip auto_irq_chip = { 36static struct irq_chip auto_irq_chip = {
@@ -59,11 +45,6 @@ static struct irq_chip user_irq_chip = {
59 .irq_shutdown = m68k_irq_shutdown, 45 .irq_shutdown = m68k_irq_shutdown,
60}; 46};
61 47
62#ifndef CONFIG_GENERIC_HARDIRQS
63#define NUM_IRQ_NODES 100
64static struct irq_data nodes[NUM_IRQ_NODES];
65#endif /* !CONFIG_GENERIC_HARDIRQS */
66
67/* 48/*
68 * void init_IRQ(void) 49 * void init_IRQ(void)
69 * 50 *
@@ -133,8 +114,6 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
133 flush_icache(); 114 flush_icache();
134} 115}
135 116
136#ifdef CONFIG_GENERIC_HARDIRQS
137
138/** 117/**
139 * m68k_setup_irq_controller 118 * m68k_setup_irq_controller
140 * @chip: irq chip which controls specified irq 119 * @chip: irq chip which controls specified irq
@@ -160,198 +139,6 @@ void m68k_setup_irq_controller(struct irq_chip *chip,
160 } 139 }
161} 140}
162 141
163#else /* !CONFIG_GENERIC_HARDIRQS */
164
165/**
166 * m68k_setup_irq_chip
167 * @contr: irq controller which controls specified irq
168 * @irq: first irq to be managed by the controller
169 *
170 * Change the controller for the specified range of irq, which will be used to
171 * manage these irq. auto/user irq already have a default controller, which can
172 * be changed as well, but the controller probably should use m68k_irq_startup/
173 * m68k_irq_shutdown.
174 */
175void m68k_setup_irq_chip(struct irq_chip *contr, unsigned int irq,
176 unsigned int cnt)
177{
178 int i;
179
180 for (i = 0; i < cnt; i++)
181 irq_set_chip(irq + i, contr);
182}
183
184struct irq_data *new_irq_node(void)
185{
186 struct irq_data *node;
187 short i;
188
189 for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--) {
190 if (!node->handler) {
191 memset(node, 0, sizeof(*node));
192 return node;
193 }
194 }
195
196 printk ("new_irq_node: out of nodes\n");
197 return NULL;
198}
199
200static int m68k_setup_irq(unsigned int irq, struct irq_data *node)
201{
202 struct irq_chip *contr;
203 struct irq_data **prev;
204 unsigned long flags;
205
206 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
207 printk("%s: Incorrect IRQ %d from %s\n",
208 __func__, irq, node->devname);
209 return -ENXIO;
210 }
211
212 local_irq_save(flags);
213
214 prev = irq_list + irq;
215 if (*prev) {
216 /* Can't share interrupts unless both agree to */
217 if (!((*prev)->flags & node->flags & IRQF_SHARED)) {
218 local_irq_restore(flags);
219 return -EBUSY;
220 }
221 while (*prev)
222 prev = &(*prev)->next;
223 }
224
225 if (!irq_list[irq]) {
226 if (contr->irq_startup)
227 contr->irq_startup(node);
228 else
229 contr->irq_enable(node);
230 }
231 node->next = NULL;
232 *prev = node;
233
234 local_irq_restore(flags);
235
236 return 0;
237}
238
239int request_irq(unsigned int irq,
240 irq_handler_t handler,
241 unsigned long flags, const char *devname, void *dev_id)
242{
243 struct irq_data *node;
244 int res;
245
246 node = new_irq_node();
247 if (!node)
248 return -ENOMEM;
249
250 node->irq = irq;
251 node->handler = handler;
252 node->flags = flags;
253 node->dev_id = dev_id;
254 node->devname = devname;
255
256 res = m68k_setup_irq(irq, node);
257 if (res)
258 node->handler = NULL;
259
260 return res;
261}
262
263EXPORT_SYMBOL(request_irq);
264
265void free_irq(unsigned int irq, void *dev_id)
266{
267 struct irq_chip *contr;
268 struct irq_data **p, *node;
269 unsigned long flags;
270
271 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
272 printk("%s: Incorrect IRQ %d\n", __func__, irq);
273 return;
274 }
275
276 local_irq_save(flags);
277
278 p = irq_list + irq;
279 while ((node = *p)) {
280 if (node->dev_id == dev_id)
281 break;
282 p = &node->next;
283 }
284
285 if (node) {
286 *p = node->next;
287 node->handler = NULL;
288 } else
289 printk("%s: Removing probably wrong IRQ %d\n",
290 __func__, irq);
291
292 if (!irq_list[irq]) {
293 if (contr->irq_shutdown)
294 contr->irq_shutdown(node);
295 else
296 contr->irq_disable(node);
297 }
298
299 local_irq_restore(flags);
300}
301
302EXPORT_SYMBOL(free_irq);
303
304void enable_irq(unsigned int irq)
305{
306 struct irq_chip *contr;
307 unsigned long flags;
308
309 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
310 printk("%s: Incorrect IRQ %d\n",
311 __func__, irq);
312 return;
313 }
314
315 local_irq_save(flags);
316 if (irq_depth[irq]) {
317 if (!--irq_depth[irq]) {
318 if (contr->irq_enable)
319 contr->irq_enable(irq_list[irq]);
320 }
321 } else
322 WARN_ON(1);
323 local_irq_restore(flags);
324}
325
326EXPORT_SYMBOL(enable_irq);
327
328void disable_irq(unsigned int irq)
329{
330 struct irq_chip *contr;
331 unsigned long flags;
332
333 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
334 printk("%s: Incorrect IRQ %d\n",
335 __func__, irq);
336 return;
337 }
338
339 local_irq_save(flags);
340 if (!irq_depth[irq]++) {
341 if (contr->irq_disable)
342 contr->irq_disable(irq_list[irq]);
343 }
344 local_irq_restore(flags);
345}
346
347EXPORT_SYMBOL(disable_irq);
348
349void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
350
351EXPORT_SYMBOL(disable_irq_nosync);
352
353#endif /* !CONFIG_GENERIC_HARDIRQS */
354
355unsigned int m68k_irq_startup_irq(unsigned int irq) 142unsigned int m68k_irq_startup_irq(unsigned int irq)
356{ 143{
357 if (irq <= IRQ_AUTO_7) 144 if (irq <= IRQ_AUTO_7)
@@ -377,36 +164,6 @@ void m68k_irq_shutdown(struct irq_data *data)
377} 164}
378 165
379 166
380#ifndef CONFIG_GENERIC_HARDIRQS
381
382/*
383 * Do we need these probe functions on the m68k?
384 *
385 * ... may be useful with ISA devices
386 */
387unsigned long probe_irq_on (void)
388{
389#ifdef CONFIG_Q40
390 if (MACH_IS_Q40)
391 return q40_probe_irq_on();
392#endif
393 return 0;
394}
395
396EXPORT_SYMBOL(probe_irq_on);
397
398int probe_irq_off (unsigned long irqs)
399{
400#ifdef CONFIG_Q40
401 if (MACH_IS_Q40)
402 return q40_probe_irq_off(irqs);
403#endif
404 return 0;
405}
406
407EXPORT_SYMBOL(probe_irq_off);
408#endif /* CONFIG_GENERIC_HARDIRQS */
409
410unsigned int irq_canonicalize(unsigned int irq) 167unsigned int irq_canonicalize(unsigned int irq)
411{ 168{
412#ifdef CONFIG_Q40 169#ifdef CONFIG_Q40
@@ -418,63 +175,9 @@ unsigned int irq_canonicalize(unsigned int irq)
418 175
419EXPORT_SYMBOL(irq_canonicalize); 176EXPORT_SYMBOL(irq_canonicalize);
420 177
421#ifndef CONFIG_GENERIC_HARDIRQS
422void generic_handle_irq(unsigned int irq)
423{
424 struct irq_data *node;
425 kstat_cpu(0).irqs[irq]++;
426 node = irq_list[irq];
427 do {
428 node->handler(irq, node->dev_id);
429 node = node->next;
430 } while (node);
431}
432
433asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
434{
435 struct pt_regs *old_regs;
436 old_regs = set_irq_regs(regs);
437 generic_handle_irq(irq);
438 set_irq_regs(old_regs);
439}
440
441asmlinkage void handle_badint(struct pt_regs *regs)
442{
443 kstat_cpu(0).irqs[0]++;
444 printk("unexpected interrupt from %u\n", regs->vector);
445}
446
447int show_interrupts(struct seq_file *p, void *v)
448{
449 struct irq_chip *contr;
450 struct irq_data *node;
451 int i = *(loff_t *) v;
452
453 /* autovector interrupts */
454 if (irq_list[i]) {
455 contr = irq_chip[i];
456 node = irq_list[i];
457 seq_printf(p, "%-8s %3u: %10u %s", contr->name, i, kstat_cpu(0).irqs[i], node->devname);
458 while ((node = node->next))
459 seq_printf(p, ", %s", node->devname);
460 seq_puts(p, "\n");
461 }
462 return 0;
463}
464
465#ifdef CONFIG_PROC_FS
466void init_irq_proc(void)
467{
468 /* Insert /proc/irq driver here */
469}
470#endif
471
472#else /* CONFIG_GENERIC_HARDIRQS */
473 178
474asmlinkage void handle_badint(struct pt_regs *regs) 179asmlinkage void handle_badint(struct pt_regs *regs)
475{ 180{
476 atomic_inc(&irq_err_count); 181 atomic_inc(&irq_err_count);
477 pr_warn("unexpected interrupt from %u\n", regs->vector); 182 pr_warn("unexpected interrupt from %u\n", regs->vector);
478} 183}
479
480#endif /* CONFIG_GENERIC_HARDIRQS */