1 /* $Id: trampoline.S,v 1.10 1999/09/10 10:40:48 davem Exp $
2 * trampoline.S: Jump start slave processors on sparc64.
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
7 #include <linux/config.h>
12 #include <asm/pstate.h>
14 #include <asm/pgtable.h>
15 #include <asm/spitfire.h>
16 #include <asm/asm_offsets.h>
21 smp_trampoline: .skip 0x300
25 .globl sparc64_cpu_startup, sparc64_cpu_startup_end
28 mov (LSU_CONTROL_IC | LSU_CONTROL_DC | LSU_CONTROL_IM | LSU_CONTROL_DM), %g1
29 stxa %g1, [%g0] ASI_LSU_CONTROL
31 wrpr %g0, (PSTATE_PRIV | PSTATE_PEF | PSTATE_IE), %pstate
35 sethi %uhi(PAGE_OFFSET), %g4
38 /* XXX Buggy PROM... */
42 sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5
44 or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5
46 sethi %uhi(_PAGE_PADDR), %g3
47 or %g3, %ulo(_PAGE_PADDR), %g3
49 sethi %hi(_PAGE_PADDR), %g7
50 or %g7, %lo(_PAGE_PADDR), %g7
57 1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1
64 ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1
67 add %l0, (1 << 3), %l0
76 sethi %hi(KERNBASE), %g3
77 sethi %hi(KERNBASE<<1), %g7
78 mov TLB_TAG_ACCESS, %l7
79 1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1
89 stxa %g0, [%l7] ASI_IMMU
90 stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS
93 add %l0, (1 << 3), %l0
99 1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1
109 stxa %g0, [%l7] ASI_DMMU
110 stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS
111 2: cmp %l0, (63 << 3)
113 add %l0, (1 << 3), %l0
118 sethi %hi(KERNBASE), %g3
120 stxa %g3, [%l7] ASI_DMMU
121 stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS
123 stxa %g3, [%l7] ASI_IMMU
124 stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS
137 mov PRIMARY_CONTEXT, %g7
138 stxa %g0, [%g7] ASI_DMMU
140 mov SECONDARY_CONTEXT, %g7
141 stxa %g0, [%g7] ASI_DMMU
144 mov TLB_TAG_ACCESS, %g2
145 stxa %g3, [%g2] ASI_IMMU
146 stxa %g3, [%g2] ASI_DMMU
149 ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1
150 andn %g1, (_PAGE_G), %g1
151 stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS
154 ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1
155 andn %g1, (_PAGE_G), %g1
156 stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS
163 sllx %g5, (PAGE_SHIFT + 1), %g5
164 sub %g5, (REGWIN_SZ + STACK_BIAS), %g5
171 /* Setup the trap globals, then we can resurface. */
174 wrpr %o1, (PSTATE_AG | PSTATE_IE), %pstate
175 sethi %hi(sparc64_ttable_tl0), %g5
179 wrpr %o1, (PSTATE_MG | PSTATE_IE), %pstate
180 #define KERN_HIGHBITS ((_PAGE_VALID | _PAGE_SZ4MB) ^ 0xfffff80000000000)
181 #define KERN_LOWBITS (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W)
182 #ifdef THIS_IS_CHEETAH
183 #error Dave, make sure you took care of other issues in rest of sparc64 code...
184 #define VPTE_BASE 0xffe0000000000000
185 #else /* Spitfire/Blackbird */
186 #define VPTE_BASE 0xfffffffe00000000
189 stxa %g0, [%g1] ASI_DMMU
192 sethi %uhi(KERN_HIGHBITS), %g2
193 or %g2, %ulo(KERN_HIGHBITS), %g2
195 or %g2, KERN_LOWBITS, %g2
196 sethi %uhi(VPTE_BASE), %g3
197 or %g3, %ulo(VPTE_BASE), %g3
204 /* Setup interrupt globals, we are always SMP. */
205 wrpr %o1, (PSTATE_IG | PSTATE_IE), %pstate
207 /* Get our UPA MID. */
208 lduw [%o2 + AOFF_task_processor], %g1
209 sethi %hi(cpu_data), %g5
210 or %g5, %lo(cpu_data), %g5
212 /* In theory this is: &(cpu_data[this_upamid].irq_worklists[0]) */
218 or %o1, PSTATE_IE, %o1
230 sparc64_cpu_startup_end: