Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Apr 2002 07:18:55 +1000
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        Brian Somers <brian@FreeBSD.ORG>
Cc:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/dev/digi digi.c
Message-ID:  <20020411071854.Q69202@gsmx07.alcatel.com.au>
In-Reply-To: <200204100313.g3A3DSt33125@freefall.freebsd.org>; from brian@FreeBSD.ORG on Tue, Apr 09, 2002 at 08:13:28PM -0700
References:  <200204100313.g3A3DSt33125@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-Apr-09 20:13:28 -0700, Brian Somers <brian@FreeBSD.ORG> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020411071854.Q69202>