Home | History | Annotate | Download | only in atactl
History log of /src/sbin/atactl/atactl.c
RevisionDateAuthorComments
 1.86  23-Feb-2025  jakllsch atap_logical_align is already what we want, we don't have to subtract it
from the logical blocks per physical block number.
 1.85  20-Dec-2020  jmcneill Managment -> Management
 1.84  07-Dec-2020  mrg micron SMART 202 is percent lifetime used not remaining.

almost gave myself a heart attack when my server said 7% remaining!
 1.83  30-May-2019  mlelstv branches: 1.83.2;
Add support for ATA command pass-through to SCSI devices.
 1.82  03-Mar-2019  mrg - smart vendor support now does try to guess the vendor,
adjust the BUGS to suit
- claim some copyright
 1.81  03-Mar-2019  mrg add a samsung specific SMART table with:

235 - POR Recovery Count
243 - SATA Downshift Count
244 - Thermal Throttle Status
245 - Timed Workload Media Wear
251 - NAND Writes

all 5 turn up on newer samsung SSDs, though 3 of them all
read 65535 for me across muliplte devices.
 1.80  01-Mar-2019  mrg add some intel specific smart values, and be more specific for
a bunch of micron/crucial values.
 1.79  05-Dec-2018  mrg "smart status" already obtains the ata parameters to check if smart
is actually supported, so we can attempt to guess a vendor smart
table from the model name. add basic support for all the micron /
crucial disk names i could find, and add a couple more micron
specific values.

XXX: probably should add regex support for matching, and probably
should be more restrictive with the current matches.
 1.78  31-Oct-2018  mrg extend "smart status" command to "smart status [vendor]", and supply a
"Micron" (for Micron/Crucial) list with their documented values.

this allows the vendor-specific data to be used.

