From owner-freebsd-firewire@FreeBSD.ORG Wed Apr 15 19:21:55 2009 Return-Path: Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED7AD1065677; Wed, 15 Apr 2009 19:21:54 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 2F6118FC12; Wed, 15 Apr 2009 19:21:53 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from wolfram.andreas.nets ([91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id n3FJLh1A086980; Wed, 15 Apr 2009 21:21:44 +0200 (CEST) (envelope-from andreast-list@fgznet.ch) Message-ID: <49E633C7.9030909@fgznet.ch> Date: Wed, 15 Apr 2009 21:21:43 +0200 From: Andreas Tobler User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Sean Bruno References: <1239382529.21481.7.camel@localhost.localdomain> <20090411154000.GG8143@alchemy.franken.de> <1239600457.24831.8.camel@localhost.localdomain> <49E2F2FA.6000204@fgznet.ch> <1239639423.24831.85.camel@localhost.localdomain> <20090413170537.GI8143@alchemy.franken.de> <1239643406.24831.95.camel@localhost.localdomain> <20090413173528.GJ8143@alchemy.franken.de> <1239646889.24831.135.camel@localhost.localdomain> <20090414184741.GK8143@alchemy.franken.de> <49E4DF9F.1090804@fgznet.ch> <1239814413.15474.2.camel@localhost.localdomain> <49E61B4D.1050209@fgznet.ch> <1239819547.15474.5.camel@localhost.localdomain> In-Reply-To: <1239819547.15474.5.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: freebsd-firewire , scottl , Marius Strobl Subject: Re: fwochi.c and bus_space_barrier() X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 19:22:05 -0000 Sean Bruno wrote: > On Wed, 2009-04-15 at 19:37 +0200, Andreas Tobler wrote: >> Sean Bruno wrote: >>>>> This looks basically good, but as outlined earlier a driver >>>>> souldn't busy-wait 50ms. Could one of you please test whether >>>>> pause("fwlps", (50 * hz + 999) / 1000) works as a drop-in >>>>> replacement for DELAY(50000) here? >>>> Works fine here! >>>> >>>> Thanks! >>>> Andreas >>>> >>>> >>>> >>> Ok, time for more testing. A couple of changes here. >>> >>> 1. change busy DELAY() call with pause() >>> 2. test for lps condition before pause(), if not set pause and retry. >> Fine here, but see that there was no pause needed, strange. >> >> Andreas >> >> > You may want to retry several times. Like you pointed out in earlier > posts, this issue seems to be a race condition. Heh, now I remember, I did not speak about a race condition, but about a timing issue. If I leave the printfs away, it panics here. for (lps = 0, lps_counter = 0; !lps && lps_counter < 3; lps_counter++) { lps = (OREAD(sc, OHCI_HCCCTL) & OHCI_HCC_LPS); if (!lps) { pause("fwlps", (50 * hz + 999) / 1000); device_printf(dev, "lps not set, attempt(%d)\n", lps_cou nter); } /* else device_printf(dev, "lps(%0x) set\n", lps);*/ } In my case the lps is not NULL, so we print something in the first run of the loop, this print statement is enough 'time' for the card to come up. If we leave the printf away, it is not enough time to come up for the card. Panic. This was the same thing I reported, adding a printf statement at the beginning of fwphy_rddata cures my panic. So I'd suggest to leave the lps test away and add always a pause(9), or does this cause headache on other archs? Thanks, Andreas