summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2006-11-27 20:15:10 +0000
committerBob Beck <beck@cvs.openbsd.org>2006-11-27 20:15:10 +0000
commit28a3f24d7c8fcd82cc666e76680f97650632e619 (patch)
tree2804d56ca9b451defbd3239ac0f193189520b701 /sys
parentae8084266ef6e3547ec0e866f97699672b909dfd (diff)
get rid of the rest of the asc/ascq magic codes in scsi
ok marco@, deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/cd.c7
-rw-r--r--sys/scsi/scsi_all.h3
-rw-r--r--sys/scsi/sd.c11
3 files changed, 10 insertions, 11 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 37f081c12cb..3fe7ed99257 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.113 2006/10/08 02:29:24 beck Exp $ */
+/* $OpenBSD: cd.c,v 1.114 2006/11/27 20:15:09 beck Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -2052,9 +2052,8 @@ cd_interpret_sense(xs)
case SKEY_NOT_READY:
if ((xs->flags & SCSI_IGNORE_NOT_READY) != 0)
return (0);
- if (sense->add_sense_code == 0x04 && /* Not ready */
- sense->add_sense_code_qual == 0x01) { /* Becoming ready */
- SC_DEBUG(sc_link, SDEV_DB1, ("not ready: busy (%#x)\n",
+ if (ASC_ASCQ(sense) == SENSE_NOT_READY_BECOMING_READY) {
+ SC_DEBUG(sc_link, SDEV_DB1, ("not ready: busy (%#x)\n",
sense->add_sense_code_qual));
/* don't count this as a retry */
xs->retries++;
diff --git a/sys/scsi/scsi_all.h b/sys/scsi/scsi_all.h
index 8afc49003a7..cfa50e838b4 100644
--- a/sys/scsi/scsi_all.h
+++ b/sys/scsi/scsi_all.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_all.h,v 1.38 2006/11/27 18:24:43 beck Exp $ */
+/* $OpenBSD: scsi_all.h,v 1.39 2006/11/27 20:15:09 beck Exp $ */
/* $NetBSD: scsi_all.h,v 1.10 1996/09/12 01:57:17 thorpej Exp $ */
/*
@@ -318,6 +318,7 @@ struct scsi_sense_data {
#define ASC_ASCQ(ssd) ((ssd->add_sense_code << 8) | ssd->add_sense_code_qual)
#define SENSE_NOT_READY_BECOMING_READY 0x0401
+#define SENSE_NOT_READY_INIT_REQUIRED 0x0402
#define SENSE_NOT_READY_FORMAT 0x0404
#define SENSE_NOT_READY_REBUILD 0x0405
#define SENSE_NOT_READY_RECALC 0x0406
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 0e3bca0a547..affb97e41b1 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.111 2006/10/07 23:40:07 beck Exp $ */
+/* $OpenBSD: sd.c,v 1.112 2006/11/27 20:15:09 beck Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1081,17 +1081,16 @@ sd_interpret_sense(xs)
if (((sc_link->flags & SDEV_OPEN) == 0) ||
(serr != 0x70 && serr != 0x71) ||
((sense->flags & SSD_KEY) != SKEY_NOT_READY) ||
- (sense->extra_len < 6) ||
- (sense->add_sense_code != 0x04))
+ (sense->extra_len < 6))
return (EJUSTRETURN);
- switch (sense->add_sense_code_qual) {
- case 0x01: /* In process of becoming ready. */
+ switch (ASC_ASCQ(sense)) {
+ case SENSE_NOT_READY_BECOMING_READY:
SC_DEBUG(sc_link, SDEV_DB1, ("becoming ready.\n"));
retval = scsi_delay(xs, 5);
break;
- case 0x02: /* Initialization command required. */
+ case SENSE_NOT_READY_INIT_REQUIRED:
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);