summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-08-28 15:18:15 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-08-28 15:18:15 +0000
commit63332380ad76c1a3962d9533d28f8ff3c19842b8 (patch)
treeccb563084e0a77b2a83352e27e3cdcb070a39588
parent76096eea8b49e1fe478932e7e49312a362eb56db (diff)
Nuke CDF_ANCIENT, SDF_ANCIENT SDEV_ONLYBIG and bogus check of SID_RelAdr in
favour of simply using the device's claimed SCSI level of support. Except of course for ATAPI/USB devices which often don't claim anything. Keep assuming they are at least SCSI-2. Use consistant tests in sdminphys/cdminphys/sdstart/cdstart.
-rw-r--r--sys/scsi/cd.c14
-rw-r--r--sys/scsi/scsi_base.c4
-rw-r--r--sys/scsi/scsiconf.h3
-rw-r--r--sys/scsi/sd.c17
-rw-r--r--sys/scsi/sdvar.h3
5 files changed, 12 insertions, 29 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index eb38b71e56a..fad40c4dda7 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.253 2020/08/26 13:57:20 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.254 2020/08/28 15:18:14 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -99,7 +99,6 @@ struct cd_softc {
struct disk sc_dk;
int sc_flags;
-#define CDF_ANCIENT 0x10 /* disk is ancient; for cdminphys */
#define CDF_DYING 0x40 /* dying, when deactivated */
struct scsi_link *sc_link; /* contains targ, lun, etc. */
struct cd_parms {
@@ -213,13 +212,6 @@ cdattach(struct device *parent, struct device *self, void *aux)
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
bufq_init(&sc->sc_bufq, BUFQ_DEFAULT);
- /*
- * Note if this device is ancient. This is used in cdminphys().
- */
- if (!ISSET(link->flags, SDEV_ATAPI) &&
- SID_ANSII_REV(&link->inqdata) == SCSI_REV_0)
- SET(sc->sc_flags, CDF_ANCIENT);
-
printf("\n");
scsi_xsh_set(&sc->sc_xsh, link, cdstart);
@@ -556,6 +548,7 @@ cdstart(struct scsi_xfer *xs)
read = (bp->b_flags & B_READ);
if (!ISSET(link->flags, SDEV_ATAPI | SDEV_UMASS) &&
+ (SID_ANSII_REV(&link->inqdata) < SCSI_REV_2) &&
((secno & 0x1fffff) == secno) &&
((nsecs & 0xff) == nsecs)) {
/*
@@ -678,7 +671,8 @@ cdminphys(struct buf *bp)
* ancient device gets confused by length == 0. A length of 0
* in a 10-byte read/write actually means 0 blocks.
*/
- if (ISSET(sc->sc_flags, CDF_ANCIENT)) {
+ if (!ISSET(link->flags, SDEV_ATAPI | SDEV_UMASS) &&
+ SID_ANSII_REV(&link->inqdata) < SCSI_REV_2) {
max = sc->sc_dk.dk_label->d_secsize * 0xff;
if (bp->b_bcount > max)
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 54484cf9b63..a1111132a87 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.270 2020/08/19 22:46:19 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.271 2020/08/28 15:18:14 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -2677,7 +2677,7 @@ const char *quirknames[] = {
"NOCAPACITY",
"",
"NODOORLOCK",
- "ONLYBIG",
+ "",
NULL
};
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 9839c40432b..887f308d920 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.196 2020/08/26 13:57:20 krw Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.197 2020/08/28 15:18:14 krw Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -309,7 +309,6 @@ struct scsi_link {
#define ADEV_LITTLETOC 0x0400 /* little-endian TOC - ATAPI */
#define ADEV_NOCAPACITY 0x0800 /* no READ CD CAPACITY */
#define ADEV_NODOORLOCK 0x2000 /* can't lock door */
-#define SDEV_ONLYBIG 0x4000 /* avoid 6 byte READ/WRITE on sd(4) */
int (*interpret_sense)(struct scsi_xfer *);
void *device_softc; /* needed for call to foo_start */
struct scsibus_softc *bus; /* link to the scsibus we're on */
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 7f0a47ca49b..7f5c5b64cdd 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.319 2020/08/26 13:57:20 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.320 2020/08/28 15:18:14 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -180,16 +180,6 @@ sdattach(struct device *parent, struct device *self, void *aux)
SDEV_REMOVABLE))
SET(link->quirks, SDEV_NOSYNCCACHE);
- if (!ISSET(link->inqdata.flags, SID_RelAdr))
- SET(link->quirks, SDEV_ONLYBIG);
-
- /*
- * Note if this device is ancient. This is used in sdminphys().
- */
- if (!ISSET(link->flags, SDEV_ATAPI) &&
- SID_ANSII_REV(&link->inqdata) == SCSI_REV_0)
- SET(sc->flags, SDF_ANCIENT);
-
/*
* Use the subdriver to request information regarding the drive. We
* cannot use interrupts yet, so the request must specify this.
@@ -690,7 +680,7 @@ sdstart(struct scsi_xfer *xs)
read = bp->b_flags & B_READ;
if (!ISSET(link->flags, SDEV_ATAPI | SDEV_UMASS) &&
- !ISSET(link->quirks, SDEV_ONLYBIG) &&
+ (SID_ANSII_REV(&link->inqdata) < SCSI_REV_2) &&
((secno & 0x1fffff) == secno) &&
((nsecs & 0xff) == nsecs))
sd_cmd_rw6(xs, read, secno, nsecs);
@@ -816,7 +806,8 @@ sdminphys(struct buf *bp)
* ancient device gets confused by length == 0. A length of 0
* in a 10-byte read/write actually means 0 blocks.
*/
- if (ISSET(sc->flags, SDF_ANCIENT)) {
+ if (!ISSET(link->flags, SDEV_ATAPI | SDEV_UMASS) &&
+ SID_ANSII_REV(&link->inqdata) < SCSI_REV_2) {
max = sc->sc_dk.dk_label->d_secsize * 0xff;
if (bp->b_bcount > max)
diff --git a/sys/scsi/sdvar.h b/sys/scsi/sdvar.h
index 0ceaf2a6692..8439f54f3f4 100644
--- a/sys/scsi/sdvar.h
+++ b/sys/scsi/sdvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdvar.h,v 1.50 2020/08/22 15:07:11 krw Exp $ */
+/* $OpenBSD: sdvar.h,v 1.51 2020/08/28 15:18:14 krw Exp $ */
/* $NetBSD: sdvar.h,v 1.7 1998/08/17 00:49:03 mycroft Exp $ */
/*-
@@ -57,7 +57,6 @@ struct sd_softc {
struct bufq sc_bufq;
int flags;
-#define SDF_ANCIENT 0x10 /* disk is ancient; for sdminphys */
#define SDF_DIRTY 0x20 /* disk is dirty; needs cache flush */
#define SDF_DYING 0x40 /* dying, when deactivated */
#define SDF_THIN 0x01 /* disk is thin provisioned */