| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * This file is subject to the terms and conditions of the GNU General Public | 
|  | 3 | * License.  See the file "COPYING" in the main directory of this archive | 
|  | 4 | * for more details. | 
|  | 5 | * | 
|  | 6 | * arch/sh64/kernel/irq.c | 
|  | 7 | * | 
|  | 8 | * Copyright (C) 2000, 2001  Paolo Alberelli | 
|  | 9 | * Copyright (C) 2003  Paul Mundt | 
|  | 10 | * | 
|  | 11 | */ | 
|  | 12 |  | 
|  | 13 | /* | 
|  | 14 | * IRQs are in fact implemented a bit like signal handlers for the kernel. | 
|  | 15 | * Naturally it's not a 1:1 relation, but there are similarities. | 
|  | 16 | */ | 
|  | 17 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/errno.h> | 
|  | 19 | #include <linux/kernel_stat.h> | 
|  | 20 | #include <linux/signal.h> | 
|  | 21 | #include <linux/rwsem.h> | 
|  | 22 | #include <linux/sched.h> | 
|  | 23 | #include <linux/ioport.h> | 
|  | 24 | #include <linux/interrupt.h> | 
|  | 25 | #include <linux/timex.h> | 
|  | 26 | #include <linux/slab.h> | 
|  | 27 | #include <linux/random.h> | 
|  | 28 | #include <linux/smp.h> | 
|  | 29 | #include <linux/smp_lock.h> | 
|  | 30 | #include <linux/init.h> | 
|  | 31 | #include <linux/seq_file.h> | 
|  | 32 | #include <linux/bitops.h> | 
|  | 33 | #include <asm/system.h> | 
|  | 34 | #include <asm/io.h> | 
|  | 35 | #include <asm/smp.h> | 
|  | 36 | #include <asm/pgalloc.h> | 
|  | 37 | #include <asm/delay.h> | 
|  | 38 | #include <asm/irq.h> | 
|  | 39 | #include <linux/irq.h> | 
|  | 40 |  | 
|  | 41 | void ack_bad_irq(unsigned int irq) | 
|  | 42 | { | 
|  | 43 | printk("unexpected IRQ trap at irq %02x\n", irq); | 
|  | 44 | } | 
|  | 45 |  | 
|  | 46 | #if defined(CONFIG_PROC_FS) | 
|  | 47 | int show_interrupts(struct seq_file *p, void *v) | 
|  | 48 | { | 
|  | 49 | int i = *(loff_t *) v, j; | 
|  | 50 | struct irqaction * action; | 
|  | 51 | unsigned long flags; | 
|  | 52 |  | 
|  | 53 | if (i == 0) { | 
|  | 54 | seq_puts(p, "           "); | 
| Andrew Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 55 | for_each_online_cpu(j) | 
|  | 56 | seq_printf(p, "CPU%d       ",j); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | seq_putc(p, '\n'); | 
|  | 58 | } | 
|  | 59 |  | 
|  | 60 | if (i < NR_IRQS) { | 
|  | 61 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 
|  | 62 | action = irq_desc[i].action; | 
|  | 63 | if (!action) | 
|  | 64 | goto unlock; | 
|  | 65 | seq_printf(p, "%3d: ",i); | 
|  | 66 | seq_printf(p, "%10u ", kstat_irqs(i)); | 
| Ingo Molnar | d1bef4e | 2006-06-29 02:24:36 -0700 | [diff] [blame] | 67 | seq_printf(p, " %14s", irq_desc[i].chip->typename); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | seq_printf(p, "  %s", action->name); | 
|  | 69 |  | 
|  | 70 | for (action=action->next; action; action = action->next) | 
|  | 71 | seq_printf(p, ", %s", action->name); | 
|  | 72 | seq_putc(p, '\n'); | 
|  | 73 | unlock: | 
|  | 74 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 
|  | 75 | } | 
|  | 76 | return 0; | 
|  | 77 | } | 
|  | 78 | #endif | 
|  | 79 |  | 
|  | 80 | /* | 
|  | 81 | * do_NMI handles all Non-Maskable Interrupts. | 
|  | 82 | */ | 
|  | 83 | asmlinkage void do_NMI(unsigned long vector_num, struct pt_regs * regs) | 
|  | 84 | { | 
|  | 85 | if (regs->sr & 0x40000000) | 
|  | 86 | printk("unexpected NMI trap in system mode\n"); | 
|  | 87 | else | 
|  | 88 | printk("unexpected NMI trap in user mode\n"); | 
|  | 89 |  | 
|  | 90 | /* No statistics */ | 
|  | 91 | } | 
|  | 92 |  | 
|  | 93 | /* | 
|  | 94 | * do_IRQ handles all normal device IRQ's. | 
|  | 95 | */ | 
|  | 96 | asmlinkage int do_IRQ(unsigned long vector_num, struct pt_regs * regs) | 
|  | 97 | { | 
|  | 98 | int irq; | 
|  | 99 |  | 
|  | 100 | irq_enter(); | 
|  | 101 |  | 
|  | 102 | irq = irq_demux(vector_num); | 
|  | 103 |  | 
|  | 104 | if (irq >= 0) { | 
|  | 105 | __do_IRQ(irq, regs); | 
|  | 106 | } else { | 
|  | 107 | printk("unexpected IRQ trap at vector %03lx\n", vector_num); | 
|  | 108 | } | 
|  | 109 |  | 
|  | 110 | irq_exit(); | 
|  | 111 |  | 
|  | 112 | return 1; | 
|  | 113 | } | 
|  | 114 |  |