diff --git a/sys/powerpc/booke/locore.S b/sys/powerpc/booke/locore.S index 3b774f47c57..624a0fe64a7 100644 --- a/sys/powerpc/booke/locore.S +++ b/sys/powerpc/booke/locore.S @@ -384,15 +384,28 @@ done_mapping: .globl __boot_page .align 12 __boot_page: - bl 1f - + /* + * The boot page is a special page of memory used during AP bringup. + * It gets *temporarily* mapped at 0xfffff000, with the instruction + * at 0xfffffffc being a branch to earlier in the same page. + * This code's job is to set up the MMU using parameters provided + * at the beginning of the page and clean up the temporary mapping. + * + * Pieces of this code are also used for UP kernel, but in this case + * the extra alignment restrictions are dropped via the preprocessor. + */ + bl 1f /* Target of reset vector at end of page. */ +#ifdef __powerpc64__ + nop /* PPC64 alignment word. */ +#endif .globl bp_trace +bp_var_base: bp_trace: - .long 0 + ADDR(0) /* Trace pointer (%r31). */ .globl bp_kernload bp_kernload: - .long 0 + ADDR(0) /* Kern phys. load address. */ /* * Initial configuration @@ -486,27 +499,16 @@ bp_kernload: isync /* Retrieve kernel load [physical] address from bp_kernload */ + bl 5f +5: + mflr %r3 #ifdef __powerpc64__ - b 0f - .align 3 -0: - nop -#endif - bl 5f - ADDR(bp_kernload) - ADDR(__boot_page) -5: mflr %r3 -#ifdef __powerpc64__ - ld %r4, 0(%r3) - ld %r5, 8(%r3) - clrrdi %r3, %r3, 12 + clrrdi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */ + ld %r3, (bp_kernload - bp_var_base)(%r3) #else - lwz %r4, 0(%r3) - lwz %r5, 4(%r3) - rlwinm %r3, %r3, 0, 0, 19 + clrrwi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */ + lwz %r3, (bp_kernload - bp_var_base)(%r3) #endif - sub %r4, %r4, %r5 /* offset of bp_kernload within __boot_page */ - lwzx %r3, %r4, %r3 /* Set RPN and protection */ ori %r3, %r3, (MAS3_SX | MAS3_SW | MAS3_SR)@l @@ -783,6 +785,11 @@ __boot_page_padding: */ .space 4092 - (__boot_page_padding - __boot_page) b __boot_page + /* + * This is the end of the boot page. + * During AP startup, the previous instruction is at 0xfffffffc + * virtual (i.e. the reset vector.) + */ #endif /* SMP */ /************************************************************************/ diff --git a/sys/powerpc/mpc85xx/platform_mpc85xx.c b/sys/powerpc/mpc85xx/platform_mpc85xx.c index c1181e87ed8..81236490325 100644 --- a/sys/powerpc/mpc85xx/platform_mpc85xx.c +++ b/sys/powerpc/mpc85xx/platform_mpc85xx.c @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); extern void *ap_pcpu; extern vm_paddr_t kernload; /* Kernel physical load address */ extern uint8_t __boot_page[]; /* Boot page body */ -extern uint32_t bp_kernload; +extern vm_paddr_t bp_kernload; extern vm_offset_t __startkernel; struct cpu_release {