Yet another adjustment of digi_delay(). The delay is now consistent

irrespective of whether tsleep() or DELAY() is used.
This commit is contained in:
brian 2002-04-10 14:32:55 +00:00
parent 15fcec3ecd
commit bb0ef348b3
3 changed files with 19 additions and 18 deletions

View File

@ -222,12 +222,12 @@ digi_bcopy(const void *vfrom, void *vto, size_t sz)
} }
void void
digi_delay(struct digi_softc *sc, const char *txt) digi_delay(struct digi_softc *sc, const char *txt, u_long timo)
{ {
if (cold) if (cold)
DELAY(1000); DELAY(timo * 1000000 / hz);
else else
tsleep(sc, PUSER | PCATCH, txt, 5); tsleep(sc, PUSER | PCATCH, txt, timo);
} }
static int static int
@ -319,7 +319,7 @@ digi_init(struct digi_softc *sc)
sc->res.unit, sc->name); sc->res.unit, sc->name);
return (EIO); return (EIO);
} }
digi_delay(sc, "digiinit0"); digi_delay(sc, "digiinit0", 5);
} }
DLOG(DIGIDB_INIT, (sc->dev, "Got init reset after %d us\n", i)); DLOG(DIGIDB_INIT, (sc->dev, "Got init reset after %d us\n", i));
@ -375,7 +375,7 @@ digi_init(struct digi_softc *sc)
sc->res.unit); sc->res.unit);
return (EIO); return (EIO);
} }
digi_delay(sc, "digibios0"); digi_delay(sc, "digibios0", 5);
} }
DLOG(DIGIDB_INIT, (sc->dev, "BIOS started after %d us\n", i)); DLOG(DIGIDB_INIT, (sc->dev, "BIOS started after %d us\n", i));
@ -387,7 +387,7 @@ digi_init(struct digi_softc *sc)
sc->res.unit, vW(ptr), *(u_short *)"GD"); sc->res.unit, vW(ptr), *(u_short *)"GD");
return (EIO); return (EIO);
} }
digi_delay(sc, "digibios1"); digi_delay(sc, "digibios1", 5);
} }
DLOG(DIGIDB_INIT, (sc->dev, "BIOS booted after %d iterations\n", i)); DLOG(DIGIDB_INIT, (sc->dev, "BIOS booted after %d iterations\n", i));
@ -427,7 +427,7 @@ digi_init(struct digi_softc *sc)
sc->hidewin(sc); sc->hidewin(sc);
return (EIO); return (EIO);
} }
digi_delay(sc, "digifep0"); digi_delay(sc, "digifep0", 5);
} }
DLOG(DIGIDB_INIT, DLOG(DIGIDB_INIT,
(sc->dev, "FEP/OS moved after %d iterations\n", i)); (sc->dev, "FEP/OS moved after %d iterations\n", i));
@ -513,7 +513,7 @@ digi_init(struct digi_softc *sc)
sc->hidewin(sc); sc->hidewin(sc);
return (EIO); return (EIO);
} }
digi_delay(sc, "digifep1"); digi_delay(sc, "digifep1", 5);
} }
DLOG(DIGIDB_INIT, (sc->dev, "FEP/OS started after %d iterations\n", i)); DLOG(DIGIDB_INIT, (sc->dev, "FEP/OS started after %d iterations\n", i));

View File

@ -215,4 +215,5 @@ const char *digi_errortxt(int _id);
int digi_attach(struct digi_softc *); int digi_attach(struct digi_softc *);
int digi_detach(device_t _dev); int digi_detach(device_t _dev);
int digi_shutdown(device_t _dev); int digi_shutdown(device_t _dev);
void digi_delay(struct digi_softc *_sc, const char *_txt); void digi_delay(struct digi_softc *_sc, const char *_txt,
u_long _timo);

View File

@ -112,12 +112,12 @@ digi_isa_check(struct digi_softc *sc)
/* Invasive probe - reset the card */ /* Invasive probe - reset the card */
outb(sc->port, FEPRST); outb(sc->port, FEPRST);
for (i = 0; i < 100; i++) { for (i = 0; i < 10; i++) {
if ((inb(sc->port) & FEPMASK) == FEPRST) if ((inb(sc->port) & FEPMASK) == FEPRST)
break; break;
digi_delay(sc, "digirst"); digi_delay(sc, "digirst", 1);
} }
if (i == 100) if (i == 10)
return (NULL); return (NULL);
DLOG(DIGIDB_INIT, (sc->dev, "got reset after %d delays\n", i)); DLOG(DIGIDB_INIT, (sc->dev, "got reset after %d delays\n", i));
@ -375,12 +375,12 @@ digi_isa_attach(device_t dev)
reset |= FEPMEM; reset |= FEPMEM;
outb(sc->port, reset); outb(sc->port, reset);
for (i = 0; i < 100; i++) { for (i = 0; i < 10; i++) {
if ((inb(sc->port) & FEPMASK) == reset) if ((inb(sc->port) & FEPMASK) == reset)
break; break;
digi_delay(sc, "digirst1"); digi_delay(sc, "digirst1", 1);
} }
if (i == 100) { if (i == 10) {
device_printf(dev, "1st reset failed\n"); device_printf(dev, "1st reset failed\n");
sc->hidewin(sc); sc->hidewin(sc);
goto failed; goto failed;
@ -397,12 +397,12 @@ digi_isa_attach(device_t dev)
if (sc->model == PCXI || sc->model == PCXE) { if (sc->model == PCXI || sc->model == PCXE) {
outb(sc->port, FEPRST | FEPMEM); outb(sc->port, FEPRST | FEPMEM);
for (i = 0; i < 100; i++) { for (i = 0; i < 10; i++) {
if ((inb(sc->port) & FEPMASK) != FEPRST) if ((inb(sc->port) & FEPMASK) != FEPRST)
break; break;
digi_delay(sc, "digirst2"); digi_delay(sc, "digirst2", 1);
} }
if (i == 100) { if (i == 10) {
device_printf(dev, "2nd reset failed (0x%02x)\n", device_printf(dev, "2nd reset failed (0x%02x)\n",
inb(sc->port)); inb(sc->port));
sc->hidewin(sc); sc->hidewin(sc);