interrupt.S 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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 <mach/irq.h>
  32. #include <linux/linkage.h>
  33. #include <asm/entry.h>
  34. #include <asm/asm-offsets.h>
  35. #include <asm/trace.h>
  36. #include <asm/traps.h>
  37. #include <asm/thread_info.h>
  38. #include <asm/context.S>
  39. .extern _ret_from_exception
  40. #ifdef CONFIG_I_ENTRY_L1
  41. .section .l1.text
  42. #else
  43. .text
  44. #endif
  45. .align 4 /* just in case */
  46. /* Common interrupt entry code. First we do CLI, then push
  47. * RETI, to keep interrupts disabled, but to allow this state to be changed
  48. * by local_bh_enable.
  49. * R0 contains the interrupt number, while R1 may contain the value of IPEND,
  50. * or garbage if IPEND won't be needed by the ISR. */
  51. __common_int_entry:
  52. [--sp] = fp;
  53. [--sp] = usp;
  54. [--sp] = i0;
  55. [--sp] = i1;
  56. [--sp] = i2;
  57. [--sp] = i3;
  58. [--sp] = m0;
  59. [--sp] = m1;
  60. [--sp] = m2;
  61. [--sp] = m3;
  62. [--sp] = l0;
  63. [--sp] = l1;
  64. [--sp] = l2;
  65. [--sp] = l3;
  66. [--sp] = b0;
  67. [--sp] = b1;
  68. [--sp] = b2;
  69. [--sp] = b3;
  70. [--sp] = a0.x;
  71. [--sp] = a0.w;
  72. [--sp] = a1.x;
  73. [--sp] = a1.w;
  74. [--sp] = LC0;
  75. [--sp] = LC1;
  76. [--sp] = LT0;
  77. [--sp] = LT1;
  78. [--sp] = LB0;
  79. [--sp] = LB1;
  80. [--sp] = ASTAT;
  81. [--sp] = r0; /* Skip reserved */
  82. [--sp] = RETS;
  83. r2 = RETI;
  84. [--sp] = r2;
  85. [--sp] = RETX;
  86. [--sp] = RETN;
  87. [--sp] = RETE;
  88. [--sp] = SEQSTAT;
  89. [--sp] = r1; /* IPEND - R1 may or may not be set up before jumping here. */
  90. /* Switch to other method of keeping interrupts disabled. */
  91. #ifdef CONFIG_DEBUG_HWERR
  92. r1 = 0x3f;
  93. sti r1;
  94. #else
  95. cli r1;
  96. #endif
  97. [--sp] = RETI; /* orig_pc */
  98. /* Clear all L registers. */
  99. r1 = 0 (x);
  100. l0 = r1;
  101. l1 = r1;
  102. l2 = r1;
  103. l3 = r1;
  104. #ifdef CONFIG_FRAME_POINTER
  105. fp = 0;
  106. #endif
  107. #if ANOMALY_05000283 || ANOMALY_05000315
  108. cc = r7 == r7;
  109. p5.h = HI(CHIPID);
  110. p5.l = LO(CHIPID);
  111. if cc jump 1f;
  112. r7.l = W[p5];
  113. 1:
  114. #endif
  115. r1 = sp;
  116. SP += -12;
  117. #ifdef CONFIG_IPIPE
  118. call ___ipipe_grab_irq
  119. SP += 12;
  120. cc = r0 == 0;
  121. if cc jump .Lcommon_restore_context;
  122. #else /* CONFIG_IPIPE */
  123. call _do_irq;
  124. SP += 12;
  125. #endif /* CONFIG_IPIPE */
  126. call _return_from_int;
  127. .Lcommon_restore_context:
  128. RESTORE_CONTEXT
  129. rti;
  130. /* interrupt routine for ivhw - 5 */
  131. ENTRY(_evt_ivhw)
  132. SAVE_ALL_SYS
  133. #ifdef CONFIG_FRAME_POINTER
  134. fp = 0;
  135. #endif
  136. #if ANOMALY_05000283 || ANOMALY_05000315
  137. cc = r7 == r7;
  138. p5.h = HI(CHIPID);
  139. p5.l = LO(CHIPID);
  140. if cc jump 1f;
  141. r7.l = W[p5];
  142. 1:
  143. #endif
  144. # We are going to dump something out, so make sure we print IPEND properly
  145. p2.l = lo(IPEND);
  146. p2.h = hi(IPEND);
  147. r0 = [p2];
  148. [sp + PT_IPEND] = r0;
  149. /* set the EXCAUSE to HWERR for trap_c */
  150. r0 = [sp + PT_SEQSTAT];
  151. R1.L = LO(VEC_HWERR);
  152. R1.H = HI(VEC_HWERR);
  153. R0 = R0 | R1;
  154. [sp + PT_SEQSTAT] = R0;
  155. r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
  156. SP += -12;
  157. call _trap_c;
  158. SP += 12;
  159. #ifdef EBIU_ERRMST
  160. /* make sure EBIU_ERRMST is clear */
  161. p0.l = LO(EBIU_ERRMST);
  162. p0.h = HI(EBIU_ERRMST);
  163. r0.l = (CORE_ERROR | CORE_MERROR);
  164. w[p0] = r0.l;
  165. #endif
  166. call _ret_from_exception;
  167. .Lcommon_restore_all_sys:
  168. RESTORE_ALL_SYS
  169. rti;
  170. ENDPROC(_evt_ivhw)
  171. /* Interrupt routine for evt2 (NMI).
  172. * We don't actually use this, so just return.
  173. * For inner circle type details, please see:
  174. * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:nmi
  175. */
  176. ENTRY(_evt_nmi)
  177. .weak _evt_nmi
  178. rtn;
  179. ENDPROC(_evt_nmi)
  180. /* interrupt routine for core timer - 6 */
  181. ENTRY(_evt_timer)
  182. TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
  183. /* interrupt routine for evt7 - 7 */
  184. ENTRY(_evt_evt7)
  185. INTERRUPT_ENTRY(EVT_IVG7_P)
  186. ENTRY(_evt_evt8)
  187. INTERRUPT_ENTRY(EVT_IVG8_P)
  188. ENTRY(_evt_evt9)
  189. INTERRUPT_ENTRY(EVT_IVG9_P)
  190. ENTRY(_evt_evt10)
  191. INTERRUPT_ENTRY(EVT_IVG10_P)
  192. ENTRY(_evt_evt11)
  193. INTERRUPT_ENTRY(EVT_IVG11_P)
  194. ENTRY(_evt_evt12)
  195. INTERRUPT_ENTRY(EVT_IVG12_P)
  196. ENTRY(_evt_evt13)
  197. INTERRUPT_ENTRY(EVT_IVG13_P)
  198. /* interrupt routine for system_call - 15 */
  199. ENTRY(_evt_system_call)
  200. SAVE_CONTEXT_SYSCALL
  201. #ifdef CONFIG_FRAME_POINTER
  202. fp = 0;
  203. #endif
  204. call _system_call;
  205. jump .Lcommon_restore_context;
  206. ENDPROC(_evt_system_call)
  207. #ifdef CONFIG_IPIPE
  208. ENTRY(___ipipe_call_irqtail)
  209. p0 = r0;
  210. r0.l = 1f;
  211. r0.h = 1f;
  212. reti = r0;
  213. rti;
  214. 1:
  215. [--sp] = rets;
  216. [--sp] = ( r7:4, p5:3 );
  217. sp += -12;
  218. call (p0);
  219. sp += 12;
  220. ( r7:4, p5:3 ) = [sp++];
  221. rets = [sp++];
  222. [--sp] = reti;
  223. reti = [sp++]; /* IRQs are off. */
  224. r0.h = 3f;
  225. r0.l = 3f;
  226. p0.l = lo(EVT14);
  227. p0.h = hi(EVT14);
  228. [p0] = r0;
  229. csync;
  230. r0 = 0x401f (z);
  231. sti r0;
  232. raise 14;
  233. [--sp] = reti; /* IRQs on. */
  234. 2:
  235. jump 2b; /* Likely paranoid. */
  236. 3:
  237. sp += 4; /* Discard saved RETI */
  238. r0.h = _evt14_softirq;
  239. r0.l = _evt14_softirq;
  240. p0.l = lo(EVT14);
  241. p0.h = hi(EVT14);
  242. [p0] = r0;
  243. csync;
  244. p0.l = _bfin_irq_flags;
  245. p0.h = _bfin_irq_flags;
  246. r0 = [p0];
  247. sti r0;
  248. rts;
  249. ENDPROC(___ipipe_call_irqtail)
  250. #endif /* CONFIG_IPIPE */