Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 1 | /* |
| 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 Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 10 | */ |
| 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 | |
| 19 | /* |
| 20 | * 'what should we do if we get a hw irq event on an illegal vector'. |
| 21 | * each architecture has to answer this themselves. |
| 22 | */ |
| 23 | void ack_bad_irq(unsigned int irq) |
| 24 | { |
| 25 | printk("unexpected IRQ %u\n", irq); |
| 26 | } |
| 27 | |
Haavard Skinnemoen | e7ba176 | 2007-10-10 14:58:29 +0200 | [diff] [blame^] | 28 | /* May be overridden by platform code */ |
| 29 | int __weak nmi_enable(void) |
| 30 | { |
| 31 | return -ENOSYS; |
| 32 | } |
| 33 | |
| 34 | void __weak nmi_disable(void) |
| 35 | { |
| 36 | |
| 37 | } |
| 38 | |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 39 | #ifdef CONFIG_PROC_FS |
| 40 | int show_interrupts(struct seq_file *p, void *v) |
| 41 | { |
| 42 | int i = *(loff_t *)v, cpu; |
| 43 | struct irqaction *action; |
| 44 | unsigned long flags; |
| 45 | |
| 46 | if (i == 0) { |
| 47 | seq_puts(p, " "); |
| 48 | for_each_online_cpu(cpu) |
| 49 | seq_printf(p, "CPU%d ", cpu); |
| 50 | seq_putc(p, '\n'); |
| 51 | } |
| 52 | |
| 53 | if (i < NR_IRQS) { |
| 54 | spin_lock_irqsave(&irq_desc[i].lock, flags); |
| 55 | action = irq_desc[i].action; |
| 56 | if (!action) |
| 57 | goto unlock; |
| 58 | |
| 59 | seq_printf(p, "%3d: ", i); |
| 60 | for_each_online_cpu(cpu) |
| 61 | seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[i]); |
David Brownell | 914ab06 | 2007-01-23 20:12:15 -0800 | [diff] [blame] | 62 | seq_printf(p, " %8s", irq_desc[i].chip->name ? : "-"); |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 63 | seq_printf(p, " %s", action->name); |
| 64 | for (action = action->next; action; action = action->next) |
| 65 | seq_printf(p, ", %s", action->name); |
| 66 | |
| 67 | seq_putc(p, '\n'); |
| 68 | unlock: |
| 69 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
| 70 | } |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | #endif |