Adjust for new DELAY() ... s/DELAY(1)/DELAY(5)/ and lengthen some

timeouts.
This commit is contained in:
thorpej 1996-05-17 15:15:29 +00:00
parent c3fc839395
commit 3ad552e74b
1 changed files with 30 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi.c,v 1.8 1996/02/14 02:44:59 thorpej Exp $ */
/* $NetBSD: scsi.c,v 1.9 1996/05/17 15:15:29 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
@ -64,8 +64,8 @@
* SCSI delays
* In u-seconds, primarily for state changes on the SPC.
*/
#define SCSI_CMD_WAIT 1000 /* wait per step of 'immediate' cmds */
#define SCSI_DATA_WAIT 1000 /* wait per data in/out step */
#define SCSI_CMD_WAIT 10000 /* wait per step of 'immediate' cmds */
#define SCSI_DATA_WAIT 10000 /* wait per data in/out step */
#define SCSI_INIT_WAIT 50000 /* wait per step (both) during init */
extern void isrlink();
@ -112,7 +112,8 @@ u_int sgo_wait[MAXWAIT+2];
#define b_cylin b_resid
static void
scsiabort(hs, hd, where)
scsiabort(target, hs, hd, where)
int target;
register struct scsi_softc *hs;
volatile register struct scsidevice *hd;
char *where;
@ -122,9 +123,11 @@ scsiabort(hs, hd, where)
int startlen; /* XXX - kludge till I understand whats *supposed* to happen */
u_char junk;
printf("%s: abort from %s: phase=0x%x, ssts=0x%x, ints=0x%x\n",
hs->sc_hc->hp_xname, where, hd->scsi_psns, hd->scsi_ssts,
hd->scsi_ints);
printf("%s: ", hs->sc_hc->hp_xname);
if (target != -1)
printf("targ %d ", target);
printf("abort from %s: phase=0x%x, ssts=0x%x, ints=0x%x\n",
where, hd->scsi_psns, hd->scsi_ssts, hd->scsi_ints);
hd->scsi_ints = hd->scsi_ints;
hd->scsi_csr = 0;
@ -142,7 +145,7 @@ scsiabort(hs, hd, where)
while ((hd->scsi_psns & PSNS_REQ) == 0) {
if (! (hd->scsi_ssts & SSTS_INITIATOR))
goto out;
DELAY(1);
DELAY(5);
if (--maxtries == 0) {
printf("-- scsiabort gave up after 1000 tries (startlen = %d len = %d)\n",
startlen, len);
@ -159,7 +162,7 @@ out2:
hd->scsi_scmd = SCMD_SET_ACK;
if (hd->scsi_tmod == 0)
while (hd->scsi_psns & PSNS_REQ)
DELAY(1);
DELAY(5);
junk = hd->scsi_temp;
} else {
/* one of the output phases - send an abort msg */
@ -167,7 +170,7 @@ out2:
hd->scsi_scmd = SCMD_SET_ACK;
if (hd->scsi_tmod == 0)
while (hd->scsi_psns & PSNS_REQ)
DELAY(1);
DELAY(5);
}
hd->scsi_scmd = SCMD_RST_ACK;
}
@ -183,7 +186,7 @@ out:
if (! ((junk = hd->scsi_ints) & INTS_RESEL)) {
hd->scsi_sctl |= SCTL_CTRLRST;
DELAY(1);
DELAY(5);
hd->scsi_sctl &=~ SCTL_CTRLRST;
hd->scsi_hconf = 0;
hd->scsi_ints = hd->scsi_ints;
@ -301,7 +304,7 @@ scsiattach(hc)
* XXX scale initialization wait according to CPU speed.
* Should we do this for all wait? Should we do this at all?
*/
scsi_init_wait *= cpuspeed;
scsi_init_wait *= (cpuspeed / 8);
}
void
@ -314,7 +317,7 @@ scsireset(unit)
u_int i;
if (hs->sc_flags & SCSI_ALIVE)
scsiabort(hs, hd, "reset");
scsiabort(-1, hs, hd, "reset");
hd->scsi_id = 0xFF;
DELAY(100);
@ -464,7 +467,7 @@ wait_for_select(hd)
u_char ints;
while ((ints = hd->scsi_ints) == 0)
DELAY(1);
DELAY(5);
hd->scsi_ints = ints;
return (!(hd->scsi_ssts & SSTS_INITIATOR));
}
@ -495,7 +498,7 @@ ixfer_start(hd, len, phase, wait)
HIST(ixstart_wait, wait)
return (0);
}
DELAY(1);
DELAY(5);
}
HIST(ixstart_wait, wait)
return (1);
@ -520,7 +523,7 @@ ixfer_out(hd, len, buf)
HIST(ixout_wait, wait)
return (len);
}
DELAY(1);
DELAY(5);
}
hd->scsi_dreg = *buf++;
}
@ -551,7 +554,7 @@ ixfer_in(hd, len, buf)
HIST(ixin_wait, wait)
return;
}
DELAY(1);
DELAY(5);
}
*buf++ = hd->scsi_dreg;
}
@ -589,7 +592,7 @@ mxfer_in(hd, len, buf, phase)
(hd->scsi_ssts & SSTS_INITIATOR) == 0)
goto out;
DELAY(1);
DELAY(5);
}
/*
* set ack (which says we're ready for the data, wait for
@ -603,7 +606,7 @@ mxfer_in(hd, len, buf, phase)
HIST(mxin_wait, wait)
return (-2);
}
DELAY(1);
DELAY(5);
}
*buf++ = hd->scsi_temp;
hd->scsi_scmd = SCMD_RST_ACK;
@ -619,7 +622,7 @@ out:
while ((hd->scsi_ssts & SSTS_ACTIVE) == SSTS_INITIATOR) {
if (--wait < 0)
break;
DELAY(1);
DELAY(5);
}
HIST(mxin2_wait, wait)
return (i);
@ -726,7 +729,7 @@ scsiicmd(hs, target, cbuf, clen, buf, len, xferphase)
HIST(cxin_wait, wait)
goto abort;
}
DELAY(1);
DELAY(5);
}
HIST(cxin_wait, wait)
hd->scsi_ints = ints;
@ -740,7 +743,7 @@ scsiicmd(hs, target, cbuf, clen, buf, len, xferphase)
}
}
abort:
scsiabort(hs, hd, "icmd");
scsiabort(target, hs, hd, "icmd");
out:
return (hs->sc_stat[0]);
}
@ -786,7 +789,7 @@ finishxfer(hs, hd, target)
}
hd->scsi_scmd |= SCMD_PROG_XFR;
hd->scsi_sctl |= SCTL_CTRLRST;
DELAY(1);
DELAY(5);
hd->scsi_sctl &=~ SCTL_CTRLRST;
hd->scsi_hconf = 0;
/*
@ -838,7 +841,7 @@ finishxfer(hs, hd, target)
return;
}
abort:
scsiabort(hs, hd, "finishxfer");
scsiabort(target, hs, hd, "finishxfer");
hs->sc_stat[0] = 0xfe;
}
@ -1053,7 +1056,7 @@ scsigo(ctlr, slave, unit, bp, cdb, pad)
HIST(sgo_wait, wait)
goto abort;
}
DELAY(1);
DELAY(5);
}
HIST(sgo_wait, wait)
hd->scsi_ints = ints;
@ -1135,7 +1138,7 @@ out:
hs->sc_flags |= SCSI_IO;
return (0);
abort:
scsiabort(hs, hd, "go");
scsiabort(slave, hs, hd, "go");
hs->sc_flags &=~ SCSI_HAVEDMA;
dmafree(&hs->sc_dq);
return (1);
@ -1194,7 +1197,7 @@ scsiintr(arg)
hd->scsi_ints = ints;
hd->scsi_csr = 0;
scsierror(hs, hd, ints);
scsiabort(hs, hd, "intr");
scsiabort(dq->dq_slave, hs, hd, "intr");
if (hs->sc_flags & SCSI_IO) {
hs->sc_flags &=~ (SCSI_IO|SCSI_HAVEDMA);
dmafree(&hs->sc_dq);