diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/cd.c | 4 | ||||
-rw-r--r-- | sys/scsi/safte.c | 8 | ||||
-rw-r--r-- | sys/scsi/scsi_base.c | 4 | ||||
-rw-r--r-- | sys/scsi/scsiconf.c | 19 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 5 | ||||
-rw-r--r-- | sys/scsi/sd.c | 6 | ||||
-rw-r--r-- | sys/scsi/ses.c | 6 |
7 files changed, 33 insertions, 19 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 7c6703b91c4..5cee420fd60 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.109 2006/07/23 02:50:20 dlg Exp $ */ +/* $OpenBSD: cd.c,v 1.110 2006/07/29 02:40:45 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -219,7 +219,7 @@ cdattach(parent, self, aux) * Note if this device is ancient. This is used in cdminphys(). */ if (!(sc_link->flags & SDEV_ATAPI) && - (sa->sa_inqbuf->version & SID_ANSII) == 0) + SCSISPC(sa->sa_inqbuf->version) == 0) cd->flags |= CDF_ANCIENT; printf("\n"); diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c index 942767a6b79..af60ab70ddd 100644 --- a/sys/scsi/safte.c +++ b/sys/scsi/safte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safte.c,v 1.28 2006/05/21 03:10:49 dlg Exp $ */ +/* $OpenBSD: safte.c,v 1.29 2006/07/29 02:40:45 krw Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -118,12 +118,12 @@ safte_match(struct device *parent, void *match, void *aux) /* match on dell enclosures */ if ((inq->device & SID_TYPE) == T_PROCESSOR && - (inq->version & SID_ANSII) == SID_ANSII_SCSI3) + SCSISPC(inq->version) == 3) return (2); if ((inq->device & SID_TYPE) != T_PROCESSOR || - (inq->version & SID_ANSII) != SID_ANSII_SCSI2 || - (inq->response_format & SID_ANSII) != SID_ANSII_SCSI2) + SCSISPC(inq->version) != 2 || + (inq->response_format & SID_ANSII) != 2) return (0); memset(&cmd, 0, sizeof(cmd)); diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 677af8c7aa9..aa5a360926c 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.110 2006/07/23 14:34:55 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.111 2006/07/29 02:40:45 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -205,7 +205,7 @@ scsi_make_xs(struct scsi_link *sc_link, struct scsi_generic *scsi_cmd, * assumed everything newer than SCSI-2 would not need it, but why risk * it? This was the old conditional: * - * if ((sc_link->inqdata.version & SID_ANSII) <= 2) + * if ((SCSISPC(sc_link->inqdata.version) <= 2)) */ xs->cmd->bytes[0] &= ~SCSI_CMD_LUN_MASK; if (sc_link->lun < 8) diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 3f55b00f4c7..5f314ef65c4 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.110 2006/07/23 14:34:55 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.111 2006/07/29 02:40:45 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -94,6 +94,17 @@ int scsi_autoconf = SCSI_AUTOCONF; int scsibusprint(void *, const char *); +const u_int8_t version_to_spc [] = { + 0, /* 0x00: The device does not claim conformance to any standard. */ + 1, /* 0x01: (Obsolete) SCSI-1 in olden times. */ + 2, /* 0x02: (Obsolete) SCSI-2 in olden times. */ + 3, /* 0x03: The device complies to ANSI INCITS 301-1997 (SPC-3). */ + 2, /* 0x04: The device complies to ANSI INCITS 351-2001 (SPC-2). */ + 3, /* 0x05: The device complies to ANSI INCITS 408-2005 (SPC-3). */ + 4, /* 0x06: The device complies to SPC-4. */ + 0, /* 0x07: RESERVED. */ +}; + int scsiprint(void *aux, const char *pnp) { @@ -266,7 +277,7 @@ scsi_probe_bus(int bus, int target, int lun) sc_link = scsi->sc_link[target][0]; if (sc_link != NULL && data != NULL && (sc_link->flags & (SDEV_UMASS | SDEV_ATAPI)) == 0 && - (sc_link->inqdata.version & SID_ANSII) > 2) { + SCSISPC(sc_link->inqdata.version) > 2) { scsi_report_luns(sc_link, REPORT_NORMAL, data, sizeof *data, scsi_autoconf | SCSI_SILENT | SCSI_IGNORE_ILLEGAL_REQUEST | @@ -550,7 +561,7 @@ scsibusprint(void *aux, const char *pnp) printf(" targ %d lun %d: <%s, %s, %s> SCSI%d %d/%s %s%s", target, lun, vendor, product, revision, - inqbuf->version & SID_ANSII, type, dtype, + SCSISPC(inqbuf->version), type, dtype, removable ? "removable" : "fixed", qtype); return (UNCONF); @@ -664,7 +675,7 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun) * Based upon the inquiry flags we got back, and if we're * at SCSI-2 or better, remove some limiting quirks. */ - if ((inqbuf.version & SID_ANSII) >= 2) { + if (SCSISPC(inqbuf.version) >= 2) { if ((inqbuf.flags & SID_CmdQue) != 0) sc_link->quirks &= ~SDEV_NOTAGS; if ((inqbuf.flags & SID_Sync) != 0) diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 4d2ef28954c..823eb9fda25 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.71 2006/07/23 14:34:55 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.72 2006/07/29 02:40:45 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -541,4 +541,7 @@ _4ltol(bytes) return (rv); } +extern const u_int8_t version_to_spc []; +#define SCSISPC(x)(version_to_spc[(x) & SID_ANSII]) + #endif /* SCSI_SCSICONF_H */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 5c4cb6e789d..b8839fc426a 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.109 2006/07/23 02:50:20 dlg Exp $ */ +/* $OpenBSD: sd.c,v 1.110 2006/07/29 02:40:46 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -199,7 +199,7 @@ sdattach(parent, self, aux) * Note if this device is ancient. This is used in sdminphys(). */ if (!(sc_link->flags & SDEV_ATAPI) && - (sa->sa_inqbuf->version & SID_ANSII) == 0) + SCSISPC(sa->sa_inqbuf->version) == 0) sd->flags |= SDF_ANCIENT; /* @@ -1451,7 +1451,7 @@ sd_flush(sd, flags) * * XXX What about older devices? */ - if ((sc_link->inqdata.version & SID_ANSII) >= 2 && + if (SCSISPC(sc_link->inqdata.version) >= 2 && (sc_link->quirks & SDEV_NOSYNCCACHE) == 0) { bzero(&sync_cmd, sizeof(sync_cmd)); sync_cmd.opcode = SYNCHRONIZE_CACHE; diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c index e99a02fb1bb..957ecff4c1d 100644 --- a/sys/scsi/ses.c +++ b/sys/scsi/ses.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ses.c,v 1.38 2006/07/16 22:08:59 dlg Exp $ */ +/* $OpenBSD: ses.c,v 1.39 2006/07/29 02:40:46 krw Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -127,12 +127,12 @@ ses_match(struct device *parent, void *match, void *aux) return (0); if ((inq->device & SID_TYPE) == T_ENCLOSURE && - (inq->version & SID_ANSII) >= SID_ANSII_SCSI2) + SCSISPC(inq->version) >= 2) return (2); /* match on dell enclosures */ if ((inq->device & SID_TYPE) == T_PROCESSOR && - (inq->version & SID_ANSII) == SID_ANSII_SCSI3) + SCSISPC(inq->version) == 3) return (3); return (0); |