trampoline_32.S 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * trampoline.S: SMP cpu boot-up trampoline code.
  3. *
  4. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5. * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6. */
  7. #include <linux/init.h>
  8. #include <asm/head.h>
  9. #include <asm/psr.h>
  10. #include <asm/page.h>
  11. #include <asm/asi.h>
  12. #include <asm/ptrace.h>
  13. #include <asm/vaddrs.h>
  14. #include <asm/contregs.h>
  15. #include <asm/thread_info.h>
  16. .globl sun4m_cpu_startup
  17. .globl sun4d_cpu_startup
  18. __CPUINIT
  19. .align 4
  20. /* When we start up a cpu for the first time it enters this routine.
  21. * This initializes the chip from whatever state the prom left it
  22. * in and sets PIL in %psr to 15, no irqs.
  23. */
  24. sun4m_cpu_startup:
  25. cpu1_startup:
  26. sethi %hi(trapbase_cpu1), %g3
  27. b 1f
  28. or %g3, %lo(trapbase_cpu1), %g3
  29. cpu2_startup:
  30. sethi %hi(trapbase_cpu2), %g3
  31. b 1f
  32. or %g3, %lo(trapbase_cpu2), %g3
  33. cpu3_startup:
  34. sethi %hi(trapbase_cpu3), %g3
  35. b 1f
  36. or %g3, %lo(trapbase_cpu3), %g3
  37. 1:
  38. /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
  39. set (PSR_PIL | PSR_S | PSR_PS), %g1
  40. wr %g1, 0x0, %psr ! traps off though
  41. WRITE_PAUSE
  42. /* Our %wim is one behind CWP */
  43. mov 2, %g1
  44. wr %g1, 0x0, %wim
  45. WRITE_PAUSE
  46. /* This identifies "this cpu". */
  47. wr %g3, 0x0, %tbr
  48. WRITE_PAUSE
  49. /* Give ourselves a stack and curptr. */
  50. set current_set, %g5
  51. srl %g3, 10, %g4
  52. and %g4, 0xc, %g4
  53. ld [%g5 + %g4], %g6
  54. sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
  55. or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
  56. add %g6, %sp, %sp
  57. /* Turn on traps (PSR_ET). */
  58. rd %psr, %g1
  59. wr %g1, PSR_ET, %psr ! traps on
  60. WRITE_PAUSE
  61. /* Init our caches, etc. */
  62. set poke_srmmu, %g5
  63. ld [%g5], %g5
  64. call %g5
  65. nop
  66. /* Start this processor. */
  67. call smp4m_callin
  68. nop
  69. b,a smp_do_cpu_idle
  70. .text
  71. .align 4
  72. smp_do_cpu_idle:
  73. call cpu_idle
  74. mov 0, %o0
  75. call cpu_panic
  76. nop
  77. /* CPUID in bootbus can be found at PA 0xff0140000 */
  78. #define SUN4D_BOOTBUS_CPUID 0xf0140000
  79. __CPUINIT
  80. .align 4
  81. sun4d_cpu_startup:
  82. /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
  83. set (PSR_PIL | PSR_S | PSR_PS), %g1
  84. wr %g1, 0x0, %psr ! traps off though
  85. WRITE_PAUSE
  86. /* Our %wim is one behind CWP */
  87. mov 2, %g1
  88. wr %g1, 0x0, %wim
  89. WRITE_PAUSE
  90. /* Set tbr - we use just one trap table. */
  91. set trapbase, %g1
  92. wr %g1, 0x0, %tbr
  93. WRITE_PAUSE
  94. /* Get our CPU id out of bootbus */
  95. set SUN4D_BOOTBUS_CPUID, %g3
  96. lduba [%g3] ASI_M_CTL, %g3
  97. and %g3, 0xf8, %g3
  98. srl %g3, 3, %g1
  99. sta %g1, [%g0] ASI_M_VIKING_TMP1
  100. /* Give ourselves a stack and curptr. */
  101. set current_set, %g5
  102. srl %g3, 1, %g4
  103. ld [%g5 + %g4], %g6
  104. sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
  105. or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
  106. add %g6, %sp, %sp
  107. /* Turn on traps (PSR_ET). */
  108. rd %psr, %g1
  109. wr %g1, PSR_ET, %psr ! traps on
  110. WRITE_PAUSE
  111. /* Init our caches, etc. */
  112. set poke_srmmu, %g5
  113. ld [%g5], %g5
  114. call %g5
  115. nop
  116. /* Start this processor. */
  117. call smp4d_callin
  118. nop
  119. b,a smp_do_cpu_idle
  120. __CPUINIT
  121. .align 4
  122. .global leon_smp_cpu_startup, smp_penguin_ctable
  123. leon_smp_cpu_startup:
  124. set smp_penguin_ctable,%g1
  125. ld [%g1+4],%g1
  126. srl %g1,4,%g1
  127. set 0x00000100,%g5 /* SRMMU_CTXTBL_PTR */
  128. sta %g1, [%g5] ASI_LEON_MMUREGS
  129. /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
  130. set (PSR_PIL | PSR_S | PSR_PS), %g1
  131. wr %g1, 0x0, %psr ! traps off though
  132. WRITE_PAUSE
  133. /* Our %wim is one behind CWP */
  134. mov 2, %g1
  135. wr %g1, 0x0, %wim
  136. WRITE_PAUSE
  137. /* Set tbr - we use just one trap table. */
  138. set trapbase, %g1
  139. wr %g1, 0x0, %tbr
  140. WRITE_PAUSE
  141. /* Get our CPU id */
  142. rd %asr17,%g3
  143. /* Give ourselves a stack and curptr. */
  144. set current_set, %g5
  145. srl %g3, 28, %g4
  146. sll %g4, 2, %g4
  147. ld [%g5 + %g4], %g6
  148. sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
  149. or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
  150. add %g6, %sp, %sp
  151. /* Turn on traps (PSR_ET). */
  152. rd %psr, %g1
  153. wr %g1, PSR_ET, %psr ! traps on
  154. WRITE_PAUSE
  155. /* Init our caches, etc. */
  156. set poke_srmmu, %g5
  157. ld [%g5], %g5
  158. call %g5
  159. nop
  160. /* Start this processor. */
  161. call leon_callin
  162. nop
  163. b,a smp_do_cpu_idle