#define GBUF_SIZE 65535
-const char * scsiprint_c_cvsid = "$Id: scsiprint.cpp 3807 2013-04-18 17:11:12Z chrfranke $"
+const char * scsiprint_c_cvsid = "$Id: scsiprint.cpp 4040 2015-03-10 22:30:44Z dpgilbert $"
SCSIPRINT_H_CVSID;
return;
} else
got_rd12 = 0;
- } else {
+ } else if (101 == err) /* Defect list not found, leave quietly */
+ return;
+ else {
if (scsi_debugmode > 0) {
print_on();
pout("Read defect list (12) Failed: %s\n", scsiErrString(err));
ull <<= 8;
ull |= xp[j];
}
- pout(" = %"PRIu64"\n", ull);
+ pout(" = %" PRIu64 "\n", ull);
num -= pl;
ucp += pl;
}
if (0 == pc)
pout(" = %.2f\n", ull / 60.0 );
else
- pout(" = %"PRIu64"\n", ull);
+ pout(" = %" PRIu64 "\n", ull);
}
num -= pl;
ucp += pl;
if (! found[k])
continue;
ecp = &errCounterArr[k];
- pout("%s%8"PRIu64" %8"PRIu64" %8"PRIu64" %8"PRIu64" %8"PRIu64,
+ pout("%s%8" PRIu64 " %8" PRIu64 " %8" PRIu64 " %8" PRIu64 " %8" PRIu64,
pageNames[k], ecp->counter[0], ecp->counter[1],
ecp->counter[2], ecp->counter[3], ecp->counter[4]);
processed_gb = ecp->counter[5] / 1000000000.0;
- pout(" %12.3f %8"PRIu64"\n", processed_gb, ecp->counter[6]);
+ pout(" %12.3f %8" PRIu64 "\n", processed_gb, ecp->counter[6]);
}
}
else
NON_MEDIUM_ERROR_LPAGE, 0, gBuf, LOG_RESP_LEN, 0))) {
scsiDecodeNonMediumErrPage(gBuf, &nme);
if (nme.gotPC0)
- pout("\nNon-medium error count: %8"PRIu64"\n", nme.counterPC0);
+ pout("\nNon-medium error count: %8" PRIu64 "\n", nme.counterPC0);
if (nme.gotTFE_H)
- pout("Track following error count [Hitachi]: %8"PRIu64"\n",
+ pout("Track following error count [Hitachi]: %8" PRIu64 "\n",
nme.counterTFE_H);
if (nme.gotPE_H)
- pout("Positioning error count [Hitachi]: %8"PRIu64"\n",
+ pout("Positioning error count [Hitachi]: %8" PRIu64 "\n",
nme.counterPE_H);
}
if (gLastNErrorLPage && (0 == scsiLogSense(device,
char buff[32];
// was hex but change to decimal to conform with ATA
- snprintf(buff, sizeof(buff), "%"PRIu64, ull);
- // snprintf(buff, sizeof(buff), "0x%"PRIx64, ull);
+ snprintf(buff, sizeof(buff), "%" PRIu64, ull);
+ // snprintf(buff, sizeof(buff), "0x%" PRIx64, ull);
pout("%18s", buff);
} else
pout(" -");
else
if ((0 == scsiFetchExtendedSelfTestTime(device, &durationSec,
modese_len)) && (durationSec > 0)) {
- pout("Long (extended) Self Test duration: %d seconds "
+ pout("\nLong (extended) Self Test duration: %d seconds "
"[%.1f minutes]\n", durationSec, durationSec / 60.0);
}
pout("\n");
case 1:
if (pl < 8) {
print_on();
- pout("Percentage used endurance indicator too short (pl=%d)\n", pl);
+ pout("SS Media Percentage used endurance indicator parameter "
+ "too short (pl=%d)\n", pl);
print_off();
return FAILSMART;
}
- pout("SS Media used endurance indicator: %d%%\n", ucp[7]);
+ pout("Percentage used endurance indicator: %d%%\n", ucp[7]);
default: /* ignore other parameter codes */
break;
}
t = ((0x70 & vcp[4]) >> 4);
switch (t) {
case 0: snprintf(s, sz, "no device attached"); break;
- case 1: snprintf(s, sz, "end device"); break;
+ case 1: snprintf(s, sz, "SAS or SATA device"); break;
case 2: snprintf(s, sz, "expander device"); break;
case 3: snprintf(s, sz, "expander device (fanout)"); break;
default: snprintf(s, sz, "reserved [%d]", t); break;
case 8: snprintf(s, sz, "phy enabled; 1.5 Gbps"); break;
case 9: snprintf(s, sz, "phy enabled; 3 Gbps"); break;
case 0xa: snprintf(s, sz, "phy enabled; 6 Gbps"); break;
+ case 0xb: snprintf(s, sz, "phy enabled; 12 Gbps"); break;
default: snprintf(s, sz, "reserved [%d]", t); break;
}
pout(" negotiated logical link rate: %s\n", s);
}
-// See Serial Attached SCSI (SAS-2) (e.g. revision 16) the Protocol Specific
-// log pageSerial Attached SCSI (SAS-2) (e.g. revision 16) the Protocol
-// Specific log page.
-// Returns 0 if ok else FAIL* bitmask. Note that if any of the most recent
-// 20 self tests fail (result code 3 to 7 inclusive) then FAILLOG and/or
-// FAILSMART is returned.
+// See Serial Attached SCSI (SPL-3) (e.g. revision 6g) the Protocol Specific
+// log page [0x18]. Returns 0 if ok else FAIL* bitmask.
static int
scsiPrintSasPhy(scsi_device * device, int reset)
{
"enclosure",
"simplified disk",
"optical card reader"
+ "reserved [0x10]"
+ "object based storage"
+ "automation/driver interface"
+ "security manager device"
+ "host managed zoned block device"
+ "reserved [0x15]"
+ "reserved [0x16]"
+ "reserved [0x17]"
+ "reserved [0x18]"
+ "reserved [0x19]"
+ "reserved [0x1a]"
+ "reserved [0x1b]"
+ "reserved [0x1c]"
+ "reserved [0x1d]"
+ "well known logical unit"
+ "unknown or no device type"
};
static const char * transport_proto_arr[] = {
"IEEE 1394 (SBP-2)",
"RDMA (SRP)",
"iSCSI",
- "SAS",
+ "SAS (SPL-3)",
"ADT",
- "0x8",
- "0x9",
- "0xa",
+ "ATA (ACS-2)",
+ "UAS",
+ "SOP",
"0xb",
"0xc",
"0xd",
{
char timedatetz[DATEANDEPOCHLEN];
struct scsi_iec_mode_page iec;
- int err, iec_err, len, req_len, avail_len, n;
+ int err, iec_err, len, req_len, avail_len, n, scsi_version;
int is_tape = 0;
int peri_dt = 0;
int returnval = 0;
int transport = -1;
int form_factor = 0;
+ int haw_zbc = 0;
int protect = 0;
memset(gBuf, 0, 96);
print_off();
return 1;
}
+ // Upper bits of version bytes were used in older standards
+ // Only interested in SPC-4 (0x6) and SPC-5 (assumed to be 0x7)
+ scsi_version = gBuf[2] & 0x7;
if (all && (0 != strncmp((char *)&gBuf[8], "ATA", 3))) {
char vendor[8+1], product[16+1], revision[4+1];
pout("Product: %.16s\n", product);
if (gBuf[32] >= ' ')
pout("Revision: %.4s\n", revision);
+ if (scsi_version == 0x6)
+ pout("Compliance: SPC-4\n");
+ else if (scsi_version == 0x7)
+ pout("Compliance: SPC-5\n");
}
if (!*device->get_req_type()/*no type requested*/ &&
(lb_size * (1 << lb_per_pb_exp)));
pout("Physical block size: %s bytes\n", lb_str);
n = ((rc16_12[2] & 0x3f) << 8) + rc16_12[3];
- pout("Lowest aligned LBA: %d\n", n);
+ if (n > 0) // not common so cut the clutter
+ pout("Lowest aligned LBA: %d\n", n);
}
if (rc16_12[0] & 0x1) { /* PROT_EN set */
int p_type = ((rc16_12[0] >> 1) & 0x7);
lbprz = !! (lb_prov_resp[5] & 0x4);
switch (prov_type) {
case 0:
- pout("Logical block provisioning type unreported, "
- "LBPME=%d, LBPRZ=%d\n", lbpme, lbprz);
+ pout("LB provisioning type: unreported, LBPME=%d, LBPRZ=%d\n",
+ lbpme, lbprz);
break;
case 1:
pout("LU is resource provisioned, LBPRZ=%d\n", lbprz);
} else if (1 == lbpme)
pout("Logical block provisioning enabled, LBPRZ=%d\n", lbprz);
- int rpm = scsiGetRPM(device, modese_len, &form_factor);
- if (rpm > 0) {
- if (1 == rpm)
+ int rpm = scsiGetRPM(device, modese_len, &form_factor, &haw_zbc);
+ if (rpm >= 0) {
+ if (0 == rpm)
+ ; // Not reported
+ else if (1 == rpm)
pout("Rotation Rate: Solid State Device\n");
+ else if ((rpm <= 0x400) || (0xffff == rpm))
+ ; // Reserved
else
pout("Rotation Rate: %d rpm\n", rpm);
}
if (cp)
pout("Form Factor: %s inches\n", cp);
}
+ if (haw_zbc > 0)
+ pout("Host aware zoned block capable\n");
}
/* Do this here to try and detect badly conforming devices (some USB
pout("Self Test returned without error\n");
any_output = true;
}
- if (options.sasphy) {
+ if (options.sasphy && gProtocolSpecificLPage) {
if (scsiPrintSasPhy(device, options.sasphy_reset))
return returnval | FAILSMART;
any_output = true;