Date: Wed, 2 Dec 2009 19:32:30 GMT From: Rafal Jaworowski <raj@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 171292 for review Message-ID: <200912021932.nB2JWUHi019140@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/dev/ofw/openfirm.c,v 1.25 2009/06/14 00:05:38 marius Exp $"); +#include "opt_platform.h" + #include <sys/param.h> #include <sys/kernel.h> #include <sys/malloc.h> @@ -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 <dev/ofw/ofwvar.h> #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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912021932.nB2JWUHi019140>