summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-12-24 11:32:41 +0000
committerjoerg <joerg@FreeBSD.org>1996-12-24 11:32:41 +0000
commit92da8dac3dc75774ad4be9c2ce144368c0fc49ec (patch)
tree509600f94787e31d476177f109f14c0c3feaef2c /sys/scsi
parentd99939c736aca9e71967d283a2ca32bb8ba0c564 (diff)
downloadFreeBSD-src-92da8dac3dc75774ad4be9c2ce144368c0fc49ec.zip
FreeBSD-src-92da8dac3dc75774ad4be9c2ce144368c0fc49ec.tar.gz
Do something Peter Dufault long since intended to do: make a current
error code with ASC/ASCQ 4/1 (``Logical unit is in the process of becoming ready'') non-fatal. Retry the operation until it will eventually either yield a real error condition, or finally succeed. Devices like CD changers or tape drives with a freshly inserted cartridge should benefit from this. Should go into 2.2 after some testing in -current. I'd like to see this in the release if possible.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_base.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 75281f9..78cba1d 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
- * $Id: scsi_base.c,v 1.38 1996/05/03 21:01:42 phk Exp $
+ * $Id: scsi_base.c,v 1.39 1996/07/14 10:46:48 joerg Exp $
*/
#include "opt_bounce.h"
@@ -932,11 +932,12 @@ scsi_interpret_sense(xs)
struct scsi_xfer *xs;
{
struct scsi_sense_data *sense;
+ struct scsi_sense_extended *ext;
struct scsi_link *sc_link = xs->sc_link;
u_int32_t key;
u_int32_t silent;
errval errcode;
- int error_code;
+ int error_code, asc, ascq;
/*
* If the flags say errs are ok, then always return ok.
@@ -946,6 +947,7 @@ scsi_interpret_sense(xs)
return (ESUCCESS);
sense = &(xs->sense);
+ ext = &(sense->ext.extended);
#ifdef SCSIDEBUG
if (sc_link->flags & SDEV_DB1) {
@@ -1016,9 +1018,21 @@ scsi_interpret_sense(xs)
}
/* otherwise use the default */
- silent = (xs->flags & SCSI_SILENT);
- key = sense->ext.extended.flags & SSD_KEY;
+ silent = xs->flags & SCSI_SILENT;
+ key = ext->flags & SSD_KEY;
error_code = sense->error_code & SSD_ERRCODE;
+ asc = (ext->extra_len >= 5) ? ext->add_sense_code : 0;
+ ascq = (ext->extra_len >= 6) ? ext->add_sense_code_qual : 0;
+
+ /*
+ * Retry while the device is returning a ``Logical unit
+ * is in the process of becoming ready.'' (until it either
+ * eventually yields an error, or finally succeeds).
+ */
+ if (error_code == 0x70 /* current error */ &&
+ (int)key == 0x2 /* not ready */ &&
+ asc == 4 && ascq == 1 /* logical unit i i t p o b r */)
+ return (SCSIRET_DO_RETRY);
if (!silent) {
scsi_sense_print(xs);
OpenPOWER on IntegriCloud