From 79eb9fbf61f33d3e7b6d547511f667b4b057814b Mon Sep 17 00:00:00 2001 From: gwr Date: Mon, 18 Mar 1996 23:09:02 +0000 Subject: [PATCH] Deal with devices that are slow to get off the bus. --- sys/dev/ic/ncr5380sbc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c index 27d8c473787d..ddc466a3da2a 100644 --- a/sys/dev/ic/ncr5380sbc.c +++ b/sys/dev/ic/ncr5380sbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr5380sbc.c,v 1.8 1996/03/07 15:00:17 christos Exp $ */ +/* $NetBSD: ncr5380sbc.c,v 1.9 1996/03/18 23:09:02 gwr Exp $ */ /* * Copyright (c) 1995 David Jones, Gordon W. Ross @@ -2329,8 +2329,25 @@ do_actions: if (act_flags & ACT_DISCONNECT) { /* * The device has dropped BSY (or will soon). - * Return and let ncr5380_sched() do its thing. + * We have to wait here for BSY to drop, otherwise + * the next command may decide we need a bus reset. */ + timo = ncr5380_wait_nrq_timo; /* XXX */ + for (;;) { + if (!SCI_BUSY(sc)) + goto busfree; + if (--timo <= 0) + break; + delay(2); + } + /* Device is sitting on the bus! */ + printf("%s: SCSI job did not finish, resetting...\n", + sc->sc_dev.dv_xname); + ncr5380_reset_scsibus(sc); + busfree: + NCR_TRACE("machine: discon, waited %d\n", + ncr5380_wait_nrq_timo - timo); + *sc->sci_icmd = 0; *sc->sci_mode = 0; *sc->sci_tcmd = PHASE_INVALID;