Date: Mon, 2 Aug 2010 12:13:02 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r210752 - in user/nwhitehorn/ps3/dev: fdt ofw Message-ID: <201008021213.o72CD2lw018139@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Mon Aug 2 12:13:02 2010 New Revision: 210752 URL: http://svn.freebsd.org/changeset/base/210752 Log: Two more tweaks to FDT: - fdtbus should simply fail to attach, not panic, if there is no device tree. Note that, because of fdtbus(4), kernels containing option FDT will not boot on machines with Open Firmware. What should eventually happen is that the OF-related code in PPC nexus(4) should be removed in favor of also using fdtbus on OF platforms. - ofw_fdt returns the wrong values as error codes. 0 is in principle a valid phandle, and -1 should be returned to indicate an error condition. I have patched OF_finddevice() to return -1 on errors for now, but the FDT code should eventually be systematically checked for this. Modified: user/nwhitehorn/ps3/dev/fdt/fdtbus.c user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Modified: user/nwhitehorn/ps3/dev/fdt/fdtbus.c ============================================================================== --- user/nwhitehorn/ps3/dev/fdt/fdtbus.c Mon Aug 2 11:48:05 2010 (r210751) +++ user/nwhitehorn/ps3/dev/fdt/fdtbus.c Mon Aug 2 12:13:02 2010 (r210752) @@ -174,7 +174,7 @@ fdtbus_attach(device_t dev) int error; if ((root = OF_peer(0)) == 0) - panic("fdtbus_attach: no root node."); + return (ENXIO); sc = device_get_softc(dev); Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Mon Aug 2 11:48:05 2010 (r210751) +++ user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Mon Aug 2 12:13:02 2010 (r210752) @@ -385,6 +385,8 @@ ofw_fdt_finddevice(ofw_t ofw, const char offset = fdt_path_offset(fdtp, device); p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + if (p == 0) + p = -1; return (p); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008021213.o72CD2lw018139>