[2a99fa8] | 1 | #
|
---|
[df4ed85] | 2 | # Copyright (c) 2005 Jakub Jermar
|
---|
[2a99fa8] | 3 | # All rights reserved.
|
---|
| 4 | #
|
---|
| 5 | # Redistribution and use in source and binary forms, with or without
|
---|
| 6 | # modification, are permitted provided that the following conditions
|
---|
| 7 | # are met:
|
---|
| 8 | #
|
---|
| 9 | # - Redistributions of source code must retain the above copyright
|
---|
| 10 | # notice, this list of conditions and the following disclaimer.
|
---|
| 11 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | # documentation and/or other materials provided with the distribution.
|
---|
| 14 | # - The name of the author may not be used to endorse or promote products
|
---|
| 15 | # derived from this software without specific prior written permission.
|
---|
| 16 | #
|
---|
| 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | #
|
---|
| 28 |
|
---|
[a52e2f4] | 29 | #include <abi/asmtool.h>
|
---|
| 30 |
|
---|
[a9ac978] | 31 | #include <arch/arch.h>
|
---|
[965dc18] | 32 | #include <arch/cpu.h>
|
---|
[63cda71] | 33 | #include <arch/regdef.h>
|
---|
[e386cbf] | 34 | #include <arch/boot/boot.h>
|
---|
[84060e2] | 35 | #include <arch/stack.h>
|
---|
[e386cbf] | 36 |
|
---|
| 37 | #include <arch/mm/mmu.h>
|
---|
| 38 | #include <arch/mm/tlb.h>
|
---|
| 39 | #include <arch/mm/tte.h>
|
---|
[b97b348] | 40 | #include <arch/mm/cache_spec.h>
|
---|
[0e4dd7b] | 41 |
|
---|
[a9ac978] | 42 | #ifdef CONFIG_SMP
|
---|
[b482287] | 43 | #include <arch/context_struct.h>
|
---|
[a9ac978] | 44 | #endif
|
---|
| 45 |
|
---|
[437ee6a4] | 46 | .register %g2, #scratch
|
---|
| 47 | .register %g3, #scratch
|
---|
| 48 |
|
---|
[2a99fa8] | 49 | .section K_TEXT_START, "ax"
|
---|
| 50 |
|
---|
[f2ea5d8] | 51 | #define BSP_FLAG 1
|
---|
| 52 |
|
---|
[965dc18] | 53 | /*
|
---|
| 54 | * 2^PHYSMEM_ADDR_SIZE is the size of the physical address space on
|
---|
| 55 | * a given processor.
|
---|
| 56 | */
|
---|
| 57 | #if defined (US)
|
---|
| 58 | #define PHYSMEM_ADDR_SIZE 41
|
---|
| 59 | #elif defined (US3)
|
---|
| 60 | #define PHYSMEM_ADDR_SIZE 43
|
---|
| 61 | #endif
|
---|
| 62 |
|
---|
[c1e43e4] | 63 | /*
|
---|
[f2ea5d8] | 64 | * Here is where the kernel is passed control from the boot loader.
|
---|
[4872160] | 65 | *
|
---|
[94d614e] | 66 | * The registers are expected to be in this state:
|
---|
[b97b348] | 67 | * - %o0 starting address of physical memory
|
---|
[4872160] | 68 | * + bootstrap processor flag
|
---|
| 69 | * bits 63...1: physical memory starting address / 2
|
---|
| 70 | * bit 0: non-zero on BSP processor, zero on AP processors
|
---|
[b97b348] | 71 | * - %o1 bootinfo structure address (BSP only)
|
---|
| 72 | *
|
---|
[10b890b] | 73 | *
|
---|
[f2ea5d8] | 74 | * Moreover, we depend on boot having established the following environment:
|
---|
[4872160] | 75 | * - TLBs are on
|
---|
| 76 | * - identity mapping for the kernel image
|
---|
| 77 | *
|
---|
[c1e43e4] | 78 | */
|
---|
| 79 |
|
---|
[a52e2f4] | 80 | SYMBOL(kernel_image_start)
|
---|
[f2ea5d8] | 81 | mov BSP_FLAG, %l0
|
---|
[b97b348] | 82 | and %o0, %l0, %l7 ! l7 <= bootstrap processor?
|
---|
| 83 | andn %o0, %l0, %l6 ! l6 <= start of physical memory
|
---|
[f2ea5d8] | 84 |
|
---|
[965dc18] | 85 | ! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base.
|
---|
[79f119b9] | 86 | srlx %l6, 13, %l5
|
---|
[a35b458] | 87 |
|
---|
[965dc18] | 88 | ! l5 <= physmem_base[(PHYSMEM_ADDR_SIZE - 1):13]
|
---|
| 89 | sllx %l5, 13 + (63 - (PHYSMEM_ADDR_SIZE - 1)), %l5
|
---|
[1b20da0] | 90 | srlx %l5, 63 - (PHYSMEM_ADDR_SIZE - 1), %l5
|
---|
[2bf4936] | 91 |
|
---|
[94d614e] | 92 | /*
|
---|
[e386cbf] | 93 | * Setup basic runtime environment.
|
---|
[94d614e] | 94 | */
|
---|
[e386cbf] | 95 |
|
---|
[8440473] | 96 | wrpr %g0, NWINDOWS - 2, %cansave ! set maximum saveable windows
|
---|
[7e7c8747] | 97 | wrpr %g0, 0, %canrestore ! get rid of windows we will
|
---|
| 98 | ! never need again
|
---|
| 99 | wrpr %g0, 0, %otherwin ! make sure the window state is
|
---|
| 100 | ! consistent
|
---|
| 101 | wrpr %g0, NWINDOWS - 1, %cleanwin ! prevent needless clean_window
|
---|
| 102 | ! traps for kernel
|
---|
[a35b458] | 103 |
|
---|
[965dc18] | 104 | wrpr %g0, 0, %wstate ! use default spill/fill trap
|
---|
[e386cbf] | 105 |
|
---|
[7e7c8747] | 106 | wrpr %g0, 0, %tl ! TL = 0, primary context
|
---|
| 107 | ! register is used
|
---|
[e386cbf] | 108 |
|
---|
[7e7c8747] | 109 | wrpr %g0, PSTATE_PRIV_BIT, %pstate ! disable interrupts and disable
|
---|
| 110 | ! 32-bit address masking
|
---|
[9a5b556] | 111 |
|
---|
| 112 | wrpr %g0, 0, %pil ! intialize %pil
|
---|
[0ffa3ef5] | 113 |
|
---|
[10b890b] | 114 | /*
|
---|
[e386cbf] | 115 | * Switch to kernel trap table.
|
---|
| 116 | */
|
---|
[7bb6b06] | 117 | sethi %hi(trap_table), %g1
|
---|
| 118 | wrpr %g1, %lo(trap_table), %tba
|
---|
[e386cbf] | 119 |
|
---|
[1b20da0] | 120 | /*
|
---|
[8dbc18c] | 121 | * Take over the DMMU by installing locked TTE entry identically
|
---|
[7e7c8747] | 122 | * mapping the first 4M of memory.
|
---|
[10b890b] | 123 | *
|
---|
[7e7c8747] | 124 | * In case of DMMU, no FLUSH instructions need to be issued. Because of
|
---|
| 125 | * that, the old DTLB contents can be demapped pretty straightforwardly
|
---|
| 126 | * and without causing any traps.
|
---|
[10b890b] | 127 | */
|
---|
| 128 |
|
---|
[e386cbf] | 129 | wr %g0, ASI_DMMU, %asi
|
---|
| 130 |
|
---|
| 131 | #define SET_TLB_DEMAP_CMD(r1, context_id) \
|
---|
[7e7c8747] | 132 | set (TLB_DEMAP_CONTEXT << TLB_DEMAP_TYPE_SHIFT) | (context_id << \
|
---|
| 133 | TLB_DEMAP_CONTEXT_SHIFT), %r1
|
---|
[a35b458] | 134 |
|
---|
[e386cbf] | 135 | ! demap context 0
|
---|
| 136 | SET_TLB_DEMAP_CMD(g1, TLB_DEMAP_NUCLEUS)
|
---|
[1b20da0] | 137 | stxa %g0, [%g1] ASI_DMMU_DEMAP
|
---|
[e386cbf] | 138 | membar #Sync
|
---|
| 139 |
|
---|
| 140 | #define SET_TLB_TAG(r1, context) \
|
---|
[7e7c8747] | 141 | set VMA | (context << TLB_TAG_ACCESS_CONTEXT_SHIFT), %r1
|
---|
[e386cbf] | 142 |
|
---|
| 143 | ! write DTLB tag
|
---|
| 144 | SET_TLB_TAG(g1, MEM_CONTEXT_KERNEL)
|
---|
[1b20da0] | 145 | stxa %g1, [VA_DMMU_TAG_ACCESS] %asi
|
---|
[e386cbf] | 146 | membar #Sync
|
---|
| 147 |
|
---|
[92778f2] | 148 | #ifdef CONFIG_VIRT_IDX_DCACHE
|
---|
[44d0758] | 149 | #define TTE_LOW_DATA(imm) (TTE_CP | TTE_CV | TTE_P | LMA | (imm))
|
---|
[92778f2] | 150 | #else /* CONFIG_VIRT_IDX_DCACHE */
|
---|
[44d0758] | 151 | #define TTE_LOW_DATA(imm) (TTE_CP | TTE_P | LMA | (imm))
|
---|
[92778f2] | 152 | #endif /* CONFIG_VIRT_IDX_DCACHE */
|
---|
[44d0758] | 153 |
|
---|
[e386cbf] | 154 | #define SET_TLB_DATA(r1, r2, imm) \
|
---|
[44d0758] | 155 | set TTE_LOW_DATA(imm), %r1; \
|
---|
[f2ea5d8] | 156 | or %r1, %l5, %r1; \
|
---|
| 157 | mov PAGESIZE_4M, %r2; \
|
---|
[e386cbf] | 158 | sllx %r2, TTE_SIZE_SHIFT, %r2; \
|
---|
| 159 | or %r1, %r2, %r1; \
|
---|
[7bb6b06] | 160 | mov 1, %r2; \
|
---|
[e386cbf] | 161 | sllx %r2, TTE_V_SHIFT, %r2; \
|
---|
| 162 | or %r1, %r2, %r1;
|
---|
[a35b458] | 163 |
|
---|
[e386cbf] | 164 | ! write DTLB data and install the kernel mapping
|
---|
[e5ecc02] | 165 | SET_TLB_DATA(g1, g2, TTE_L | TTE_W) ! use non-global mapping
|
---|
[1b20da0] | 166 | stxa %g1, [%g0] ASI_DTLB_DATA_IN_REG
|
---|
[d681c17] | 167 | membar #Sync
|
---|
| 168 |
|
---|
| 169 | /*
|
---|
[7e7c8747] | 170 | * Because we cannot use global mappings (because we want to have
|
---|
| 171 | * separate 64-bit address spaces for both the kernel and the
|
---|
| 172 | * userspace), we prepare the identity mapping also in context 1. This
|
---|
| 173 | * step is required by the code installing the ITLB mapping.
|
---|
[d681c17] | 174 | */
|
---|
| 175 | ! write DTLB tag of context 1 (i.e. MEM_CONTEXT_TEMP)
|
---|
| 176 | SET_TLB_TAG(g1, MEM_CONTEXT_TEMP)
|
---|
[1b20da0] | 177 | stxa %g1, [VA_DMMU_TAG_ACCESS] %asi
|
---|
[d681c17] | 178 | membar #Sync
|
---|
| 179 |
|
---|
| 180 | ! write DTLB data and install the kernel mapping in context 1
|
---|
[e5ecc02] | 181 | SET_TLB_DATA(g1, g2, TTE_W) ! use non-global mapping
|
---|
[1b20da0] | 182 | stxa %g1, [%g0] ASI_DTLB_DATA_IN_REG
|
---|
[e386cbf] | 183 | membar #Sync
|
---|
[a35b458] | 184 |
|
---|
[e386cbf] | 185 | /*
|
---|
[7e7c8747] | 186 | * Now is time to take over the IMMU. Unfortunatelly, it cannot be done
|
---|
| 187 | * as easily as the DMMU, because the IMMU is mapping the code it
|
---|
| 188 | * executes.
|
---|
[e386cbf] | 189 | *
|
---|
[7e7c8747] | 190 | * [ Note that brave experiments with disabling the IMMU and using the
|
---|
| 191 | * DMMU approach failed after a dozen of desparate days with only little
|
---|
| 192 | * success. ]
|
---|
[e386cbf] | 193 | *
|
---|
[7e7c8747] | 194 | * The approach used here is inspired from OpenBSD. First, the kernel
|
---|
| 195 | * creates IMMU mapping for itself in context 1 (MEM_CONTEXT_TEMP) and
|
---|
| 196 | * switches to it. Context 0 (MEM_CONTEXT_KERNEL) can be demapped
|
---|
| 197 | * afterwards and replaced with the kernel permanent mapping. Finally,
|
---|
| 198 | * the kernel switches back to context 0 and demaps context 1.
|
---|
[e386cbf] | 199 | *
|
---|
[7e7c8747] | 200 | * Moreover, the IMMU requires use of the FLUSH instructions. But that
|
---|
| 201 | * is OK because we always use operands with addresses already mapped by
|
---|
| 202 | * the taken over DTLB.
|
---|
[e386cbf] | 203 | */
|
---|
[a35b458] | 204 |
|
---|
[a7961271] | 205 | set kernel_image_start, %g5
|
---|
[a35b458] | 206 |
|
---|
[e386cbf] | 207 | ! write ITLB tag of context 1
|
---|
| 208 | SET_TLB_TAG(g1, MEM_CONTEXT_TEMP)
|
---|
[7bb6b06] | 209 | mov VA_DMMU_TAG_ACCESS, %g2
|
---|
[e386cbf] | 210 | stxa %g1, [%g2] ASI_IMMU
|
---|
[a7961271] | 211 | flush %g5
|
---|
[e386cbf] | 212 |
|
---|
| 213 | ! write ITLB data and install the temporary mapping in context 1
|
---|
| 214 | SET_TLB_DATA(g1, g2, 0) ! use non-global mapping
|
---|
[1b20da0] | 215 | stxa %g1, [%g0] ASI_ITLB_DATA_IN_REG
|
---|
[a7961271] | 216 | flush %g5
|
---|
[a35b458] | 217 |
|
---|
[e386cbf] | 218 | ! switch to context 1
|
---|
[7bb6b06] | 219 | mov MEM_CONTEXT_TEMP, %g1
|
---|
[e386cbf] | 220 | stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi ! ASI_DMMU is correct here !!!
|
---|
[a7961271] | 221 | flush %g5
|
---|
[a35b458] | 222 |
|
---|
[e386cbf] | 223 | ! demap context 0
|
---|
| 224 | SET_TLB_DEMAP_CMD(g1, TLB_DEMAP_NUCLEUS)
|
---|
[1b20da0] | 225 | stxa %g0, [%g1] ASI_IMMU_DEMAP
|
---|
[a7961271] | 226 | flush %g5
|
---|
[a35b458] | 227 |
|
---|
[e386cbf] | 228 | ! write ITLB tag of context 0
|
---|
| 229 | SET_TLB_TAG(g1, MEM_CONTEXT_KERNEL)
|
---|
[7bb6b06] | 230 | mov VA_DMMU_TAG_ACCESS, %g2
|
---|
[e386cbf] | 231 | stxa %g1, [%g2] ASI_IMMU
|
---|
[a7961271] | 232 | flush %g5
|
---|
[e386cbf] | 233 |
|
---|
| 234 | ! write ITLB data and install the permanent kernel mapping in context 0
|
---|
[e5ecc02] | 235 | SET_TLB_DATA(g1, g2, TTE_L) ! use non-global mapping
|
---|
[1b20da0] | 236 | stxa %g1, [%g0] ASI_ITLB_DATA_IN_REG
|
---|
[a7961271] | 237 | flush %g5
|
---|
[e386cbf] | 238 |
|
---|
[398e7688] | 239 | ! enter nucleus - using context 0
|
---|
[e386cbf] | 240 | wrpr %g0, 1, %tl
|
---|
| 241 |
|
---|
| 242 | ! demap context 1
|
---|
| 243 | SET_TLB_DEMAP_CMD(g1, TLB_DEMAP_PRIMARY)
|
---|
[1b20da0] | 244 | stxa %g0, [%g1] ASI_IMMU_DEMAP
|
---|
[a7961271] | 245 | flush %g5
|
---|
[a35b458] | 246 |
|
---|
[e386cbf] | 247 | ! set context 0 in the primary context register
|
---|
| 248 | stxa %g0, [VA_PRIMARY_CONTEXT_REG] %asi ! ASI_DMMU is correct here !!!
|
---|
[a7961271] | 249 | flush %g5
|
---|
[a35b458] | 250 |
|
---|
[398e7688] | 251 | ! leave nucleus - using primary context, i.e. context 0
|
---|
[e386cbf] | 252 | wrpr %g0, 0, %tl
|
---|
[cfa70add] | 253 |
|
---|
[a9ac978] | 254 | brz %l7, 1f ! skip if you are not the bootstrap CPU
|
---|
| 255 | nop
|
---|
[b44939b] | 256 |
|
---|
[79f119b9] | 257 | /*
|
---|
| 258 | * Save physmem_base for use by the mm subsystem.
|
---|
| 259 | * %l6 contains starting physical address
|
---|
| 260 | */
|
---|
| 261 | sethi %hi(physmem_base), %l4
|
---|
| 262 | stx %l6, [%l4 + %lo(physmem_base)]
|
---|
| 263 |
|
---|
| 264 | /*
|
---|
| 265 | * Precompute kernel 8K TLB data template.
|
---|
[965dc18] | 266 | * %l5 contains starting physical address
|
---|
| 267 | * bits [(PHYSMEM_ADDR_SIZE - 1):13]
|
---|
[79f119b9] | 268 | */
|
---|
| 269 | sethi %hi(kernel_8k_tlb_data_template), %l4
|
---|
| 270 | ldx [%l4 + %lo(kernel_8k_tlb_data_template)], %l3
|
---|
| 271 | or %l3, %l5, %l3
|
---|
| 272 | stx %l3, [%l4 + %lo(kernel_8k_tlb_data_template)]
|
---|
[a35b458] | 273 |
|
---|
[b97b348] | 274 | ! flush the whole D-cache
|
---|
| 275 | set (DCACHE_SIZE - DCACHE_LINE_SIZE), %g1
|
---|
| 276 | stxa %g0, [%g1] ASI_DCACHE_TAG
|
---|
[a35b458] | 277 |
|
---|
[b97b348] | 278 | 0:
|
---|
| 279 | membar #Sync
|
---|
| 280 | subcc %g1, DCACHE_LINE_SIZE, %g1
|
---|
| 281 | bnz,pt %xcc, 0b
|
---|
| 282 | stxa %g0, [%g1] ASI_DCACHE_TAG
|
---|
| 283 | membar #Sync
|
---|
[a35b458] | 284 |
|
---|
[84060e2] | 285 | /*
|
---|
| 286 | * So far, we have not touched the stack.
|
---|
[3869e9c5] | 287 | * It is a good idea to set the kernel stack to a known state now.
|
---|
[84060e2] | 288 | */
|
---|
| 289 | sethi %hi(temporary_boot_stack), %sp
|
---|
| 290 | or %sp, %lo(temporary_boot_stack), %sp
|
---|
| 291 | sub %sp, STACK_BIAS, %sp
|
---|
[a35b458] | 292 |
|
---|
[b97b348] | 293 | /*
|
---|
[36df4109] | 294 | * Call sparc64_pre_main(bootinfo)
|
---|
[b97b348] | 295 | */
|
---|
[36df4109] | 296 | call sparc64_pre_main
|
---|
[d806ce1] | 297 | mov %o1, %o0
|
---|
[a35b458] | 298 |
|
---|
[7f1d897] | 299 | /*
|
---|
| 300 | * Create the first stack frame.
|
---|
| 301 | */
|
---|
| 302 | save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
|
---|
| 303 | flushw
|
---|
| 304 | add %g0, -STACK_BIAS, %fp
|
---|
| 305 |
|
---|
[437ee6a4] | 306 | call main_bsp
|
---|
| 307 | nop
|
---|
| 308 |
|
---|
| 309 | /* Not reached. */
|
---|
| 310 |
|
---|
[a9ac978] | 311 | 0:
|
---|
[d806ce1] | 312 | ba,a %xcc, 0b
|
---|
[a9ac978] | 313 |
|
---|
| 314 |
|
---|
[965dc18] | 315 | 1:
|
---|
| 316 | #ifdef CONFIG_SMP
|
---|
| 317 | /*
|
---|
| 318 | * Determine the width of the MID and save its mask to %g3. The width
|
---|
| 319 | * is
|
---|
| 320 | * * 5 for US and US-IIIi,
|
---|
| 321 | * * 10 for US3 except US-IIIi.
|
---|
| 322 | */
|
---|
| 323 | #if defined(US)
|
---|
| 324 | mov 0x1f, %g3
|
---|
| 325 | #elif defined(US3)
|
---|
| 326 | mov 0x3ff, %g3
|
---|
| 327 | rdpr %ver, %g2
|
---|
| 328 | sllx %g2, 16, %g2
|
---|
| 329 | srlx %g2, 48, %g2
|
---|
| 330 | cmp %g2, IMPL_ULTRASPARCIII_I
|
---|
| 331 | move %xcc, 0x1f, %g3
|
---|
| 332 | #endif
|
---|
| 333 |
|
---|
[a9ac978] | 334 | /*
|
---|
| 335 | * Read MID from the processor.
|
---|
| 336 | */
|
---|
[965dc18] | 337 | ldxa [%g0] ASI_ICBUS_CONFIG, %g1
|
---|
| 338 | srlx %g1, ICBUS_CONFIG_MID_SHIFT, %g1
|
---|
| 339 | and %g1, %g3, %g1
|
---|
[a9ac978] | 340 |
|
---|
| 341 | /*
|
---|
[7e7c8747] | 342 | * Active loop for APs until the BSP picks them up. A processor cannot
|
---|
| 343 | * leave the loop until the global variable 'waking_up_mid' equals its
|
---|
[a9ac978] | 344 | * MID.
|
---|
| 345 | */
|
---|
| 346 | set waking_up_mid, %g2
|
---|
[39cb79a] | 347 | 2:
|
---|
[a9ac978] | 348 | ldx [%g2], %g3
|
---|
| 349 | cmp %g3, %g1
|
---|
[2bf4936] | 350 | bne %xcc, 2b
|
---|
[a9ac978] | 351 | nop
|
---|
| 352 |
|
---|
| 353 | /*
|
---|
| 354 | * Configure stack for the AP.
|
---|
| 355 | * The AP is expected to use the stack saved
|
---|
| 356 | * in the ctx global variable.
|
---|
| 357 | */
|
---|
[65f3117] | 358 | set bootstrap_stack_top, %g1
|
---|
[a9ac978] | 359 | ldx [%g1], %o6
|
---|
| 360 |
|
---|
[7f1d897] | 361 | /*
|
---|
| 362 | * Create the first stack frame.
|
---|
| 363 | */
|
---|
| 364 | save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
|
---|
| 365 | flushw
|
---|
| 366 | add %g0, -STACK_BIAS, %fp
|
---|
| 367 |
|
---|
[a9ac978] | 368 | call main_ap
|
---|
| 369 | nop
|
---|
| 370 |
|
---|
| 371 | /* Not reached. */
|
---|
[c23baab] | 372 | #endif
|
---|
[a35b458] | 373 |
|
---|
[a9ac978] | 374 | 0:
|
---|
[d806ce1] | 375 | ba,a %xcc, 0b
|
---|
[84060e2] | 376 |
|
---|
| 377 |
|
---|
| 378 | .section K_DATA_START, "aw", @progbits
|
---|
| 379 |
|
---|
| 380 | /*
|
---|
[7e7c8747] | 381 | * Create small stack to be used by the bootstrap processor. It is going to be
|
---|
| 382 | * used only for a very limited period of time, but we switch to it anyway,
|
---|
| 383 | * just to be sure we are properly initialized.
|
---|
[84060e2] | 384 | */
|
---|
| 385 |
|
---|
| 386 | #define INITIAL_STACK_SIZE 1024
|
---|
| 387 |
|
---|
| 388 | .align STACK_ALIGNMENT
|
---|
[f2ea5d8] | 389 | .space INITIAL_STACK_SIZE
|
---|
[84060e2] | 390 | .align STACK_ALIGNMENT
|
---|
| 391 | temporary_boot_stack:
|
---|
[f2ea5d8] | 392 | .space STACK_WINDOW_SAVE_AREA_SIZE
|
---|
| 393 |
|
---|
| 394 |
|
---|
| 395 | .data
|
---|
| 396 |
|
---|
| 397 | .align 8
|
---|
[a52e2f4] | 398 | SYMBOL(physmem_base) ! copy of the physical memory base address
|
---|
[f2ea5d8] | 399 | .quad 0
|
---|
| 400 |
|
---|
| 401 | /*
|
---|
[d70ebffe] | 402 | * The fast_data_access_mmu_miss_data_hi label, the end_of_identity,
|
---|
| 403 | * kernel_8k_tlb_data_template and tlb_tag_access_context_mask variables
|
---|
| 404 | * are meant to stay together, aligned on a 32B boundary.
|
---|
[f2ea5d8] | 405 | */
|
---|
[2bf4936] | 406 |
|
---|
[1b20da0] | 407 | .align 32
|
---|
[2bf4936] | 408 | /*
|
---|
| 409 | * This label is used by the fast_data_access_MMU_miss trap handler.
|
---|
| 410 | */
|
---|
[a52e2f4] | 411 | SYMBOL(fast_data_access_mmu_miss_data_hi)
|
---|
[2bf4936] | 412 | /*
|
---|
| 413 | * This variable is used by the fast_data_access_MMU_miss trap handler.
|
---|
| 414 | * In runtime, it is modified to contain the address of the end of physical
|
---|
| 415 | * memory.
|
---|
| 416 | */
|
---|
[a52e2f4] | 417 | SYMBOL(end_of_identity)
|
---|
[1b20da0] | 418 | .quad -1
|
---|
[2bf4936] | 419 | /*
|
---|
| 420 | * This variable is used by the fast_data_access_MMU_miss trap handler.
|
---|
| 421 | * In runtime, it is further modified to reflect the starting address of
|
---|
| 422 | * physical memory.
|
---|
| 423 | */
|
---|
[a52e2f4] | 424 | SYMBOL(kernel_8k_tlb_data_template)
|
---|
[92778f2] | 425 | #ifdef CONFIG_VIRT_IDX_DCACHE
|
---|
[7e7c8747] | 426 | .quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | \
|
---|
| 427 | TTE_CV | TTE_P | TTE_W)
|
---|
[92778f2] | 428 | #else /* CONFIG_VIRT_IDX_DCACHE */
|
---|
[7e7c8747] | 429 | .quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | \
|
---|
| 430 | TTE_P | TTE_W)
|
---|
[92778f2] | 431 | #endif /* CONFIG_VIRT_IDX_DCACHE */
|
---|
[7e7c8747] | 432 |
|
---|
[d70ebffe] | 433 | /*
|
---|
| 434 | * This variable is used by the fast_data_access_MMU_miss trap handler.
|
---|
| 435 | * It allows us to save one precious instruction slot of this handler.
|
---|
| 436 | */
|
---|
[a52e2f4] | 437 | SYMBOL(tlb_tag_access_context_mask)
|
---|
[d70ebffe] | 438 | .quad TLB_TAG_ACCESS_CONTEXT_MASK
|
---|
| 439 |
|
---|