From owner-freebsd-embedded@FreeBSD.ORG Wed Dec 28 18:35:09 2011 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ED24106566B for ; Wed, 28 Dec 2011 18:35:09 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 28ACD8FC14 for ; Wed, 28 Dec 2011 18:34:59 +0000 (UTC) Received: by vcbfk1 with SMTP id fk1so17406581vcb.13 for ; Wed, 28 Dec 2011 10:34:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=avxeCja71ZgFIZPjg1/wEZRv3s7zyuq/LUqzGW+vD0E=; b=GjUG/9jPd5M1Hx2DAwEfpm4uPvR1DmW+GsHF2yIswB0oLtPpSgNqOq329fwRt/HsN+ YiDaxn0D/1n1EQ9TDqw717V6WMZpfTxi6DT0ToVzqu7mW2lAXVILI1iLOdM65B7C7imC dHi69YpZ6hv9R8C0yRLH1nxIKYiOfHGpkDHOQ= MIME-Version: 1.0 Received: by 10.220.213.200 with SMTP id gx8mr19219467vcb.13.1325097298538; Wed, 28 Dec 2011 10:34:58 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Wed, 28 Dec 2011 10:34:58 -0800 (PST) In-Reply-To: <2135AD2B-76D4-4B3D-A009-8F3BEC836051@lassitu.de> References: <0F6CC18F-6973-42A2-AC03-F01BF59458AE@lassitu.de> <1100F70E-9DA9-4163-AC9A-423ECE5AA9A3@lassitu.de> <18CABB46-9B9A-41CB-8742-6723C5FF4D67@lassitu.de> <2CBD8651-E132-49DC-A082-37A8F5C626EA@bsdimp.com> <267FB3D6-830E-4A2F-8C1C-A96873EDCD31@lassitu.de> <12538AED-175C-4B1E-BF05-6FD05D14CE70@lassitu.de> <2135AD2B-76D4-4B3D-A009-8F3BEC836051@lassitu.de> Date: Wed, 28 Dec 2011 10:34:58 -0800 X-Google-Sender-Auth: gIiZNQcKJb8Ec6diAAsRyUr_KT8 Message-ID: From: Adrian Chadd To: Stefan Bethke Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-embedded@freebsd.org" Subject: Re: Updated switch/glue patch? X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2011 18:35:09 -0000 On 28 December 2011 05:52, Stefan Bethke wrote: > Implement a number of suggestions by Adrian: > * add mutex to callout > * add locking macros > * rename _lockheld to _locked > * bring debugging under DEBUG, incl. sysctls > * move i2c select retry to its own function > * mtx_sleep when retrying the select > * only reset bus on probe > * do not DELAY on phy access retries > * count phy access retries (under DEBUG) > > http://gitorious.org/~stb/freebsd/stb-adrianchadd-freebsd-work (branch work/ath) > http://www.lassitu.de/freebsd/etherswitch-adrian.patch (patch against Adrians gitorious repo as of now) > http://www.lassitu.de/freebsd/etherswitch.tbz (all files) The patch didn't compile - you were missing softc *sc pointers in smi_read_locked and smi_write_locked. Then when I added it: iicbb0: on gpioiic0 iicbb0: udelay=5 microseconds iicbus0: on iicbb0 master-only iic0: on iicbus0 panic: mutex (null) not owned at /home/adrian/work/freebsd/git/adrianchadd-freebsd-work/adrianchadd-freebsd-work/sys/dev/etherswitch/rtl8366rb.c:365 KDB: enter: panic .. and I bet it's because the path through rtl8366rb_probe() calls smi_read_locked() without things being locked. Which it can't be, there's no softc yet. :) So perhaps you need an smi_read() which doesn't have a lock, and use that just for the probe path. Also, remember to use braces ( ) around fields in a macro. :) Adrian