int-handler.S 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle and Andreas Busse
  7. *
  8. * Jazz family specific interrupt stuff
  9. *
  10. * To do: On Jazz machines we remap some non-ISA interrupts to ISA
  11. * interrupts. These interrupts should use their own vectors.
  12. * Squeeze the last cycles out of the handlers. Only a dead
  13. * cycle is a good cycle.
  14. */
  15. #include <asm/asm.h>
  16. #include <asm/mipsregs.h>
  17. #include <asm/jazz.h>
  18. #include <asm/regdef.h>
  19. #include <asm/stackframe.h>
  20. /*
  21. * jazz_handle_int: Interrupt handler for the ACER Pica-61 boards
  22. */
  23. .set noreorder
  24. NESTED(jazz_handle_int, PT_SIZE, ra)
  25. .set noat
  26. SAVE_ALL
  27. CLI
  28. .set at
  29. /*
  30. * Get pending interrupts
  31. */
  32. mfc0 t0,CP0_CAUSE # get pending interrupts
  33. mfc0 t1,CP0_STATUS # get enabled interrupts
  34. and t0,t1 # isolate allowed ones
  35. andi t0,0xff00 # isolate pending bits
  36. beqz t0,3f
  37. sll t0,16 # delay slot
  38. /*
  39. * Find irq with highest priority
  40. * FIXME: This is slow - use binary search
  41. */
  42. la t1,ll_vectors
  43. 1: bltz t0,2f # found pending irq
  44. sll t0,1
  45. b 1b
  46. subu t1,PTRSIZE # delay slot
  47. /*
  48. * Do the low-level stuff
  49. */
  50. 2: lw t0,(t1)
  51. jr t0
  52. nop # delay slot
  53. END(jazz_handle_int)
  54. ll_sw0: li s1,~IE_SW0
  55. mfc0 t0,CP0_CAUSE
  56. and t0,s1
  57. mtc0 t0,CP0_CAUSE
  58. PANIC("Unimplemented sw0 handler")
  59. ll_sw1: li s1,~IE_SW1
  60. mfc0 t0,CP0_CAUSE
  61. and t0,s1
  62. mtc0 t0,CP0_CAUSE
  63. PANIC("Unimplemented sw1 handler")
  64. ll_local_dma: li s1,~IE_IRQ0
  65. PANIC("Unimplemented local_dma handler")
  66. ll_local_dev: lbu t0,JAZZ_IO_IRQ_SOURCE
  67. #if PTRSIZE == 8 /* True 64 bit kernel */
  68. dsll t0,1
  69. #endif
  70. .set reorder
  71. LONG_L t0,local_vector(t0)
  72. jr t0
  73. .set noreorder
  74. /*
  75. * The braindead PICA hardware gives us no way to distinguish if we really
  76. * received interrupt 7 from the (E)ISA bus or if we just received an
  77. * interrupt with no findable cause. This sometimes happens with braindead
  78. * cards. Oh well - for all the Jazz boxes slots are more or less just
  79. * whistles and bells and we're aware of the problem.
  80. */
  81. ll_isa_irq: lw a0, JAZZ_EISA_IRQ_ACK
  82. jal do_IRQ
  83. move a1,sp
  84. j ret_from_irq
  85. nop
  86. /*
  87. * Hmm... This is not just a plain PC clone so the question is
  88. * which devices on Jazz machines can generate an (E)ISA NMI?
  89. * (Writing to nonexistent memory?)
  90. */
  91. ll_isa_nmi: li s1,~IE_IRQ3
  92. PANIC("Unimplemented isa_nmi handler")
  93. /*
  94. * Timer IRQ - remapped to be more similar to an IBM compatible.
  95. *
  96. * The timer interrupt is handled specially to ensure that the jiffies
  97. * variable is updated at all times. Specifically, the timer interrupt is
  98. * just like the complete handlers except that it is invoked with interrupts
  99. * disabled and should never re-enable them. If other interrupts were
  100. * allowed to be processed while the timer interrupt is active, then the
  101. * other interrupts would have to avoid using the jiffies variable for delay
  102. * and interval timing operations to avoid hanging the system.
  103. */
  104. ll_timer: lw zero,JAZZ_TIMER_REGISTER # timer irq cleared on read
  105. li s1,~IE_IRQ4
  106. li a0, JAZZ_TIMER_IRQ
  107. jal do_IRQ
  108. move a1,sp
  109. mfc0 t0,CP0_STATUS # disable interrupts again
  110. ori t0,1
  111. xori t0,1
  112. mtc0 t0,CP0_STATUS
  113. j ret_from_irq
  114. nop
  115. /*
  116. * CPU count/compare IRQ (unused)
  117. */
  118. ll_count: j ret_from_irq
  119. mtc0 zero,CP0_COMPARE
  120. #if 0
  121. /*
  122. * Call the handler for the interrupt
  123. * (Currently unused)
  124. */
  125. call_real: /*
  126. * temporarily disable interrupt
  127. */
  128. mfc0 t2,CP0_STATUS
  129. and t2,s1
  130. mtc0 t2,CP0_STATUS
  131. nor s1,zero,s1
  132. jal do_IRQ
  133. /*
  134. * reenable interrupt
  135. */
  136. mfc0 t2,CP0_STATUS
  137. or t2,s1
  138. mtc0 t2,CP0_STATUS
  139. j ret_from_irq
  140. #endif
  141. .data
  142. PTR ll_sw0 # SW0
  143. PTR ll_sw1 # SW1
  144. PTR ll_local_dma # Local DMA
  145. PTR ll_local_dev # Local devices
  146. PTR ll_isa_irq # ISA IRQ
  147. PTR ll_isa_nmi # ISA NMI
  148. PTR ll_timer # Timer
  149. ll_vectors: PTR ll_count # Count/Compare IRQ
  150. /*
  151. * Interrupt handlers for local devices.
  152. */
  153. .text
  154. .set reorder
  155. loc_no_irq: PANIC("Unimplemented loc_no_irq handler")
  156. /*
  157. * Parallel port IRQ
  158. */
  159. loc_parallel: li s1,~JAZZ_IE_PARALLEL
  160. li a0,JAZZ_PARALLEL_IRQ
  161. b loc_call
  162. /*
  163. * Floppy IRQ
  164. */
  165. loc_floppy: li s1,~JAZZ_IE_FLOPPY
  166. li a0,JAZZ_FLOPPY_IRQ
  167. b loc_call
  168. /*
  169. * Sound IRQ
  170. */
  171. loc_sound: PANIC("Unimplemented loc_sound handler")
  172. loc_video: PANIC("Unimplemented loc_video handler")
  173. /*
  174. * Ethernet interrupt handler
  175. */
  176. loc_ethernet: li s1,~JAZZ_IE_ETHERNET
  177. li a0,JAZZ_ETHERNET_IRQ
  178. b loc_call
  179. /*
  180. * SCSI interrupt handler
  181. */
  182. loc_scsi: li s1,~JAZZ_IE_SCSI
  183. li a0,JAZZ_SCSI_IRQ
  184. b loc_call
  185. /*
  186. * Keyboard interrupt handler
  187. */
  188. loc_keyboard: li s1,~JAZZ_IE_KEYBOARD
  189. li a0,JAZZ_KEYBOARD_IRQ
  190. b loc_call
  191. /*
  192. * Mouse interrupt handler
  193. */
  194. loc_mouse: li s1,~JAZZ_IE_MOUSE
  195. li a0,JAZZ_MOUSE_IRQ
  196. b loc_call
  197. /*
  198. * Serial port 1 IRQ
  199. */
  200. loc_serial1: li s1,~JAZZ_IE_SERIAL1
  201. li a0,JAZZ_SERIAL1_IRQ
  202. b loc_call
  203. /*
  204. * Serial port 2 IRQ
  205. */
  206. loc_serial2: li s1,~JAZZ_IE_SERIAL2
  207. li a0,JAZZ_SERIAL2_IRQ
  208. b loc_call
  209. /*
  210. * Call the interrupt handler for an interrupt generated by a
  211. * local device.
  212. */
  213. loc_call: /*
  214. * Temporarily disable interrupt source
  215. */
  216. lhu t2,JAZZ_IO_IRQ_ENABLE
  217. and t2,s1
  218. sh t2,JAZZ_IO_IRQ_ENABLE
  219. nor s1,zero,s1
  220. jal do_IRQ
  221. /*
  222. * Reenable interrupt
  223. */
  224. lhu t2,JAZZ_IO_IRQ_ENABLE
  225. or t2,s1
  226. sh t2,JAZZ_IO_IRQ_ENABLE
  227. j ret_from_irq
  228. /*
  229. * "Jump extender" to reach spurious_interrupt
  230. */
  231. 3: j spurious_interrupt
  232. /*
  233. * Vectors for interrupts generated by local devices
  234. */
  235. .data
  236. local_vector: PTR loc_no_irq
  237. PTR loc_parallel
  238. PTR loc_floppy
  239. PTR loc_sound
  240. PTR loc_video
  241. PTR loc_ethernet
  242. PTR loc_scsi
  243. PTR loc_keyboard
  244. PTR loc_mouse
  245. PTR loc_serial1
  246. PTR loc_serial2