blob: 9604f7758f9a6e84f00779e036c4625073e9fd46 [file] [log] [blame]
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -07001/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * Based on arch/i386/kernel/irq.c
5 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070010 */
11
12#include <linux/interrupt.h>
13#include <linux/irq.h>
14#include <linux/kernel_stat.h>
15#include <linux/proc_fs.h>
16#include <linux/seq_file.h>
17#include <linux/sysdev.h>
18
Haavard Skinnemoene7ba1762007-10-10 14:58:29 +020019/* May be overridden by platform code */
20int __weak nmi_enable(void)
21{
22 return -ENOSYS;
23}
24
25void __weak nmi_disable(void)
26{
27
28}
29
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070030#ifdef CONFIG_PROC_FS
31int show_interrupts(struct seq_file *p, void *v)
32{
33 int i = *(loff_t *)v, cpu;
34 struct irqaction *action;
35 unsigned long flags;
36
37 if (i == 0) {
38 seq_puts(p, " ");
39 for_each_online_cpu(cpu)
40 seq_printf(p, "CPU%d ", cpu);
41 seq_putc(p, '\n');
42 }
43
44 if (i < NR_IRQS) {
Thomas Gleixner239007b2009-11-17 16:46:45 +010045 raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070046 action = irq_desc[i].action;
47 if (!action)
48 goto unlock;
49
50 seq_printf(p, "%3d: ", i);
51 for_each_online_cpu(cpu)
Yinghai Lu0b0f0b12009-01-11 13:35:56 -080052 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu));
David Brownell914ab062007-01-23 20:12:15 -080053 seq_printf(p, " %8s", irq_desc[i].chip->name ? : "-");
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070054 seq_printf(p, " %s", action->name);
55 for (action = action->next; action; action = action->next)
56 seq_printf(p, ", %s", action->name);
57
58 seq_putc(p, '\n');
59 unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +010060 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070061 }
62
63 return 0;
64}
65#endif