From owner-freebsd-current@FreeBSD.ORG Sat Oct 3 07:52:31 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E19C21065676 for ; Sat, 3 Oct 2009 07:52:31 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.freebsd.org (Postfix) with ESMTP id 773AE8FC0A for ; Sat, 3 Oct 2009 07:52:31 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=aQey1_VUwUUA:10 a=RERtC8nhXGhYvIZhK0yWrQ==:17 a=XxDeWrsLWpFRxdEFReUA:9 a=O3vr-6xOhxxg5fUnN7EA:7 a=xP-kcI-DwXktOvvZSUfYx4ND2xQA:4 Received: from [90.149.203.35] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.16) with ESMTPA id 1214505543; Sat, 03 Oct 2009 09:52:29 +0200 From: Hans Petter Selasky To: freebsd-current@freebsd.org Date: Sat, 3 Oct 2009 09:53:16 +0200 User-Agent: KMail/1.11.4 (FreeBSD/9.0-CURRENT; KDE/4.2.4; i386; ; ) References: <20091002150931.K35591@pooker.samsco.org> In-Reply-To: <20091002150931.K35591@pooker.samsco.org> X-Face: (%:6u[ldzJ`0qjD7sCkfdMmD*RxpOwEEQ+KWt[{J#x6ow~JO:,zwp.(t; @Aq :4:&nFCgDb8[3oIeTb^'",;u{5{}C9>"PuY\)!=#\u9SSM-nz8+SR~B\!qBv MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910030953.17359.hselasky@c2i.net> Cc: Subject: Re: [PATCH] Fix for USB media not found at boot X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2009 07:52:32 -0000 On Friday 02 October 2009 23:11:21 Scott Long wrote: > All, > > I have a candidate patch to fix the problem with USB boot media not being > found in time at boot, leading to the "mountroot" prompt instead of a > booting system. Please apply both patches below and let me know if it > works for you. Hi, Your patch looks OK. Some checkpoints however: Does your patch work if ehci/ohci/uhci is kldloaded after system startup? Does your patch work if CAM is not in the kernel? I have a simple imporovement to your patch: I would just add a synchronously blocking call to the end of "usb_bus_attach". Something like: #ifdef USB_HAVE_CAM static void usb_cam_wait_cb(void *arg) { struct usb_bus *bus = *(struct usb_bus **)arg; USB_BUS_LOCK(bus); *(struct usb_bus **)arg = NULL; wakeup(arg); USB_BUS_UNLOCK(bus); } static void usb_wait_cam(struct usb_bus *bus) { struct intr_config_hook *hook; void *temp = bus; hook = malloc(sizeof(*hook), M_TEMP, M_ZERO); hook->ich_func = usb_wait_cam_cb; hook->ich_arg = &temp; config_intrhook_establish(hook); USB_BUS_LOCK(bus); if (temp != NULL) mtx_sleep(&temp, &bus->bus_mtx, 0, "WCAM", 0); USB_BUS_UNLOCK(bus); } #endif That way makes the code more simple and avoids a race with the CAM callback being called after that the hardware is detached. For example if the Host Controller resides on a removable device. There are some more USB_HAVE_XXX in sys/dev/usb/usb_freebsd.h . --HPS