Do not rely on firmware having pre-enabled the MMU in a reasonable way for

late boot: enable it explicitly after installing the page tables. If booting
from an FDT, also make sure to escape the firmware's MMU context early
before overwriting firmware page tables.

Approved by:	re (gjb)
This commit is contained in:
Nathan Whitehorn 2016-06-29 14:40:43 +00:00
parent b689d9268f
commit 0081393d79
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302279
2 changed files with 13 additions and 1 deletions

View File

@ -921,7 +921,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
Maxmem = powerpc_btop(phys_avail[i + 1]);
moea_cpu_bootstrap(mmup,0);
mtmsr(mfmsr() | PSL_DR | PSL_IR);
pmap_bootstrapped++;
/*

View File

@ -251,6 +251,18 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp)
if (mdp == (void *)0x65504150)
mdp = NULL;
#if AIM
/*
* If running from an FDT, make sure we are in real mode to avoid
* tromping on firmware page tables. Everything in the kernel assumes
* 1:1 mappings out of firmware, so this won't break anything not
* already broken. This doesn't work if there is live OF, since OF
* may internally use non-1:1 mappings.
*/
if (ofentry == 0)
mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
#endif
/*
* Parse metadata if present and fetch parameters. Must be done
* before console is inited so cninit gets the right value of