From owner-freebsd-current@FreeBSD.ORG Wed Feb 11 16:07:56 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 B8B661065670 for ; Wed, 11 Feb 2009 16:07:56 +0000 (UTC) (envelope-from c47g@gmx.at) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 1EBA88FC12 for ; Wed, 11 Feb 2009 16:07:55 +0000 (UTC) (envelope-from c47g@gmx.at) Received: (qmail invoked by alias); 11 Feb 2009 16:07:52 -0000 Received: from cm56-152-15.liwest.at (EHLO bones) [86.56.152.15] by mail.gmx.net (mp063) with SMTP; 11 Feb 2009 17:07:52 +0100 X-Authenticated: #9978462 X-Provags-ID: V01U2FsdGVkX19ornNClwNonn0dMqSG1Ely3YOMJ8XhofwziXGRDC 6RUOjh7vuRlb77 From: Christian Gusenbauer To: freebsd-current@freebsd.org Date: Wed, 11 Feb 2009 17:08:22 +0100 User-Agent: KMail/1.9.10 References: <200902021643.39862.c47g@gmx.at> <200902101734.10365.jhb@freebsd.org> <20090211000741.GA1625@wep4035.physik.uni-wuerzburg.de> In-Reply-To: <20090211000741.GA1625@wep4035.physik.uni-wuerzburg.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200902111708.23030.c47g@gmx.at> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.43 Cc: Alexey Shuvaev Subject: Re: lpt stopped working 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: Wed, 11 Feb 2009 16:07:57 -0000 On Wednesday 11 February 2009, Alexey Shuvaev wrote: > On Tue, Feb 10, 2009 at 05:34:10PM -0500, John Baldwin wrote: > > On Tuesday 10 February 2009 4:57:20 pm Alexey Shuvaev wrote: > > > On Tue, Feb 10, 2009 at 04:12:57PM -0500, John Baldwin wrote: > > > > Ok, so the first cat works, the second one gets EBUSY? > > > > > > Mmm... I don't think the first cat really works. > > > It hangs, I suppose nothing goes to the wire, > > > and during this I got the above printigs from kgdb. > > > > > > > Hmm, I think I've found it. Due to a bug, lptclose() wasn't > > > > releasing the bus. > > > > Grr, lptopen() was also busted. The old lpt driver didn't actually check > > the HAVEBUS flag in lpt_release_ppbus() which masked the bugs in > > lptopen(). Try this: > > > > --- //depot/vendor/freebsd/src/sys/dev/ppbus/lpt.c 2009/01/26 21:00:15 > > +++ //depot/user/jhb/acpipci/dev/ppbus/lpt.c 2009/02/10 22:32:11 > > @@ -544,10 +544,10 @@ > > do { > > /* ran out of waiting for the printer */ > > if (trys++ >= LPINITRDY*4) { > > - sc->sc_state = 0; > > lprintf(("status %x\n", ppb_rstr(ppbus))); > > > > lpt_release_ppbus(lptdev); > > + sc->sc_state = 0; > > ppb_unlock(ppbus); > > return (EBUSY); > > } > > @@ -555,9 +555,8 @@ > > /* wait 1/4 second, give up if we get a signal */ > > if (ppb_sleep(ppbus, lptdev, LPPRI | PCATCH, "lptinit", > > hz / 4) != EWOULDBLOCK) { > > + lpt_release_ppbus(lptdev); > > sc->sc_state = 0; > > - > > - lpt_release_ppbus(lptdev); > > ppb_unlock(ppbus); > > return (EBUSY); > > } > > @@ -577,7 +576,8 @@ > > > > ppb_wctr(ppbus, sc->sc_control); > > > > - sc->sc_state = OPEN; > > + sc->sc_state &= ~LPTINIT; > > + sc->sc_state |= OPEN; > > sc->sc_xfercnt = 0; > > > > /* only use timeout if using interrupt */ > > @@ -611,11 +611,8 @@ > > int err; > > > > ppb_lock(ppbus); > > - if (sc->sc_flags & LP_BYPASS) { > > - sc->sc_state = 0; > > - ppb_unlock(ppbus); > > + if (sc->sc_flags & LP_BYPASS) > > goto end_close; > > - } > > > > if ((err = lpt_request_ppbus(lptdev, PPB_WAIT|PPB_INTR)) != 0) { > > ppb_unlock(ppbus); > > @@ -635,16 +632,16 @@ > > sc->sc_state &= ~OPEN; > > callout_stop(&sc->sc_timer); > > ppb_wctr(ppbus, LPC_NINIT); > > - sc->sc_state = 0; > > - sc->sc_xfercnt = 0; > > > > /* > > * unregistration of interrupt forced by release > > */ > > lpt_release_ppbus(lptdev); > > - ppb_unlock(ppbus); > > > > end_close: > > + sc->sc_state = 0; > > + sc->sc_xfercnt = 0; > > + ppb_unlock(ppbus); > > lprintf(("closed.\n")); > > return(0); > > } > > Seems to work! > No messages in the console, like "interrupt storm", too. > Thanks! > > Alexey. That works for me, too. Thanks for fixing it! Christian.