From owner-freebsd-usb@FreeBSD.ORG Tue Jul 3 12:00:47 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 26FCE16A400 for ; Tue, 3 Jul 2007 12:00:47 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from pobox.codelabs.ru (pobox.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id CF84913C447 for ; Tue, 3 Jul 2007 12:00:46 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Message-ID:MIME-Version:Content-Type:Content-Disposition:Sender:X-Spam-Status:Subject; b=PqbaJLFs3yf6z2C01Crdb2nyD6up5oMqZ/Pehmn+guCtywsMtwPYmdCVCIljjPFPZrDTcNH9hkwvnm1rlnFTpHMb41JazNKBJ3rqgbZPeNOckxG/McTi2U3au2Dze/AZPhTCzdNxtvWy2AYkI78lpmseXptc+IPRju3tU81Lt9I=; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by pobox.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1I5h3i-0005cM-CN; Tue, 03 Jul 2007 16:00:42 +0400 Date: Tue, 3 Jul 2007 16:00:37 +0400 From: Eygene Ryabinkin To: hselasky@c2i.net Message-ID: <20070703120037.GA998@void.codelabs.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline Sender: rea-fbsd@codelabs.ru X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED,AWL,BAYES_00 Cc: freebsd-usb@freebsd.org Subject: Patch that fixes usb4bsd stack build on the recent -CURRENT X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2007 12:00:47 -0000 --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Hans, good day. Tried to build the usb4bsd stack on the recent (yesterday's -CURRENT) and it failed due to the cam subsystem API changes introduced in xpt_bus_register: now it takes three values. The following patch cures the situation: ----- Index: trunk/i4b/src/sys/dev/usb/umass.c =================================================================== --- trunk/i4b/src/sys/dev/usb/umass.c (revision 529) +++ trunk/i4b/src/sys/dev/usb/umass.c (working copy) @@ -2305,7 +2305,11 @@ mtx_lock(&(sc->sc_mtx)); #endif +#if (__FreeBSD_version >= 700048) + if(xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit) != CAM_SUCCESS) { +#else if(xpt_bus_register(sc->sc_sim, sc->sc_unit) != CAM_SUCCESS) { +#endif #if (__FreeBSD_version >= 700037) mtx_unlock(&(sc->sc_mtx)); #endif ----- It was tested on my system: I am writing from the USB keyboard and my USB flash is burned by the dd. My naughty 2Gb Transcend flash, as usual, buries the system completely. So all is going as expected ;)) The original umass.c from the fresh -CURRENT uses 'NULL' instead of 'sc->sc_dev'. The commit comment for the cam_xpt.c tells us ----- Prepare for future integration between CAM and newbus. xpt_bus_register now takes a device_t to be the parent of the bus that is being created. Most SIMs have been updated with a reasonable argument, but a few exceptions just pass NULL for now. This argument isn't used yet and the newbus integration likely won't be ready until after 7.0-RELEASE. ----- I don't know why umass.c is using NULL, but I had tried both ways and there is no difference for my hardware. I had chosen the check for the __FreeBSD_version of 700048, because the cam changes were done at 2007/06/17 05:55:53: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/cam/cam_xpt.c?rev=1.189;content-type=text%2Fplain and the latest changes in the param.h occured at 2007/06/12 16:24:54 http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/param.h?rev=1.303;content-type=text%2Fplain Users that updated the -CURRENT after June 12th, but before June 17th will suffer from the uncompilable stack, but I hope that this timeframe is small and -CURRENT users are periodically upgrading the sources. -- Eygene --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=koi8-r Content-Disposition: attachment; filename="new-xpt_bus_register.diff" Index: trunk/i4b/src/sys/dev/usb/umass.c =================================================================== --- trunk/i4b/src/sys/dev/usb/umass.c (revision 529) +++ trunk/i4b/src/sys/dev/usb/umass.c (working copy) @@ -2305,7 +2305,11 @@ mtx_lock(&(sc->sc_mtx)); #endif +#if (__FreeBSD_version >= 700048) + if(xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit) != CAM_SUCCESS) { +#else if(xpt_bus_register(sc->sc_sim, sc->sc_unit) != CAM_SUCCESS) { +#endif #if (__FreeBSD_version >= 700037) mtx_unlock(&(sc->sc_mtx)); #endif --SLDf9lqlvOQaIe6s--