ataidentify.cpp, ataprint.cpp: ACS-5 enhancements.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5227 4ea69e1a-61f1-4043-bf83-b5c94c648137
pull/99/head
chrfranke 1 year ago
parent ef538865d3
commit e0d56b2314
  1. 2
      smartmontools/ChangeLog
  2. 21
      smartmontools/ataidentify.cpp
  3. 72
      smartmontools/ataprint.cpp

@ -2,6 +2,8 @@ $Id$
2021-06-26 Christian Franke <franke@computer.org>
ataidentify.cpp, ataprint.cpp: ACS-5 enhancements.
ataprint.cpp: Don't set bit 2 of exit status if ATA output registers
are missing but attributes are available (#1441, GH issues/98).

@ -1,9 +1,9 @@
/*
* ataidentify.cpp
*
* Home page of code is: http://www.smartmontools.org
* Home page of code is: https://www.smartmontools.org
*
* Copyright (C) 2012-18 Christian Franke
* Copyright (C) 2012-21 Christian Franke
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
@ -30,6 +30,7 @@ const char * ataidentify_cpp_cvsid = "$Id$"
// Tables 50 and 61 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
// Tables 45 and 50 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 55 of T13/BSR INCITS 529 (ACS-4) Revision 20, October 26, 2017 (ATAPI removed)
// Table 57 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
const char * const identify_descriptions[] = {
" 0 General configuration",
@ -113,7 +114,7 @@ const char * const identify_descriptions[] = {
". 14 OVERWRITE EXT supported",
". 13 CRYPTO SCRAMBLE EXT supported",
". 12 Sanitize Device feature set supported",
". 11 Cmds during sanitize as specified by this standard", // ACS-3
". 11 Cmds during sanitize are as specified by ACS-3", // ACS-3
". 10 SANITIZE ANTIFREEZE LOCK EXT supported", // ACS-3
". 9 Reserved",
". 8 Bits 7:0 are valid [OBS-ACS-4]",
@ -157,7 +158,7 @@ const char * const identify_descriptions[] = {
". 4 Device encrypts all user data",
". 3 Extended number of user addressable sectors supported",
". 2 All write cache is non-volatile", // ACS-3
". 1:0 Zoned Capabilities", // ACS-4
". 1:0 Zoned Capabilities [OBS-ACS-5]", // ACS-4
" 70 Reserved",
" 71-74 ATA: Reserved for IDENTIFY PACKET DEVICE",
@ -185,7 +186,8 @@ const char * const identify_descriptions[] = {
". 0 Must be set to 0",
" 77 Serial ATA additional capabilities", // ACS-3
". 15:9 Reserved for Serial ATA",
". 15:10 Reserved for Serial ATA",
". 9 Out Of Band Management supported", // ACS-5
". 8 Power Disable feature always enabled", // ACS-4
". 7 DevSleep to ReducedPwrState supported", // ACS-4
". 6 RECEIVE/SEND FPDMA QUEUED supported",
@ -226,7 +228,8 @@ const char * const identify_descriptions[] = {
". 0 Must be set to 0",
" 80 Major version number",
". 15:12 Reserved",
". 15:13 Reserved",
". 12 ACS-5 supported",
". 11 ACS-4 supported",
". 10 ACS-3 supported",
". 9 ACS-2 supported",
@ -390,7 +393,7 @@ const char * const identify_descriptions[] = {
". 4 Device 0 detected the assertion of PDIAG-",
". 3 Device 0 passed diagnostics",
". 2:1 Device 0 detection method: -, Jumper, CSEL, other",
". 0 Must be set to 1",
". 0 Must be set to 1 for PATA devices",
" 94 AAM level [OBS-ACS-2]",
". 15:8 Recommended AAM level [OBS-ACS-2]",
@ -533,7 +536,9 @@ const char * const identify_descriptions[] = {
"222 Transport major version number",
". 15:12 Transport: 0x0 = Parallel, 0x1 = Serial, 0xe = PCIe", // PCIe: ACS-4
". 11:9 Reserved | Reserved",
". 11 Reserved | Reserved",
". 10 Reserved | SATA 3.5", // ACS-5
". 9 Reserved | SATA 3.4", // ACS-5
". 8 Reserved | SATA 3.3", // ACS-4
". 7 Reserved | SATA 3.2", // ACS-4
". 6 Reserved | SATA 3.1", // ACS-3

@ -405,8 +405,9 @@ static inline std::string format_st_er_desc(
static const char * get_form_factor(unsigned short word168)
{
// Bits 0:3 are the form factor
// Table A.32 of T13/2161-D (ACS-3) Revision 4p, September 19, 2013
// Table 236 of T13/BSR INCITS 529 (ACS-4) Revision 04, August 25, 2014
// Table A.32 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 247 of T13/BSR INCITS 529 (ACS-4) Revision 20, October 26, 2017
// Table 254 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (word168 & 0xF) {
case 0x1: return "5.25 inches";
case 0x2: return "3.5 inches";
@ -434,8 +435,9 @@ static const char * get_ata_major_version(const ata_identify_device * drive)
// Table 13 of T13/1153D (ATA/ATAPI-4) revision 18, August 19, 1998
// Table 29 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Table 55 of T13/BSR INCITS 529 (ACS-4) Revision 20, October 26, 2017
// Table 55 of T13/BSR INCITS 558 (ACS-5) Revision 1c, June 11, 2019
// Table 57 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (find_msb(drive->major_rev_num)) {
case 15: return "ACS >5 (15)";
case 14: return "ACS >5 (14)";
case 13: return "ACS >5 (13)";
case 12: return "ACS-5";
@ -459,8 +461,10 @@ static const char * get_ata_minor_version(const ata_identify_device * drive)
// Table 10 of X3T13/2008D (ATA-3) Revision 7b, January 27, 1997
// Table 28 of T13/1410D (ATA/ATAPI-6) Revision 3b, February 26, 2002
// Table 31 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Table 52 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
// Table 47 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 57 of T13/BSR INCITS 529 (ACS-4) Revision 20, October 26, 2017
// Table 57 of T13/BSR INCITS 558 (ACS-5) Revision 1c, June 11, 2019
// Table 59 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (drive->minor_rev_num) {
case 0x0001: return "ATA-1 X3T9.2/781D prior to revision 4";
case 0x0002: return "ATA-1 published, ANSI X3.221-1994";
@ -533,6 +537,8 @@ static const char * get_ata_minor_version(const ata_identify_device * drive)
static const char * get_pata_version(unsigned short word222, char (& buf)[32])
{
// Table 29 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Table 57 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (word222 & 0x0fff) {
default: snprintf(buf, sizeof(buf),
"Unknown (0x%03x)", word222 & 0x0fff); return buf;
@ -544,14 +550,19 @@ static const char * get_pata_version(unsigned short word222, char (& buf)[32])
static const char * get_sata_version(unsigned short word222)
{
// Table 29 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Table 50 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
// Table 45 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 55 of T13/BSR INCITS 529 (ACS-4) Revision 20, October 26, 2017
// Table 57 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (find_msb(word222 & 0x0fff)) {
case 11: return "SATA >3.3 (11)";
case 10: return "SATA >3.3 (10)";
case 9: return "SATA >3.3 (9)";
case 8: return "SATA 3.3";
case 7: return "SATA 3.2";
case 6: return "SATA 3.1";
case 5: return "SATA 3.0";
case 11: return "SATA >3.5 (11)";
case 10: return "SATA 3.5"; // ACS-5
case 9: return "SATA 3.4"; // ACS-5
case 8: return "SATA 3.3"; // ACS-4
case 7: return "SATA 3.2"; // ACS-4
case 6: return "SATA 3.1"; // ACS-3
case 5: return "SATA 3.0"; // ACS-2
case 4: return "SATA 2.6";
case 3: return "SATA 2.5";
case 2: return "SATA II Ext";
@ -565,14 +576,18 @@ static const char * get_sata_speed(int speed)
{
if (speed <= 0)
return 0;
// Table 29 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Table 50 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
// Table 45 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 57 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (speed) {
default: return ">6.0 Gb/s (7)";
case 6: return ">6.0 Gb/s (6)";
case 5: return ">6.0 Gb/s (5)";
case 4: return ">6.0 Gb/s (4)";
case 3: return "6.0 Gb/s";
case 3: return "6.0 Gb/s"; // ACS-3
case 2: return "3.0 Gb/s";
case 1: return "1.5 Gb/s";
case 1: return "1.5 Gb/s"; // ATA8-ACS
}
}
@ -729,6 +744,7 @@ static void print_drive_info(const ata_identify_device * drive,
}
// Print Zoned Device Capabilites if reported
// (added in ACS-4, obsoleted in ACS-5)
unsigned short zoned_caps = word069 & 0x3;
if (zoned_caps) {
jout("Zoned Device: %s\n",
@ -1404,7 +1420,8 @@ static const char * GetLogName(unsigned logaddr)
// Table A.2 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
// Table 112 of Serial ATA Revision 3.2, August 7, 2013
// Table A.2 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 204 of T13/BSR INCITS 529 (ACS-4) Revision 16, February 21, 2017
// Table 213 of T13/BSR INCITS 529 (ACS-4) Revision 20, October 26, 2017
// Table 213 of T13/BSR INCITS 558 (ACS-5) Revision 10, March 3, 2021
switch (logaddr) {
case 0x00: return "Log Directory";
case 0x01: return "Summary SMART error log";
@ -1412,8 +1429,8 @@ static const char * GetLogName(unsigned logaddr)
case 0x03: return "Ext. Comprehensive SMART error log";
case 0x04: return "Device Statistics log";
case 0x05: return "Reserved for CFA"; // ACS-2
case 0x06: return "SMART self-test log";
case 0x07: return "Extended self-test log";
case 0x06: return "SMART self-test log"; // OBS-ACS-5
case 0x07: return "Extended self-test log"; // OBS-ACS-5
case 0x08: return "Power Conditions log"; // ACS-2
case 0x09: return "Selective self-test log";
case 0x0a: return "Device Statistics Notification"; // ACS-3
@ -1429,9 +1446,9 @@ static const char * GetLogName(unsigned logaddr)
case 0x13: return "SATA NCQ Send and Receive log"; // SATA 3.1, ACS-3
case 0x14: return "Hybrid Information log"; // SATA 3.2, ACS-4
case 0x15: return "Rebuild Assist log"; // SATA 3.2, ACS-4
case 0x16:
case 0x16: return "Out Of Band Management Control log"; // ACS-5
case 0x17: return "Reserved for Serial ATA";
case 0x18: return "Command Duration Limits log"; // ACS-5
case 0x19: return "LBA Status log"; // ACS-3
case 0x20: return "Streaming performance log [OBS-8]";
@ -1441,9 +1458,15 @@ static const char * GetLogName(unsigned logaddr)
case 0x24: return "Current Device Internal Status Data log"; // ACS-3
case 0x25: return "Saved Device Internal Status Data log"; // ACS-3
case 0x2f: return "Set Sector Configuration";; // ACS-4
case 0x2f: return "Set Sector Configuration"; // ACS-4
case 0x30: return "IDENTIFY DEVICE data log"; // ACS-3
case 0x42: return "Mutate Configurations log"; // ACS-5
case 0x47: return "Concurrent Positioning Ranges log"; // ACS-5
case 0x53: return "Sense Data log"; // ACS-5
case 0xe0: return "SCT Command/Status";
case 0xe1: return "SCT Data Transfer";
default:
@ -1464,11 +1487,15 @@ static const char * get_log_rw(unsigned logaddr)
|| (0x0f <= logaddr && logaddr <= 0x14)
|| (0x19 == logaddr)
|| (0x20 <= logaddr && logaddr <= 0x25)
|| (0x30 == logaddr))
|| (0x30 == logaddr)
|| (0x42 == logaddr)
|| (0x47 == logaddr)
|| (0x53 == logaddr))
return "R/O";
if ( (0x09 <= logaddr && logaddr <= 0x0a)
|| (0x15 == logaddr)
if ( ( logaddr <= 0x0a)
|| (0x15 <= logaddr && logaddr <= 0x16)
|| (0x18 == logaddr)
|| (0x80 <= logaddr && logaddr <= 0x9f)
|| (0xe0 <= logaddr && logaddr <= 0xe1))
return "R/W";
@ -1714,6 +1741,7 @@ const devstat_entry_info * devstat_infos[] = {
devstat_info_0x06,
devstat_info_0x07
// TODO: 0x08 Zoned Device Statistics (T13/f16136r7, January 2017)
// TODO: 0x09 Command Duration Limits Statistics (ACS-5 Revision 10, March 2021)
};
const int num_devstat_infos = sizeof(devstat_infos)/sizeof(devstat_infos[0]);

Loading…
Cancel
Save