From owner-svn-src-all@FreeBSD.ORG Sun Feb 22 01:02:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05919106564A; Sun, 22 Feb 2009 01:02:26 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDA3F8FC14; Sun, 22 Feb 2009 01:02:25 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1M12P4E080062; Sun, 22 Feb 2009 01:02:25 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1M12PG6080060; Sun, 22 Feb 2009 01:02:25 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902220102.n1M12PG6080060@svn.freebsd.org> From: Andrew Thompson Date: Sun, 22 Feb 2009 01:02:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188907 - head/sys/dev/usb2/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2009 01:02:26 -0000 Author: thompsa Date: Sun Feb 22 01:02:25 2009 New Revision: 188907 URL: http://svn.freebsd.org/changeset/base/188907 Log: Use root_mount_hold and root_mount_rel to allow the USB bus to be explored before trying to mount root. Unlike USB1 the busses are not explored at attach but rather after threads are running. Modified: head/sys/dev/usb2/controller/usb2_bus.h head/sys/dev/usb2/controller/usb2_controller.c Modified: head/sys/dev/usb2/controller/usb2_bus.h ============================================================================== --- head/sys/dev/usb2/controller/usb2_bus.h Sat Feb 21 23:46:34 2009 (r188906) +++ head/sys/dev/usb2/controller/usb2_bus.h Sun Feb 22 01:02:25 2009 (r188907) @@ -53,6 +53,7 @@ struct usb2_bus { struct usb2_bus_stat stats_ok; struct usb2_process explore_proc; struct usb2_process roothub_proc; + struct root_hold_token *bus_roothold; /* * There are two callback processes. One for Giant locked * callbacks. One for non-Giant locked callbacks. This should Modified: head/sys/dev/usb2/controller/usb2_controller.c ============================================================================== --- head/sys/dev/usb2/controller/usb2_controller.c Sat Feb 21 23:46:34 2009 (r188906) +++ head/sys/dev/usb2/controller/usb2_controller.c Sun Feb 22 01:02:25 2009 (r188907) @@ -126,6 +126,10 @@ usb2_attach(device_t dev) DPRINTFN(0, "USB device has no ivars\n"); return (ENXIO); } + + /* delay vfs_mountroot until the bus is explored */ + bus->bus_roothold = root_mount_hold(device_get_nameunit(dev)); + if (usb2_post_init_called) { mtx_lock(&Giant); usb2_attach_sub(dev, bus); @@ -153,6 +157,10 @@ usb2_detach(device_t dev) usb2_callout_drain(&bus->power_wdog); /* Let the USB explore process detach all devices. */ + if (bus->bus_roothold != NULL) { + root_mount_rel(bus->bus_roothold); + bus->bus_roothold = NULL; + } USB_BUS_LOCK(bus); if (usb2_proc_msignal(&bus->explore_proc, @@ -225,6 +233,10 @@ usb2_bus_explore(struct usb2_proc_msg *p USB_BUS_LOCK(bus); } + if (bus->bus_roothold != NULL) { + root_mount_rel(bus->bus_roothold); + bus->bus_roothold = NULL; + } } /*------------------------------------------------------------------------*