irq.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_each_online_cpu(j)
  35. seq_printf(p, "CPU%d ",j);
  36. seq_putc(p, '\n');
  37. }
  38. if (i < NR_IRQS) {
  39. spin_lock_irqsave(&irq_desc[i].lock, flags);
  40. action = irq_desc[i].action;
  41. if (!action)
  42. goto skip;
  43. seq_printf(p, "%3d: ",i);
  44. #ifndef CONFIG_SMP
  45. seq_printf(p, "%10u ", kstat_irqs(i));
  46. #else
  47. for_each_online_cpu(j)
  48. seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
  49. #endif
  50. seq_printf(p, " %14s", irq_desc[i].chip->typename);
  51. seq_printf(p, " %s", action->name);
  52. for (action=action->next; action; action = action->next)
  53. seq_printf(p, ", %s", action->name);
  54. seq_putc(p, '\n');
  55. skip:
  56. spin_unlock_irqrestore(&irq_desc[i].lock, flags);
  57. } else if (i == NR_IRQS) {
  58. seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
  59. seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
  60. }
  61. return 0;
  62. }
  63. /*
  64. * do_IRQ handles all normal device IRQ's (the special
  65. * SMP cross-CPU interrupts have their own specific
  66. * handlers).
  67. */
  68. asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs)
  69. {
  70. struct pt_regs *old_regs;
  71. old_regs = set_irq_regs(regs);
  72. irq_enter();
  73. #ifdef CONFIG_DEBUG_STACKOVERFLOW
  74. /* FIXME M32R */
  75. #endif
  76. __do_IRQ(irq);
  77. irq_exit();
  78. set_irq_regs(old_regs);
  79. return 1;
  80. }