2 * trampoline.S: SMP cpu boot-up trampoline code.
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 #include <linux/init.h>
13 #include <asm/ptrace.h>
14 #include <asm/vaddrs.h>
15 #include <asm/contregs.h>
16 #include <asm/thread_info.h>
18 .globl sun4m_cpu_startup, __smp4m_processor_id, __leon_processor_id
19 .globl sun4d_cpu_startup, __smp4d_processor_id
24 /* When we start up a cpu for the first time it enters this routine.
25 * This initializes the chip from whatever state the prom left it
26 * in and sets PIL in %psr to 15, no irqs.
31 sethi %hi(trapbase_cpu1), %g3
33 or %g3, %lo(trapbase_cpu1), %g3
36 sethi %hi(trapbase_cpu2), %g3
38 or %g3, %lo(trapbase_cpu2), %g3
41 sethi %hi(trapbase_cpu3), %g3
43 or %g3, %lo(trapbase_cpu3), %g3
46 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
47 set (PSR_PIL | PSR_S | PSR_PS), %g1
48 wr %g1, 0x0, %psr ! traps off though
51 /* Our %wim is one behind CWP */
56 /* This identifies "this cpu". */
60 /* Give ourselves a stack and curptr. */
66 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
67 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
70 /* Turn on traps (PSR_ET). */
72 wr %g1, PSR_ET, %psr ! traps on
75 /* Init our caches, etc. */
81 /* Start this processor. */
104 __smp4d_processor_id:
105 lda [%g0] ASI_M_VIKING_TMP1, %g2
115 /* CPUID in bootbus can be found at PA 0xff0140000 */
116 #define SUN4D_BOOTBUS_CPUID 0xf0140000
122 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
123 set (PSR_PIL | PSR_S | PSR_PS), %g1
124 wr %g1, 0x0, %psr ! traps off though
127 /* Our %wim is one behind CWP */
132 /* Set tbr - we use just one trap table. */
137 /* Get our CPU id out of bootbus */
138 set SUN4D_BOOTBUS_CPUID, %g3
139 lduba [%g3] ASI_M_CTL, %g3
142 sta %g1, [%g0] ASI_M_VIKING_TMP1
144 /* Give ourselves a stack and curptr. */
149 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
150 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
153 /* Turn on traps (PSR_ET). */
155 wr %g1, PSR_ET, %psr ! traps on
158 /* Init our caches, etc. */
164 /* Start this processor. */
170 #ifdef CONFIG_SPARC_LEON
174 .global leon_smp_cpu_startup, smp_penguin_ctable
176 leon_smp_cpu_startup:
178 set smp_penguin_ctable,%g1
181 set 0x00000100,%g5 /* SRMMU_CTXTBL_PTR */
182 sta %g1, [%g5] ASI_M_MMUREGS
184 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
185 set (PSR_PIL | PSR_S | PSR_PS), %g1
186 wr %g1, 0x0, %psr ! traps off though
189 /* Our %wim is one behind CWP */
194 /* Set tbr - we use just one trap table. */
202 /* Give ourselves a stack and curptr. */
208 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
209 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
212 /* Turn on traps (PSR_ET). */
214 wr %g1, PSR_ET, %psr ! traps on
217 /* Init our caches, etc. */
223 /* Start this processor. */