Commit ce22e1d3 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Fix booting on non-zero cpu.

The early per-cpu handling needs a slight tweak to work when booting
on a non-zero cpu.

We got away with this for a long time, but can't any longer as now
even printk() calls functions (cpu_clock() for example) that thus make
early references to per-cpu variables.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 488b5ec8
...@@ -632,11 +632,36 @@ tlb_fixup_done: ...@@ -632,11 +632,36 @@ tlb_fixup_done:
/* Not reached... */ /* Not reached... */
1: 1:
/* If we boot on a non-zero cpu, all of the per-cpu
* variable references we make before setting up the
* per-cpu areas will use a bogus offset. Put a
* compensating factor into __per_cpu_base to handle
* this cleanly.
*
* What the per-cpu code calculates is:
*
* __per_cpu_base + (cpu << __per_cpu_shift)
*
* These two variables are zero initially, so to
* make it all cancel out to zero we need to put
* "0 - (cpu << 0)" into __per_cpu_base so that the
* above formula evaluates to zero.
*
* We cannot even perform a printk() until this stuff
* is setup as that calls cpu_clock() which uses
* per-cpu variables.
*/
sub %g0, %o0, %o1
sethi %hi(__per_cpu_base), %o2
stx %o1, [%o2 + %lo(__per_cpu_base)]
#else #else
mov 0, %o0 mov 0, %o0
#endif #endif
sth %o0, [%g6 + TI_CPU] sth %o0, [%g6 + TI_CPU]
call prom_init_report
nop
/* Off we go.... */ /* Off we go.... */
call start_kernel call start_kernel
nop nop
......
...@@ -48,7 +48,10 @@ void __init prom_init(void *cif_handler, void *cif_stack) ...@@ -48,7 +48,10 @@ void __init prom_init(void *cif_handler, void *cif_stack)
prom_getstring(node, "version", prom_version, sizeof(prom_version)); prom_getstring(node, "version", prom_version, sizeof(prom_version));
prom_printf("\n"); prom_printf("\n");
}
void __init prom_init_report(void)
{
printk("PROMLIB: Sun IEEE Boot Prom '%s'\n", prom_version); printk("PROMLIB: Sun IEEE Boot Prom '%s'\n", prom_version);
printk("PROMLIB: Root node compatible: %s\n", prom_root_compatible); printk("PROMLIB: Root node compatible: %s\n", prom_root_compatible);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment