blob: 7db26f1f082d097f24ffa51da083694e05f47a5a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/m32r/kernel/irq.c
3 *
4 * Copyright (c) 2003, 2004 Hitoshi Yamamoto
5 * Copyright (c) 2004 Hirokazu Takata <takata at linux-m32r.org>
6 */
7
8/*
9 * linux/arch/i386/kernel/irq.c
10 *
11 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
12 *
13 * This file contains the lowest level m32r-specific interrupt
14 * entry and irq statistics code. All the remaining irq logic is
15 * done by the generic kernel/irq/ code and in the
16 * m32r-specific irq controller code.
17 */
18
19#include <linux/kernel_stat.h>
20#include <linux/interrupt.h>
21#include <linux/seq_file.h>
22#include <linux/module.h>
23#include <asm/uaccess.h>
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025/*
26 * Generic, controller-independent functions:
27 */
28
29int show_interrupts(struct seq_file *p, void *v)
30{
31 int i = *(loff_t *) v, j;
32 struct irqaction * action;
33 unsigned long flags;
34
35 if (i == 0) {
36 seq_printf(p, " ");
Andrew Morton394e3902006-03-23 03:01:05 -080037 for_each_online_cpu(j)
38 seq_printf(p, "CPU%d ",j);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 seq_putc(p, '\n');
40 }
41
42 if (i < NR_IRQS) {
Thomas Gleixner239007b2009-11-17 16:46:45 +010043 raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 action = irq_desc[i].action;
45 if (!action)
46 goto skip;
47 seq_printf(p, "%3d: ",i);
48#ifndef CONFIG_SMP
49 seq_printf(p, "%10u ", kstat_irqs(i));
50#else
Andrew Morton394e3902006-03-23 03:01:05 -080051 for_each_online_cpu(j)
Yinghai Ludee41022009-01-11 00:29:15 -080052 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#endif
Thomas Gleixnerd1ea13c2010-09-23 18:40:07 +020054 seq_printf(p, " %14s", irq_desc[i].chip->name);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 seq_printf(p, " %s", action->name);
56
57 for (action=action->next; action; action = action->next)
58 seq_printf(p, ", %s", action->name);
59
60 seq_putc(p, '\n');
61skip:
Thomas Gleixner239007b2009-11-17 16:46:45 +010062 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 }
64 return 0;
65}
66
67/*
Simon Arlott5aa8b6c2007-10-20 01:14:39 +020068 * do_IRQ handles all normal device IRQs (the special
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 * SMP cross-CPU interrupts have their own specific
70 * handlers).
71 */
72asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs)
73{
Al Viro9c8e7f52006-10-07 16:29:18 +010074 struct pt_regs *old_regs;
75 old_regs = set_irq_regs(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 irq_enter();
77
78#ifdef CONFIG_DEBUG_STACKOVERFLOW
79 /* FIXME M32R */
80#endif
Al Viro9c8e7f52006-10-07 16:29:18 +010081 __do_IRQ(irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 irq_exit();
Al Viro9c8e7f52006-10-07 16:29:18 +010083 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85 return 1;
86}