interrupt.S 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. call _do_irq;
  118. SP += 12;
  119. call _return_from_int;
  120. .Lcommon_restore_context:
  121. RESTORE_CONTEXT
  122. rti;
  123. /* interrupt routine for ivhw - 5 */
  124. ENTRY(_evt_ivhw)
  125. SAVE_ALL_SYS
  126. #ifdef CONFIG_FRAME_POINTER
  127. fp = 0;
  128. #endif
  129. #if ANOMALY_05000283
  130. cc = r7 == r7;
  131. p5.h = HI(CHIPID);
  132. p5.l = LO(CHIPID);
  133. if cc jump 1f;
  134. r7.l = W[p5];
  135. 1:
  136. #endif
  137. #ifdef CONFIG_HARDWARE_PM
  138. r7 = [sp + PT_SEQSTAT];
  139. r7 = r7 >>> 0xe;
  140. r6 = 0x1F;
  141. r7 = r7 & r6;
  142. r5 = 0x12;
  143. cc = r7 == r5;
  144. if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
  145. #endif
  146. # We are going to dump something out, so make sure we print IPEND properly
  147. p2.l = lo(IPEND);
  148. p2.h = hi(IPEND);
  149. r0 = [p2];
  150. [sp + PT_IPEND] = r0;
  151. /* set the EXCAUSE to HWERR for trap_c */
  152. r0 = [sp + PT_SEQSTAT];
  153. R1.L = LO(VEC_HWERR);
  154. R1.H = HI(VEC_HWERR);
  155. R0 = R0 | R1;
  156. [sp + PT_SEQSTAT] = R0;
  157. r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
  158. SP += -12;
  159. call _trap_c;
  160. SP += 12;
  161. call _ret_from_exception;
  162. .Lcommon_restore_all_sys:
  163. RESTORE_ALL_SYS
  164. rti;
  165. #ifdef CONFIG_HARDWARE_PM
  166. .Lcall_do_ovf:
  167. SP += -12;
  168. call _pm_overflow;
  169. SP += 12;
  170. jump .Lcommon_restore_all_sys;
  171. #endif
  172. ENDPROC(_evt_ivhw)
  173. /* Interrupt routine for evt2 (NMI).
  174. * We don't actually use this, so just return.
  175. * For inner circle type details, please see:
  176. * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi
  177. */
  178. ENTRY(_evt_nmi)
  179. .weak _evt_nmi
  180. rtn;
  181. ENDPROC(_evt_nmi)
  182. /* interrupt routine for core timer - 6 */
  183. ENTRY(_evt_timer)
  184. TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
  185. /* interrupt routine for evt7 - 7 */
  186. ENTRY(_evt_evt7)
  187. INTERRUPT_ENTRY(EVT_IVG7_P)
  188. ENTRY(_evt_evt8)
  189. INTERRUPT_ENTRY(EVT_IVG8_P)
  190. ENTRY(_evt_evt9)
  191. INTERRUPT_ENTRY(EVT_IVG9_P)
  192. ENTRY(_evt_evt10)
  193. INTERRUPT_ENTRY(EVT_IVG10_P)
  194. ENTRY(_evt_evt11)
  195. INTERRUPT_ENTRY(EVT_IVG11_P)
  196. ENTRY(_evt_evt12)
  197. INTERRUPT_ENTRY(EVT_IVG12_P)
  198. ENTRY(_evt_evt13)
  199. INTERRUPT_ENTRY(EVT_IVG13_P)
  200. /* interrupt routine for system_call - 15 */
  201. ENTRY(_evt_system_call)
  202. SAVE_CONTEXT_SYSCALL
  203. #ifdef CONFIG_FRAME_POINTER
  204. fp = 0;
  205. #endif
  206. call _system_call;
  207. jump .Lcommon_restore_context;
  208. ENDPROC(_evt_system_call)