summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/scsi/cd.c13
-rw-r--r--sys/scsi/ch.c3
-rw-r--r--sys/scsi/scsi_base.c7
-rw-r--r--sys/scsi/scsiconf.c6
-rw-r--r--sys/scsi/scsiconf.h10
-rw-r--r--sys/scsi/sd.c3
-rw-r--r--sys/scsi/ss.c4
-rw-r--r--sys/scsi/st.c10
8 files changed, 35 insertions, 21 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 251fa6144b3..01e107195f9 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.64 2002/06/09 00:01:49 art Exp $ */
+/* $OpenBSD: cd.c,v 1.65 2002/12/30 21:50:28 grange Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -353,10 +353,13 @@ cdopen(dev, flag, fmt, p)
goto bad3;
}
} else {
- /* Check that it is still responding and ok. */
- error = scsi_test_unit_ready(sc_link,
- SCSI_IGNORE_ILLEGAL_REQUEST |
- SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY);
+ /*
+ * Check that it is still responding and ok.
+ * Drive can be in progress of loading media so use
+ * increased retries number and don't ignore NOT_READY.
+ */
+ error = scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_CD,
+ SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
if (error) {
if (part != RAW_PART || fmt != S_IFCHR)
goto bad3;
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index c780fcf239a..112b5c3e798 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ch.c,v 1.13 2002/10/17 17:47:24 mickey Exp $ */
+/* $OpenBSD: ch.c,v 1.14 2002/12/30 21:50:28 grange Exp $ */
/* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */
/*
@@ -205,6 +205,7 @@ chopen(dev, flags, fmt, p)
* loaded in the drive.
*/
error = scsi_test_unit_ready(sc->sc_link,
+ TEST_READY_RETRIES_DEFAULT,
SCSI_IGNORE_NOT_READY|SCSI_IGNORE_MEDIA_CHANGE);
if (error)
goto bad;
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 2b2b3dcfc4c..7f400f5ac79 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.38 2002/11/30 18:46:56 nate Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.39 2002/12/30 21:50:28 grange Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -247,8 +247,9 @@ scsi_size(sc_link, flags)
* Get scsi driver to send a "are you ready?" command
*/
int
-scsi_test_unit_ready(sc_link, flags)
+scsi_test_unit_ready(sc_link, retries, flags)
struct scsi_link *sc_link;
+ int retries;
int flags;
{
struct scsi_test_unit_ready scsi_cmd;
@@ -257,7 +258,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, 5, 10000, NULL, flags);
+ sizeof(scsi_cmd), 0, 0, retries, 10000, NULL, flags);
}
/*
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 2973c5c299a..dabdb3f2ef2 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.69 2002/09/04 23:11:10 tdeval Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.70 2002/12/30 21:50:28 grange Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -802,7 +802,7 @@ scsi_probedev(scsi, target, lun)
sc_link->flags |= scsidebug_level;
#endif /* SCSIDEBUG */
- (void) scsi_test_unit_ready(sc_link,
+ (void) scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT,
scsi_autoconf | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);
#ifdef SCSI_2_DEF
@@ -932,7 +932,7 @@ scsi_probedev(scsi, target, lun)
* any messages generated by config_attach() do not have
* negotiation messages inserted into their midst.
*/
- (void) scsi_test_unit_ready(sc_link,
+ (void) scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT,
scsi_autoconf | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);
config_attach((struct device *)scsi, cf, &sa, scsibusprint);
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 85be0891e7b..b317359fde2 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.35 2002/08/03 08:55:35 pvalchev Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.36 2002/12/30 21:50:28 grange Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -309,6 +309,12 @@ struct scsi_xfer {
#define XS_SHORTSENSE 6 /* Check the ATAPI sense for the error */
#define XS_RESET 8 /* bus was reset; possible retry command */
+/*
+ * Possible retries numbers for scsi_test_unit_ready()
+ */
+#define TEST_READY_RETRIES_DEFAULT 5
+#define TEST_READY_RETRIES_CD 10
+
caddr_t scsi_inqmatch(struct scsi_inquiry_data *, caddr_t, int,
int, int *);
@@ -318,7 +324,7 @@ struct scsi_xfer *
void scsi_free_xs(struct scsi_xfer *, int);
int scsi_execute_xs(struct scsi_xfer *);
u_long scsi_size(struct scsi_link *, int);
-int scsi_test_unit_ready(struct scsi_link *, int);
+int scsi_test_unit_ready(struct scsi_link *, int, int);
int scsi_change_def(struct scsi_link *, int);
int scsi_inquire(struct scsi_link *, struct scsi_inquiry_data *, int);
int scsi_prevent(struct scsi_link *, int, int);
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 1c30de210f1..bfbb1e7dec8 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.55 2002/09/04 23:07:28 tdeval Exp $ */
+/* $OpenBSD: sd.c,v 1.56 2002/12/30 21:50:29 grange Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -390,6 +390,7 @@ sdopen(dev, flag, fmt, p)
} else {
/* Check that it is still responding and ok. */
error = scsi_test_unit_ready(sc_link,
+ TEST_READY_RETRIES_DEFAULT,
SCSI_IGNORE_ILLEGAL_REQUEST |
SCSI_IGNORE_MEDIA_CHANGE |
SCSI_IGNORE_NOT_READY);
diff --git a/sys/scsi/ss.c b/sys/scsi/ss.c
index fb100c70916..0b5e6cb4188 100644
--- a/sys/scsi/ss.c
+++ b/sys/scsi/ss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss.c,v 1.46 2002/06/09 00:05:57 art Exp $ */
+/* $OpenBSD: ss.c,v 1.47 2002/12/30 21:50:29 grange Exp $ */
/* $NetBSD: ss.c,v 1.10 1996/05/05 19:52:55 christos Exp $ */
/*
@@ -436,7 +436,7 @@ ssopen(dev, flag, mode, p)
* consider paper to be a changeable media
*
*/
- error = scsi_test_unit_ready(sc_link,
+ error = scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT,
SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_ILLEGAL_REQUEST |
(ssmode == MODE_CONTROL ? SCSI_IGNORE_NOT_READY : 0));
if (error)
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index bb7ce7a81fb..13e84f50947 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.32 2002/06/09 00:05:57 art Exp $ */
+/* $OpenBSD: st.c,v 1.33 2002/12/30 21:50:29 grange Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -401,7 +401,7 @@ stattach(parent, self, aux)
*/
printf("\n");
printf("%s: %s", st->sc_dev.dv_xname, st->quirkdata ? "rogue, " : "");
- if (scsi_test_unit_ready(sc_link,
+ if (scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT,
scsi_autoconf | SCSI_SILENT | SCSI_IGNORE_MEDIA_CHANGE) ||
st_mode_sense(st,
scsi_autoconf | SCSI_SILENT | SCSI_IGNORE_MEDIA_CHANGE))
@@ -530,7 +530,8 @@ stopen(dev, flags, mode, p)
/*
* Catch any unit attention errors.
*/
- error = scsi_test_unit_ready(sc_link, SCSI_IGNORE_MEDIA_CHANGE |
+ error = scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT,
+ SCSI_IGNORE_MEDIA_CHANGE |
(stmode == CTLMODE ? SCSI_IGNORE_NOT_READY : 0));
if (error)
goto bad;
@@ -656,7 +657,8 @@ st_mount_tape(dev, flags)
* these after doing a Load instruction.
* (noteably some DAT drives)
*/
- scsi_test_unit_ready(sc_link, SCSI_SILENT); /* XXX */
+ /* XXX */
+ scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT, SCSI_SILENT);
/*
* Some devices can't tell you much until they have been