interrupt.S 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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/linkage.h>
  33. #include <asm/entry.h>
  34. #include <asm/asm-offsets.h>
  35. #include <asm/trace.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. /* Common interrupt entry code. First we do CLI, then push
  44. * RETI, to keep interrupts disabled, but to allow this state to be changed
  45. * by local_bh_enable.
  46. * R0 contains the interrupt number, while R1 may contain the value of IPEND,
  47. * or garbage if IPEND won't be needed by the ISR. */
  48. __common_int_entry:
  49. [--sp] = fp;
  50. [--sp] = usp;
  51. [--sp] = i0;
  52. [--sp] = i1;
  53. [--sp] = i2;
  54. [--sp] = i3;
  55. [--sp] = m0;
  56. [--sp] = m1;
  57. [--sp] = m2;
  58. [--sp] = m3;
  59. [--sp] = l0;
  60. [--sp] = l1;
  61. [--sp] = l2;
  62. [--sp] = l3;
  63. [--sp] = b0;
  64. [--sp] = b1;
  65. [--sp] = b2;
  66. [--sp] = b3;
  67. [--sp] = a0.x;
  68. [--sp] = a0.w;
  69. [--sp] = a1.x;
  70. [--sp] = a1.w;
  71. [--sp] = LC0;
  72. [--sp] = LC1;
  73. [--sp] = LT0;
  74. [--sp] = LT1;
  75. [--sp] = LB0;
  76. [--sp] = LB1;
  77. [--sp] = ASTAT;
  78. [--sp] = r0; /* Skip reserved */
  79. [--sp] = RETS;
  80. r2 = RETI;
  81. [--sp] = r2;
  82. [--sp] = RETX;
  83. [--sp] = RETN;
  84. [--sp] = RETE;
  85. [--sp] = SEQSTAT;
  86. [--sp] = r1; /* IPEND - R1 may or may not be set up before jumping here. */
  87. /* Switch to other method of keeping interrupts disabled. */
  88. #ifdef CONFIG_DEBUG_HWERR
  89. r1 = 0x3f;
  90. sti r1;
  91. #else
  92. cli r1;
  93. #endif
  94. [--sp] = RETI; /* orig_pc */
  95. /* Clear all L registers. */
  96. r1 = 0 (x);
  97. l0 = r1;
  98. l1 = r1;
  99. l2 = r1;
  100. l3 = r1;
  101. #ifdef CONFIG_FRAME_POINTER
  102. fp = 0;
  103. #endif
  104. #if ANOMALY_05000283 || ANOMALY_05000315
  105. cc = r7 == r7;
  106. p5.h = 0xffc0;
  107. p5.l = 0x0014;
  108. if cc jump 1f;
  109. r7.l = W[p5];
  110. 1:
  111. #endif
  112. r1 = sp;
  113. SP += -12;
  114. call _do_irq;
  115. SP += 12;
  116. call _return_from_int;
  117. .Lcommon_restore_context:
  118. RESTORE_CONTEXT
  119. rti;
  120. /* interrupt routine for ivhw - 5 */
  121. ENTRY(_evt_ivhw)
  122. SAVE_CONTEXT
  123. #ifdef CONFIG_FRAME_POINTER
  124. fp = 0;
  125. #endif
  126. #if ANOMALY_05000283
  127. cc = r7 == r7;
  128. p5.h = 0xffc0;
  129. p5.l = 0x0014;
  130. if cc jump 1f;
  131. r7.l = W[p5];
  132. 1:
  133. #endif
  134. trace_buffer_stop(p0, r0);
  135. r0 = IRQ_HWERR;
  136. r1 = sp;
  137. #ifdef CONFIG_HARDWARE_PM
  138. r7 = 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. SP += -12;
  147. call _irq_panic;
  148. SP += 12;
  149. rti;
  150. #ifdef CONFIG_HARDWARE_PM
  151. .Lcall_do_ovf:
  152. SP += -12;
  153. call _pm_overflow;
  154. SP += 12;
  155. jump .Lcommon_restore_context;
  156. #endif
  157. /* Interrupt routine for evt2 (NMI).
  158. * We don't actually use this, so just return.
  159. * For inner circle type details, please see:
  160. * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi
  161. */
  162. ENTRY(_evt_nmi)
  163. .weak _evt_nmi
  164. rtn;
  165. ENDPROC(_evt_nmi)
  166. /* interrupt routine for core timer - 6 */
  167. ENTRY(_evt_timer)
  168. TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
  169. /* interrupt routine for evt7 - 7 */
  170. ENTRY(_evt_evt7)
  171. INTERRUPT_ENTRY(EVT_IVG7_P)
  172. ENTRY(_evt_evt8)
  173. INTERRUPT_ENTRY(EVT_IVG8_P)
  174. ENTRY(_evt_evt9)
  175. INTERRUPT_ENTRY(EVT_IVG9_P)
  176. ENTRY(_evt_evt10)
  177. INTERRUPT_ENTRY(EVT_IVG10_P)
  178. ENTRY(_evt_evt11)
  179. INTERRUPT_ENTRY(EVT_IVG11_P)
  180. ENTRY(_evt_evt12)
  181. INTERRUPT_ENTRY(EVT_IVG12_P)
  182. ENTRY(_evt_evt13)
  183. INTERRUPT_ENTRY(EVT_IVG13_P)
  184. /* interrupt routine for system_call - 15 */
  185. ENTRY(_evt_system_call)
  186. SAVE_CONTEXT_SYSCALL
  187. #ifdef CONFIG_FRAME_POINTER
  188. fp = 0;
  189. #endif
  190. call _system_call;
  191. jump .Lcommon_restore_context;
  192. ENDPROC(_evt_system_call)