| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 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 |  | 
|  | 25 | atomic_t irq_err_count; | 
|  | 26 | atomic_t irq_mis_count; | 
|  | 27 |  | 
|  | 28 | /* | 
|  | 29 | * Generic, controller-independent functions: | 
|  | 30 | */ | 
|  | 31 |  | 
|  | 32 | int show_interrupts(struct seq_file *p, void *v) | 
|  | 33 | { | 
|  | 34 | int i = *(loff_t *) v, j; | 
|  | 35 | struct irqaction * action; | 
|  | 36 | unsigned long flags; | 
|  | 37 |  | 
|  | 38 | if (i == 0) { | 
|  | 39 | seq_printf(p, "           "); | 
| Andrew Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 40 | for_each_online_cpu(j) | 
|  | 41 | seq_printf(p, "CPU%d       ",j); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | seq_putc(p, '\n'); | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 | if (i < NR_IRQS) { | 
|  | 46 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 
|  | 47 | action = irq_desc[i].action; | 
|  | 48 | if (!action) | 
|  | 49 | goto skip; | 
|  | 50 | seq_printf(p, "%3d: ",i); | 
|  | 51 | #ifndef CONFIG_SMP | 
|  | 52 | seq_printf(p, "%10u ", kstat_irqs(i)); | 
|  | 53 | #else | 
| Andrew Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 54 | for_each_online_cpu(j) | 
|  | 55 | seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #endif | 
| Ingo Molnar | d1bef4e | 2006-06-29 02:24:36 -0700 | [diff] [blame] | 57 | seq_printf(p, " %14s", irq_desc[i].chip->typename); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | seq_printf(p, "  %s", action->name); | 
|  | 59 |  | 
|  | 60 | for (action=action->next; action; action = action->next) | 
|  | 61 | seq_printf(p, ", %s", action->name); | 
|  | 62 |  | 
|  | 63 | seq_putc(p, '\n'); | 
|  | 64 | skip: | 
|  | 65 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 
|  | 66 | } else if (i == NR_IRQS) { | 
|  | 67 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | 
|  | 68 | seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); | 
|  | 69 | } | 
|  | 70 | return 0; | 
|  | 71 | } | 
|  | 72 |  | 
|  | 73 | /* | 
| Simon Arlott | 5aa8b6c | 2007-10-20 01:14:39 +0200 | [diff] [blame] | 74 | * do_IRQ handles all normal device IRQs (the special | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | * SMP cross-CPU interrupts have their own specific | 
|  | 76 | * handlers). | 
|  | 77 | */ | 
|  | 78 | asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs) | 
|  | 79 | { | 
| Al Viro | 9c8e7f5 | 2006-10-07 16:29:18 +0100 | [diff] [blame] | 80 | struct pt_regs *old_regs; | 
|  | 81 | old_regs = set_irq_regs(regs); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | irq_enter(); | 
|  | 83 |  | 
|  | 84 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 
|  | 85 | /* FIXME M32R */ | 
|  | 86 | #endif | 
| Al Viro | 9c8e7f5 | 2006-10-07 16:29:18 +0100 | [diff] [blame] | 87 | __do_IRQ(irq); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | irq_exit(); | 
| Al Viro | 9c8e7f5 | 2006-10-07 16:29:18 +0100 | [diff] [blame] | 89 | set_irq_regs(old_regs); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 |  | 
|  | 91 | return 1; | 
|  | 92 | } |