interrupt.S 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*
  2. * File: arch/blackfin/mach-common/interrupt.S
  3. * Based on:
  4. * Author: D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>
  5. * Kenneth Albanowski <kjahds@kjahds.com>
  6. *
  7. * Created: ?
  8. * Description: Interrupt Entries
  9. *
  10. * Modified:
  11. * Copyright 2004-2006 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #include <asm/blackfin.h>
  31. #include <asm/mach/irq.h>
  32. #include <linux/autoconf.h>
  33. #include <linux/linkage.h>
  34. #include <asm/entry.h>
  35. #include <asm/asm-offsets.h>
  36. #include <asm/mach-common/context.S>
  37. #ifdef CONFIG_I_ENTRY_L1
  38. .section .l1.text
  39. #else
  40. .text
  41. #endif
  42. .align 4 /* just in case */
  43. /*
  44. * initial interrupt handlers
  45. */
  46. #ifndef CONFIG_KGDB
  47. /* interrupt routine for emulation - 0 */
  48. /* Currently used only if GDB stub is not in - invalid */
  49. /* gdb-stub set the evt itself */
  50. /* save registers for post-mortem only */
  51. ENTRY(_evt_emulation)
  52. SAVE_ALL_SYS
  53. #ifdef CONFIG_FRAME_POINTER
  54. fp = 0;
  55. #endif
  56. r0 = IRQ_EMU;
  57. r1 = sp;
  58. SP += -12;
  59. call _irq_panic;
  60. SP += 12;
  61. /* - GDB stub fills this in by itself (if defined) */
  62. rte;
  63. #endif
  64. /* Common interrupt entry code. First we do CLI, then push
  65. * RETI, to keep interrupts disabled, but to allow this state to be changed
  66. * by local_bh_enable.
  67. * R0 contains the interrupt number, while R1 may contain the value of IPEND,
  68. * or garbage if IPEND won't be needed by the ISR. */
  69. __common_int_entry:
  70. [--sp] = fp;
  71. [--sp] = usp;
  72. [--sp] = i0;
  73. [--sp] = i1;
  74. [--sp] = i2;
  75. [--sp] = i3;
  76. [--sp] = m0;
  77. [--sp] = m1;
  78. [--sp] = m2;
  79. [--sp] = m3;
  80. [--sp] = l0;
  81. [--sp] = l1;
  82. [--sp] = l2;
  83. [--sp] = l3;
  84. [--sp] = b0;
  85. [--sp] = b1;
  86. [--sp] = b2;
  87. [--sp] = b3;
  88. [--sp] = a0.x;
  89. [--sp] = a0.w;
  90. [--sp] = a1.x;
  91. [--sp] = a1.w;
  92. [--sp] = LC0;
  93. [--sp] = LC1;
  94. [--sp] = LT0;
  95. [--sp] = LT1;
  96. [--sp] = LB0;
  97. [--sp] = LB1;
  98. [--sp] = ASTAT;
  99. [--sp] = r0; /* Skip reserved */
  100. [--sp] = RETS;
  101. r2 = RETI;
  102. [--sp] = r2;
  103. [--sp] = RETX;
  104. [--sp] = RETN;
  105. [--sp] = RETE;
  106. [--sp] = SEQSTAT;
  107. [--sp] = r1; /* IPEND - R1 may or may not be set up before jumping here. */
  108. /* Switch to other method of keeping interrupts disabled. */
  109. #ifdef CONFIG_DEBUG_HWERR
  110. r1 = 0x3f;
  111. sti r1;
  112. #else
  113. cli r1;
  114. #endif
  115. [--sp] = RETI; /* orig_pc */
  116. /* Clear all L registers. */
  117. r1 = 0 (x);
  118. l0 = r1;
  119. l1 = r1;
  120. l2 = r1;
  121. l3 = r1;
  122. #ifdef CONFIG_FRAME_POINTER
  123. fp = 0;
  124. #endif
  125. #ifdef ANOMALY_05000283
  126. cc = r7 == r7;
  127. p5.h = 0xffc0;
  128. p5.l = 0x0014;
  129. if cc jump 1f;
  130. r7.l = W[p5];
  131. 1:
  132. #endif
  133. r1 = sp;
  134. SP += -12;
  135. call _do_irq;
  136. SP += 12;
  137. call _return_from_int;
  138. .Lcommon_restore_context:
  139. RESTORE_CONTEXT
  140. rti;
  141. /* interrupt routine for ivhw - 5 */
  142. ENTRY(_evt_ivhw)
  143. SAVE_CONTEXT
  144. #ifdef CONFIG_FRAME_POINTER
  145. fp = 0;
  146. #endif
  147. #ifdef ANOMALY_05000283
  148. cc = r7 == r7;
  149. p5.h = 0xffc0;
  150. p5.l = 0x0014;
  151. if cc jump 1f;
  152. r7.l = W[p5];
  153. 1:
  154. #endif
  155. p0.l = lo(TBUFCTL);
  156. p0.h = hi(TBUFCTL);
  157. r0 = 1;
  158. [p0] = r0;
  159. r0 = IRQ_HWERR;
  160. r1 = sp;
  161. #ifdef CONFIG_HARDWARE_PM
  162. r7 = SEQSTAT;
  163. r7 = r7 >>> 0xe;
  164. r6 = 0x1F;
  165. r7 = r7 & r6;
  166. r5 = 0x12;
  167. cc = r7 == r5;
  168. if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
  169. #endif
  170. SP += -12;
  171. call _irq_panic;
  172. SP += 12;
  173. rti;
  174. #ifdef CONFIG_HARDWARE_PM
  175. .Lcall_do_ovf:
  176. SP += -12;
  177. call _pm_overflow;
  178. SP += 12;
  179. jump .Lcommon_restore_context;
  180. #endif
  181. /* interrupt routine for evt2 - 2. This is NMI. */
  182. ENTRY(_evt_evt2)
  183. SAVE_CONTEXT
  184. #ifdef CONFIG_FRAME_POINTER
  185. fp = 0;
  186. #endif
  187. #ifdef ANOMALY_05000283
  188. cc = r7 == r7;
  189. p5.h = 0xffc0;
  190. p5.l = 0x0014;
  191. if cc jump 1f;
  192. r7.l = W[p5];
  193. 1:
  194. #endif
  195. r0 = IRQ_NMI;
  196. r1 = sp;
  197. SP += -12;
  198. call _asm_do_IRQ;
  199. SP += 12;
  200. RESTORE_CONTEXT
  201. rtn;
  202. /* interrupt routine for core timer - 6 */
  203. ENTRY(_evt_timer)
  204. TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
  205. /* interrupt routine for evt7 - 7 */
  206. ENTRY(_evt_evt7)
  207. INTERRUPT_ENTRY(EVT_IVG7_P)
  208. ENTRY(_evt_evt8)
  209. INTERRUPT_ENTRY(EVT_IVG8_P)
  210. ENTRY(_evt_evt9)
  211. INTERRUPT_ENTRY(EVT_IVG9_P)
  212. ENTRY(_evt_evt10)
  213. INTERRUPT_ENTRY(EVT_IVG10_P)
  214. ENTRY(_evt_evt11)
  215. INTERRUPT_ENTRY(EVT_IVG11_P)
  216. ENTRY(_evt_evt12)
  217. INTERRUPT_ENTRY(EVT_IVG12_P)
  218. ENTRY(_evt_evt13)
  219. INTERRUPT_ENTRY(EVT_IVG13_P)
  220. /* interrupt routine for system_call - 15 */
  221. ENTRY(_evt_system_call)
  222. SAVE_CONTEXT_SYSCALL
  223. #ifdef CONFIG_FRAME_POINTER
  224. fp = 0;
  225. #endif
  226. call _system_call;
  227. jump .Lcommon_restore_context;