From owner-p4-projects@FreeBSD.ORG Wed Dec 2 19:32:31 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 86E201065676; Wed, 2 Dec 2009 19:32:31 +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 31C161065670 for ; Wed, 2 Dec 2009 19:32:31 +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 1F4818FC15 for ; Wed, 2 Dec 2009 19:32:31 +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 nB2JWUkm019142 for ; Wed, 2 Dec 2009 19:32:31 GMT (envelope-from raj@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nB2JWUHi019140 for perforce@freebsd.org; Wed, 2 Dec 2009 19:32:30 GMT (envelope-from raj@freebsd.org) Date: Wed, 2 Dec 2009 19:32:30 GMT Message-Id: <200912021932.nB2JWUHi019140@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 171292 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: Wed, 02 Dec 2009 19:32:31 -0000 http://p4web.freebsd.org/chv.cgi?CH=171292 Change 171292 by raj@raj_fdt on 2009/12/02 19:31:45 Extend the ofw I/F so that ofw_init() can return a value. This will allow for better handling during initialization the flattened device ofw I/F back-end. Affected files ... .. //depot/projects/fdt/sys/dev/ofw/ofw_if.m#2 edit .. //depot/projects/fdt/sys/dev/ofw/ofw_standard.c#2 edit .. //depot/projects/fdt/sys/dev/ofw/openfirm.c#2 edit .. //depot/projects/fdt/sys/dev/ofw/openfirm.h#2 edit .. //depot/projects/fdt/sys/powerpc/ofw/ofw_real.c#2 edit Differences ... ==== //depot/projects/fdt/sys/dev/ofw/ofw_if.m#2 (text+ko) ==== @@ -43,7 +43,7 @@ * @param _cookie A handle to the client interface, generally the OF * callback routine. */ -METHOD void init { +METHOD int init { ofw_t _ofw; void *_cookie; }; ==== //depot/projects/fdt/sys/dev/ofw/ofw_standard.c#2 (text+ko) ==== @@ -70,7 +70,7 @@ #include "ofw_if.h" -static void ofw_std_init(ofw_t ofw, void *openfirm); +static int ofw_std_init(ofw_t ofw, void *openfirm); static int ofw_std_test(ofw_t ofw, const char *name); static int ofw_std_interpret(ofw_t ofw, const char *cmd, int nreturns, unsigned long *returns); @@ -150,11 +150,12 @@ /* Initializer */ -static void +static int ofw_std_init(ofw_t ofw, void *openfirm) { openfirmware = (int (*)(void *))openfirm; + return (0); } /* ==== //depot/projects/fdt/sys/dev/ofw/openfirm.c#2 (text+ko) ==== @@ -58,6 +58,8 @@ #include __FBSDID("$FreeBSD: src/sys/dev/ofw/openfirm.c,v 1.25 2009/06/14 00:05:38 marius Exp $"); +#include "opt_platform.h" + #include #include #include @@ -110,10 +112,10 @@ } /* Initializer */ -void +int OF_init(void *cookie) { - phandle_t chosen; + int rv; ofw_obj = &ofw_kernel_obj; /* @@ -123,12 +125,24 @@ kobj_class_compile_static(ofw_def_impl, &ofw_kernel_kops); kobj_init((kobj_t)ofw_obj, ofw_def_impl); - OFW_INIT(ofw_obj, cookie); + if (rv = OFW_INIT(ofw_obj, cookie)) + return (rv); + +#ifndef FDT + /* + * XXX The #ifndef is a temporary workaround until we handle /chosen + * properly for the FDT blob. + */ + + 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); } void @@ -228,7 +242,7 @@ } /* - * Resursively search the node and its parent for the given property, working + * Recursively search the node and its parent for the given property, working * downward from the node to the device tree root. Returns the value of the * first match. */ ==== //depot/projects/fdt/sys/dev/ofw/openfirm.h#2 (text+ko) ==== @@ -83,7 +83,7 @@ */ boolean_t OF_install(char *name, int prio); -void OF_init(void *cookie); +int OF_init(void *cookie); /* * Known Open Firmware interface names ==== //depot/projects/fdt/sys/powerpc/ofw/ofw_real.c#2 (text+ko) ==== @@ -76,7 +76,7 @@ #include #include "ofw_if.h" -static void ofw_real_init(ofw_t, void *openfirm); +static int ofw_real_init(ofw_t, void *openfirm); static int ofw_real_test(ofw_t, const char *name); static phandle_t ofw_real_peer(ofw_t, phandle_t node); static phandle_t ofw_real_child(ofw_t, phandle_t node); @@ -256,13 +256,14 @@ /* Initialiser */ -static void +static int ofw_real_init(ofw_t ofw, void *openfirm) { openfirmware = (int (*)(void *))openfirm; mtx_init(&of_bounce_mtx, "OF Bounce Page", MTX_DEF, 0); of_bounce_virt = NULL; + return (0); } /*