aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2012-03-22 10:53:16 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2012-03-22 10:53:16 +0000
commita6e2431f031fdc0962fa4b347b096f438a4cd61f (patch)
tree9d3d967a22a5205e70cee476eaed73b10992ab61
parent36377a7eb3d43ef08c17bcdfff27027fe5a0a26a (diff)
downloadsg3_utils-a6e2431f031fdc0962fa4b347b096f438a4cd61f.tar.gz
sg_inq+sg_vpd: decode old EMC Symmetrix abuse of VPD page 0x83
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@447 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog6
-rw-r--r--src/sg_inq.c43
-rw-r--r--src/sg_vpd.c55
3 files changed, 85 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index b8c27df9..18c5d594 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,11 +2,13 @@ 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 [20120319] [svn: r446]
+Changelog for sg3_utils-1.34 [20120320] [svn: r447]
- sg_verify: add 16 byte cdb, bytchk (data-out buffer)
and group number support
- sync to spc4r35 and sbc3r30
- sg_inq: add --export to experiment with udev
+ - decode old EMC Symmetrix abuse of VPD page 0x83
+ - sg_vpd: decode old EMC Symmetrix abuse of VPD page 0x83
- sg_ses: increase max dpage response size to 64 KB
- sg_sanitize: add --ause, --fail and --test=
- sg_luns: add long extended flat space addressing format
@@ -19,7 +21,7 @@ Changelog for sg3_utils-1.34 [20120319] [svn: r446]
- decode ATA PT fixed format sense (SAT-2)
- ./configure options:
- change --enable-no-linux-bsg to --disable-linuxbsg
- - add --disable-scsistrings to reduce utility size
+ - add --disable-scsistrings to reduce utility sizes
Changelog for sg3_utils-1.33 [20120118] [svn: r435]
- sg_ses: major rework of indexes (again), now two level
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 4e239556..56a5e543 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -66,7 +66,7 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static char * version_str = "1.05 20120311"; /* SPC-4 rev 34 */
+static char * version_str = "1.06 20120320"; /* SPC-4 rev 34 */
/* Following VPD pages are in ascending page number order */
@@ -1022,6 +1022,29 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
const unsigned char * ip;
char b[64];
+ if (buff[2] != 0) {
+ /*
+ * Reference the 3rd byte of the first Identification descriptor
+ * of a page 83 reply to determine whether the reply is compliant
+ * with SCSI-2 or SPC-2/3 specifications. A zero value in the
+ * 3rd byte indicates an SPC-2/3 conformant reply ( the field is
+ * reserved ). This byte will be non-zero for a SCSI-2
+ * conformant page 83 reply from these EMC Symmetrix models since
+ * the 7th byte of the reply corresponds to the 4th and 5th
+ * nibbles of the 6-byte OUI for EMC, that is, 0x006048.
+ */
+ i_len = len;
+ ip = ucp = buff;
+ c_set = 1;
+ assoc = 0;
+ piv = 0;
+ desig_type = 3;
+ j = 1;
+ off = 16;
+ printf(" Pre-SPC descriptor, descriptor length: %d\n", i_len);
+ goto decode;
+ }
+
for (j = 1, off = -1;
(u = sg_vpd_dev_id_iter(buff, len, &off, -1, -1, -1)) == 0;
++j) {
@@ -1042,6 +1065,7 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
piv = ((ucp[1] & 0x80) ? 1 : 0);
assoc = ((ucp[1] >> 4) & 0x3);
desig_type = (ucp[1] & 0xf);
+ decode:
if (piv && ((1 == assoc) || (2 == assoc)))
printf(" transport: %s\n",
sg_get_trans_proto_str(p_id, sizeof(b), b));
@@ -1288,6 +1312,20 @@ export_dev_ids(unsigned char * buff, int len)
unsigned char * ip;
const char * assoc_str;
+ if (buff[2] != 0) {
+ /*
+ * Cf decode_dev_ids() for details
+ */
+ i_len = len;
+ ip = buff;
+ c_set = 1;
+ assoc = 0;
+ desig_type = 3;
+ j = 1;
+ off = 16;
+ goto decode;
+ }
+
for (j = 1, off = -1;
(u = sg_vpd_dev_id_iter(buff, len, &off, -1, -1, -1)) == 0;
++j) {
@@ -1303,6 +1341,8 @@ export_dev_ids(unsigned char * buff, int len)
ip = ucp + 4;
c_set = (ucp[0] & 0xf);
assoc = ((ucp[1] >> 4) & 0x3);
+ desig_type = (ucp[1] & 0xf);
+ decode:
switch (assoc) {
case 0:
assoc_str = "LUN";
@@ -1317,7 +1357,6 @@ export_dev_ids(unsigned char * buff, int len)
fprintf(stderr, " Invalid association %d\n", assoc);
return;
}
- desig_type = (ucp[1] & 0xf);
switch (desig_type) {
case 0: /* vendor specific */
k = 0;
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 272ecab9..e1f51b6a 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -30,7 +30,7 @@
*/
-static char * version_str = "0.59 20120224"; /* spc4r34 + sbc3r30 */
+static char * version_str = "0.60 20120320"; /* spc4r35 + sbc3r30 */
extern void svpd_enumerate_vendor(void);
extern int svpd_decode_vendor(int sg_fd, int num_vpd, int subvalue,
@@ -599,6 +599,19 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
rtp = 0;
memset(sas_tport_addr, 0, sizeof(sas_tport_addr));
off = -1;
+ if (buff[2] != 0) {
+ if (m_assoc != VPD_ASSOC_LU)
+ return 0;
+ ip = buff;
+ p_id = 0;
+ c_set = 1;
+ assoc = VPD_ASSOC_LU;
+ piv = 0;
+ desig_type = 3;
+ i_len = 16;
+ off = 16;
+ goto decode;
+ }
while ((u = sg_vpd_dev_id_iter(buff, len, &off, m_assoc, m_desig_type,
m_code_set)) == 0) {
ucp = buff + off;
@@ -615,6 +628,7 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
is_sas = (piv && (6 == p_id)) ? 1 : 0;
assoc = ((ucp[1] >> 4) & 0x3);
desig_type = (ucp[1] & 0xf);
+ decode:
switch (desig_type) {
case 0: /* vendor specific */
break;
@@ -746,22 +760,16 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
}
static void
-decode_designation_descriptor(const unsigned char * ucp, int i_len,
- int long_out, int print_assoc)
+decode_designation_descriptor(const unsigned char * ip, int i_len,
+ int p_id, int c_set, int piv, int assoc,
+ int desig_type, int long_out, int print_assoc)
{
- int m, p_id, piv, c_set, assoc, desig_type, ci_off, c_id, d_id, naa;
+ int m, ci_off, c_id, d_id, naa;
int vsi, k;
- const unsigned char * ip;
uint64_t vsei;
uint64_t id_ext;
char b[64];
- ip = ucp + 4;
- p_id = ((ucp[0] >> 4) & 0xf);
- c_set = (ucp[0] & 0xf);
- piv = ((ucp[1] & 0x80) ? 1 : 0);
- assoc = ((ucp[1] >> 4) & 0x3);
- desig_type = (ucp[1] & 0xf);
if (print_assoc)
printf(" %s:\n", assoc_arr[assoc]);
printf(" designator type: %s, code set: %s\n",
@@ -1016,13 +1024,19 @@ decode_dev_ids(const char * print_if_found, unsigned char * buff, int len,
int m_assoc, int m_desig_type, int m_code_set, int long_out,
int quiet)
{
- int assoc, i_len;
+ int assoc, i_len, c_set, piv, p_id, desig_type;
int printed, off, u;
const unsigned char * ucp;
if (quiet)
return decode_dev_ids_quiet(buff, len, m_assoc, m_desig_type,
m_code_set);
+ if ( buff[2] != 0 ) {
+ if (m_assoc == VPD_ASSOC_LU)
+ decode_designation_descriptor( buff, 16, 0, 1, 0, m_assoc, 3,
+ long_out, 0);
+ return 0;
+ }
off = -1;
printed = 0;
while ((u = sg_vpd_dev_id_iter(buff, len, &off, m_assoc, m_desig_type,
@@ -1041,7 +1055,12 @@ decode_dev_ids(const char * print_if_found, unsigned char * buff, int len,
}
if (NULL == print_if_found)
printf(" %s:\n", assoc_arr[assoc]);
- decode_designation_descriptor(ucp, i_len, long_out, 0);
+ p_id = ((ucp[0] >> 4) & 0xf);
+ c_set = (ucp[0] & 0xf);
+ piv = ((ucp[1] & 0x80) ? 1 : 0);
+ desig_type = (ucp[1] & 0xf);
+ decode_designation_descriptor(ucp + 4, i_len, p_id, c_set, piv, assoc,
+ desig_type, long_out, 0);
}
if (-2 == u) {
fprintf(stderr, "VPD page error: short designator around "
@@ -1714,7 +1733,7 @@ decode_block_lb_prov_vpd(unsigned char * b, int len)
printf(" Provisioning type: %d\n", b[6] & 0x7);
if (dp) {
const unsigned char * ucp;
- int i_len;
+ int i_len, p_id, c_set, piv, assoc, desig_type;
ucp = b + 8;
i_len = ucp[3];
@@ -1724,7 +1743,13 @@ decode_block_lb_prov_vpd(unsigned char * b, int len)
return 0;
}
printf(" Provisioning group descriptor\n");
- decode_designation_descriptor(ucp, i_len, 0, 1);
+ p_id = ((ucp[0] >> 4) & 0xf);
+ c_set = (ucp[0] & 0xf);
+ piv = ((ucp[1] & 0x80) ? 1 : 0);
+ assoc = ((ucp[1] >> 4) & 0x3);
+ desig_type = (ucp[1] & 0xf);
+ decode_designation_descriptor(ucp, i_len, p_id, c_set, piv, assoc,
+ desig_type, 0, 1);
}
return 0;
}