From owner-freebsd-current@FreeBSD.ORG Wed Feb 11 00:07:44 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 11BCA106566C; Wed, 11 Feb 2009 00:07:44 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from mailrelay.rz.uni-wuerzburg.de (mailrelay.rz.uni-wuerzburg.de [132.187.3.28]) by mx1.freebsd.org (Postfix) with ESMTP id 8D7BF8FC12; Wed, 11 Feb 2009 00:07:43 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from virusscan.mail (localhost [127.0.0.1]) by mailrelay.mail (Postfix) with ESMTP id 81786199081; Wed, 11 Feb 2009 01:07:42 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by virusscan.mail (Postfix) with ESMTP id 7576919907F; Wed, 11 Feb 2009 01:07:42 +0100 (CET) Received: from mail.physik.uni-wuerzburg.de (wthp192.physik.uni-wuerzburg.de [132.187.40.192]) by mailmaster.uni-wuerzburg.de (Postfix) with ESMTP id 6180A199071; Wed, 11 Feb 2009 01:07:42 +0100 (CET) Received: from wep4035 ([132.187.37.35]) by mail.physik.uni-wuerzburg.de (Lotus Domino Release 8.0.2HF443) with ESMTP id 2009021101074153-51215 ; Wed, 11 Feb 2009 01:07:41 +0100 Received: by wep4035 (sSMTP sendmail emulation); Wed, 11 Feb 2009 01:07:41 +0100 From: "Alexey Shuvaev" Date: Wed, 11 Feb 2009 01:07:41 +0100 To: John Baldwin Message-ID: <20090211000741.GA1625@wep4035.physik.uni-wuerzburg.de> References: <200902021643.39862.c47g@gmx.at> <200902101612.57922.jhb@freebsd.org> <20090210215720.GA1594@wep4035.physik.uni-wuerzburg.de> <200902101734.10365.jhb@freebsd.org> MIME-Version: 1.0 In-Reply-To: <200902101734.10365.jhb@freebsd.org> Organization: Universitaet Wuerzburg User-Agent: Mutt/1.5.18 (2008-05-17) X-MIMETrack: Itemize by SMTP Server on domino1/uni-wuerzburg(Release 8.0.2HF443 | November 25, 2008) at 02/11/2009 01:07:41 AM, Serialize by Router on domino1/uni-wuerzburg(Release 8.0.2HF443 | November 25, 2008) at 02/11/2009 01:07:42 AM, Serialize complete at 02/11/2009 01:07:42 AM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: by amavisd-new at uni-wuerzburg.de Cc: freebsd-current@freebsd.org 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 00:07:44 -0000 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.