trampoline_32.S 3.8 KB

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