Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Dec 2009 22:25:33 GMT
From:      Rafal Jaworowski <raj@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 171816 for review
Message-ID:  <200912152225.nBFMPX7N072179@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=171816

Change 171816 by raj@raj_fdt on 2009/12/15 22:24:35

	Lessen the OF_init() requirement about /chosen node. It's not
	mandatory for a flattened device tree.
	
	Also, exclude code not used for FDT.

Affected files ...

.. //depot/projects/fdt/sys/dev/ofw/openfirm.c#4 edit

Differences ...

==== //depot/projects/fdt/sys/dev/ofw/openfirm.c#4 (text+ko) ====

@@ -115,6 +115,7 @@
 int
 OF_init(void *cookie)
 {
+	phandle_t chosen;
 	int rv;
 
 	ofw_obj = &ofw_kernel_obj;
@@ -125,26 +126,16 @@
 	kobj_class_compile_static(ofw_def_impl, &ofw_kernel_kops);
 	kobj_init((kobj_t)ofw_obj, ofw_def_impl);
 
-	if ((rv = OFW_INIT(ofw_obj, cookie)) != 0)
-		return (rv);
+	rv = OFW_INIT(ofw_obj, cookie);
 
-#ifndef FDT
-	/*
-	 * XXX The #ifndef is a temporary workaround until we handle /chosen
-	 * properly for the FDT blob.
-	 */
+	if ((chosen = OF_finddevice("/chosen")) > 0)
+		if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1)
+			stdout = -1;
 
-	phandle_t chosen;
-
-	if ((chosen = OF_finddevice("/chosen")) == -1)
-		OF_exit();
-	if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1)
-		stdout = -1;
-#endif
-
 	return (rv);
 }
 
+#ifndef FDT
 void
 OF_printf(const char *fmt, ...)
 {
@@ -188,6 +179,7 @@
 
 	return (status);
 }
+#endif
 
 /*
  * Device tree functions
@@ -329,6 +321,7 @@
 	return (OFW_PACKAGE_TO_PATH(ofw_obj, package, buf, len));
 }
 
+#ifndef FDT
 /*  Call the method in the scope of a given instance. */
 int
 OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns,
@@ -442,3 +435,4 @@
 	for (;;)			/* just in case */
 		;
 }
+#endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912152225.nBFMPX7N072179>