sun3ints.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file COPYING in the main directory of this archive
  6. * for more details.
  7. */
  8. #include <linux/types.h>
  9. #include <linux/kernel.h>
  10. #include <linux/sched.h>
  11. #include <linux/kernel_stat.h>
  12. #include <linux/interrupt.h>
  13. #include <asm/segment.h>
  14. #include <asm/intersil.h>
  15. #include <asm/oplib.h>
  16. #include <asm/sun3ints.h>
  17. #include <linux/seq_file.h>
  18. extern void sun3_leds (unsigned char);
  19. void sun3_disable_interrupts(void)
  20. {
  21. sun3_disable_irq(0);
  22. }
  23. void sun3_enable_interrupts(void)
  24. {
  25. sun3_enable_irq(0);
  26. }
  27. int led_pattern[8] = {
  28. ~(0x80), ~(0x01),
  29. ~(0x40), ~(0x02),
  30. ~(0x20), ~(0x04),
  31. ~(0x10), ~(0x08)
  32. };
  33. volatile unsigned char* sun3_intreg;
  34. void sun3_enable_irq(unsigned int irq)
  35. {
  36. *sun3_intreg |= (1 << irq);
  37. }
  38. void sun3_disable_irq(unsigned int irq)
  39. {
  40. *sun3_intreg &= ~(1 << irq);
  41. }
  42. static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp)
  43. {
  44. *sun3_intreg |= (1 << irq);
  45. if (!(kstat_cpu(0).irqs[irq] % 2000))
  46. sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 16000) / 2000]);
  47. return IRQ_HANDLED;
  48. }
  49. static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp)
  50. {
  51. #ifdef CONFIG_SUN3
  52. intersil_clear();
  53. #endif
  54. *sun3_intreg |= (1 << irq);
  55. #ifdef CONFIG_SUN3
  56. intersil_clear();
  57. #endif
  58. do_timer(fp);
  59. #ifndef CONFIG_SMP
  60. update_process_times(user_mode(fp));
  61. #endif
  62. if (!(kstat_cpu(0).irqs[irq] % 20))
  63. sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]);
  64. return IRQ_HANDLED;
  65. }
  66. static irqreturn_t sun3_vec255(int irq, void *dev_id, struct pt_regs *fp)
  67. {
  68. // intersil_clear();
  69. return IRQ_HANDLED;
  70. }
  71. static void sun3_inthandle(unsigned int irq, struct pt_regs *fp)
  72. {
  73. *sun3_intreg &= ~(1 << irq);
  74. m68k_handle_int(irq, fp);
  75. }
  76. static struct irq_controller sun3_irq_controller = {
  77. .name = "sun3",
  78. .lock = SPIN_LOCK_UNLOCKED,
  79. .startup = m68k_irq_startup,
  80. .shutdown = m68k_irq_shutdown,
  81. .enable = sun3_enable_irq,
  82. .disable = sun3_disable_irq,
  83. };
  84. void sun3_init_IRQ(void)
  85. {
  86. *sun3_intreg = 1;
  87. m68k_setup_auto_interrupt(sun3_inthandle);
  88. m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7);
  89. m68k_setup_user_interrupt(VEC_USER, 192, NULL);
  90. request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL);
  91. request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL);
  92. request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL);
  93. }