From owner-p4-projects@FreeBSD.ORG Tue Dec 15 22:25:34 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AF66010656AA; Tue, 15 Dec 2009 22:25:33 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 734A610656A8 for ; Tue, 15 Dec 2009 22:25:33 +0000 (UTC) (envelope-from raj@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 61BCC8FC0C for ; Tue, 15 Dec 2009 22:25:33 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id nBFMPXt1072181 for ; Tue, 15 Dec 2009 22:25:33 GMT (envelope-from raj@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nBFMPX7N072179 for perforce@freebsd.org; Tue, 15 Dec 2009 22:25:33 GMT (envelope-from raj@freebsd.org) Date: Tue, 15 Dec 2009 22:25:33 GMT Message-Id: <200912152225.nBFMPX7N072179@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to raj@freebsd.org using -f From: Rafal Jaworowski To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 171816 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2009 22:25:34 -0000 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