secondary.S 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * File: arch/blackfin/mach-bf561/secondary.S
  3. * Based on: arch/blackfin/mach-bf561/head.S
  4. * Author: Philippe Gerum <rpm@xenomai.org>
  5. *
  6. * Copyright 2007 Analog Devices Inc.
  7. *
  8. * Description: BF561 coreB bootstrap file
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, see the file COPYING, or write
  22. * to the Free Software Foundation, Inc.,
  23. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  24. */
  25. #include <linux/linkage.h>
  26. #include <linux/init.h>
  27. #include <asm/blackfin.h>
  28. #include <asm/asm-offsets.h>
  29. __INIT
  30. /* Lay the initial stack into the L1 scratch area of Core B */
  31. #define INITIAL_STACK (COREB_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
  32. ENTRY(_coreb_trampoline_start)
  33. /* Set the SYSCFG register */
  34. R0 = 0x36;
  35. SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
  36. R0 = 0;
  37. /*Clear Out All the data and pointer Registers*/
  38. R1 = R0;
  39. R2 = R0;
  40. R3 = R0;
  41. R4 = R0;
  42. R5 = R0;
  43. R6 = R0;
  44. R7 = R0;
  45. P0 = R0;
  46. P1 = R0;
  47. P2 = R0;
  48. P3 = R0;
  49. P4 = R0;
  50. P5 = R0;
  51. LC0 = r0;
  52. LC1 = r0;
  53. L0 = r0;
  54. L1 = r0;
  55. L2 = r0;
  56. L3 = r0;
  57. /* Clear Out All the DAG Registers*/
  58. B0 = r0;
  59. B1 = r0;
  60. B2 = r0;
  61. B3 = r0;
  62. I0 = r0;
  63. I1 = r0;
  64. I2 = r0;
  65. I3 = r0;
  66. M0 = r0;
  67. M1 = r0;
  68. M2 = r0;
  69. M3 = r0;
  70. /* Turn off the icache */
  71. p0.l = LO(IMEM_CONTROL);
  72. p0.h = HI(IMEM_CONTROL);
  73. R1 = [p0];
  74. R0 = ~ENICPLB;
  75. R0 = R0 & R1;
  76. /* Anomaly 05000125 */
  77. #ifdef ANOMALY_05000125
  78. CLI R2;
  79. SSYNC;
  80. #endif
  81. [p0] = R0;
  82. SSYNC;
  83. #ifdef ANOMALY_05000125
  84. STI R2;
  85. #endif
  86. /* Turn off the dcache */
  87. p0.l = LO(DMEM_CONTROL);
  88. p0.h = HI(DMEM_CONTROL);
  89. R1 = [p0];
  90. R0 = ~ENDCPLB;
  91. R0 = R0 & R1;
  92. /* Anomaly 05000125 */
  93. #ifdef ANOMALY_05000125
  94. CLI R2;
  95. SSYNC;
  96. #endif
  97. [p0] = R0;
  98. SSYNC;
  99. #ifdef ANOMALY_05000125
  100. STI R2;
  101. #endif
  102. /* in case of double faults, save a few things */
  103. p0.l = _init_retx_coreb;
  104. p0.h = _init_retx_coreb;
  105. R0 = RETX;
  106. [P0] = R0;
  107. #ifdef CONFIG_DEBUG_DOUBLEFAULT
  108. /* Only save these if we are storing them,
  109. * This happens here, since L1 gets clobbered
  110. * below
  111. */
  112. GET_PDA(p0, r0);
  113. r7 = [p0 + PDA_RETX];
  114. p1.l = _init_saved_retx_coreb;
  115. p1.h = _init_saved_retx_coreb;
  116. [p1] = r7;
  117. r7 = [p0 + PDA_DCPLB];
  118. p1.l = _init_saved_dcplb_fault_addr_coreb;
  119. p1.h = _init_saved_dcplb_fault_addr_coreb;
  120. [p1] = r7;
  121. r7 = [p0 + PDA_ICPLB];
  122. p1.l = _init_saved_icplb_fault_addr_coreb;
  123. p1.h = _init_saved_icplb_fault_addr_coreb;
  124. [p1] = r7;
  125. r7 = [p0 + PDA_SEQSTAT];
  126. p1.l = _init_saved_seqstat_coreb;
  127. p1.h = _init_saved_seqstat_coreb;
  128. [p1] = r7;
  129. #endif
  130. /* Initialize stack pointer */
  131. sp.l = lo(INITIAL_STACK);
  132. sp.h = hi(INITIAL_STACK);
  133. fp = sp;
  134. usp = sp;
  135. /* This section keeps the processor in supervisor mode
  136. * during core B startup. Branches to the idle task.
  137. */
  138. /* EVT15 = _real_start */
  139. p0.l = lo(EVT15);
  140. p0.h = hi(EVT15);
  141. p1.l = _coreb_start;
  142. p1.h = _coreb_start;
  143. [p0] = p1;
  144. csync;
  145. p0.l = lo(IMASK);
  146. p0.h = hi(IMASK);
  147. p1.l = IMASK_IVG15;
  148. p1.h = 0x0;
  149. [p0] = p1;
  150. csync;
  151. raise 15;
  152. p0.l = .LWAIT_HERE;
  153. p0.h = .LWAIT_HERE;
  154. reti = p0;
  155. #if defined(ANOMALY_05000281)
  156. nop; nop; nop;
  157. #endif
  158. rti;
  159. .LWAIT_HERE:
  160. jump .LWAIT_HERE;
  161. ENDPROC(_coreb_trampoline_start)
  162. ENTRY(_coreb_trampoline_end)
  163. ENTRY(_coreb_start)
  164. [--sp] = reti;
  165. p0.l = lo(WDOGB_CTL);
  166. p0.h = hi(WDOGB_CTL);
  167. r0 = 0xAD6(z);
  168. w[p0] = r0; /* Clear the watchdog. */
  169. ssync;
  170. /*
  171. * switch to IDLE stack.
  172. */
  173. p0.l = _secondary_stack;
  174. p0.h = _secondary_stack;
  175. sp = [p0];
  176. usp = sp;
  177. fp = sp;
  178. sp += -12;
  179. call _init_pda
  180. sp += 12;
  181. call _secondary_start_kernel;
  182. .L_exit:
  183. jump.s .L_exit;
  184. ENDPROC(_coreb_start)
  185. __FINIT