From owner-freebsd-mips@FreeBSD.ORG Fri Apr 1 20:04:29 2011 Return-Path: Delivered-To: mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6AB9106566C; Fri, 1 Apr 2011 20:04:29 +0000 (UTC) (envelope-from aduane@juniper.net) Received: from exprod7og115.obsmtp.com (exprod7og115.obsmtp.com [64.18.2.217]) by mx1.freebsd.org (Postfix) with ESMTP id 3EB548FC0A; Fri, 1 Apr 2011 20:04:28 +0000 (UTC) Received: from source ([66.129.224.36]) (using TLSv1) by exprod7ob115.postini.com ([64.18.6.12]) with SMTP ID DSNKTZYvzAn4BaIGNY6/5s/3Yo7t2gbebQ5D@postini.com; Fri, 01 Apr 2011 13:04:29 PDT Received: from p-emfe01-wf.jnpr.net (172.28.145.24) by P-EMHUB03-HQ.jnpr.net (172.24.192.37) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 1 Apr 2011 13:02:22 -0700 Received: from EMBX01-WF.jnpr.net ([fe80::1914:3299:33d9:e43b]) by p-emfe01-wf.jnpr.net ([fe80::d0d1:653d:5b91:a123%11]) with mapi; Fri, 1 Apr 2011 16:03:56 -0400 From: Andrew Duane To: Juli Mallett Date: Fri, 1 Apr 2011 16:03:55 -0400 Thread-Topic: Blatant simple bug in Cavium SDK USB code? Thread-Index: AcvwnQ1yYeQ8T8nMRTawf5rZ4yQXtAACPFEi Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "mips@freebsd.org" Subject: RE: Blatant simple bug in Cavium SDK USB code? X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2011 20:04:29 -0000 This isn't even close to the only problem I'm having. I don't make it out o= f cvmx_usb_initialize at all. One of two things happens: 1) The code completes and device_probe returns ENXIO so the routine bails o= ut and USB doesn't work. 2) Something goes insane and I either get a load fault halfway through the = routine touching one of the USB registers (CVMX_USBCX_GAHBCFG I think), or = I get an instruction exception in some worker routine buried in the middle. Ouch indeed.... -- Andrew Duane Juniper Networks 978-589-0551 10 Technology Park Dr aduane@juniper.net Westford, MA 01886-3418 ________________________________________ From: juli@clockworksquid.com [juli@clockworksquid.com] On Behalf Of Juli M= allett [jmallett@FreeBSD.org] Sent: Friday, April 01, 2011 2:45 PM To: Andrew Duane Cc: mips@freebsd.org Subject: Re: Blatant simple bug in Cavium SDK USB code? Hey Andrew, On Fri, Apr 1, 2011 at 11:08, Andrew Duane wrote: > > In the routine cvmx_usb_initialize in sys/contrib/octeon-sdk/cvmx-usb.c, = I'm pretty sure there's a silly little bug that really BADLY breaks the USB= driver for some of us. > > Near the top, after it finds board type and sets the clock type, as part = of the structure initialization, there is: > > memset(usb, 0, sizeof(usb)); > > Tell me that is not supposed to be: > > memset(usb, 0, sizeof(*usb)); > > The existing code only zeros 4/8 bytes, instead of the 23KB of the struct= ure. Ouch, nice catch. Is that the only thing keeping the USB driver from working for you? I thought it had rotted some behind other controller changes and also had some problems with stalls, but perhaps the culprit was initialization all along. I'll check in that fix soon, but would like to hear from you as to whether you have any additional fixes for USB (or even bugs to report.) I've BCC'd some Cavium people who will no doubt appreciate the bug report! Thanks, Juli.