sun3ints.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 <asm/irq_regs.h>
  18. #include <linux/seq_file.h>
  19. extern void sun3_leds (unsigned char);
  20. void sun3_disable_interrupts(void)
  21. {
  22. sun3_disable_irq(0);
  23. }
  24. void sun3_enable_interrupts(void)
  25. {
  26. sun3_enable_irq(0);
  27. }
  28. static int led_pattern[8] = {
  29. ~(0x80), ~(0x01),
  30. ~(0x40), ~(0x02),
  31. ~(0x20), ~(0x04),
  32. ~(0x10), ~(0x08)
  33. };
  34. volatile unsigned char* sun3_intreg;
  35. void sun3_enable_irq(unsigned int irq)
  36. {
  37. *sun3_intreg |= (1 << irq);
  38. }
  39. void sun3_disable_irq(unsigned int irq)
  40. {
  41. *sun3_intreg &= ~(1 << irq);
  42. }
  43. static irqreturn_t sun3_int7(int irq, void *dev_id)
  44. {
  45. unsigned int cnt;
  46. cnt = kstat_irqs_cpu(irq, 0);
  47. if (!(cnt % 2000))
  48. sun3_leds(led_pattern[cnt % 16000 / 2000]);
  49. return IRQ_HANDLED;
  50. }
  51. static irqreturn_t sun3_int5(int irq, void *dev_id)
  52. {
  53. unsigned int cnt;
  54. #ifdef CONFIG_SUN3
  55. intersil_clear();
  56. #endif
  57. sun3_disable_irq(5);
  58. sun3_enable_irq(5);
  59. #ifdef CONFIG_SUN3
  60. intersil_clear();
  61. #endif
  62. xtime_update(1);
  63. update_process_times(user_mode(get_irq_regs()));
  64. cnt = kstat_irqs_cpu(irq, 0);
  65. if (!(cnt % 20))
  66. sun3_leds(led_pattern[cnt % 160 / 20]);
  67. return IRQ_HANDLED;
  68. }
  69. static irqreturn_t sun3_vec255(int irq, void *dev_id)
  70. {
  71. return IRQ_HANDLED;
  72. }
  73. void __init sun3_init_IRQ(void)
  74. {
  75. *sun3_intreg = 1;
  76. m68k_setup_user_interrupt(VEC_USER, 128);
  77. if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "clock", NULL))
  78. pr_err("Couldn't register %s interrupt\n", "int5");
  79. if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "nmi", NULL))
  80. pr_err("Couldn't register %s interrupt\n", "int7");
  81. if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
  82. pr_err("Couldn't register %s interrupt\n", "vec255");
  83. }