cplbhdlr.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /* Copyright (C) 2003 Analog Devices, Inc. All Rights Reserved.
  2. *
  3. * This file is subject to the terms and conditions of the GNU General Public
  4. * License.
  5. *
  6. * Blackfin BF533/2.6 support : LG Soft India
  7. */
  8. /* Include an exception handler to invoke the CPLB manager
  9. */
  10. #include <asm-blackfin/linkage.h>
  11. #include <asm/cplb.h>
  12. #include <asm/entry.h>
  13. .text
  14. .globl _cplb_hdr;
  15. .type _cplb_hdr, STT_FUNC;
  16. .extern _cplb_mgr;
  17. .type _cplb_mgr, STT_FUNC;
  18. .extern __unknown_exception_occurred;
  19. .type __unknown_exception_occurred, STT_FUNC;
  20. .extern __cplb_miss_all_locked;
  21. .type __cplb_miss_all_locked, STT_FUNC;
  22. .extern __cplb_miss_without_replacement;
  23. .type __cplb_miss_without_replacement, STT_FUNC;
  24. .extern __cplb_protection_violation;
  25. .type __cplb_protection_violation, STT_FUNC;
  26. .extern panic_pv;
  27. .align 2;
  28. ENTRY(_cplb_hdr)
  29. SSYNC;
  30. [--SP] = ( R7:0, P5:0 );
  31. [--SP] = ASTAT;
  32. [--SP] = SEQSTAT;
  33. [--SP] = I0;
  34. [--SP] = I1;
  35. [--SP] = I2;
  36. [--SP] = I3;
  37. [--SP] = LT0;
  38. [--SP] = LB0;
  39. [--SP] = LC0;
  40. [--SP] = LT1;
  41. [--SP] = LB1;
  42. [--SP] = LC1;
  43. R2 = SEQSTAT;
  44. /*Mask the contents of SEQSTAT and leave only EXCAUSE in R2*/
  45. R2 <<= 26;
  46. R2 >>= 26;
  47. R1 = 0x23; /* Data access CPLB protection violation */
  48. CC = R2 == R1;
  49. IF !CC JUMP not_data_write;
  50. R0 = 2; /* is a write to data space*/
  51. JUMP is_icplb_miss;
  52. not_data_write:
  53. R1 = 0x2C; /* CPLB miss on an instruction fetch */
  54. CC = R2 == R1;
  55. R0 = 0; /* is_data_miss == False*/
  56. IF CC JUMP is_icplb_miss;
  57. R1 = 0x26;
  58. CC = R2 == R1;
  59. IF !CC JUMP unknown;
  60. R0 = 1; /* is_data_miss == True*/
  61. is_icplb_miss:
  62. #if ( defined (CONFIG_BLKFIN_CACHE) || defined (CONFIG_BLKFIN_DCACHE))
  63. #if ( defined (CONFIG_BLKFIN_CACHE) && !defined (CONFIG_BLKFIN_DCACHE))
  64. R1 = CPLB_ENABLE_ICACHE;
  65. #endif
  66. #if ( !defined (CONFIG_BLKFIN_CACHE) && defined (CONFIG_BLKFIN_DCACHE))
  67. R1 = CPLB_ENABLE_DCACHE;
  68. #endif
  69. #if ( defined (CONFIG_BLKFIN_CACHE) && defined (CONFIG_BLKFIN_DCACHE))
  70. R1 = CPLB_ENABLE_DCACHE | CPLB_ENABLE_ICACHE;
  71. #endif
  72. #else
  73. R1 = 0;
  74. #endif
  75. [--SP] = RETS;
  76. CALL _cplb_mgr;
  77. RETS = [SP++];
  78. CC = R0 == 0;
  79. IF !CC JUMP not_replaced;
  80. LC1 = [SP++];
  81. LB1 = [SP++];
  82. LT1 = [SP++];
  83. LC0 = [SP++];
  84. LB0 = [SP++];
  85. LT0 = [SP++];
  86. I3 = [SP++];
  87. I2 = [SP++];
  88. I1 = [SP++];
  89. I0 = [SP++];
  90. SEQSTAT = [SP++];
  91. ASTAT = [SP++];
  92. ( R7:0, P5:0 ) = [SP++];
  93. RTS;
  94. unknown:
  95. [--SP] = RETS;
  96. CALL __unknown_exception_occurred;
  97. RETS = [SP++];
  98. JUMP unknown;
  99. not_replaced:
  100. CC = R0 == CPLB_NO_UNLOCKED;
  101. IF !CC JUMP next_check;
  102. [--SP] = RETS;
  103. CALL __cplb_miss_all_locked;
  104. RETS = [SP++];
  105. next_check:
  106. CC = R0 == CPLB_NO_ADDR_MATCH;
  107. IF !CC JUMP next_check2;
  108. [--SP] = RETS;
  109. CALL __cplb_miss_without_replacement;
  110. RETS = [SP++];
  111. JUMP not_replaced;
  112. next_check2:
  113. CC = R0 == CPLB_PROT_VIOL;
  114. IF !CC JUMP strange_return_from_cplb_mgr;
  115. [--SP] = RETS;
  116. CALL __cplb_protection_violation;
  117. RETS = [SP++];
  118. JUMP not_replaced;
  119. strange_return_from_cplb_mgr:
  120. IDLE;
  121. CSYNC;
  122. JUMP strange_return_from_cplb_mgr;
  123. /************************************
  124. * Diagnostic exception handlers
  125. */
  126. __cplb_miss_all_locked:
  127. sp += -12;
  128. R0 = CPLB_NO_UNLOCKED;
  129. call panic_bfin;
  130. SP += 12;
  131. RTS;
  132. __cplb_miss_without_replacement:
  133. sp += -12;
  134. R0 = CPLB_NO_ADDR_MATCH;
  135. call panic_bfin;
  136. SP += 12;
  137. RTS;
  138. __cplb_protection_violation:
  139. sp += -12;
  140. R0 = CPLB_PROT_VIOL;
  141. call panic_bfin;
  142. SP += 12;
  143. RTS;
  144. __unknown_exception_occurred:
  145. /* This function is invoked by the default exception
  146. * handler, if it does not recognise the kind of
  147. * exception that has occurred. In other words, the
  148. * default handler only handles some of the system's
  149. * exception types, and it does not expect any others
  150. * to occur. If your application is going to be using
  151. * other kinds of exceptions, you must replace the
  152. * default handler with your own, that handles all the
  153. * exceptions you will use.
  154. *
  155. * Since there's nothing we can do, we just loop here
  156. * at what we hope is a suitably informative label.
  157. */
  158. IDLE;
  159. do_not_know_what_to_do:
  160. CSYNC;
  161. JUMP __unknown_exception_occurred;
  162. RTS;
  163. .__unknown_exception_occurred.end:
  164. .global __unknown_exception_occurred;
  165. .type __unknown_exception_occurred, STT_FUNC;
  166. panic_bfin:
  167. RTS;