Author: kevans
Date: Wed Mar 14 03:45:33 2018
New Revision: 330904
URL: https://svnweb.freebsd.org/changeset/base/330904

Log:
  MFC r326310: Back out OF module installation in the event of failure.
  
  PS3 firmware gives some ancient FDT version (2) that fails the init check in
  OFW_FDT. It is still possible to make progress, but not while the OF layer
  is going crazy.

Modified:
  stable/11/sys/dev/ofw/openfirm.c
  stable/11/sys/powerpc/ofw/ofw_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/openfirm.c
==============================================================================
--- stable/11/sys/dev/ofw/openfirm.c    Wed Mar 14 03:43:49 2018        
(r330903)
+++ stable/11/sys/dev/ofw/openfirm.c    Wed Mar 14 03:45:33 2018        
(r330904)
@@ -201,6 +201,12 @@ OF_install(char *name, int prio)
        ofw_def_t *ofwp, **ofwpp;
        static int curr_prio = 0;
 
+       /* Allow OF layer to be uninstalled */
+       if (name == NULL) {
+               ofw_def_impl = NULL;
+               return (FALSE);
+       }
+
        /*
         * Try and locate the OFW kobj corresponding to the name.
         */

Modified: stable/11/sys/powerpc/ofw/ofw_machdep.c
==============================================================================
--- stable/11/sys/powerpc/ofw/ofw_machdep.c     Wed Mar 14 03:43:49 2018        
(r330903)
+++ stable/11/sys/powerpc/ofw/ofw_machdep.c     Wed Mar 14 03:45:33 2018        
(r330904)
@@ -389,6 +389,7 @@ boolean_t
 OF_bootstrap()
 {
        boolean_t status = FALSE;
+       int err = 0;
 
 #ifdef AIM
        if (openfirmware_entry != NULL) {
@@ -405,7 +406,7 @@ OF_bootstrap()
                if (status != TRUE)
                        return status;
 
-               OF_init(openfirmware);
+               err = OF_init(openfirmware);
        } else
 #endif
        if (fdt != NULL) {
@@ -414,9 +415,15 @@ OF_bootstrap()
                if (status != TRUE)
                        return status;
 
-               OF_init(fdt);
-               OF_interpret("perform-fixup", 0);
+               err = OF_init(fdt);
+               if (err == 0)
+                       OF_interpret("perform-fixup", 0);
        } 
+
+       if (err != 0) {
+               OF_install(NULL, 0);
+               status = FALSE;
+       }
 
        return (status);
 }
_______________________________________________
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