irq.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. * linux/arch/i386/kernel/irq.c
  9. *
  10. * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
  11. *
  12. * This file contains the lowest level m32r-specific interrupt
  13. * entry and irq statistics code. All the remaining irq logic is
  14. * done by the generic kernel/irq/ code and in the
  15. * m32r-specific irq controller code.
  16. */
  17. #include <linux/kernel_stat.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/seq_file.h>
  20. #include <linux/module.h>
  21. #include <asm/uaccess.h>
  22. atomic_t irq_err_count;
  23. atomic_t irq_mis_count;
  24. /*
  25. * Generic, controller-independent functions:
  26. */
  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_printf(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 skip;
  44. seq_printf(p, "%3d: ",i);
  45. #ifndef CONFIG_SMP
  46. seq_printf(p, "%10u ", kstat_irqs(i));
  47. #else
  48. for (j = 0; j < NR_CPUS; j++)
  49. if (cpu_online(j))
  50. seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
  51. #endif
  52. seq_printf(p, " %14s", irq_desc[i].handler->typename);
  53. seq_printf(p, " %s", action->name);
  54. for (action=action->next; action; action = action->next)
  55. seq_printf(p, ", %s", action->name);
  56. seq_putc(p, '\n');
  57. skip:
  58. spin_unlock_irqrestore(&irq_desc[i].lock, flags);
  59. } else if (i == NR_IRQS) {
  60. seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
  61. seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
  62. }
  63. return 0;
  64. }
  65. /*
  66. * do_IRQ handles all normal device IRQ's (the special
  67. * SMP cross-CPU interrupts have their own specific
  68. * handlers).
  69. */
  70. asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs)
  71. {
  72. irq_enter();
  73. #ifdef CONFIG_DEBUG_STACKOVERFLOW
  74. /* FIXME M32R */
  75. #endif
  76. __do_IRQ(irq, regs);
  77. irq_exit();
  78. return 1;
  79. }