aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2012-02-24 19:00:45 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2012-02-24 19:00:45 +0000
commitdfcdb2bc3c00d328233373dfcfa3803ca0726716 (patch)
tree703875b95af995e5b9bda36b6f0354f4fff9e8bc
parentc410806c13d2baab90641ef6816866cd6e6bfeff (diff)
downloadsg3_utils-dfcdb2bc3c00d328233373dfcfa3803ca0726716.tar.gz
more sync with spc4r34 and sbc3r30
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@442 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--COVERAGE6
-rw-r--r--ChangeLog2
-rw-r--r--doc/sg3_utils.84
-rw-r--r--doc/sg_inq.83
-rw-r--r--doc/sginfo.812
-rw-r--r--lib/sg_lib.c2
-rw-r--r--lib/sg_lib_data.c3
-rw-r--r--src/sg_inq.c120
-rw-r--r--src/sg_inq_data.c16
-rw-r--r--src/sg_logs.c24
-rw-r--r--src/sg_modes.c29
-rw-r--r--src/sg_persist.c30
-rw-r--r--src/sg_read_buffer.c6
-rw-r--r--src/sg_vpd.c65
-rw-r--r--utils/Makefile4
-rw-r--r--utils/sg_lib.h1
16 files changed, 231 insertions, 96 deletions
diff --git a/COVERAGE b/COVERAGE
index d7291284..88a87351 100644
--- a/COVERAGE
+++ b/COVERAGE
@@ -39,8 +39,8 @@ READ BLOCK LIMITS sg_read_block_limits, ++
READ BUFFER sg_rbuf, sg_test_rwbuf, sg_read_buffer, sg_safte, ++
READ CAPACITY(10) sg_readcap, sg_dd, sgm_dd, sgp_dd, sg_format, ++
READ CAPACITY(16) sg_readcap, sg_dd, sgm_dd, sgp_dd, sg_format, ++
-READ DEFECT(10) sginfo, sg_reassign('-g'), ++
-READ DEFECT(12) sginfo
+READ DEFECT(10) sginfo('-d' or '-G'), sg_reassign('-g'), ++
+READ DEFECT(12) sginfo('-d' or '-G')
READ LONG (10) sg_read_long, sg_dd, ++
READ LONG (16) sg_read_long, ++
READ MEDIA SERIAL NUMBER sg_rmsn, ++
@@ -97,4 +97,4 @@ SMART READ DATA examples/sg_sat_smart_rd_data
Douglas Gilbert
-17th February 2012
+24th February 2012
diff --git a/ChangeLog b/ChangeLog
index c632954a..8b174310 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.34 [20120222] [svn: r441]
+Changelog for sg3_utils-1.34 [20120224] [svn: r442]
- sg_verify: add 16 byte cdb, bytchk (data-out buffer)
and group number support
- sync to spc4r34 and sbc3r30
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index deb9a0fb..814e6632 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "January 2012" "sg3_utils\-1.34" SG3_UTILS
+.TH SG3_UTILS "8" "February 2012" "sg3_utils\-1.34" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
@@ -248,7 +248,7 @@ status of 0 .
the command sent to \fIDEVICE\fR has timed out.
.TP
.B 97
-the response to a SCSI command failed sanity checks.
+a SCSI command response failed sanity checks.
.TP
.B 98
the \fIDEVICE\fR reports it has a check condition but the error
diff --git a/doc/sg_inq.8 b/doc/sg_inq.8
index bfde5e3d..b378f75c 100644
--- a/doc/sg_inq.8
+++ b/doc/sg_inq.8
@@ -85,7 +85,8 @@ print out information obtained from the device identification VPD page in
the form: "SCSI_IDENT_<assoc>_<type>=<ident>" to stdout. This may be useful
to tools like udev in Linux. If \fIPG\fR (from \fI\-\-page=PG\fR) is given
then then it overrides the default choice of the device identification VPD
-page.
+page. Only other value of \fIPG\fR supported is 0x80 which is the unit
+serial number VPD page (used by older disks).
.TP
\fB\-E\fR, \fB\-x\fR, \fB\-\-extended\fR
prints the extended INQUIRY VPD page [0x86].
diff --git a/doc/sginfo.8 b/doc/sginfo.8
index 70ae824e..5f4e8000 100644
--- a/doc/sginfo.8
+++ b/doc/sginfo.8
@@ -1,4 +1,4 @@
-.TH SGINFO "8" "March 2008" "sg3_utils\-1.26" SG3_UTILS
+.TH SGINFO "8" "February 2012" "sg3_utils\-1.34" SG3_UTILS
.SH NAME
sginfo \- access mode page information for a SCSI (or ATAPI) device
.SH SYNOPSIS
@@ -147,11 +147,11 @@ page 0 which, if present, is last. Page 0 is vendor specific and not
necessarily in mode page format. Alternatively hex values can be given for
both \fIPN\fR and \fISPN\fR (both prefixed by '0x').
.TP
-\fB\-t\fR
-Trace commands (for debugging). When used once SCSI commands are shown
-(in hex) and any errors from these SCSI commands are spelt out (i.e.
-with a decoded and raw sense buffer). When used twice, the additional
-data sent with mode select and the response from mode sense are
+\fB\-T\fR
+Trace commands to obtain more verbose output (for debugging). When used once
+SCSI commands are shown (in hex) and any errors from these SCSI commands are
+spelt out (i.e. with a decoded and raw sense buffer). When used twice, the
+additional data sent with mode select and the response from mode sense are
shown (in hex).
.TP
\fB\-u\fR \fIPN\fR[,\fISPN\fR]
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index 42e694e3..ff84ff40 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2011 Douglas Gilbert.
+ * Copyright (c) 1999-2012 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index c9028b7a..a72733c6 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -599,6 +599,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x23,0x07,"Invalid token operation, token expired"},
{0x23,0x08,"Invalid token operation, token cancelled"},
{0x23,0x09,"Invalid token operation, token deleted"},
+ {0x23,0x0a,"Invalid token operation, invalid token length"},
{0x24,0x00,"Invalid field in cdb"},
{0x24,0x01,"CDB decryption error"},
{0x24,0x02,"Invalid cdb field while in explicit block model (obs)"},
@@ -1135,7 +1136,7 @@ const char * sg_lib_transport_proto_strs[] =
"Internet SCSI (iSCSI)",
"Serial Attached SCSI Protocol (SPL-2)",
"Automation/Drive Interface Transport (ADT-2)",
- "AT Attachment Interface (ACS-2)", /* 0x8 */
+ "AT Attachment Interface (ACS-2)", /* 0x8 */
"USB Attached SCSI (UAS-2)",
"SCSI over PCI Express (SOP)",
"Oxb", "Oxc", "Oxd", "Oxe",
diff --git a/src/sg_inq.c b/src/sg_inq.c
index d641a260..522164ed 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -66,9 +66,10 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static char * version_str = "1.04 20120222"; /* SPC-4 rev 34 */
+static char * version_str = "1.04 20120224"; /* SPC-4 rev 34 */
+/* Following VPD pages are in ascending page number order */
#define VPD_SUPPORTED_VPDS 0x0
#define VPD_UNIT_SERIAL_NUM 0x80
#define VPD_DEVICE_ID 0x83
@@ -82,11 +83,12 @@ static char * version_str = "1.04 20120222"; /* SPC-4 rev 34 */
#define VPD_DEVICE_CONSTITUENTS 0x8b
#define VPD_CFA_PROFILE_INFO 0x8c
#define VPD_POWER_CONSUMPTION 0x8d
+#define VPD_3PARTY_COPY 0x8f
#define VPD_PROTO_LU 0x90
#define VPD_PROTO_PORT 0x91
#define VPD_BLOCK_LIMITS 0xb0
#define VPD_BLOCK_DEV_CHARS 0xb1
-#define VPD_MAN_ASS_SN 0xb1
+#define VPD_MAN_ASS_SN 0xb1
#define VPD_LB_PROVISIONING 0xb2
#define VPD_REFERRALS 0xb3
#define VPD_UPR_EMC 0xc0
@@ -137,7 +139,6 @@ static struct svpd_values_name_t vpd_pg[] = {
{VPD_BLOCK_DEV_CHARS, 0, 0, 0, "bdc",
"Block device characteristics (SBC)"},
{VPD_BLOCK_LIMITS, 0, 0, 0, "bl", "Block limits (SBC)"},
- {VPD_REFERRALS, 0, 0, 0, "ref", "Referrals (SBC)"},
{VPD_DEVICE_ID, 0, -1, 0, "di", "Device identification"},
#if 0
{VPD_DEVICE_ID, VPD_DI_SEL_AS_IS, -1, 0, "di_asis", "Like 'di' "
@@ -150,19 +151,22 @@ static struct svpd_values_name_t vpd_pg[] = {
"identification, target device only"},
#endif
{VPD_EXT_INQ, 0, -1, 0, "ei", "Extended inquiry data"},
- {VPD_MAN_NET_ADDR, 0, -1, 0, "mna", "Management network addresses"},
- {VPD_MODE_PG_POLICY, 0, -1, 0, "mpp", "Mode page policy"},
{VPD_LB_PROVISIONING, 0, 0, 0, "lbpv", "Logical block provisioning "
"(SBC)"},
+ {VPD_MAN_NET_ADDR, 0, -1, 0, "mna", "Management network addresses"},
+ {VPD_MODE_PG_POLICY, 0, -1, 0, "mpp", "Mode page policy"},
{VPD_POWER_CONDITION, 0, -1, 0, "po", "Power condition"},
{VPD_POWER_CONSUMPTION, 0, -1, 0, "psm", "Power consumption"},
{VPD_PROTO_LU, 0, 0x0, 0, "pslu", "Protocol-specific logical unit "
"information"},
{VPD_PROTO_PORT, 0, 0x0, 0, "pspo", "Protocol-specific port information"},
+ {VPD_REFERRALS, 0, 0, 0, "ref", "Referrals (SBC)"},
{VPD_SOFTW_INF_ID, 0, -1, 0, "sii", "Software interface identification"},
{VPD_UNIT_SERIAL_NUM, 0, -1, 0, "sn", "Unit serial number"},
{VPD_SCSI_PORTS, 0, -1, 0, "sp", "SCSI ports"},
{VPD_SUPPORTED_VPDS, 0, -1, 0, "sv", "Supported VPD pages"},
+ {VPD_3PARTY_COPY, 0, -1, 0, "tpc", "Third party copy"},
+ /* Following are vendor specific */
{VPD_RDAC_VAC, 0, -1, 1, "rdac_vac", "RDAC volume access control (IBM)"},
{VPD_RDAC_VERS, 0, -1, 1, "rdac_vers", "RDAC software version (IBM)"},
{VPD_UPR_EMC, 0, -1, 1, "upr", "Unit path report (EMC)"},
@@ -247,7 +251,8 @@ usage()
" --export|-u SCSI_IDENT_<assoc>_<type>=<ident> output "
"format.\n"
" Defaults to device id page (0x83) if --page "
- "not given\n"
+ "not given,\n"
+ " only supported for VPD pages 0x80 and 0x83\n"
" --extended|-E|-x decode extended INQUIRY data VPD page "
"(0x86)\n"
" --help|-h print usage message then exit\n"
@@ -664,6 +669,45 @@ dStrRaw(const char* str, int len)
printf("%c", str[k]);
}
+static int
+encode_whitespaces(unsigned char *str, int inlen)
+{
+ int outlen = inlen;
+ int i, j = 0, k, valid = 0;
+
+ /* Skip initial whitespaces */
+ while (isblank(str[j]))
+ j++;
+ k = j;
+ /* Strip trailing whitespaces */
+ while (outlen > k &&
+ (isblank(str[outlen - 1]) || str[outlen - 1] == '\0')) {
+ str[outlen - 1] = '\0';
+ outlen--;
+ }
+ for (i = 0; (k < outlen); ++k) {
+ if (isblank(str[k])) {
+ if (i > 0 && str[i - 1] != '_') {
+ str[i] = '_';
+ valid++;
+ i++;
+ }
+ } else if (!isprint(str[k])) {
+ str[i] = '.';
+ i++;
+ } else {
+ str[i] = str[k];
+ valid++;
+ i++;
+ }
+ }
+ if (!valid) {
+ i = 0;
+ }
+ str[i] = '\0';
+ return i;
+}
+
struct vpd_name {
int number;
int peri_type;
@@ -687,6 +731,7 @@ static struct vpd_name vpd_name_arr[] = {
{VPD_DEVICE_CONSTITUENTS, 0, "Device constituents"},
{VPD_CFA_PROFILE_INFO, 0, "CFA profile information"}, /* 0x8c */
{VPD_POWER_CONSUMPTION, 0, "Power consumption"}, /* 0x8d */
+ {VPD_3PARTY_COPY, 0, "Third party copy"}, /* 0x8f */
/* 0xb0 to 0xbf are per peripheral device type */
{VPD_BLOCK_LIMITS, 0, "Block limits (sbc2)"}, /* 0xb0 */
{VPD_BLOCK_DEV_CHARS, 0, "Block device characteristics (sbc3)"},
@@ -1186,6 +1231,11 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
*/
printf(" %s\n", (const char *)ip);
break;
+ case 9: /* PCIe routing ID */
+ /* added in sbc4r34, no limits on code_set or association ?? */
+ d_id = ((ip[0] << 8) | ip[1]);
+ printf(" PCIe routing ID: 0x%x\n", d_id);
+ break;
default: /* reserved */
dStrHex((const char *)ip, i_len, -1);
break;
@@ -1238,28 +1288,16 @@ export_dev_ids(unsigned char * buff, int len)
case 0: /* vendor specific */
k = 0;
if ((1 == c_set) || (2 == c_set)) { /* ASCII or UTF-8 */
- for (k = 0; (k < i_len); ++k) {
- if (isblank(ip[k])) {
- ip[k]='_';
- } else if (!isprint(ip[k])) {
- ip[k] = '.';
- }
- }
+ k = encode_whitespaces(ip, i_len);
if (k >= i_len)
k = 1;
}
if (k)
- printf("SCSI_IDENT_%s_VENDOR=%.*s\n", assoc_str, i_len, ip);
- else
- dStrHex((const char *)ip, i_len, 0);
+ printf("SCSI_IDENT_%s_VENDOR=%.*s\n", assoc_str, k, ip);
break;
case 1: /* T10 vendor identification */
- for (k = 0; (k < i_len); ++k) {
- if (isblank(ip[k])) {
- ip[k]='_';
- }
- }
- printf("SCSI_IDENT_%s_T10=%.*s\n", assoc_str, i_len, ip);
+ k = encode_whitespaces(ip, i_len);
+ printf("SCSI_IDENT_%s_T10=%.*s\n", assoc_str, k, ip);
break;
case 2: /* EUI-64 based */
if (1 != c_set) {
@@ -1357,6 +1395,8 @@ export_dev_ids(unsigned char * buff, int len)
printf("SCSI_IDENT_%s_NAME=%.*s\n", assoc_str, i_len,
(const char *)ip);
break;
+ case 9: /* PCIe Routing ID */
+ /* new in spc4r34, looks under-specified, drop through now */
default: /* reserved */
dStrHex((const char *)ip, i_len, -1);
break;
@@ -1368,7 +1408,7 @@ export_dev_ids(unsigned char * buff, int len)
}
/* Transport IDs are initiator port identifiers, typically other than the
- initiator port issuing a SCSI command. Code borrowed from sg_persist.c */
+ initiator port issuing a SCSI command. */
static void
decode_transport_id(const char * leadin, unsigned char * ucp, int len)
{
@@ -1481,6 +1521,10 @@ decode_transport_id(const char * leadin, unsigned char * ucp, int len)
bump = 24;
break;
case TPROTO_NONE:
+ fprintf(stderr, "%s No specified protocol\n", leadin);
+ /* dStrHex((const char *)ucp, ((len > 24) ? 24 : len), 0); */
+ bump = 24;
+ break;
default:
fprintf(stderr, "%s unknown protocol id=0x%x "
"format_code=%d\n", leadin, proto_id, format_code);
@@ -1522,6 +1566,8 @@ decode_x_inq_vpd(unsigned char * buff, int len, int do_hex)
(buff[10] << 8) + buff[11]); /* spc4r27 */
printf(" POA_SUP=%d HRA_SUP=%d VSA_SUP=%d\n", /* spc4r32 */
!!(buff[12] & 0x80), !!(buff[12] & 0x40), !!(buff[12] & 0x20));
+ printf(" Maximum supported sense data length=%d\n",
+ buff[13]); /* spc4r34 */
}
/* VPD_SOFTW_INF_ID */
@@ -2397,7 +2443,7 @@ decode_vpd(int sg_fd, const struct opts_t * optsp)
switch (optsp->page_num) {
case VPD_UNIT_SERIAL_NUM:
- if (! optsp->do_raw)
+ if (! optsp->do_raw && ! optsp->do_export)
printf("VPD INQUIRY: Unit serial number page\n");
res = sg_ll_inquiry(sg_fd, 0, 1, VPD_UNIT_SERIAL_NUM, rsp_buff,
DEF_ALLOC_LEN, 1, optsp->do_verbose);
@@ -2420,7 +2466,12 @@ decode_vpd(int sg_fd, const struct opts_t * optsp)
if (len >= (int)sizeof(obuff))
len = sizeof(obuff) - 1;
memcpy(obuff, rsp_buff + 4, len);
- printf(" Unit serial number: %s\n", obuff);
+ if (optsp->do_export) {
+ len = encode_whitespaces((unsigned char *)obuff, len);
+ printf("SCSI_IDENT_SERIAL=%s\n", obuff);
+ } else {
+ printf(" Unit serial number: %s\n", obuff);
+ }
}
}
break;
@@ -2911,11 +2962,6 @@ main(int argc, char * argv[])
fprintf(stderr, "Version string: %s\n", version_str);
return 0;
}
- if (opts.do_export && (NULL == opts.page_arg)) {
- opts.page_num = VPD_DEVICE_ID;
- ++opts.do_decode;
- ++opts.do_vpd;
- }
if (opts.page_arg) {
if (opts.page_num >= 0) {
fprintf(stderr, "Given '-p' option and another option that "
@@ -2962,6 +3008,20 @@ main(int argc, char * argv[])
opts.page_num = n;
}
}
+ if (opts.do_export) {
+ if (NULL == opts.page_arg) {
+ opts.page_num = VPD_DEVICE_ID;
+ }
+ if (opts.page_num != VPD_DEVICE_ID &&
+ opts.page_num != VPD_UNIT_SERIAL_NUM) {
+ fprintf(stderr, "Option '--export' only supported "
+ "for VPD pages 0x80 and 0x83\n");
+ usage_for(&opts);
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ ++opts.do_decode;
+ ++opts.do_vpd;
+ }
if ((0 == opts.do_cmddt) && (opts.page_num >= 0) && opts.p_given)
++opts.do_vpd;
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index 83a77768..690b88bc 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -9,7 +9,7 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
-* Copyright (C) 2000-2011 D. Gilbert
+* Copyright (C) 2000-2012 D. Gilbert
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
@@ -48,7 +48,7 @@ struct sg_version_descriptor {
const char * name;
};
-/* table from SPC-4 revision 33 [sorted numerically (from Annex D.8)] */
+/* table from SPC-4 revision 34 [sorted numerically (from Annex E.9)] */
/* Can also be obtained from : http://www.t10.org/lists/stds.txt */
struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x0, "Version Descriptor not supported or No standard identified"},
@@ -167,6 +167,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x3e7, "SES-2 T10/1559-D revision 19"},
{0x3eb, "SES-2 T10/1559-D revision 20"},
{0x3f0, "SES-2 ANSI INCITS 448-2008"},
+ {0x3f2, "SES-2 ISO/IEC 14776-372"},
{0x400, "SSC-3 (no version claimed)"},
{0x403, "SSC-3 T10/1611-D revision 04a"},
{0x407, "SSC-3 T10/1611-D revision 05"},
@@ -186,6 +187,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x463, "SPC-4 T10/1731-D revision 23"},
{0x480, "SMC-3 (no version claimed)"},
{0x482, "SMC-3 T10/1730-D revision 15"},
+ {0x482, "SMC-3 T10/1730-D revision 16"},
{0x4a0, "ADC-2 (no version claimed)"},
{0x4a7, "ADC-2 T10/1741-D revision 7"},
{0x4aa, "ADC-2 T10/1741-D revision 8"},
@@ -196,7 +198,8 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x4e5, "MMC-6 T10/1836-D revision 02g"},
{0x4e6, "MMC-6 MMC-6 ANSI INCITS 468-2010"},
{0x500, "ADC-3 (no version claimed)"},
- {0x502, "ADC-3 T10/1895-D revision 04"},
+ {0x502, "ADC-3 T10/1895-D revision 04"},
+ {0x504, "ADC-3 T10/1895-D revision 05"},
{0x520, "SSC-4 (no version claimed)"},
{0x523, "SSC-4 T10/2123-D revision 2"},
{0x560, "OSD-3 (no version claimed)"},
@@ -261,6 +264,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xa42, "FCP-4 T10/1828-D revision 01"},
{0xa44, "FCP-4 T10/1828-D revision 02"},
{0xa45, "FCP-4 T10/1828-D revision 02b"},
+ {0xa46, "FCP-4 ANSI INCITS 481-2011"},
{0xaa0, "SPI (no version claimed)"},
{0xab9, "SPI T10/0855-D revision 15a"},
{0xaba, "SPI ANSI INCITS 253-1995"},
@@ -302,6 +306,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xc07, "SAS-1.1 T10/1602-D revision 9"},
{0xc0f, "SAS-1.1 T10/1602-D revision 10"},
{0xc11, "SAS-1.1 ANSI INCITS 417-2006"},
+ {0xc12, "SAS-1.1 ISO/IEC 14776-151"},
{0xc20, "SAS-2 (no version claimed)"},
{0xc23, "SAS-2 T10/1760-D revision 14"},
{0xc27, "SAS-2 T10/1760-D revision 15"},
@@ -311,6 +316,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xc48, "SAS-2.1 T10/2125-D revision 04"},
{0xc4a, "SAS-2.1 T10/2125-D revision 06"},
{0xc4b, "SAS-2.1 T10/2125-D revision 07"},
+ {0xc4e, "SAS-2.1 ANSI INCITS 478-2011"},
{0xc60, "SAS-3 (no version claimed)"},
{0xd20, "FC-PH (no version claimed)"},
{0xd3b, "FC-PH ANSI INCITS 230-1994"},
@@ -363,6 +369,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xee2, "FC-FS-3 T11/1861-D revision 0.9"},
{0xee7, "FC-FS-3 T11/1861-D revision 1.0"},
{0xee9, "FC-FS-3 T11/1861-D revision 1.10"},
+ {0xeeb, "FC-FS-3 ANSI INCITS 470-2011"},
{0xf00, "FC-LS-2 (no version claimed)"},
{0xf03, "FC-LS-2 T11/2103-D revision 2.11"},
{0xf05, "FC-LS-2 T11/2103-D revision 2.21"},
@@ -372,6 +379,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xf28, "FC-PI-5 T11/2118-D revision 3.00"},
{0xf2a, "FC-PI-5 T11/2118-D revision 6.00"},
{0xf2b, "FC-PI-5 T11/2118-D revision 6.10"},
+ {0xf2e, "FC-PI-5 ANSI INCITS 479-2011"},
{0xf40, "FC-PI-6 (no version claimed)"},
{0xf60, "FC-FS-4 (no version claimed)"},
{0xf80, "FC-LS-3 (no version claimed)"},
@@ -411,6 +419,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x1600, "ATA/ATAPI-7 (no version claimed)"},
{0x1602, "ATA/ATAPI-7 T13/1532-D revision 3"},
{0x161c, "ATA/ATAPI-7 ANSI INCITS 397-2005"},
+ {0x161e, "ATA/ATAPI-7 ISO/IEC 24739"},
{0x1620, "ATA/ATAPI-8 ATA-AAM Architecture model (no version claimed)"},
{0x1621, "ATA/ATAPI-8 ATA-PT Parallel transport (no version claimed)"},
{0x1622, "ATA/ATAPI-8 ATA-AST Serial transport (no version claimed)"},
@@ -441,6 +450,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x20a5, "SPL T10/2124-D revision 7"},
{0x20a7, "SPL SPL ANSI INCITS 476-2011"},
{0x20c0, "SPL-2 (no version claimed)"},
+ {0x20c2, "SPL-2 T10/2228-D revision 4"},
{0x20e0, "SPL-3 (no version claimed)"},
{0x21e0, "SOP (no version claimed)"},
{0x2200, "PQI (no version claimed)"},
diff --git a/src/sg_logs.c b/src/sg_logs.c
index 0b8dc4c6..3a1460ea 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -1,3 +1,14 @@
+/* A utility program originally written for the Linux OS SCSI subsystem.
+* Copyright (C) 2000-2012 D. Gilbert
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2, or (at your option)
+* any later version.
+
+ This program outputs information provided by a SCSI LOG SENSE command.
+
+*/
+
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
@@ -14,18 +25,7 @@
#include "sg_lib.h"
#include "sg_cmds_basic.h"
-/* A utility program originally written for the Linux OS SCSI subsystem.
-* Copyright (C) 2000-2011 D. Gilbert
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2, or (at your option)
-* any later version.
-
- This program outputs information provided by a SCSI LOG SENSE command.
-
-*/
-
-static char * version_str = "1.05 20111020"; /* spc4r30 + sbc3r28 */
+static char * version_str = "1.06 20120223"; /* spc4r34 + sbc3r30 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
diff --git a/src/sg_modes.c b/src/sg_modes.c
index 0bf89b69..d7180493 100644
--- a/src/sg_modes.c
+++ b/src/sg_modes.c
@@ -1,3 +1,16 @@
+/*
+ * Copyright (C) 2000-2012 D. Gilbert
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program outputs information provided by a SCSI MODE SENSE command.
+ * Does 10 byte MODE SENSE commands by default, Trent Piepho added a "-6"
+ * switch for force 6 byte mode sense commands.
+ * This utility cannot modify mode pages. See the sdparm utility for that.
+ */
+
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
@@ -12,21 +25,7 @@
#include "sg_lib.h"
#include "sg_cmds_basic.h"
-/*
-* Copyright (C) 2000-2011 D. Gilbert
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2, or (at your option)
-* any later version.
-
- This program outputs information provided by a SCSI MODE SENSE command.
- Does 10 byte MODE SENSE commands by default, Trent Piepho added a "-6"
- switch for force 6 byte mode sense commands.
- This utility cannot modify mode pages. See the sdparm utility for that.
-
-*/
-
-static char * version_str = "1.37 20111113";
+static char * version_str = "1.38 20120224";
#define DEF_ALLOC_LEN (1024 * 4)
#define DEF_6_ALLOC_LEN 252
diff --git a/src/sg_persist.c b/src/sg_persist.c
index 8bc188e3..6f34f036 100644
--- a/src/sg_persist.c
+++ b/src/sg_persist.c
@@ -1,3 +1,13 @@
+/* A utility program originally written for the Linux OS SCSI subsystem.
+ * Copyright (C) 2004-2012 D. Gilbert
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program issues the SCSI PERSISTENT IN and OUT commands.
+ */
+
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
@@ -16,18 +26,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-/* A utility program originally written for the Linux OS SCSI subsystem.
-* Copyright (C) 2004-2012 D. Gilbert
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2, or (at your option)
-* any later version.
-
- This program issues the SCSI PERSISTENT IN and OUT commands.
-
-*/
-
-static char * version_str = "0.38 20120222";
+static char * version_str = "0.38 20120224";
#define PRIN_RKEY_SA 0x0
@@ -198,6 +197,10 @@ usage()
"Performs a SCSI PERSISTENT RESERVE (IN or OUT) command\n");
}
+/* If num_tids==0 then only one TransportID is assumed with len bytes in
+ * it. If num_tids>0 then that many TransportIDs is assumed, each in an
+ * element that is MX_TID_LEN bytes long (and the 'len' argument is
+ * ignored). */
static void
decode_transport_id(const char * leadin, unsigned char * ucp, int len,
int num_tids)
@@ -302,6 +305,9 @@ decode_transport_id(const char * leadin, unsigned char * ucp, int len,
}
break;
case TPROTO_NONE:
+ fprintf(stderr, "%s No specified protocol\n", leadin);
+ /* dStrHex((const char *)ucp, ((len > 24) ? 24 : len), -1); */
+ break;
default:
fprintf(stderr, "%s unknown protocol id=0x%x "
"format_code=%d\n", leadin, proto_id, format_code);
diff --git a/src/sg_read_buffer.c b/src/sg_read_buffer.c
index 52cc08b2..731ed336 100644
--- a/src/sg_read_buffer.c
+++ b/src/sg_read_buffer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2011 Luben Tuikov and Douglas Gilbert.
+ * Copyright (c) 2006-2012 Luben Tuikov and Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -25,7 +25,7 @@
* This utility issues the SCSI READ BUFFER command to the given device.
*/
-static char * version_str = "1.07 20110216";
+static char * version_str = "1.08 20120224";
static struct option long_options[] = {
@@ -316,7 +316,7 @@ main(int argc, char * argv[])
printf("Echo buffer capacity: %d (0x%x)\n", k, k);
break;
default:
- dStrHex((const char *)resp, rb_len, 1);
+ dStrHex((const char *)resp, rb_len, (verbose > 1 ? 0 : 1));
break;
}
}
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 8167eae8..272ecab9 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -30,7 +30,7 @@
*/
-static char * version_str = "0.59 20120222"; /* spc4r34 + sbc3r30 */
+static char * version_str = "0.59 20120224"; /* spc4r34 + sbc3r30 */
extern void svpd_enumerate_vendor(void);
extern int svpd_decode_vendor(int sg_fd, int num_vpd, int subvalue,
@@ -40,7 +40,7 @@ extern const struct svpd_values_name_t *
svpd_find_vendor_by_acron(const char * ap);
-/* standard VPD pages */
+/* standard VPD pages, in ascending page number order */
#define VPD_SUPPORTED_VPDS 0x0
#define VPD_UNIT_SERIAL_NUM 0x80
#define VPD_IMP_OP_DEF 0x81 /* obsolete in SPC-2 */
@@ -56,6 +56,7 @@ extern const struct svpd_values_name_t *
#define VPD_DEVICE_CONSTITUENTS 0x8b
#define VPD_CFA_PROFILE_INFO 0x8c
#define VPD_POWER_CONSUMPTION 0x8d
+#define VPD_3PARTY_COPY 0x8f
#define VPD_PROTO_LU 0x90
#define VPD_PROTO_PORT 0x91
#define VPD_BLOCK_LIMITS 0xb0 /* SBC-3 */
@@ -176,6 +177,7 @@ static struct svpd_values_name_t standard_vpd_pg[] = {
{VPD_SECURITY_TOKEN, 0, 0x11, 0, "st", "Security token (OSD)"},
{VPD_SUPPORTED_VPDS, 0, -1, 0, "sv", "Supported VPD pages"},
{VPD_TA_SUPPORTED, 0, 1, 0, "tas", "TapeAlert supported flags (SSC)"},
+ {VPD_3PARTY_COPY, 0, -1, 0, "tpc", "Third party copy"},
{0, 0, 0, 0, NULL, NULL},
};
@@ -723,6 +725,8 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
*/
printf("%s\n", (const char *)ip);
break;
+ case 9: /* PCIe routing ID */
+ break;
default: /* reserved */
break;
}
@@ -994,6 +998,11 @@ decode_designation_descriptor(const unsigned char * ucp, int i_len,
*/
printf(" %s\n", (const char *)ip);
break;
+ case 9: /* PCIe routing ID */
+ /* added in sbc4r34, no limits on code_set or association ?? */
+ d_id = ((ip[0] << 8) | ip[1]);
+ printf(" PCIe routing ID: 0x%x\n", d_id);
+ break;
default: /* reserved */
dStrHex((const char *)ip, i_len, 0);
break;
@@ -1043,7 +1052,7 @@ decode_dev_ids(const char * print_if_found, unsigned char * buff, int len,
}
/* Transport IDs are initiator port identifiers, typically other than the
- initiator port issuing a SCSI command. Code borrowed from sg_persist.c */
+ initiator port issuing a SCSI command. */
static void
decode_transport_id(const char * leadin, unsigned char * ucp, int len)
{
@@ -1156,6 +1165,10 @@ decode_transport_id(const char * leadin, unsigned char * ucp, int len)
bump = 24;
break;
case TPROTO_NONE:
+ fprintf(stderr, "%s No specified protocol\n", leadin);
+ /* dStrHex((const char *)ucp, ((len > 24) ? 24 : len), 0); */
+ bump = 24;
+ break;
default:
fprintf(stderr, "%s unknown protocol id=0x%x "
"format_code=%d\n", leadin, proto_id, format_code);
@@ -1246,6 +1259,8 @@ decode_x_inq_vpd(unsigned char * b, int len, int do_hex, int do_long,
printf(" POA_SUP=%d\n", !!(b[12] & 0x80)); /* spc4r32 */
printf(" HRA_SUP=%d\n", !!(b[12] & 0x40)); /* spc4r32 */
printf(" VSA_SUP=%d\n", !!(b[12] & 0x20)); /* spc4r32 */
+ printf(" Maximum supported sense data length=%d\n",
+ b[13]); /* spc4r34 */
return;
}
printf(" ACTIVATE_MICROCODE=%d SPT=%d GRD_CHK=%d APP_CHK=%d "
@@ -1263,6 +1278,7 @@ decode_x_inq_vpd(unsigned char * b, int len, int do_hex, int do_long,
(b[10] << 8) + b[11]); /* spc4r27 */
printf(" POA_SUP=%d HRA_SUP=%d VSA_SUP=%d\n", /* spc4r32 */
!!(b[12] & 0x80), !!(b[12] & 0x40), !!(b[12] & 0x20));
+ printf(" Maximum supported sense data length=%d\n", b[13]); /* spc4r34 */
}
/* VPD_SOFTW_INF_ID */
@@ -2441,6 +2457,49 @@ svpd_decode_t10(int sg_fd, int num_vpd, int subvalue, int maxlen, int do_hex,
return 0;
}
break;
+ case VPD_3PARTY_COPY: /* 0x8f */
+ if ((! do_raw) && (! do_quiet))
+ printf("Third party copy VPD page:\n");
+ res = sg_ll_inquiry(sg_fd, 0, 1, num_vpd, rsp_buff, alloc_len, 1,
+ verbose);
+ if (0 == res) {
+ len = ((rsp_buff[2] << 8) + rsp_buff[3]) + 4; /* spc4r25 */
+ if (num_vpd != rsp_buff[1]) {
+ fprintf(stderr, "invalid VPD response; probably a STANDARD "
+ "INQUIRY response\n");
+ if (verbose) {
+ fprintf(stderr, "First 32 bytes of bad response\n");
+ dStrHex((const char *)rsp_buff, 32, 0);
+ }
+ return SG_LIB_CAT_MALFORMED;
+ }
+ if (len > alloc_len) {
+ if ((0 == maxlen) && (len < MX_ALLOC_LEN)) {
+ res = sg_ll_inquiry(sg_fd, 0, 1, num_vpd, rsp_buff, len,
+ 1, verbose);
+ if (res) {
+ fprintf(stderr, "fetching Third party copy page "
+ "(alloc_len=%d) failed\n", len);
+ return res;
+ }
+ } else {
+ fprintf(stderr, ">>> warning: response length (%d) "
+ "longer than requested (%d)\n", len, alloc_len);
+ len = alloc_len;
+ }
+ }
+ if (do_raw)
+ dStrRaw((const char *)rsp_buff, len);
+ else if (do_hex)
+ dStrHex((const char *)rsp_buff, len, 0);
+ else {
+ printf(" Leave decoding of this page until it is wanted, "
+ "in hex:\n");
+ dStrHex((const char *)rsp_buff, len, 0);
+ }
+ return 0;
+ }
+ break;
case VPD_PROTO_LU: /* 0x90 */
if ((! do_raw) && (! do_quiet))
printf("Protocol-specific logical unit information:\n");
diff --git a/utils/Makefile b/utils/Makefile
index 77b56fd2..a1416467 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -13,8 +13,8 @@ EXTRA_EXECS = hxascdmp sg_chk_asc
MAN_PGS = hxascdmp.1
MAN_PREF = man1
-CFLAGS = -g -O2 -W -Wall
-# CFLAGS = -g -O2 -W -pedantic -std=c99
+CFLAGS = -g -O2 -W -Wall -I ../include
+# CFLAGS = -g -O2 -W -I ../include -pedantic -std=c99
LDFLAGS =
diff --git a/utils/sg_lib.h b/utils/sg_lib.h
deleted file mode 100644
index 609c2584..00000000
--- a/utils/sg_lib.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../include/sg_lib.h"