aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2019-01-11 06:11:25 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2019-01-11 06:11:25 +0000
commit2433a22138f1b508c2765aa8499456cd6138a200 (patch)
treecf41a311a4230b908c6c14726bcfeae431bfdb48 /src
parent284fbfc7e0eb7b53b3ab7a9872aa1416685de785 (diff)
downloadsg3_utils-2433a22138f1b508c2765aa8499456cd6138a200.tar.gz
spc5r20 updates; fixes for FreeBSD 12.0 release
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@804 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r--src/BSD_LICENSE4
-rw-r--r--src/sg_format.c4
-rw-r--r--src/sg_inq.c8
-rw-r--r--src/sg_logs.c7
-rw-r--r--src/sg_opcodes.c8
-rw-r--r--src/sg_read_buffer.c7
-rw-r--r--src/sg_vpd.c40
7 files changed, 46 insertions, 32 deletions
diff --git a/src/BSD_LICENSE b/src/BSD_LICENSE
index 7f1906bb..15e3da3f 100644
--- a/src/BSD_LICENSE
+++ b/src/BSD_LICENSE
@@ -1,5 +1,5 @@
-Copyright (c) 1999-2018, Douglas Gilbert
+Copyright (c) 1999-2019, Douglas Gilbert
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -22,3 +22,5 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Above is the:
+SPDX-License-Identifier: BSD-2-Clause
diff --git a/src/sg_format.c b/src/sg_format.c
index 092b55d7..a75208d4 100644
--- a/src/sg_format.c
+++ b/src/sg_format.c
@@ -40,7 +40,7 @@
#include "sg_pr2serr.h"
#include "sg_pt.h"
-static const char * version_str = "1.56 20181212";
+static const char * version_str = "1.57 20190107";
#define RW_ERROR_RECOVERY_PAGE 1 /* can give alternate with --mode=MP */
@@ -238,7 +238,7 @@ usage()
"\tExample: sg_format --format /dev/sdc\n\n"
"This utility formats a SCSI disk [FORMAT UNIT] or resizes "
"it. Alternatively\nif '--tape=FM' is given formats a tape "
- "[FORMAT MEDIUM].\n");
+ "[FORMAT MEDIUM].\n\n");
printf("WARNING: This utility will destroy all the data on "
"DEVICE when '--format'\n\t or '--tape' is given. Check that "
"you have specified the correct\n\t DEVICE.\n");
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 61f4fdb3..186e5bf6 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
- * Copyright (C) 2000-2018 D. Gilbert
+ * Copyright (C) 2000-2019 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)
@@ -51,7 +51,7 @@
#include "sg_pt_nvme.h"
#endif
-static const char * version_str = "1.98 20180828"; /* SPC-5 rev 19 */
+static const char * version_str = "1.99 20190109"; /* SPC-5 rev 20 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
@@ -2176,7 +2176,7 @@ decode_x_inq_vpd(uint8_t * buff, int len, int do_hex)
sg_get_unaligned_be16(buff + 10)); /* spc4r27 */
printf(" POA_SUP=%d HRA_SUP=%d VSA_SUP=%d DMS_VALID=%d\n",
!!(buff[12] & 0x80), !!(buff[12] & 0x40), !!(buff[12] & 0x20),
- !!(buff[12] & 0x10)); /* spc4r32 + 17-142r5 */
+ !!(buff[12] & 0x10)); /* spc5r20 */
printf(" Maximum supported sense data length=%d\n",
buff[13]); /* spc4r34 */
/* All byte 14 bits added in spc5r09 */
@@ -2189,7 +2189,7 @@ decode_x_inq_vpd(uint8_t * buff, int len, int do_hex)
sg_get_unaligned_be16(buff + 17)); /* spc5r17 */
printf(" DM_MD_4=%d DM_MD_5=%d DM_MD_6=%d DM_MD_7=%d\n",
!!(buff[19] & 0x80), !!(buff[19] & 0x40), !!(buff[19] & 0x20),
- !!(buff[19] & 0x10)); /* 17-142r5 */
+ !!(buff[19] & 0x10)); /* spc5r20 */
printf(" DM_MD_D=%d DM_MD_E=%d DM_MD_F=%d\n",
!!(buff[19] & 0x8), !!(buff[19] & 0x4), !!(buff[19] & 0x2));
}
diff --git a/src/sg_logs.c b/src/sg_logs.c
index 65eb3947..33a77b38 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
- * Copyright (C) 2000-2018 D. Gilbert
+ * Copyright (C) 2000-2019 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)
@@ -36,7 +36,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.69 20180911"; /* spc5r19 + sbc4r11 */
+static const char * version_str = "1.70 20190104"; /* spc5r19 + sbc4r11 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
@@ -57,6 +57,7 @@ static const char * version_str = "1.69 20180911"; /* spc5r19 + sbc4r11 */
#define APP_CLIENT_LPAGE 0xf
#define SELF_TEST_LPAGE 0x10
#define SOLID_STATE_MEDIA_LPAGE 0x11
+#define REQ_RECOVERY_LPAGE 0x13
#define BACKGROUND_SCAN_LPAGE 0x15
#define SAT_ATA_RESULTS_LPAGE 0x16
#define PROTO_SPECIFIC_LPAGE 0x18
@@ -363,7 +364,7 @@ static struct log_elem log_arr[] = {
show_dt_device_status_page}, /* 0x11, 0x0 SSC,ADC */
{0x12, 0, 0, PDT_TAPE, MVP_STD, "Tape alert response", "tar",
show_tapealert_response_page}, /* 0x12, 0x0 SSC,ADC */
- {0x13, 0, 0, PDT_TAPE, MVP_STD, "Requested recovery", "rr",
+ {REQ_RECOVERY_LPAGE, 0, 0, PDT_TAPE, MVP_STD, "Requested recovery", "rr",
show_requested_recovery_page}, /* 0x13, 0x0 SSC,ADC */
{0x14, 0, 0, PDT_TAPE, MVP_STD, "Device statistics", "ds",
show_device_stats_page}, /* 0x14, 0x0 SSC,ADC */
diff --git a/src/sg_opcodes.c b/src/sg_opcodes.c
index 16d7c6c9..49e2ac1c 100644
--- a/src/sg_opcodes.c
+++ b/src/sg_opcodes.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
- * Copyright (C) 2004-2018 D. Gilbert
+ * Copyright (C) 2004-2019 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)
@@ -33,7 +33,7 @@
#include "sg_pt.h"
-static const char * version_str = "0.64 20180926"; /* spc5r19+ */
+static const char * version_str = "0.65 20190108"; /* spc5r20 */
#define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */
@@ -59,7 +59,7 @@ static struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"hex", no_argument, 0, 'H'},
{"mask", no_argument, 0, 'm'},
- {"mlu", no_argument, 0, 'M'},
+ {"mlu", no_argument, 0, 'M'}, /* added in spc5r20 */
{"no-inquiry", no_argument, 0, 'n'},
{"no_inquiry", no_argument, 0, 'n'},
{"new", no_argument, 0, 'N'},
@@ -784,7 +784,7 @@ list_all_codes(uint8_t * rsoc_buff, int rsoc_len, struct opts_t * op,
else
printf(" %.2x %.4s %3d %2d %s\n", bp[0],
sa_buff, sg_get_unaligned_be16(bp + 6),
- (byt5 >> 2) & 0x3, name_buff);
+ ((byt5 >> 4) & 0x3) /* MLU */, name_buff);
}
if (op->do_mask) {
int cdb_sz;
diff --git a/src/sg_read_buffer.c b/src/sg_read_buffer.c
index 823fed73..812de8c2 100644
--- a/src/sg_read_buffer.c
+++ b/src/sg_read_buffer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018 Luben Tuikov and Douglas Gilbert.
+ * Copyright (c) 2006-2019 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.
@@ -35,7 +35,7 @@
* device.
*/
-static const char * version_str = "1.25 20180523";
+static const char * version_str = "1.26 20190108"; /* spc5r20 */
#ifndef SG_READ_BUFFER_10_CMD
@@ -108,6 +108,7 @@ usage()
#define MODE_DESCRIPTOR 3
#define MODE_ECHO_BUFFER 0x0A
#define MODE_ECHO_BDESC 0x0B
+#define MODE_READ_MICROCODE_ST 0x0F
#define MODE_EN_EX_ECHO 0x1A
#define MODE_ERR_HISTORY 0x1C
@@ -123,6 +124,8 @@ static struct mode_s {
{ "echo", MODE_ECHO_BUFFER, "read data from echo buffer "
"(spc-2)"},
{ "echo_desc", MODE_ECHO_BDESC, "echo buffer descriptor (spc-2)"},
+ { "rd_microc_st", MODE_READ_MICROCODE_ST, "read microcode status "
+ "(spc-5)"},
{ "en_ex", MODE_EN_EX_ECHO,
"enable expander communications protocol and echo buffer (spc-3)"},
{ "err_hist", MODE_ERR_HISTORY, "error history (spc-4)"},
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 70e1fddf..04d5110d 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018 Douglas Gilbert.
+ * Copyright (c) 2006-2019 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.
@@ -40,7 +40,7 @@
*/
-static const char * version_str = "1.48 20180910"; /* spc5r19 + sbc4r15 */
+static const char * version_str = "1.49 20190109"; /* spc5r20 + sbc4r15 */
/* standard VPD pages, in ascending page number order */
#define VPD_SUPPORTED_VPDS 0x0
@@ -1268,7 +1268,7 @@ decode_x_inq_vpd(uint8_t * b, int len, int do_hex, bool 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(" DMS_VALID=%d\n", !!(b[12] & 0x10)); /* 17-142r5 */
+ printf(" DMS_VALID=%d\n", !!(b[12] & 0x10)); /* spc5r20 */
printf(" Maximum supported sense data length=%d\n",
b[13]); /* spc4r34 */
printf(" IBS=%d\n", !!(b[14] & 0x80)); /* spc5r09 */
@@ -1280,13 +1280,13 @@ decode_x_inq_vpd(uint8_t * b, int len, int do_hex, bool do_long,
sg_get_unaligned_be16(b + 15)); /* spc5r17 */
printf(" Maximum mode page change logs=%u\n",
sg_get_unaligned_be16(b + 17)); /* spc5r17 */
- printf(" DM_MD_4=%d\n", !!(b[19] & 0x80)); /* 17-142r5 */
- printf(" DM_MD_5=%d\n", !!(b[19] & 0x40)); /* 17-142r5 */
- printf(" DM_MD_6=%d\n", !!(b[19] & 0x20)); /* 17-142r5 */
- printf(" DM_MD_7=%d\n", !!(b[19] & 0x10)); /* 17-142r5 */
- printf(" DM_MD_D=%d\n", !!(b[19] & 0x8)); /* 17-142r5 */
- printf(" DM_MD_E=%d\n", !!(b[19] & 0x4)); /* 17-142r5 */
- printf(" DM_MD_F=%d\n", !!(b[19] & 0x2)); /* 17-142r5 */
+ printf(" DM_MD_4=%d\n", !!(b[19] & 0x80)); /* spc5r20 */
+ printf(" DM_MD_5=%d\n", !!(b[19] & 0x40)); /* spc5r20 */
+ printf(" DM_MD_6=%d\n", !!(b[19] & 0x20)); /* spc5r20 */
+ printf(" DM_MD_7=%d\n", !!(b[19] & 0x10)); /* spc5r20 */
+ printf(" DM_MD_D=%d\n", !!(b[19] & 0x8)); /* spc5r20 */
+ printf(" DM_MD_E=%d\n", !!(b[19] & 0x4)); /* spc5r20 */
+ printf(" DM_MD_F=%d\n", !!(b[19] & 0x2)); /* spc5r20 */
return;
}
printf(" ACTIVATE_MICROCODE=%d SPT=%d GRD_CHK=%d APP_CHK=%d "
@@ -1309,7 +1309,7 @@ decode_x_inq_vpd(uint8_t * b, int len, int do_hex, bool do_long,
sg_get_unaligned_be16(b + 10)); /* spc4r27 */
printf(" POA_SUP=%d HRA_SUP=%d VSA_SUP=%d DMS_VALID=%d\n",
!!(b[12] & 0x80), !!(b[12] & 0x40), !!(b[12] & 0x20),
- !!(b[12] & 0x10)); /* spc4r32 + 17-142r5 */
+ !!(b[12] & 0x10)); /* spc5r20 */
printf(" Maximum supported sense data length=%d\n", b[13]); /* spc4r34 */
printf(" IBS=%d IAS=%d SAC=%d NRD1=%d NRD0=%d\n", !!(b[14] & 0x80),
!!(b[14] & 0x40), !!(b[14] & 0x4), !!(b[14] & 0x2),
@@ -1320,7 +1320,7 @@ decode_x_inq_vpd(uint8_t * b, int len, int do_hex, bool do_long,
sg_get_unaligned_be16(b + 17)); /* spc5r17 */
printf(" DM_MD_4=%d DM_MD_5=%d DM_MD_6=%d DM_MD_7=%d\n",
!!(b[19] & 0x80), !!(b[19] & 0x40), !!(b[19] & 0x20),
- !!(b[19] & 0x10)); /* 17-142r5 */
+ !!(b[19] & 0x10)); /* spc5r20 */
printf(" DM_MD_D=%d DM_MD_E=%d DM_MD_F=%d\n",
!!(b[19] & 0x8), !!(b[19] & 0x4), !!(b[19] & 0x2));
}
@@ -1763,12 +1763,12 @@ static void
decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt,
int verbose)
{
- int j, k, m, bump, desc_type, desc_len, sa_len;
+ int j, k, m, bump, desc_type, desc_len, sa_len, blen;
unsigned int u;
const uint8_t * bp;
const char * cp;
uint64_t ull;
- char b[80];
+ char b[120];
if (len < 4) {
pr2serr("Third-party Copy VPD page length too short=%d\n", len);
@@ -1778,6 +1778,7 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt,
hex2stdout(buff, len, -1);
return;
}
+ blen = sizeof(b);
len -= 4;
bp = buff + 4;
for (k = 0; k < len; k += bump, bp += bump) {
@@ -1851,11 +1852,11 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt,
sa_len = bp[6 + j];
for (m = 0; (m < sa_len) && ((j + m) < csll); ++m) {
sg_get_opcode_sa_name(bp[5 + j], bp[7 + j + m],
- pdt, sizeof(b), b);
+ pdt, blen, b);
printf(" %s\n", b);
}
if (0 == sa_len) {
- sg_get_opcode_name(bp[5 + j], pdt, sizeof(b), b);
+ sg_get_opcode_name(bp[5 + j], pdt, blen, b);
printf(" %s\n", b);
} else if (m < sa_len)
pr2serr("Supported service actions list length (%d) "
@@ -1895,6 +1896,13 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt,
printf(" 0x%04x\n", u);
}
break;
+ case 0x000D:
+ printf(" Copy group identifier:\n");
+ u = bp[4];
+ sg_t10_uuid_desig2str(bp + 5, u, 1 /* c_set */, false,
+ false, NULL, blen, b);
+ printf("%s", b);
+ break;
case 0x0106:
printf(" ROD token features:\n");
printf(" Remote tokens: %d\n", bp[4] & 0x0f);