diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-12-19 01:32:27 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-12-19 01:32:27 +0000 |
commit | 68f0592b1498d2919f28ed745272fc2530a252c9 (patch) | |
tree | 94f41939e2ef27b6af77b8e3b817e432ddab8ae0 /sys/scsi/scsi_base.c | |
parent | 8ee4cb3af823ea866ee160e1913939e71e577152 (diff) |
for sense code "Logical Unit Is in Process Of Becoming Ready", make
the sense code evaluation function return ERESTART with xs->error = XS_BUSY;
then higher up catch this case and drop into the scbusy tsleep code.
For exabyte 8500 units, this makes st opening reprobe repeatedly, rather
than fail with an EIO while the tape is being loaded.
Diffstat (limited to 'sys/scsi/scsi_base.c')
-rw-r--r-- | sys/scsi/scsi_base.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index a366a548902..2f0a8a24dda 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.21 1998/02/14 08:56:50 deraadt Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.22 1998/12/19 01:32:26 deraadt Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -238,7 +238,7 @@ scsi_test_unit_ready(sc_link, flags) scsi_cmd.opcode = TEST_UNIT_READY; return scsi_scsi_cmd(sc_link, (struct scsi_generic *) &scsi_cmd, - sizeof(scsi_cmd), 0, 0, 2, 10000, NULL, flags); + sizeof(scsi_cmd), 0, 0, 50, 10000, NULL, flags); } /* @@ -531,19 +531,25 @@ sc_err1(xs, async) break; case XS_SENSE: - if ((error = scsi_interpret_sense(xs)) == ERESTART) + if ((error = scsi_interpret_sense(xs)) == ERESTART) { + if (xs->error == XS_BUSY) { + xs->error = XS_SENSE; + goto sense_retry; + } goto retry; + } SC_DEBUG(xs->sc_link, SDEV_DB3, ("scsi_interpret_sense returned %d\n", error)); break; case XS_BUSY: + sense_retry: if (xs->retries) { if ((xs->flags & SCSI_POLL) != 0) delay(1000000); - else if ((xs->flags & SCSI_NOSLEEP) == 0) + else if ((xs->flags & SCSI_NOSLEEP) == 0) { tsleep(&lbolt, PRIBIO, "scbusy", 0); - else + } else #if 0 timeout(scsi_requeue, xs, hz); #else @@ -659,6 +665,11 @@ scsi_interpret_sense(xs) sc_link->flags &= ~SDEV_MEDIA_LOADED; if ((xs->flags & SCSI_IGNORE_NOT_READY) != 0) return 0; + if (xs->retries && sense->add_sense_code == 0x04 && + sense->add_sense_code_qual == 0x01) { + xs->error = XS_BUSY; /* ie. sense_retry */ + return ERESTART; + } if (xs->retries && !(sc_link->flags & SDEV_REMOVABLE)) { delay(1000000); return ERESTART; |