trampoline_32.S 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 smp_callin
  68. nop
  69. b,a smp_panic
  70. .text
  71. .align 4
  72. smp_panic:
  73. call cpu_panic
  74. nop
  75. /* CPUID in bootbus can be found at PA 0xff0140000 */
  76. #define SUN4D_BOOTBUS_CPUID 0xf0140000
  77. __CPUINIT
  78. .align 4
  79. sun4d_cpu_startup:
  80. /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
  81. set (PSR_PIL | PSR_S | PSR_PS), %g1
  82. wr %g1, 0x0, %psr ! traps off though
  83. WRITE_PAUSE
  84. /* Our %wim is one behind CWP */
  85. mov 2, %g1
  86. wr %g1, 0x0, %wim
  87. WRITE_PAUSE
  88. /* Set tbr - we use just one trap table. */
  89. set trapbase, %g1
  90. wr %g1, 0x0, %tbr
  91. WRITE_PAUSE
  92. /* Get our CPU id out of bootbus */
  93. set SUN4D_BOOTBUS_CPUID, %g3
  94. lduba [%g3] ASI_M_CTL, %g3
  95. and %g3, 0xf8, %g3
  96. srl %g3, 3, %g1
  97. sta %g1, [%g0] ASI_M_VIKING_TMP1
  98. /* Give ourselves a stack and curptr. */
  99. set current_set, %g5
  100. srl %g3, 1, %g4
  101. ld [%g5 + %g4], %g6
  102. sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
  103. or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
  104. add %g6, %sp, %sp
  105. /* Turn on traps (PSR_ET). */
  106. rd %psr, %g1
  107. wr %g1, PSR_ET, %psr ! traps on
  108. WRITE_PAUSE
  109. /* Init our caches, etc. */
  110. set poke_srmmu, %g5
  111. ld [%g5], %g5
  112. call %g5
  113. nop
  114. /* Start this processor. */
  115. call smp_callin
  116. nop
  117. b,a smp_panic
  118. __CPUINIT
  119. .align 4
  120. .global leon_smp_cpu_startup, smp_penguin_ctable
  121. leon_smp_cpu_startup:
  122. set smp_penguin_ctable,%g1
  123. ld [%g1+4],%g1
  124. srl %g1,4,%g1
  125. set 0x00000100,%g5 /* SRMMU_CTXTBL_PTR */
  126. sta %g1, [%g5] ASI_LEON_MMUREGS
  127. /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
  128. set (PSR_PIL | PSR_S | PSR_PS), %g1
  129. wr %g1, 0x0, %psr ! traps off though
  130. WRITE_PAUSE
  131. /* Our %wim is one behind CWP */
  132. mov 2, %g1
  133. wr %g1, 0x0, %wim
  134. WRITE_PAUSE
  135. /* Set tbr - we use just one trap table. */
  136. set trapbase, %g1
  137. wr %g1, 0x0, %tbr
  138. WRITE_PAUSE
  139. /* Get our CPU id */
  140. rd %asr17,%g3
  141. /* Give ourselves a stack and curptr. */
  142. set current_set, %g5
  143. srl %g3, 28, %g4
  144. sll %g4, 2, %g4
  145. ld [%g5 + %g4], %g6
  146. sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
  147. or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
  148. add %g6, %sp, %sp
  149. /* Turn on traps (PSR_ET). */
  150. rd %psr, %g1
  151. wr %g1, PSR_ET, %psr ! traps on
  152. WRITE_PAUSE
  153. /* Init our caches, etc. */
  154. set poke_srmmu, %g5
  155. ld [%g5], %g5
  156. call %g5
  157. nop
  158. /* Start this processor. */
  159. call smp_callin
  160. nop
  161. b,a smp_panic