From acf3f6c34674e4d5895a65c2500aa558ceeac52a Mon Sep 17 00:00:00 2001 From: jraynard Date: Sun, 14 Dec 1997 00:32:33 +0000 Subject: Allow slow SCSI CDROMs more time to start up. PR: 5181 Submitted by: Wilko Bulte --- sys/scsi/cd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sys/scsi') diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index ac7bfb1..c3808c5 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.86 1997/09/21 22:02:59 gibbs Exp $ + * $Id: cd.c,v 1.87 1997/12/02 21:06:58 phk Exp $ */ #include "opt_bounce.h" @@ -242,6 +242,7 @@ cd_open(dev_t dev, int flags, int fmt, struct proc *p, errval errcode = 0; u_int32_t unit, part; struct scsi_data *cd; + int n; unit = CDUNIT(dev); part = PARTITION(dev); @@ -285,6 +286,17 @@ cd_open(dev_t dev, int flags, int fmt, struct proc *p, SC_DEBUG(sc_link, SDEV_DB3, ("'start' attempted ")); } sc_link->flags |= SDEV_OPEN; /* unit attn errors are now errors */ + + /* + * Some drives take a long time to become ready after a disk swap + * and report 'Not Ready' rather than 'Unit in the Process of Getting + * Ready' while doing so; attempts to mount during this period will + * return ENXIO. Give them some time to come up. + */ + for (n = 0; scsi_test_unit_ready(sc_link, SCSI_SILENT) && n != 12; n++) + tsleep(cd, PRIBIO | PCATCH, "cdrdy", hz); + + /* If still not ready, give up */ if (scsi_test_unit_ready(sc_link, SCSI_SILENT) != 0) { SC_DEBUG(sc_link, SDEV_DB3, ("not ready\n")); errcode = ENXIO; -- cgit v1.1