irq.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #include <linux/irq.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/kernel_stat.h>
  13. #include <linux/seq_file.h>
  14. #include <asm/irq.h>
  15. #include <asm/processor.h>
  16. #include <asm/cpu/mmu_context.h>
  17. /*
  18. * 'what should we do if we get a hw irq event on an illegal vector'.
  19. * each architecture has to answer this themselves, it doesn't deserve
  20. * a generic callback i think.
  21. */
  22. void ack_bad_irq(unsigned int irq)
  23. {
  24. printk("unexpected IRQ trap at vector %02x\n", irq);
  25. }
  26. #if defined(CONFIG_PROC_FS)
  27. int show_interrupts(struct seq_file *p, void *v)
  28. {
  29. int i = *(loff_t *) v, j;
  30. struct irqaction * action;
  31. unsigned long flags;
  32. if (i == 0) {
  33. seq_puts(p, " ");
  34. for (j=0; j<NR_CPUS; j++)
  35. if (cpu_online(j))
  36. seq_printf(p, "CPU%d ",j);
  37. seq_putc(p, '\n');
  38. }
  39. if (i < NR_IRQS) {
  40. spin_lock_irqsave(&irq_desc[i].lock, flags);
  41. action = irq_desc[i].action;
  42. if (!action)
  43. goto unlock;
  44. seq_printf(p, "%3d: ",i);
  45. seq_printf(p, "%10u ", kstat_irqs(i));
  46. seq_printf(p, " %14s", irq_desc[i].handler->typename);
  47. seq_printf(p, " %s", action->name);
  48. for (action=action->next; action; action = action->next)
  49. seq_printf(p, ", %s", action->name);
  50. seq_putc(p, '\n');
  51. unlock:
  52. spin_unlock_irqrestore(&irq_desc[i].lock, flags);
  53. }
  54. return 0;
  55. }
  56. #endif
  57. asmlinkage int do_IRQ(unsigned long r4, unsigned long r5,
  58. unsigned long r6, unsigned long r7,
  59. struct pt_regs regs)
  60. {
  61. int irq = r4;
  62. irq_enter();
  63. #ifdef CONFIG_CPU_HAS_INTEVT
  64. __asm__ __volatile__ (
  65. #ifdef CONFIG_CPU_HAS_SR_RB
  66. "stc r2_bank, %0\n\t"
  67. #else
  68. "mov.l @%1, %0\n\t"
  69. #endif
  70. "shlr2 %0\n\t"
  71. "shlr2 %0\n\t"
  72. "shlr %0\n\t"
  73. "add #-16, %0\n\t"
  74. : "=z" (irq), "=r" (r4)
  75. : "1" (INTEVT)
  76. : "memory"
  77. );
  78. #endif
  79. irq = irq_demux(irq);
  80. __do_IRQ(irq, &regs);
  81. irq_exit();
  82. return 1;
  83. }