Date: Thu, 11 Apr 2002 00:59:25 +0100 From: Brian Somers <brian@freebsd-services.com> To: Peter Jeremy <peter.jeremy@alcatel.com.au> Cc: Brian Somers <brian@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/dev/digi digi.c Message-ID: <200204102359.g3ANxQOF059310@hak.lan.Awfulhak.org> In-Reply-To: Message from Peter Jeremy <peter.jeremy@alcatel.com.au> of "Thu, 11 Apr 2002 07:18:55 %2B1000." <20020411071854.Q69202@gsmx07.alcatel.com.au>
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).
Hi,
The code has changed slightly (moving goalposts!). Does this patch
(based on yours) make things work for you ?
Also, if you have a few moments, could you set digi_debug = 1 and
send me the dmesg output from a ``kldload digi'' ? I get this with
hz = 100:
digi0 mem 0xec800000-0xecbfffff irq 10 at device 9.0 on pci2
digi0: Got init reset after 0 us
digi0: BIOS uploaded
digi0: BIOS started after 0 us
digi0: BIOS booted after 381 iterations
digi0: Loading FEP/OS
digi0: FEP/OS loaded
digi0: FEP/OS started after 10 iterations
digi0: Digiboard PCI8r 920, 8 ports found
I can't try any of the other boards at the moment... see my other
email :*/ but I guess you're timing out on the BIOS boot ?
Cheers.
--
Brian <brian@freebsd-services.com> <brian@Awfulhak.org>
http://www.freebsd-services.com/ <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org>
Index: digi.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/digi/digi.c,v
retrieving revision 1.27
diff -u -r1.27 digi.c
--- digi.c 10 Apr 2002 14:32:55 -0000 1.27
+++ digi.c 10 Apr 2002 23:28:45 -0000
@@ -314,12 +314,12 @@
for (i = 0; ((sc->pcibus ? PCIPORT : inb(sc->port)) &
FEPMASK) != FEPRST; i++) {
- if (i > 100) {
+ if (i > 10 * hz) {
log(LOG_ERR, "digi%d: %s init reset failed\n",
sc->res.unit, sc->name);
return (EIO);
}
- digi_delay(sc, "digiinit0", 5);
+ digi_delay(sc, "digiinit0", 1);
}
DLOG(DIGIDB_INIT, (sc->dev, "Got init reset after %d us\n", i));
@@ -370,24 +370,24 @@
for (i = 0; ((sc->pcibus ? PCIPORT : inb(sc->port)) & FEPMASK)
== resp; i++) {
- if (i > 100) {
+ if (i > 10 * hz) {
log(LOG_ERR, "digi%d: BIOS start failed\n",
sc->res.unit);
return (EIO);
}
- digi_delay(sc, "digibios0", 5);
+ digi_delay(sc, "digibios0", 1);
}
DLOG(DIGIDB_INIT, (sc->dev, "BIOS started after %d us\n", i));
for (i = 0; vW(ptr) != *(u_short *)"GD"; i++) {
- if (i > 200) {
+ 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");
return (EIO);
}
- digi_delay(sc, "digibios1", 5);
+ digi_delay(sc, "digibios1", 1);
}
DLOG(DIGIDB_INIT, (sc->dev, "BIOS booted after %d iterations\n", i));
@@ -421,13 +421,13 @@
outb(sc->port, FEPCLR | FEPMEM);
for (i = 0; W(ptr); i++) {
- if (i > 100) {
+ if (i > 10 * hz) {
log(LOG_ERR, "digi%d: FEP/OS move failed\n",
sc->res.unit);
sc->hidewin(sc);
return (EIO);
}
- digi_delay(sc, "digifep0", 5);
+ digi_delay(sc, "digifep0", 1);
}
DLOG(DIGIDB_INIT,
(sc->dev, "FEP/OS moved after %d iterations\n", i));
@@ -506,14 +506,14 @@
/* Now wait 'till the FEP/OS has booted */
for (i = 0; vW(ptr) != *(u_short *)"OS"; i++) {
- if (i > 200) {
+ 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");
sc->hidewin(sc);
return (EIO);
}
- digi_delay(sc, "digifep1", 5);
+ digi_delay(sc, "digifep1", 1);
}
DLOG(DIGIDB_INIT, (sc->dev, "FEP/OS started after %d iterations\n", i));
Index: digi_isa.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/digi/digi_isa.c,v
retrieving revision 1.9
diff -u -r1.9 digi_isa.c
--- digi_isa.c 10 Apr 2002 14:32:55 -0000 1.9
+++ digi_isa.c 10 Apr 2002 23:48:03 -0000
@@ -112,12 +112,12 @@
/* Invasive probe - reset the card */
outb(sc->port, FEPRST);
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < 10 * hz; i++) {
if ((inb(sc->port) & FEPMASK) == FEPRST)
break;
digi_delay(sc, "digirst", 1);
}
- if (i == 10)
+ if (i == 10 * hz)
return (NULL);
DLOG(DIGIDB_INIT, (sc->dev, "got reset after %d delays\n", i));
@@ -375,12 +375,12 @@
reset |= FEPMEM;
outb(sc->port, reset);
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < 10 * hz; i++) {
if ((inb(sc->port) & FEPMASK) == reset)
break;
digi_delay(sc, "digirst1", 1);
}
- if (i == 10) {
+ if (i == 10 * hz) {
device_printf(dev, "1st reset failed\n");
sc->hidewin(sc);
goto failed;
@@ -397,12 +397,12 @@
if (sc->model == PCXI || sc->model == PCXE) {
outb(sc->port, FEPRST | FEPMEM);
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < 10 * hz; i++) {
if ((inb(sc->port) & FEPMASK) != FEPRST)
break;
digi_delay(sc, "digirst2", 1);
}
- if (i == 10) {
+ if (i == 10 * hz) {
device_printf(dev, "2nd reset failed (0x%02x)\n",
inb(sc->port));
sc->hidewin(sc);
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?200204102359.g3ANxQOF059310>
