secondary.S 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /*
  2. * BF561 coreB bootstrap file
  3. *
  4. * Copyright 2007-2009 Analog Devices Inc.
  5. * Philippe Gerum <rpm@xenomai.org>
  6. *
  7. * Licensed under the GPL-2 or later.
  8. */
  9. #include <linux/linkage.h>
  10. #include <linux/init.h>
  11. #include <asm/blackfin.h>
  12. #include <asm/asm-offsets.h>
  13. #include <asm/trace.h>
  14. __INIT
  15. /* Lay the initial stack into the L1 scratch area of Core B */
  16. #define INITIAL_STACK (COREB_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
  17. ENTRY(_coreb_trampoline_start)
  18. /* Set the SYSCFG register */
  19. R0 = 0x36;
  20. SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
  21. R0 = 0;
  22. /*Clear Out All the data and pointer Registers*/
  23. R1 = R0;
  24. R2 = R0;
  25. R3 = R0;
  26. R4 = R0;
  27. R5 = R0;
  28. R6 = R0;
  29. R7 = R0;
  30. P0 = R0;
  31. P1 = R0;
  32. P2 = R0;
  33. P3 = R0;
  34. P4 = R0;
  35. P5 = R0;
  36. LC0 = r0;
  37. LC1 = r0;
  38. L0 = r0;
  39. L1 = r0;
  40. L2 = r0;
  41. L3 = r0;
  42. /* Clear Out All the DAG Registers*/
  43. B0 = r0;
  44. B1 = r0;
  45. B2 = r0;
  46. B3 = r0;
  47. I0 = r0;
  48. I1 = r0;
  49. I2 = r0;
  50. I3 = r0;
  51. M0 = r0;
  52. M1 = r0;
  53. M2 = r0;
  54. M3 = r0;
  55. trace_buffer_init(p0,r0);
  56. /* Turn off the icache */
  57. p0.l = LO(IMEM_CONTROL);
  58. p0.h = HI(IMEM_CONTROL);
  59. R1 = [p0];
  60. R0 = ~ENICPLB;
  61. R0 = R0 & R1;
  62. /* Disabling of CPLBs should be proceeded by a CSYNC */
  63. CSYNC;
  64. [p0] = R0;
  65. SSYNC;
  66. /* Turn off the dcache */
  67. p0.l = LO(DMEM_CONTROL);
  68. p0.h = HI(DMEM_CONTROL);
  69. R1 = [p0];
  70. R0 = ~ENDCPLB;
  71. R0 = R0 & R1;
  72. /* Disabling of CPLBs should be proceeded by a CSYNC */
  73. CSYNC;
  74. [p0] = R0;
  75. SSYNC;
  76. /* in case of double faults, save a few things */
  77. p0.l = _init_retx_coreb;
  78. p0.h = _init_retx_coreb;
  79. R0 = RETX;
  80. [P0] = R0;
  81. #ifdef CONFIG_DEBUG_DOUBLEFAULT
  82. /* Only save these if we are storing them,
  83. * This happens here, since L1 gets clobbered
  84. * below
  85. */
  86. GET_PDA(p0, r0);
  87. r7 = [p0 + PDA_DF_RETX];
  88. p1.l = _init_saved_retx_coreb;
  89. p1.h = _init_saved_retx_coreb;
  90. [p1] = r7;
  91. r7 = [p0 + PDA_DF_DCPLB];
  92. p1.l = _init_saved_dcplb_fault_addr_coreb;
  93. p1.h = _init_saved_dcplb_fault_addr_coreb;
  94. [p1] = r7;
  95. r7 = [p0 + PDA_DF_ICPLB];
  96. p1.l = _init_saved_icplb_fault_addr_coreb;
  97. p1.h = _init_saved_icplb_fault_addr_coreb;
  98. [p1] = r7;
  99. r7 = [p0 + PDA_DF_SEQSTAT];
  100. p1.l = _init_saved_seqstat_coreb;
  101. p1.h = _init_saved_seqstat_coreb;
  102. [p1] = r7;
  103. #endif
  104. /* Initialize stack pointer */
  105. sp.l = lo(INITIAL_STACK);
  106. sp.h = hi(INITIAL_STACK);
  107. fp = sp;
  108. usp = sp;
  109. /* This section keeps the processor in supervisor mode
  110. * during core B startup. Branches to the idle task.
  111. */
  112. /* EVT15 = _real_start */
  113. p0.l = lo(EVT15);
  114. p0.h = hi(EVT15);
  115. p1.l = _coreb_start;
  116. p1.h = _coreb_start;
  117. [p0] = p1;
  118. csync;
  119. p0.l = lo(IMASK);
  120. p0.h = hi(IMASK);
  121. p1.l = IMASK_IVG15;
  122. p1.h = 0x0;
  123. [p0] = p1;
  124. csync;
  125. raise 15;
  126. p0.l = .LWAIT_HERE;
  127. p0.h = .LWAIT_HERE;
  128. reti = p0;
  129. #if defined(ANOMALY_05000281)
  130. nop; nop; nop;
  131. #endif
  132. rti;
  133. .LWAIT_HERE:
  134. jump .LWAIT_HERE;
  135. ENDPROC(_coreb_trampoline_start)
  136. ENTRY(_coreb_trampoline_end)
  137. .section ".text"
  138. ENTRY(_set_sicb_iwr)
  139. P0.H = hi(SICB_IWR0);
  140. P0.L = lo(SICB_IWR0);
  141. P1.H = hi(SICB_IWR1);
  142. P1.L = lo(SICB_IWR1);
  143. [P0] = R0;
  144. [P1] = R1;
  145. SSYNC;
  146. RTS;
  147. ENDPROC(_set_sicb_iwr)
  148. ENTRY(_coreb_sleep)
  149. sp.l = lo(INITIAL_STACK);
  150. sp.h = hi(INITIAL_STACK);
  151. fp = sp;
  152. usp = sp;
  153. call _set_sicb_iwr;
  154. CLI R2;
  155. SSYNC;
  156. IDLE;
  157. STI R2;
  158. R0 = IWR_DISABLE_ALL;
  159. R1 = IWR_DISABLE_ALL;
  160. call _set_sicb_iwr;
  161. p0.h = hi(COREB_L1_CODE_START);
  162. p0.l = lo(COREB_L1_CODE_START);
  163. jump (p0);
  164. ENDPROC(_coreb_sleep)
  165. __CPUINIT
  166. ENTRY(_coreb_start)
  167. [--sp] = reti;
  168. p0.l = lo(WDOGB_CTL);
  169. p0.h = hi(WDOGB_CTL);
  170. r0 = 0xAD6(z);
  171. w[p0] = r0; /* Clear the watchdog. */
  172. ssync;
  173. /*
  174. * switch to IDLE stack.
  175. */
  176. p0.l = _secondary_stack;
  177. p0.h = _secondary_stack;
  178. sp = [p0];
  179. usp = sp;
  180. fp = sp;
  181. #ifdef CONFIG_HOTPLUG_CPU
  182. p0.l = _hotplug_coreb;
  183. p0.h = _hotplug_coreb;
  184. r0 = [p0];
  185. cc = BITTST(r0, 0);
  186. if cc jump 3f;
  187. #endif
  188. sp += -12;
  189. call _init_pda
  190. sp += 12;
  191. #ifdef CONFIG_HOTPLUG_CPU
  192. 3:
  193. #endif
  194. call _secondary_start_kernel;
  195. .L_exit:
  196. jump.s .L_exit;
  197. ENDPROC(_coreb_start)