aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2014-10-31 11:46:48 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2014-10-31 11:46:48 +0000
commiteaf4f3bb70012ded7e0c2a2ccb053531ea80d4d0 (patch)
tree9868136c62e13b5c6f4f830077b0d5fb2c2bb0ff
parent52f1deb80e4e6c14c8e75703695c32fc98590189 (diff)
downloadsg3_utils-eaf4f3bb70012ded7e0c2a2ccb053531ea80d4d0.tar.gz
sg_vpd: add zoned block device characteristics page; sg_ses: sync with ses3r07
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@619 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog4
-rw-r--r--doc/sg_ses.82
-rw-r--r--doc/sg_ses_microcode.84
-rw-r--r--examples/sg_tst_async.cpp4
-rw-r--r--src/sg_sat_identify.c6
-rw-r--r--src/sg_sat_phy_event.c6
-rw-r--r--src/sg_sat_set_features.c6
-rw-r--r--src/sg_ses.c7
-rw-r--r--src/sg_ses_microcode.c2
-rw-r--r--src/sg_vpd.c70
10 files changed, 91 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e59fd98c..8b13e7dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for sg3_utils-1.40 [20141028] [svn: r618]
+Changelog for sg3_utils-1.40 [20141029] [svn: r619]
- sg_write_verify: new utility for WRITE AND VERIFY
- sg_ses_microcode: new utility
- sg_senddiag: add --maxlen= option
@@ -15,6 +15,7 @@ Changelog for sg3_utils-1.40 [20141028] [svn: r618]
- fix --cmddt output if not supported by device
- sg_vpd: add --all option
- more TPC VPD page decoding
+ - add zoned block device characteristics page
- sg_ses: fix problem with --index=sse (and ssc)
- mask status element before using as control
- defeat previous item with --mask (ignore) option
@@ -23,6 +24,7 @@ Changelog for sg3_utils-1.40 [20141028] [svn: r618]
trailing NULL
- add --warn option mainly for broken joins
- add optional descriptions to -ee output
+ - sync with ses3r07: add OC on SAS connector
- sg_sanitize: add --desc and --zero options
- output unit serial number and LU name prior to
- sg_rep_zones: corrections, sync with zbc-r01c
diff --git a/doc/sg_ses.8 b/doc/sg_ses.8
index 1ba9c529..9d969bbd 100644
--- a/doc/sg_ses.8
+++ b/doc/sg_ses.8
@@ -28,7 +28,7 @@ If no options are given (i.e. only the \fIDEVICE\fR argument is given) then
the names of all diagnostic pages supported are listed. Most, but not
necessarily all, of the named diagnostic pages are defined in the SES
standards and drafts. The most recent reference for this utility is the
-draft SCSI Enclosure Services 3 document T10/2149\-D Revision 6 at
+draft SCSI Enclosure Services 3 document T10/2149\-D Revision 7 at
http://www.t10.org . Existing standards for SES and SES\-2 are ANSI INCITS
305\-1998 and ANSI INCITS 448\-2008 respectively.
.PP
diff --git a/doc/sg_ses_microcode.8 b/doc/sg_ses_microcode.8
index 303d6f41..3e4a9d27 100644
--- a/doc/sg_ses_microcode.8
+++ b/doc/sg_ses_microcode.8
@@ -1,4 +1,4 @@
-.TH SG_SES_MICROCODE "8" "October 2014" "sg3_utils\-1.39" SG3_UTILS
+.TH SG_SES_MICROCODE "8" "October 2014" "sg3_utils\-1.40" SG3_UTILS
.SH NAME
sg_ses_microcode \- send microcode to a SCSI enclosure
.SH SYNOPSIS
@@ -27,7 +27,7 @@ not require the microcode (firmware) itself so the \fI\-\-in=FILE\fR option
is not required.
.PP
The most recent reference for this utility is the draft SCSI Enclosure
-Services 3 (SES\-3) document T10/2149\-D Revision 6 at http://www.t10.org .
+Services 3 (SES\-3) document T10/2149\-D Revision 7 at http://www.t10.org .
Existing standards for SES and SES\-2 are ANSI INCITS 305\-1998 and ANSI
INCITS 448\-2008 respectively.
.PP
diff --git a/examples/sg_tst_async.cpp b/examples/sg_tst_async.cpp
index fa3c3769..a070a819 100644
--- a/examples/sg_tst_async.cpp
+++ b/examples/sg_tst_async.cpp
@@ -57,7 +57,7 @@
#include "sg_io_linux.h"
#include "sg_unaligned.h"
-static const char * version_str = "1.07 20140827";
+static const char * version_str = "1.08 20141028";
static const char * util_name = "sg_tst_async";
/* This is a test program for checking the async usage of the Linux sg
@@ -932,7 +932,7 @@ main(int argc, char * argv[])
} else if (0 == memcmp("-n", argv[k], 2)) {
++k;
if ((k < argc) && isdigit(*argv[k]))
- op->num_per_thread = atoi(argv[k]);
+ op->num_per_thread = sg_get_num(argv[k]);
else
break;
} else if (0 == memcmp("-N", argv[k], 2))
diff --git a/src/sg_sat_identify.c b/src/sg_sat_identify.c
index 885a382d..bedd5359 100644
--- a/src/sg_sat_identify.c
+++ b/src/sg_sat_identify.c
@@ -45,7 +45,7 @@
#define EBUFF_SZ 256
-static const char * version_str = "1.11 20140816";
+static const char * version_str = "1.11 20141030";
static struct option long_options[] = {
{"ck_cond", no_argument, 0, 'c'},
@@ -365,8 +365,8 @@ int main(int argc, char * argv[])
++do_indent;
break;
case 'l':
- cdb_len = sg_get_num(optarg);
- if (! ((cdb_len == 12) || (cdb_len == 16))) {
+ cdb_len = sg_get_num(optarg);
+ if (! ((cdb_len == 12) || (cdb_len == 16))) {
fprintf(stderr, "argument to '--len' should be 12 or 16\n");
return SG_LIB_SYNTAX_ERROR;
}
diff --git a/src/sg_sat_phy_event.c b/src/sg_sat_phy_event.c
index 92d97463..e465c96d 100644
--- a/src/sg_sat_phy_event.c
+++ b/src/sg_sat_phy_event.c
@@ -21,7 +21,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "1.05 20140816";
+static const char * version_str = "1.05 20141030";
/* This program uses a ATA PASS-THROUGH SCSI command. This usage is
* defined in the SCSI to ATA Translation (SAT) drafts and standards.
@@ -381,8 +381,8 @@ int main(int argc, char * argv[])
++ignore;
break;
case 'l':
- cdb_len = sg_get_num(optarg);
- if (! ((cdb_len == 12) || (cdb_len == 16))) {
+ cdb_len = sg_get_num(optarg);
+ if (! ((cdb_len == 12) || (cdb_len == 16))) {
fprintf(stderr, "argument to '--len' should be 12 or 16\n");
return SG_LIB_SYNTAX_ERROR;
}
diff --git a/src/sg_sat_set_features.c b/src/sg_sat_set_features.c
index a6e946ad..974970c0 100644
--- a/src/sg_sat_set_features.c
+++ b/src/sg_sat_set_features.c
@@ -46,7 +46,7 @@
#define DEF_TIMEOUT 20
-static const char * version_str = "1.09 20140816";
+static const char * version_str = "1.09 20141030";
static struct option long_options[] = {
{"count", required_argument, 0, 'c'},
@@ -318,8 +318,8 @@ main(int argc, char * argv[])
usage();
return 0;
case 'l':
- cdb_len = sg_get_num(optarg);
- if (! ((cdb_len == 12) || (cdb_len == 16))) {
+ cdb_len = sg_get_num(optarg);
+ if (! ((cdb_len == 12) || (cdb_len == 16))) {
fprintf(stderr, "argument to '--len' should be 12 or 16\n");
return SG_LIB_SYNTAX_ERROR;
}
diff --git a/src/sg_ses.c b/src/sg_ses.c
index e79a8156..c911f4ca 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -29,7 +29,7 @@
* commands tailored for SES (enclosure) devices.
*/
-static const char * version_str = "1.98 20141027"; /* ses3r06 */
+static const char * version_str = "1.99 20141028"; /* ses3r07 */
#define MX_ALLOC_LEN ((64 * 1024) - 4) /* max allowable for big enclosures */
#define MX_ELEM_HDR 1024
@@ -427,7 +427,8 @@ static struct acronym2tuple ecs_a2t_arr[] = {
{"missing", ARRAY_DEV_ETC, 2, 4, 1, NULL},
{"ok", ARRAY_DEV_ETC, 1, 7, 1, NULL},
{"on", POWER_SUPPLY_ETC, 3, 5, 1, "0: turn (remain) off; 1: turn on"},
- {"overcurrent", SAS_CONNECTOR_ETC, 3, 5, 1, NULL},
+ {"overcurrent", POWER_SUPPLY_ETC, 2, 1, 1, "DC overcurrent"},
+ {"overcurrent", SAS_CONNECTOR_ETC, 3, 5, 1, NULL}, /* added ses3r07 */
{"locate", DEVICE_ETC, 2, 1, 1, NULL},
{"locate", ARRAY_DEV_ETC, 2, 1, 1, NULL},
{"pow_cycle", ENCLOSURE_ETC, 2, 7, 2,
@@ -2014,7 +2015,7 @@ enc_status_helper(const char * pad, const unsigned char * statp, int etype,
printf("%sIdent=%d, Fail=%d\n", pad, !!(statp[1] & 0x80),
!!(statp[1] & 0x40));
break;
- case SAS_CONNECTOR_ETC:
+ case SAS_CONNECTOR_ETC: /* OC (overcurrent) added in ses3r07 */
printf("%sIdent=%d, %s\n", pad, !!(statp[1] & 0x80),
find_sas_connector_type((statp[1] & 0x7f), bb, sizeof(bb)));
printf("%sConnector physical link=0x%x, Fail=%d, OC=%d\n", pad,
diff --git a/src/sg_ses_microcode.c b/src/sg_ses_microcode.c
index e6cabe4b..f49a346e 100644
--- a/src/sg_ses_microcode.c
+++ b/src/sg_ses_microcode.c
@@ -36,7 +36,7 @@
* RESULTS commands in order to send microcode to the given SES device.
*/
-static const char * version_str = "1.01 20141002"; /* ses3r06 */
+static const char * version_str = "1.02 20141029"; /* ses3r07 */
#define ME "sg_ses_microcode: "
#define MAX_XFER_LEN (128 * 1024 * 1024)
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 8ecb3a71..c6808409 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -36,7 +36,7 @@
*/
-static const char * version_str = "0.94 20141006"; /* spc4r37 + sbc4r02 */
+static const char * version_str = "0.95 20141029"; /* spc4r37 + sbc4r02 */
/* These structures are duplicates of those of the same name in
@@ -112,6 +112,7 @@ int vpd_fetch_page_from_dev(int sg_fd, unsigned char * rp, int page,
#define VPD_SUP_BLOCK_LENS 0xb4 /* SBC-4 */
#define VPD_DTDE_ADDRESS 0xb4 /* SSC-4 */
#define VPD_BLOCK_DEV_C_EXTENS 0xb5 /* SBC-4 */
+#define VPD_ZBC_DEV_CHARS 0xb6 /* ZBC */
#define VPD_NO_RATHER_STD_INQ -2 /* request for standard inquiry */
/* Device identification VPD page associations */
@@ -218,6 +219,8 @@ static struct svpd_values_name_t standard_vpd_pg[] = {
{VPD_SUPPORTED_VPDS, 0, -1, "sv", "Supported VPD pages"},
{VPD_TA_SUPPORTED, 0, 1, "tas", "TapeAlert supported flags (SSC)"},
{VPD_3PARTY_COPY, 0, -1, "tpc", "Third party copy"},
+ {VPD_ZBC_DEV_CHARS, 0, -1, "zbdc", "Zoned block device characteristics"},
+ /* Use pdt of -1 since this page both for pdt=0 and pdt=0x14 */
{0, 0, 0, NULL, NULL},
};
@@ -2758,6 +2761,43 @@ decode_b5_vpd(unsigned char * b, int len, int do_hex, int pdt)
}
}
+/* VPD_ZBC_DEV_CHARS sbc or zbc */
+static void
+decode_zbdc_vpd(unsigned char * b, int len, int do_hex)
+{
+ uint32_t u;
+
+ if (do_hex) {
+ dStrHex((const char *)b, len, (1 == do_hex) ? 0 : -1);
+ return;
+ }
+ if (len < 64) {
+ pr2serr("Zoned block device characteristics VPD page length too "
+ "short=%d\n", len);
+ return;
+ }
+ printf(" URSWRZ type: %d\n", !!(b[4] & 0x1));
+ u = sg_get_unaligned_be32(b + 8);
+ printf(" Optimal number of open sequential write preferred zones: ");
+ if (0xffffffff == u)
+ printf("0xffffffff\n");
+ else
+ printf("%" PRIu32 "\n", u);
+ u = sg_get_unaligned_be32(b + 12);
+ printf(" Optimal number of non-sequentially written sequential write "
+ "preferred zones: ");
+ if (0xffffffff == u)
+ printf("0xffffffff\n");
+ else
+ printf("%" PRIu32 "\n", u);
+ u = sg_get_unaligned_be32(b + 16);
+ printf(" Maximum number of open sequential write required: ");
+ if (0xffffffff == u)
+ printf("0xffffffff\n");
+ else
+ printf("%" PRIu32 "\n", u);
+}
+
/* Returns 0 if successful */
static int
svpd_unable_to_decode(int sg_fd, struct opts_t * op, int subvalue, int off)
@@ -3353,6 +3393,34 @@ svpd_decode_t10(int sg_fd, struct opts_t * op, int subvalue, int off)
} else if ((! op->do_raw) && (! op->do_quiet) && (op->do_hex < 3))
printf("VPD page=0xb5\n");
break;
+ case VPD_ZBC_DEV_CHARS: /* 0xb6 for both pdt=0 and pdt=0x14 */
+ res = vpd_fetch_page_from_dev(sg_fd, rp, pn, op->maxlen, vb, &len);
+ if (0 == res) {
+ pdt = rp[0] & 0x1f;
+ if (allow_name) {
+ switch (pdt) {
+ case PDT_DISK: case PDT_WO: case PDT_OPTICAL: case PDT_ZBC:
+ printf("Zoned block device characteristics VPD page "
+ "(SBC, ZBC):\n");
+ break;
+ default:
+ printf("VPD page=0x%x, pdt=0x%x:\n", pn, pdt);
+ break;
+ }
+ }
+ if (op->do_raw)
+ dStrRaw((const char *)rp, len);
+ else {
+ if (vb || long_notquiet)
+ printf(" [PQual=%d Peripheral device type: %s]\n",
+ (rp[0] & 0xe0) >> 5,
+ sg_get_pdt_str(pdt, sizeof(b), b));
+ decode_zbdc_vpd(rp, len, op->do_hex);
+ }
+ return 0;
+ } else if ((! op->do_raw) && (! op->do_quiet) && (op->do_hex < 3))
+ printf("VPD page=0xb5\n");
+ break;
default:
return SG_LIB_SYNTAX_ERROR;
}