diff --git a/sys/mips/include/md_var.h b/sys/mips/include/md_var.h --- a/sys/mips/include/md_var.h +++ b/sys/mips/include/md_var.h @@ -71,6 +71,7 @@ void mips_vector_init(void); void mips_cpu_init(void); +void mips_hwrena_init(void); void mips_pcpu0_init(void); void mips_proc0_init(void); void mips_postboot_fixup(void); diff --git a/sys/mips/mips/cpu.c b/sys/mips/mips/cpu.c --- a/sys/mips/mips/cpu.c +++ b/sys/mips/mips/cpu.c @@ -141,10 +141,11 @@ /* Check to see if UserLocal register is implemented. */ if (cfg3 & MIPS_CONFIG3_ULR) { - /* UserLocal register is implemented, enable it. */ + /* + * UserLocal register is implemented, enable it later in + * mips_hwrena_init. + */ cpuinfo->userlocal_reg = true; - tmp = mips_rd_hwrena(); - mips_wr_hwrena(tmp | MIPS_HWRENA_UL); } else { /* * UserLocal register is not implemented. Patch @@ -275,11 +276,25 @@ #endif } +void +mips_hwrena_init(void) +{ + uint32_t reg; + + reg = mips_rd_hwrena(); + + if (cpuinfo.userlocal_reg) + reg |= MIPS_HWRENA_UL; + + mips_wr_hwrena(reg); +} + void mips_cpu_init(void) { platform_cpu_init(); mips_get_identity(&cpuinfo); + mips_hwrena_init(); num_tlbentries = cpuinfo.tlb_nentries; mips_wr_wired(0); tlb_invalidate_all(); diff --git a/sys/mips/mips/mp_machdep.c b/sys/mips/mips/mp_machdep.c --- a/sys/mips/mips/mp_machdep.c +++ b/sys/mips/mips/mp_machdep.c @@ -52,6 +52,7 @@ #include #include #include +#include struct pcb stoppcbs[MAXCPU]; @@ -276,6 +277,8 @@ smp_init_secondary(u_int32_t cpuid) { + mips_hwrena_init(); + /* TLB */ mips_wr_wired(0); tlb_invalidate_all();