1 /* $Id: irq.c,v 1.20 2004/01/13 05:52:11 kkojima Exp $ 2 * 3 * linux/arch/sh/kernel/irq.c 4 * 5 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 6 * 7 * 8 * SuperH version: Copyright (C) 1999 Niibe Yutaka 9 */ 10 11 #include <linux/irq.h> 12 #include <linux/interrupt.h> 13 #include <linux/kernel_stat.h> 14 #include <linux/seq_file.h> 15 #include <asm/irq.h> 16 #include <asm/processor.h> 17 #include <asm/cpu/mmu_context.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, it doesn't deserve 22 * a generic callback i think. 23 */ 24 void ack_bad_irq(unsigned int irq) 25 { 26 printk("unexpected IRQ trap at vector %02x\n", irq); 27 } 28 29 #if defined(CONFIG_PROC_FS) 30 int show_interrupts(struct seq_file *p, void *v) 31 { 32 int i = *(loff_t *) v, j; 33 struct irqaction * action; 34 unsigned long flags; 35 36 if (i == 0) { 37 seq_puts(p, " "); 38 for (j=0; j<NR_CPUS; j++) 39 if (cpu_online(j)) 40 seq_printf(p, "CPU%d ",j); 41 seq_putc(p, '\n'); 42 } 43 44 if (i < NR_IRQS) { 45 spin_lock_irqsave(&irq_desc[i].lock, flags); 46 action = irq_desc[i].action; 47 if (!action) 48 goto unlock; 49 seq_printf(p, "%3d: ",i); 50 seq_printf(p, "%10u ", kstat_irqs(i)); 51 seq_printf(p, " %14s", irq_desc[i].handler->typename); 52 seq_printf(p, " %s", action->name); 53 54 for (action=action->next; action; action = action->next) 55 seq_printf(p, ", %s", action->name); 56 seq_putc(p, '\n'); 57 unlock: 58 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 59 } 60 return 0; 61 } 62 #endif 63 64 65 asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, 66 unsigned long r6, unsigned long r7, 67 struct pt_regs regs) 68 { 69 int irq = r4; 70 71 irq_enter(); 72 73 #ifdef CONFIG_CPU_HAS_INTEVT 74 __asm__ __volatile__ ( 75 #ifdef CONFIG_CPU_HAS_SR_RB 76 "stc r2_bank, %0\n\t" 77 #else 78 "mov.l @%1, %0\n\t" 79 #endif 80 "shlr2 %0\n\t" 81 "shlr2 %0\n\t" 82 "shlr %0\n\t" 83 "add #-16, %0\n\t" 84 : "=z" (irq), "=r" (r4) 85 : "1" (INTEVT) 86 : "memory" 87 ); 88 #endif 89 90 irq = irq_demux(irq); 91 __do_IRQ(irq, ®s); 92 irq_exit(); 93 return 1; 94 } 95