there appears to be no simple way to automatically determine the right
vendor to use -- identify data seems to be the only obvious way and
that data can be and is changed by OEMs. (eg, a disk may be listed as
being "dell", but dell don't make disks.) as such, no attempt is made
to automatically determine if a vendor list should be used.
 1.77  04-Oct-2016  mrg branches: 1.77.12; 1.77.14;
add SMART 249: Total Raw NAND Writes (1GiB units), sourced from
intel spec sheets.
 1.76  10-May-2016  mrg branches: 1.76.2;
update the micron smart codes for 247/248 to match data i found in
micron's "TN-FD-33: M510DC SSD SMART Implementation Introduction"
document.

these two values can be used to calculate the write amplication
factor:

WAF = ( A247 + A248 ) / A247
 1.75  21-Sep-2015  mrg add smart IDs 210, 246, 247 and 248 (Micron):
+ { 210, "Successful RAIN Recovery Count", NULL },
+ { 246, "Total Host Sector Writes", NULL },
+ { 247, "Contact Factory (Micron)", NULL },
+ { 248, "Contact Factory (Micron)", NULL },

(eek i hope 247 and 248 don't move.)
 1.74  15-Oct-2014  mrg add a whole bunch of S.M.A.R.T. status i found around various sources.

now nothing on my new SSD is unknown, except #249.
 1.73  09-Dec-2013  wiz branches: 1.73.4;
Fix typo ("then" instead of "than")
 1.72  30-Oct-2013  drochner -recognize CF cards by the magic value in inquiry data
-kill CFG_ATAPI_MASK, didn't see anything in the specs supporting
that it exists
 1.71  06-Aug-2013  soren TRIM showed up sometime between ATA-7 and ATA-8.
 1.70  03-Aug-2013  soren Don't use \t to align text columns.
Add a few attribute descriptions.
 1.69  08-Feb-2013  jakllsch Decode 6Gbps signaling SATA capability in IDENTIFY DEVICE data.
 1.68  09-Jan-2013  riastradh Add some ATA SECURITY commands to atactl(8).
 1.67  19-Oct-2012  drochner Implement experimental support to pass notifications that a file
was deleted from the filesystem to the disk driver, commonly
known as "discard" or "trim".
fs/driver support is in ffs and ata wd for now.
This is what was posted here:
http://mail-index.netbsd.org/tech-kern/2012/02/28/msg012813.html
with minor cleanup, and the global switch replaced by a mount option.
 1.66  31-Oct-2011  jakllsch branches: 1.66.2; 1.66.4; 1.66.8;
Constify structure pointed to by getataparams() return value.
 1.65  31-Oct-2011  jakllsch Remove write-only variable.
 1.64  31-Oct-2011  jakllsch Wrap or shorten lines longer than 80 columns.
 1.63  24-Oct-2011  jakllsch use C99 fixed-width integer types
 1.62  24-Oct-2011  jakllsch constify
 1.61  24-Oct-2011  jakllsch change lines containing only whitespace to empty lines,
remove trailing whitespace
 1.60  27-Aug-2011  joerg staticfy. Use __dead.
 1.59  19-Jan-2011  nisimura fix mislabelled S.M.A.R.T. lifetime temperature record reading.
 1.58  14-Jan-2011  nisimura fix a mysterious indent lossage roaming around for last couple of years.
 1.57  13-Mar-2010  mrg add SMART code 187: "Reported uncorrect". from smartmontools.
 1.56  25-Jan-2010  jakllsch Add display of Long Physical Sector and Long Logical Sectors feature set
information to atactl identify output.

Also:
- remove caddr_t cast
- warn about invalid IDENTIFY data checksum (when possible)
- humanize capacity in power-of-10 format
- remove semi-pointless ATAPI check
- slightly rework command queue depth output to be less conversational
 1.55  08-Jun-2009  jakllsch Improve "identify" output slightly:
- Capitialize "Name" in World Wide Name.
- Print the World Wide Name if it exists.
- Use LBA48 maximum address when available for "total sectors" output.
- So that geometry will display on more drives, don't be as strict when
checking for non-ATAPI devices. (This seemed to be an issue on at least
one instance of a Caviar SE16 drive.)
- Check more carefully for valid/relevant queue depth before printing it.
- Increment the queue depth by one for display.

While here, wrap some long lines that I should have had wrapped before they
were commited in rev. 1.46.
 1.54  06-Jun-2009  mlelstv make space for a trailing \0 in model,revision and serial buffers.
 1.53  16-Mar-2009  lukem fix sign-compare issues
 1.52  25-Aug-2008  dholland branches: 1.52.2; 1.52.4; 1.52.8;
Add two missing SMART attributes; PR 37967 from Henry Bent. Also add a
third I found while digging around, and fix one whose name was typoed.
 1.51  24-Jul-2008  dholland Fix this to not need -Wno-pointer-sign. Make it pass -Wsign-compare too,
while I'm at it.
 1.50  28-Apr-2008  martin branches: 1.50.2;
Remove clause 3 and 4 from TNF licenses
 1.49  15-Dec-2007  perry branches: 1.49.4; 1.49.6;
replace instances of __attribute__((__packed__)) with __packed
 1.48  18-Nov-2007  christos branches: 1.48.2;
From Marco Trillo (marcotrillo at gmail dot com):
Add Advanced power management in atactl(8)
 1.47  04-Nov-2007  xtraeme Fix typo in SATA features: Perservation -> Preservation.
 1.46  21-Aug-2007  bouyer branches: 1.46.2;
Improved SATA support, from Jonathan A. Kollasch in PR bin/36772:
* use full 5-bit command queue depth that SATA supports
* decode SATA bits
 1.45  16-Oct-2006  christos add missing initializers
 1.44  24-Sep-2006  xtraeme It's WDCC_SECURITY_FREEZE not WCDD_SECURITY_FREEZE.

Noticed by Sergey Svishchev.
 1.43  23-Sep-2006  xtraeme Do not print "SMART not supported" when SMART was disabled, this
fixes PR bin/18666.
 1.42  25-Feb-2006  wiz Fix some typos.
 1.41  29-Nov-2005  dbj fix byteswap of log revision structure check, improve error printout
 1.40  29-Nov-2005  dbj add newline termination on error message
 1.39  27-Jun-2005  christos Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
 1.38  12-Apr-2005  drochner Implement a "security" command with subcommands to query the status of
the "security" extension and to "freeze" it. With the security extension
frozen, disk passwords cannot be set anymore, until the next hard reset.
Normally, this is the business of the BIOS, but older/buggy/embedded
BIOSes don't care. This leaves the (theoretical) possibility that a
malicious program in posession of superuser rights sets a disk password,
rendering the disk useless (or at least uneconomical to recover from).
Inspired by an article in the german "ct" magazine.
Being here, consolidate the implementations of IDENTIFY into one, and
fix an obvious alignment problem.
 1.37  20-Jan-2005  xtraeme branches: 1.37.2;
Kill __P(), remove main() prototype; WARNS=2
 1.36  17-Jan-2005  dogcow Add missing SMART attribute (6, Read channel margin)
 1.35  17-Nov-2004  fvdl * don't swap the WDSMART_CYL value, it isn't needed
* swap the 16- and 32 bit fields of the SMART structures (where used)

Makes SMART commands work on big-endian systems.
 1.34  08-Oct-2004  soren Add offline command to usage() and man page.
 1.33  08-Oct-2004  mycroft Combine the listing of enabled/disabled features with the general listing of
features.
Add an "smart error-log" command to display the SMART error-log.
Add an "offline" command to run offline selftests.
 1.32  10-Sep-2004  atatat Add some more attribute "names", taken from

http://freepgs.com/smart/attributes.php

which gets them from smartmontools as maintained by Bruce Allen.

Note that some of these attributes should be "named" differently
depending on the drive (point for future work?), but at least now
there are names for some of the one that were missing them.
 1.31  10-Sep-2004  atatat White space police
 1.30  01-Aug-2004  bouyer Add infrastructure for ATA bus commands, and implement the reset bus command.
 1.29  28-Mar-2004  mycroft Print the raw SMART values always. These are important in a bunch of cases --
e.g. for the load cycle count and power-cycle count.

Also, consistently treat the raw values as unsigned.
 1.28  14-Mar-2004  wiz It's extension, not extention. From Miod Vallat (miod at online fr).
 1.27  05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.26  30-Dec-2003  thorpej No longer need to include <dev/ic/wdcreg.h>
 1.25  30-Dec-2003  thorpej Don't need to include atavar.h
 1.24  20-Dec-2003  lha Extend SMART status to print temperature. Add support for printing
selftest log (but no code it start selftest yet).
 1.23  30-Nov-2003  yamt display more capabilities for "identify" command.
 1.22  21-Oct-2003  fvdl Fix various uses of NULL that should have been 0.
 1.21  23-Jun-2003  agc Add NetBSD RCS Ids.
 1.20  13-Sep-2002  mycroft Allow the enable command if SMART is not enabled. Duh.
Also, just blindly allow the disable command.
 1.19  15-Aug-2002  soren Typo.
 1.18  15-Aug-2002  mycroft Correct the check for whether SMART is enabled.
 1.17  06-Aug-2002  soren Print symbolic names for SMART STATUS attributes.
 1.16  06-Aug-2002  soren s/smart info/smart status/ to better fit in with the standard's feature set.
 1.15  05-Aug-2002  soren Add ATA SMART reporting support from Ben Collver in kern/12787.
 1.14  07-Sep-2001  simonb Use the command set/feature *enabled* words when displaying what
command sets and features are enabled.
 1.13  07-Sep-2001  simonb ANSIfy.
 1.12  28-Aug-2001  ad errx() prints the newline for you.
 1.11  19-Feb-2001  cgd convert to use getprogname()
 1.10  10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.9  13-Jul-2000  ad Back out previous two - didn't follow the code properly.
 1.8  13-Jul-2000  ad Fix previous. From Micheal Eriksson <eramore@era-t.ericsson.se>.
 1.7  06-Jul-2000  ad printf fmt string without %s, from OpenBSD.
 1.6  01-Nov-1999  soren branches: 1.6.6;
Fix typo.
 1.5  29-Oct-1999  soren Sync with scsictl: rearrange usage() and print list of commands.
 1.4  24-Feb-1999  jwise branches: 1.4.2; 1.4.4;
Code to check for cooked device names was failing even if it succeeded in
opening the cooked device. Also some typos.

Fixes part of PR bin/6883 from Soren S. Jorvang.
 1.3  23-Nov-1998  kenh Implement a new command: "checkpower". Returns the current power management
mode of an ATA device.
 1.2  20-Nov-1998  kenh Fix a warning that shows up on big-endian machines.
 1.1  19-Nov-1998  kenh wdctl -> atactl
 1.4.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.1  10-Oct-2000  he Pull up revision 1.10 (requested by is):
Format string cleanup.
 1.6.6.1  18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.37.2.1  15-Apr-2005  tron Pull up revision 1.38 (requested by drochner in ticket #156):
Implement a "security" command with subcommands to query the status of
the "security" extension and to "freeze" it. With the security extension
frozen, disk passwords cannot be set anymore, until the next hard reset.
Normally, this is the business of the BIOS, but older/buggy/embedded
BIOSes don't care. This leaves the (theoretical) possibility that a
malicious program in posession of superuser rights sets a disk password,
rendering the disk useless (or at least uneconomical to recover from).
Inspired by an article in the german "ct" magazine.
Being here, consolidate the implementations of IDENTIFY into one, and
fix an obvious alignment problem.
 1.46.2.2  09-Jan-2008  matt sync with HEAD
 1.46.2.1  06-Nov-2007  matt sync with HEAD
 1.48.2.1  27-Dec-2007  mjf Sync with HEAD.
 1.49.6.1  18-May-2008  yamt sync with head.
 1.49.4.2  28-Sep-2008  mjf Sync with HEAD.
 1.49.4.1  02-Jun-2008  mjf Sync with HEAD.
 1.50.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.52.8.1  21-Apr-2010  matt sync to netbsd-5
 1.52.4.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.52.2.1  06-Jun-2009  bouyer Pull up following revision(s) (requested by mlelstv in ticket #794):
sbin/atactl/atactl.c: revision 1.54
make space for a trailing \0 in model,revision and serial buffers.
 1.66.8.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.66.8.2  25-Feb-2013  tls resync with head
 1.66.8.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.66.4.2  07-Dec-2014  martin Pull up following revision(s) (requested by mrg in ticket #1206):
sbin/atactl/atactl.c: revision 1.70 and 1.74

Don't use \t to align text columns.
Add a few attribute descriptions.
Add various S.M.A.R.T. status attributes.
 1.66.4.1  18-Feb-2013  riz Pull up following revision(s) (requested by jakllsch in ticket #830):
sbin/atactl/atactl.c: revision 1.69
Decode 6Gbps signaling SATA capability in IDENTIFY DEVICE data.
 1.66.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.66.2.2  23-Jan-2013  yamt sync with head
 1.66.2.1  30-Oct-2012  yamt sync with head
 1.73.4.1  09-Nov-2014  snj Pull up following revision(s) (requested by mrg in ticket #196):
sbin/atactl/atactl.c: revision 1.74
add a whole bunch of S.M.A.R.T. status i found around various sources.
now nothing on my new SSD is unknown, except #249.
 1.76.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.77.14.1  10-Jun-2019  christos Sync with HEAD
 1.77.12.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.77.12.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.83.2.1  12-Dec-2020  martin Pull up following revision(s) (requested by mrg in ticket #1148):

sbin/atactl/atactl.c: revision 1.84

micron SMART 202 is percent lifetime used not remaining.

almost gave myself a heart attack when my server said 7% remaining!

RSS XML Feed