1 /* SPDX-License-Identifier: GPL-2.0 */
3 * trampoline.S: SMP cpu boot-up trampoline code.
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
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
19 .globl sun4d_cpu_startup
23 /* When we start up a cpu for the first time it enters this routine.
24 * This initializes the chip from whatever state the prom left it
25 * in and sets PIL in %psr to 15, no irqs.
30 sethi %hi(trapbase_cpu1), %g3
32 or %g3, %lo(trapbase_cpu1), %g3
35 sethi %hi(trapbase_cpu2), %g3
37 or %g3, %lo(trapbase_cpu2), %g3
40 sethi %hi(trapbase_cpu3), %g3
42 or %g3, %lo(trapbase_cpu3), %g3
45 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
46 set (PSR_PIL | PSR_S | PSR_PS), %g1
47 wr %g1, 0x0, %psr ! traps off though
50 /* Our %wim is one behind CWP */
55 /* This identifies "this cpu". */
59 /* Give ourselves a stack and curptr. */
65 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
66 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
69 /* Turn on traps (PSR_ET). */
71 wr %g1, PSR_ET, %psr ! traps on
74 /* Init our caches, etc. */
80 /* Start this processor. */
93 /* CPUID in bootbus can be found at PA 0xff0140000 */
94 #define SUN4D_BOOTBUS_CPUID 0xf0140000
99 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
100 set (PSR_PIL | PSR_S | PSR_PS), %g1
101 wr %g1, 0x0, %psr ! traps off though
104 /* Our %wim is one behind CWP */
109 /* Set tbr - we use just one trap table. */
114 /* Get our CPU id out of bootbus */
115 set SUN4D_BOOTBUS_CPUID, %g3
116 lduba [%g3] ASI_M_CTL, %g3
119 sta %g1, [%g0] ASI_M_VIKING_TMP1
121 /* Give ourselves a stack and curptr. */
126 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
127 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
130 /* Turn on traps (PSR_ET). */
132 wr %g1, PSR_ET, %psr ! traps on
135 /* Init our caches, etc. */
141 /* Start this processor. */
148 .global leon_smp_cpu_startup, smp_penguin_ctable
150 leon_smp_cpu_startup:
152 set smp_penguin_ctable,%g1
155 set 0x00000100,%g5 /* SRMMU_CTXTBL_PTR */
156 sta %g1, [%g5] ASI_LEON_MMUREGS
158 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
159 set (PSR_PIL | PSR_S | PSR_PS), %g1
160 wr %g1, 0x0, %psr ! traps off though
163 /* Our %wim is one behind CWP */
168 /* Set tbr - we use just one trap table. */
176 /* Give ourselves a stack and curptr. */
182 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
183 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
186 /* Turn on traps (PSR_ET). */
188 wr %g1, PSR_ET, %psr ! traps on
191 /* Init our caches, etc. */
197 /* Start this processor. */