summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-11-13 16:10:06 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-11-13 16:10:06 +0000
commit94b07f62b8ab98845695c80a6e0b1e4bfb80244a (patch)
tree2f8f3c7a82e5f2cef4f03ae0d3276f048ae633ad
parenta3d09f4be1f39030a97c87adb833b3ee213874a5 (diff)
Allow removable disks to be spun up if they ask for initialization
after being opened. Use SC_DEBUG() to suppress some verbiage during spin up. Return actual errors encountered during attempt to spin up, rather than always returning EIO. ok dlg@
-rw-r--r--sys/scsi/sd.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 4238caa2f34..f6ba3f2f365 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.97 2005/11/13 02:39:45 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.98 2005/11/13 16:10:05 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1108,25 +1108,18 @@ sd_interpret_sense(xs)
SC_DEBUG(sc_link, SDEV_DB1, ("becoming ready.\n"));
retval = scsi_delay(xs, 5);
break;
+
case 0x02: /* Initialization command required. */
- if (sd->sc_link->flags & SDEV_REMOVABLE) {
- printf("%s: removable disk stopped - not restarting\n",
- sd->sc_dev.dv_xname);
- retval = EIO;
- } else {
- printf("%s: respinning up disk\n", sd->sc_dev.dv_xname);
- retval = scsi_start(sd->sc_link, SSS_START,
- SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_URGENT |
- SCSI_NOSLEEP);
- if (retval != 0) {
- printf("%s: respin of disk failed - %d\n",
- sd->sc_dev.dv_xname, retval);
- retval = EIO;
- } else {
- retval = ERESTART;
- }
- }
+ SC_DEBUG(sc_link, SDEV_DB1, ("spinning up\n"));
+ retval = scsi_start(sd->sc_link, SSS_START,
+ SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_URGENT | SCSI_NOSLEEP);
+ if (retval == 0)
+ retval = ERESTART;
+ else
+ SC_DEBUG(sc_link, SDEV_DB1, ("spin up failed (%#x)\n",
+ retval));
break;
+
default:
retval = EJUSTRETURN;
break;