interrupt.S 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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/trace.h>
  37. #include <asm/mach-common/context.S>
  38. #ifdef CONFIG_I_ENTRY_L1
  39. .section .l1.text
  40. #else
  41. .text
  42. #endif
  43. .align 4 /* just in case */
  44. /*
  45. * initial interrupt handlers
  46. */
  47. #ifndef CONFIG_KGDB
  48. /* interrupt routine for emulation - 0 */
  49. /* Currently used only if GDB stub is not in - invalid */
  50. /* gdb-stub set the evt itself */
  51. /* save registers for post-mortem only */
  52. ENTRY(_evt_emulation)
  53. SAVE_ALL_SYS
  54. #ifdef CONFIG_FRAME_POINTER
  55. fp = 0;
  56. #endif
  57. r0 = IRQ_EMU;
  58. r1 = sp;
  59. SP += -12;
  60. call _irq_panic;
  61. SP += 12;
  62. /* - GDB stub fills this in by itself (if defined) */
  63. rte;
  64. ENDPROC(_evt_emulation)
  65. #endif
  66. /* Common interrupt entry code. First we do CLI, then push
  67. * RETI, to keep interrupts disabled, but to allow this state to be changed
  68. * by local_bh_enable.
  69. * R0 contains the interrupt number, while R1 may contain the value of IPEND,
  70. * or garbage if IPEND won't be needed by the ISR. */
  71. __common_int_entry:
  72. [--sp] = fp;
  73. [--sp] = usp;
  74. [--sp] = i0;
  75. [--sp] = i1;
  76. [--sp] = i2;
  77. [--sp] = i3;
  78. [--sp] = m0;
  79. [--sp] = m1;
  80. [--sp] = m2;
  81. [--sp] = m3;
  82. [--sp] = l0;
  83. [--sp] = l1;
  84. [--sp] = l2;
  85. [--sp] = l3;
  86. [--sp] = b0;
  87. [--sp] = b1;
  88. [--sp] = b2;
  89. [--sp] = b3;
  90. [--sp] = a0.x;
  91. [--sp] = a0.w;
  92. [--sp] = a1.x;
  93. [--sp] = a1.w;
  94. [--sp] = LC0;
  95. [--sp] = LC1;
  96. [--sp] = LT0;
  97. [--sp] = LT1;
  98. [--sp] = LB0;
  99. [--sp] = LB1;
  100. [--sp] = ASTAT;
  101. [--sp] = r0; /* Skip reserved */
  102. [--sp] = RETS;
  103. r2 = RETI;
  104. [--sp] = r2;
  105. [--sp] = RETX;
  106. [--sp] = RETN;
  107. [--sp] = RETE;
  108. [--sp] = SEQSTAT;
  109. [--sp] = r1; /* IPEND - R1 may or may not be set up before jumping here. */
  110. /* Switch to other method of keeping interrupts disabled. */
  111. #ifdef CONFIG_DEBUG_HWERR
  112. r1 = 0x3f;
  113. sti r1;
  114. #else
  115. cli r1;
  116. #endif
  117. [--sp] = RETI; /* orig_pc */
  118. /* Clear all L registers. */
  119. r1 = 0 (x);
  120. l0 = r1;
  121. l1 = r1;
  122. l2 = r1;
  123. l3 = r1;
  124. #ifdef CONFIG_FRAME_POINTER
  125. fp = 0;
  126. #endif
  127. #if defined (ANOMALY_05000283) || defined (ANOMALY_05000315)
  128. cc = r7 == r7;
  129. p5.h = 0xffc0;
  130. p5.l = 0x0014;
  131. if cc jump 1f;
  132. r7.l = W[p5];
  133. 1:
  134. #endif
  135. r1 = sp;
  136. SP += -12;
  137. call _do_irq;
  138. SP += 12;
  139. call _return_from_int;
  140. .Lcommon_restore_context:
  141. RESTORE_CONTEXT
  142. rti;
  143. /* interrupt routine for ivhw - 5 */
  144. ENTRY(_evt_ivhw)
  145. SAVE_CONTEXT
  146. #ifdef CONFIG_FRAME_POINTER
  147. fp = 0;
  148. #endif
  149. #ifdef ANOMALY_05000283
  150. cc = r7 == r7;
  151. p5.h = 0xffc0;
  152. p5.l = 0x0014;
  153. if cc jump 1f;
  154. r7.l = W[p5];
  155. 1:
  156. #endif
  157. trace_buffer_stop(p0, r0);
  158. r0 = IRQ_HWERR;
  159. r1 = sp;
  160. #ifdef CONFIG_HARDWARE_PM
  161. r7 = SEQSTAT;
  162. r7 = r7 >>> 0xe;
  163. r6 = 0x1F;
  164. r7 = r7 & r6;
  165. r5 = 0x12;
  166. cc = r7 == r5;
  167. if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
  168. #endif
  169. SP += -12;
  170. call _irq_panic;
  171. SP += 12;
  172. rti;
  173. #ifdef CONFIG_HARDWARE_PM
  174. .Lcall_do_ovf:
  175. SP += -12;
  176. call _pm_overflow;
  177. SP += 12;
  178. jump .Lcommon_restore_context;
  179. #endif
  180. /* interrupt routine for evt2 - 2. This is NMI. */
  181. ENTRY(_evt_evt2)
  182. SAVE_CONTEXT
  183. #ifdef CONFIG_FRAME_POINTER
  184. fp = 0;
  185. #endif
  186. #ifdef ANOMALY_05000283
  187. cc = r7 == r7;
  188. p5.h = 0xffc0;
  189. p5.l = 0x0014;
  190. if cc jump 1f;
  191. r7.l = W[p5];
  192. 1:
  193. #endif
  194. r0 = IRQ_NMI;
  195. r1 = sp;
  196. SP += -12;
  197. call _asm_do_IRQ;
  198. SP += 12;
  199. RESTORE_CONTEXT
  200. rtn;
  201. /* interrupt routine for core timer - 6 */
  202. ENTRY(_evt_timer)
  203. TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
  204. /* interrupt routine for evt7 - 7 */
  205. ENTRY(_evt_evt7)
  206. INTERRUPT_ENTRY(EVT_IVG7_P)
  207. ENTRY(_evt_evt8)
  208. INTERRUPT_ENTRY(EVT_IVG8_P)
  209. ENTRY(_evt_evt9)
  210. INTERRUPT_ENTRY(EVT_IVG9_P)
  211. ENTRY(_evt_evt10)
  212. INTERRUPT_ENTRY(EVT_IVG10_P)
  213. ENTRY(_evt_evt11)
  214. INTERRUPT_ENTRY(EVT_IVG11_P)
  215. ENTRY(_evt_evt12)
  216. INTERRUPT_ENTRY(EVT_IVG12_P)
  217. ENTRY(_evt_evt13)
  218. INTERRUPT_ENTRY(EVT_IVG13_P)
  219. /* interrupt routine for system_call - 15 */
  220. ENTRY(_evt_system_call)
  221. SAVE_CONTEXT_SYSCALL
  222. #ifdef CONFIG_FRAME_POINTER
  223. fp = 0;
  224. #endif
  225. call _system_call;
  226. jump .Lcommon_restore_context;
  227. ENDPROC(_evt_system_call)