svn commit: r326310 - in head/sys: dev/ofw powerpc/ofw

Nathan Whitehorn nwhitehorn at FreeBSD.org
Tue Nov 28 06:31:40 UTC 2017


Author: nwhitehorn
Date: Tue Nov 28 06:31:39 2017
New Revision: 326310
URL: https://svnweb.freebsd.org/changeset/base/326310

Log:
  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:
  head/sys/dev/ofw/openfirm.c
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/dev/ofw/openfirm.c
==============================================================================
--- head/sys/dev/ofw/openfirm.c	Tue Nov 28 06:21:37 2017	(r326309)
+++ head/sys/dev/ofw/openfirm.c	Tue Nov 28 06:31:39 2017	(r326310)
@@ -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: head/sys/powerpc/ofw/ofw_machdep.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_machdep.c	Tue Nov 28 06:21:37 2017	(r326309)
+++ head/sys/powerpc/ofw/ofw_machdep.c	Tue Nov 28 06:31:39 2017	(r326310)
@@ -393,6 +393,7 @@ boolean_t
 OF_bootstrap()
 {
 	boolean_t status = FALSE;
+	int err = 0;
 
 #ifdef AIM
 	if (openfirmware_entry != NULL) {
@@ -409,7 +410,7 @@ OF_bootstrap()
 		if (status != TRUE)
 			return status;
 
-		OF_init(openfirmware);
+		err = OF_init(openfirmware);
 	} else
 #endif
 	if (fdt != NULL) {
@@ -418,9 +419,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);
 }


More information about the svn-src-head mailing list