Author: nwhitehorn
Date: Wed Jun 29 14:40:43 2016
New Revision: 302279
URL: https://svnweb.freebsd.org/changeset/base/302279

Log:
  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)

Modified:
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/powerpc/machdep.c

Modified: head/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea.c      Wed Jun 29 11:48:42 2016        
(r302278)
+++ head/sys/powerpc/aim/mmu_oea.c      Wed Jun 29 14:40:43 2016        
(r302279)
@@ -921,7 +921,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k
        Maxmem = powerpc_btop(phys_avail[i + 1]);
 
        moea_cpu_bootstrap(mmup,0);
-
+       mtmsr(mfmsr() | PSL_DR | PSL_IR);
        pmap_bootstrapped++;
 
        /*

Modified: head/sys/powerpc/powerpc/machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/machdep.c  Wed Jun 29 11:48:42 2016        
(r302278)
+++ head/sys/powerpc/powerpc/machdep.c  Wed Jun 29 14:40:43 2016        
(r302279)
@@ -251,6 +251,18 @@ powerpc_init(vm_offset_t fdt, vm_offset_
        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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to