summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2005-08-23 23:31:04 +0000
committerkrw <krw@openbsd.org>2005-08-23 23:31:04 +0000
commit37d2179ae7d71b1468d011bb4e40d8869f003793 (patch)
tree24ac74a096d841a2dbbcad507abeae9337d75408
parentdisable -B support for now; ok dlg (diff)
downloadwireguard-openbsd-37d2179ae7d71b1468d011bb4e40d8869f003793.tar.xz
wireguard-openbsd-37d2179ae7d71b1468d011bb4e40d8869f003793.zip
Spin up sd units even if TEST_UNIT_READY says they're ready.
Use consistant scsi_autoconf and SCSI_SILENT flags in scsi_test_unit()/scsi_start() pairs. Fixes some hppa, vax, sparc systems that do not spin up disks automatically. Keeps USB card readers and such reasonably quiet. Noted by millert@ (hppa), henning@ (sparc) and hshoexer@ (vax). ok deraadt@
-rw-r--r--sys/scsi/sd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index a282413629e..07577206cea 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.86 2005/08/21 16:25:52 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.87 2005/08/23 23:31:04 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -216,10 +216,9 @@ sdattach(parent, self, aux)
scsi_autoconf | SCSI_IGNORE_ILLEGAL_REQUEST |
SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT);
- /* Try to start the unit if it wasn't ready. */
- if (error == EIO)
- error = scsi_start(sc_link, SSS_START,
- SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
+ /* Spin up the unit ready or not. */
+ error = scsi_start(sc_link, SSS_START, scsi_autoconf | SCSI_SILENT |
+ SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
if (error)
result = SDGP_RESULT_OFFLINE;
@@ -386,11 +385,10 @@ sdopen(dev, flag, fmt, p)
(part == RAW_PART && fmt == S_IFCHR) ? SCSI_SILENT : 0 |
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
- /* Try to start the unit if it wasn't ready. */
- if (error == EIO)
- error = scsi_start(sc_link, SSS_START,
- SCSI_IGNORE_ILLEGAL_REQUEST |
- SCSI_IGNORE_MEDIA_CHANGE);
+ /* Spin up the unit, ready or not. */
+ error = scsi_start(sc_link, SSS_START,
+ (part == RAW_PART && fmt == S_IFCHR) ? SCSI_SILENT : 0 |
+ SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
if (error) {
if (part == RAW_PART && fmt == S_IFCHR) {