From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 12:13:03 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09DF11065674; Mon, 2 Aug 2010 12:13:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC6228FC1C; Mon, 2 Aug 2010 12:13:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72CD27G018142; Mon, 2 Aug 2010 12:13:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72CD2lw018139; Mon, 2 Aug 2010 12:13:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021213.o72CD2lw018139@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 12:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210752 - in user/nwhitehorn/ps3/dev: fdt ofw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 12:13:03 -0000 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); }