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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | /* |
| 26 | * Generic, controller-independent functions: |
| 27 | */ |
| 28 | |
| 29 | int 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 Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 37 | for_each_online_cpu(j) |
| 38 | seq_printf(p, "CPU%d ",j); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | seq_putc(p, '\n'); |
| 40 | } |
| 41 | |
| 42 | if (i < NR_IRQS) { |
Thomas Gleixner | 863018a | 2010-09-22 19:13:16 +0200 | [diff] [blame] | 43 | struct irq_desc *desc = irq_to_desc(i); |
| 44 | |
| 45 | raw_spin_lock_irqsave(&desc->lock, flags); |
| 46 | action = desc->action; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | if (!action) |
| 48 | goto skip; |
| 49 | seq_printf(p, "%3d: ",i); |
| 50 | #ifndef CONFIG_SMP |
| 51 | seq_printf(p, "%10u ", kstat_irqs(i)); |
| 52 | #else |
Andrew Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 53 | for_each_online_cpu(j) |
Yinghai Lu | dee4102 | 2009-01-11 00:29:15 -0800 | [diff] [blame] | 54 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | #endif |
Thomas Gleixner | 863018a | 2010-09-22 19:13:16 +0200 | [diff] [blame] | 56 | seq_printf(p, " %14s", desc->irq_data.chip->name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | seq_printf(p, " %s", action->name); |
| 58 | |
| 59 | for (action=action->next; action; action = action->next) |
| 60 | seq_printf(p, ", %s", action->name); |
| 61 | |
| 62 | seq_putc(p, '\n'); |
| 63 | skip: |
Thomas Gleixner | 863018a | 2010-09-22 19:13:16 +0200 | [diff] [blame] | 64 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | } |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | /* |
Simon Arlott | 5aa8b6c | 2007-10-20 01:14:39 +0200 | [diff] [blame] | 70 | * do_IRQ handles all normal device IRQs (the special |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | * SMP cross-CPU interrupts have their own specific |
| 72 | * handlers). |
| 73 | */ |
| 74 | asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs) |
| 75 | { |
Al Viro | 9c8e7f5 | 2006-10-07 16:29:18 +0100 | [diff] [blame] | 76 | struct pt_regs *old_regs; |
| 77 | old_regs = set_irq_regs(regs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | irq_enter(); |
| 79 | |
| 80 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 81 | /* FIXME M32R */ |
| 82 | #endif |
Thomas Gleixner | a9fe8d5 | 2011-02-05 21:39:28 +0100 | [diff] [blame^] | 83 | generic_handle_irq(irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | irq_exit(); |
Al Viro | 9c8e7f5 | 2006-10-07 16:29:18 +0100 | [diff] [blame] | 85 | set_irq_regs(old_regs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
| 87 | return 1; |
| 88 | } |