irq.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. /*
  23. * Generic, controller-independent functions:
  24. */
  25. int show_interrupts(struct seq_file *p, void *v)
  26. {
  27. int i = *(loff_t *) v, j;
  28. struct irqaction * action;
  29. unsigned long flags;
  30. if (i == 0) {
  31. seq_printf(p, " ");
  32. for_each_online_cpu(j)
  33. seq_printf(p, "CPU%d ",j);
  34. seq_putc(p, '\n');
  35. }
  36. if (i < NR_IRQS) {
  37. struct irq_desc *desc = irq_to_desc(i);
  38. raw_spin_lock_irqsave(&desc->lock, flags);
  39. action = desc->action;
  40. if (!action)
  41. goto skip;
  42. seq_printf(p, "%3d: ",i);
  43. #ifndef CONFIG_SMP
  44. seq_printf(p, "%10u ", kstat_irqs(i));
  45. #else
  46. for_each_online_cpu(j)
  47. seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
  48. #endif
  49. seq_printf(p, " %14s", desc->irq_data.chip->name);
  50. seq_printf(p, " %s", action->name);
  51. for (action=action->next; action; action = action->next)
  52. seq_printf(p, ", %s", action->name);
  53. seq_putc(p, '\n');
  54. skip:
  55. raw_spin_unlock_irqrestore(&desc->lock, flags);
  56. }
  57. return 0;
  58. }
  59. /*
  60. * do_IRQ handles all normal device IRQs (the special
  61. * SMP cross-CPU interrupts have their own specific
  62. * handlers).
  63. */
  64. asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs)
  65. {
  66. struct pt_regs *old_regs;
  67. old_regs = set_irq_regs(regs);
  68. irq_enter();
  69. #ifdef CONFIG_DEBUG_STACKOVERFLOW
  70. /* FIXME M32R */
  71. #endif
  72. generic_handle_irq(irq);
  73. irq_exit();
  74. set_irq_regs(old_regs);
  75. return 1;
  76. }