From owner-cvs-all Wed Apr 10 14:19:22 2002 Delivered-To: cvs-all@freebsd.org Received: from alcanet.com.au (mail2.alcanet.com.au [203.62.196.17]) by hub.freebsd.org (Postfix) with ESMTP id 456A137B435; Wed, 10 Apr 2002 14:19:01 -0700 (PDT) Received: from mfg1.cim.alcatel.com.au (localhost.localdomain [127.0.0.1]) by alcanet.com.au (8.12.1/8.12.1/Alcanet1.2) with ESMTP id g3ALIwQg007248; Thu, 11 Apr 2002 07:18:59 +1000 Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37640) with ESMTP id <01KGFGE9N6BKVLN0HI@cim.alcatel.com.au>; Thu, 11 Apr 2002 07:18:57 +1000 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id g3ALItf79143; Thu, 11 Apr 2002 07:18:55 +1000 Content-return: prohibited Date: Thu, 11 Apr 2002 07:18:55 +1000 From: Peter Jeremy Subject: Re: cvs commit: src/sys/dev/digi digi.c In-reply-to: <200204100313.g3A3DSt33125@freefall.freebsd.org>; from brian@FreeBSD.ORG on Tue, Apr 09, 2002 at 08:13:28PM -0700 To: Brian Somers Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Mail-Followup-To: Brian Somers , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Message-id: <20020411071854.Q69202@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <200204100313.g3A3DSt33125@freefall.freebsd.org> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-Apr-09 20:13:28 -0700, Brian Somers wrote: >brian 2002/04/09 20:13:28 PDT > > Modified files: > sys/dev/digi digi.c > Log: > Add a digi_delay() function and use it instead of tsleep() when polling > the card for command completion. > > digi_delay() uses either tsleep() or DELAY() depending on the value of > ``cold''. Originally, the initialisation looks used tsleep(,,,1) with a loop limit of 1000. Whilst this presumably worked for hz=100, it failed on my system with hz=2000. I extended the loop counter by a factor of 20 to compensate (I agree I should havd reported it, but I hadn't bothered with a portable fix). digi_delay() is roughly (cold ? DELAY(5000) : tsleep(,,,5)) - which is a fixed 5msec delay on boot, but a 5/hz delay once the system is running. (And I'm not sure why the timeout delay has changed). This will still probably timeout on dynamic loading. How about the following (untested) patch (which also reverts to the previous timeout). Index: digi.c =================================================================== RCS file: /home/CVSROOT/src/sys/dev/digi/digi.c,v retrieving revision 1.25 diff -u -r1.25 digi.c --- digi.c 10 Apr 2002 03:13:28 -0000 1.25 +++ digi.c 10 Apr 2002 21:13:43 -0000 @@ -225,9 +225,9 @@ digi_delay(struct digi_softc *sc, const char *txt) { if (cold) - DELAY(5000); + DELAY(1000000/hz); else - tsleep(sc, PUSER | PCATCH, txt, 5); + tsleep(sc, PUSER | PCATCH, txt, 1); } static int @@ -314,7 +314,7 @@ for (i = 0; ((sc->pcibus ? PCIPORT : inb(sc->port)) & FEPMASK) != FEPRST; i++) { - if (i > 1000) { + if (i > 10*hz) { log(LOG_ERR, "digi%d: %s init reset failed\n", sc->res.unit, sc->name); return (EIO); @@ -370,7 +370,7 @@ for (i = 0; ((sc->pcibus ? PCIPORT : inb(sc->port)) & FEPMASK) == resp; i++) { - if (i > 1000) { + if (i > 10*hz) { log(LOG_ERR, "digi%d: BIOS start failed\n", sc->res.unit); return (EIO); @@ -381,7 +381,7 @@ DLOG(DIGIDB_INIT, (sc->dev, "BIOS started after %d us\n", i)); for (i = 0; vW(ptr) != *(u_short *)"GD"; i++) { - if (i > 2000) { + if (i > 20*hz) { log(LOG_ERR, "digi%d: BIOS boot failed " "(0x%02x != 0x%02x)\n", sc->res.unit, vW(ptr), *(u_short *)"GD"); @@ -421,7 +421,7 @@ outb(sc->port, FEPCLR | FEPMEM); for (i = 0; W(ptr); i++) { - if (i > 10) { + if (i > hz/10) { log(LOG_ERR, "digi%d: FEP/OS move failed\n", sc->res.unit); sc->hidewin(sc); @@ -506,7 +506,7 @@ /* Now wait 'till the FEP/OS has booted */ for (i = 0; vW(ptr) != *(u_short *)"OS"; i++) { - if (i > 2000) { + if (i > 20*hz) { log(LOG_ERR, "digi%d: FEP/OS start failed " "(0x%02x != 0x%02x)\n", sc->res.unit, vW(ptr), *(u_short *)"OS"); Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message