aboutsummaryrefslogtreecommitdiff
path: root/sbin/nvmecontrol
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement {io,admin}-passthru commands.Warner Losh2019-07-161-0/+273
| | | | | | | | | | | | | | | | | These are mostly compatible with Linux, with three exceptions. 1. We don't do metadata segment stuff. Our passthrough interface doesn't cope. The code is there, but generates an error. 2. Linux lets you specify a namespace ID for the command. We current do not: we get ours from the namespace device, or pass in a generic one. Generally, this will lead to the same command, but FreeBSD's is safer since you can't specify the wrong id. 3. --show-command outputs to stderr instead of stdout so you can both see your command, and capture its output with a simple redirect. Differential Revision: https://reviews.freebsd.org/D19296 Notes: svn path=/head/; revision=350058
* Create generic command / arg parsing routinesWarner Losh2019-07-1615-813/+1267
| | | | | | | | | | | | | | | | | | | | | Create a set of routines and structures to hold the data for the args for a command. Use them to generate help and to parse args. Convert all the current commands over to the new format. "comnd" is a hat-tip to the TOPS-20 %COMND JSYS that (very) loosely inspired much of the subsequent command line notions in the industry, but this is far simpler (the %COMND man page is longer than this code) and not in the kernel... Also, it implements today's de-facto command [verb]+ [opts]* [args]* format rather than the old, archaic TOPS-20 command format :) This is a snapshot of a work in progress to get the nvme passthru stuff committed. In time it will become a private library and used by some other programs in the tree that conform to the above pattern. Differential Revision: https://reviews.freebsd.org/D19296 Notes: svn path=/head/; revision=350057
* Better formatting for the logpage sectionScott Long2019-05-171-6/+20
| | | | Notes: svn path=/head/; revision=347939
* Decode Deallocate Logical Block Features.Alexander Motin2019-05-051-1/+11
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=347158
* Add SPDX tag.Warner Losh2019-02-281-0/+2
| | | | Notes: svn path=/head/; revision=344653
* Rework logpage extensibility.Warner Losh2019-02-223-27/+29
| | | | | | | | | | | | | Move from using a linker set to a constructor function that's called. This simplifies the code and is slightly more obvious. We now keep a list of page decoders rather than having an array we managed before. Commands will move to something similar in the future. Reviewed by: jhb@ Differential Revision: https://reviews.freebsd.org/D19275 Notes: svn path=/head/; revision=344469
* Remove write-only s_flag.Warner Losh2019-02-161-3/+2
| | | | Notes: svn path=/head/; revision=344191
* Regularize the Netflix copyrightWarner Losh2019-02-045-8/+5
| | | | | | | | | | | | | | | Use recent best practices for Copyright form at the top of the license: 1. Remove all the All Rights Reserved clauses on our stuff. Where we piggybacked others, use a separate line to make things clear. 2. Use "Netflix, Inc." everywhere. 3. Use a single line for the copyright for grep friendliness. 4. Use date ranges in all places for our stuff. Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files) Notes: svn path=/head/; revision=343755
* Try the first 256 units with nvmecontrol devlist.Warner Losh2018-12-211-8/+8
| | | | | | | | | | | | The nvmecontrol code that did the devlist assumed that we had a tightly-packed allocation of units. Since pci writing exists, this isn't the case. Loop over the first 256 units, which is a reasonable number of possible units. Sponsored by: Netflix Notes: svn path=/head/; revision=342358
* Update paths based on last-minute changes from libexec to lib.Warner Losh2018-12-061-2/+2
| | | | Notes: svn path=/head/; revision=341664
* Declare global function print_intel_add_smart in headerWarner Losh2018-12-061-0/+1
| | | | Notes: svn path=/head/; revision=341663
* Use proper prototypes.Warner Losh2018-12-061-2/+2
| | | | Notes: svn path=/head/; revision=341662
* It's useful to have this be a global function.Warner Losh2018-12-061-1/+1
| | | | | | | | | | Other vendors base their additional smart info pages on what Intel did plus some other bits. So it's convenient to have this be global. Sponsored by: Netflix Notes: svn path=/head/; revision=341661
* This is not a samsung standard, so remove that alias.Warner Losh2018-12-061-4/+1
| | | | | | | | | | | This was never documented, and isn't needed, so it's best removed to avoid confusion. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18460 Notes: svn path=/head/; revision=341660
* Move intel and wdc files to their own modulesWarner Losh2018-12-067-1/+31
| | | | | | | | | | Move the intel and wdc vendor specific stuff to their own modules. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18460 Notes: svn path=/head/; revision=341659
* Const poison the command interfaceWarner Losh2018-12-0612-39/+41
| | | | | | | | | | | | Make the pointers we pass into the commands const, also make the linker set mirrors const. Suggested by: cem@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18459 Notes: svn path=/head/; revision=341658
* Dynamically load .so modules to expand functionalityWarner Losh2018-12-067-13/+134
| | | | | | | | | | | | | | | | | | | | o Dynamically load all the .so files found in /libexec/nvmecontrol and /usr/local/libexec/nvmecontrol. o Link nvmecontrol -rdynamic so that its symbols are visible to the libraries we load. o Create concatinated linker sets that we dynamically expand. o Add the linked-in top and logpage linker sets to the mirrors for them and add those sets to the mirrors when we load a new .so. o Add some macros to help hide the names of the linker sets. o Update the man page. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18455 fold Notes: svn path=/head/; revision=341657
* Fix typo in commentWarner Losh2018-12-021-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=341416
* Delete the undocumented alias 'wds'.Warner Losh2018-12-021-3/+0
| | | | | | | | | | | | This was a typo for wdc. Eliminate it since it was in error. People should use either 'wdc' or 'hgst' for the vendor from now on. 'hgst' works for all versions this functionality is present for. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341415
* Move Intel specific log pages to intel.cWarner Losh2018-12-024-151/+202
| | | | | | | | | | | | Move the Intel specific log pages (including the one that samsung implements) to intel.c. Add comment to the samsung vendor that it will be going away soon. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341414
* Usage cleanup pt 2Warner Losh2018-12-0211-20/+37
| | | | | | | | | | | | | Eliminage redundant spaces and nvmecontrol at start of all the usage strings. Update the usage printing code to add them back when presenting to the user. Allow multi-line usage messages and print proper leading spaces for lines starting with a space. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341413
* Usage cleanup pt 1Warner Losh2018-12-0212-183/+96
| | | | | | | | | | | | | Provide a usage() function that takes a struct nvme_function pointer and produces a usage mssage. Eliminate all now-redundant usage functions. Propigate the new argument through the program as needed. Use common routine to print usage. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341412
* Return after we find the dispatched function.Warner Losh2018-12-021-1/+3
| | | | | | | | | | | | If the dispatched function doesn't exit, then we get can get a spurious function not found message. They all do exit, but this is a little cleaner. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341411
* Move the hgst/wdc log page printing code into wdc.cWarner Losh2018-12-022-408/+408
| | | | | | | | | | | These are all hgst/wdc specific, so move them into the wdc.c to live with the wdc command. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341410
* Move common logpage routines into nvmecontrol.hWarner Losh2018-12-022-8/+9
| | | | | | | | | | | | For the upcoming move of vendor specific code into vendor specific files, make the common logpage routines global and move them to nvmecontrol.h. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341409
* Make logpage functions a linker set.Warner Losh2018-12-022-45/+67
| | | | | | | | | | | | Move logpage function def to header. Convert all the logpage_function elements to elements of the linker set. Leave them all in logpage.c for the moment. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341408
* Move nvmecontrol to using linker sets for commandsWarner Losh2018-12-0212-96/+103
| | | | | | | | | | | | | | | | | More commands will be added to nvmecontrol. Also, there will be a few more vendor commands (some of which may need to remain private to companies writing them). The first step on that journey is to move to using linker sets to dispatch commands. The next step will be using dlopen to bring in the .so's that have the command that might need to remain private for seamless integration. Similar changes to this will be needed for vendor specific log pages. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341407
* Fix typoWarner Losh2018-10-201-0/+2
| | | | | | | | | | The vendor name wds should have been wdc. Add wdc and keep the wds for script compat. MFC after: 3 days Notes: svn path=/head/; revision=339493
* Make NVMe compatible with the original APIChuck Tuffli2018-08-227-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | The original NVMe API used bit-fields to represent fields in data structures defined by the specification (e.g. the op-code in the command data structure). The implementation targeted x86_64 processors and defined the bit fields for little endian dwords (i.e. 32 bits). This approach does not work as-is for big endian architectures and was changed to use a combination of bit shifts and masks to support PowerPC. Unfortunately, this changed the NVMe API and forces #ifdef's based on the OS revision level in user space code. This change reverts to something that looks like the original API, but it uses bytes instead of bit-fields inside the packed command structure. As a bonus, this works as-is for both big and little endian CPU architectures. Bump __FreeBSD_version to 1200081 due to API change Reviewed by: imp, kbowling, smh, mav Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D16404 Notes: svn path=/head/; revision=338182
* Make it possible to use print_controller from another programWarner Losh2018-06-135-182/+257
| | | | | | | | | | | | | Rename print_controller to nvme_print_controller. Put it in its own file for easy inclusion. Move util.c to be nc_util.c to not conflict with camcontrol. add nvecontrol_ext.h to define shared interfaces. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15371 Notes: svn path=/head/; revision=335091
* Print Maximum Data Transfer Size as a long rather than intJustin Hibbits2018-06-071-1/+1
| | | | | | | | | | | | PowerPC has PAGE_SIZE as a long, not an int. This causes the compiler to throw a format mismatch warning on this print. To work around the difference, print it as a long instead of an int, and force the argument to a long. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D15653 Notes: svn path=/head/; revision=334754
* Add NVMe Namespace Management support to nvmecontrol(8).Alexander Motin2018-05-055-1/+482
| | | | | | | | | | | | | This allows create/delete/attach/detach namespaces on new NVMe controllers. This is only a first user-level part of the bigger change set. Kernel part required to detect and handle the configuration changes without reboot is completely independent and will be added separately. Submitted by: Matt Williams <mffbsdw@gmail.com> (original version) Differential Revision: https://reviews.freebsd.org/D11399 Notes: svn path=/head/; revision=333275
* Add some argument checks to be more user-friendly.Alexander Motin2018-03-131-23/+35
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330846
* Add `nvmecontrol format` subcommand.Alexander Motin2018-03-137-11/+225
| | | | | | | | | | | It allows to change namespace parameters, such as block size, metadata, protection information, etc. and/or erase the data. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330826
* Print fuses and fna fields in identify data.Alexander Motin2018-03-121-0/+11
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330802
* Add new identify data structures fields from NVMe 1.3a.Alexander Motin2018-03-111-15/+117
| | | | | | | | Some of them are already supported by existing hardware, so reporting them `nvmecontrol identify` can be useful. Notes: svn path=/head/; revision=330759
* nvmecontrol: fix build on amd64/clangAlan Somers2018-02-221-1/+1
| | | | | | | | Broken by: 329824 Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=329830
* NVMe: Add big-endian supportWojciech Macek2018-02-228-88/+234
| | | | | | | | | | | | | | | | Remove bitfields from defined structures as they are not portable. Instead use shift and mask macros in the driver and nvmecontrol application. NVMe is now working on powerpc64 host. Submitted by: Michal Stanek <mst@semihalf.com> Obtained from: Semihalf Reviewed by: imp, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13916 Notes: svn path=/head/; revision=329824
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-278-0/+16
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Report only the valid slots in the firmware log page.Warner Losh2017-10-251-2/+7
| | | | | | | | | | | | Printing the entire log page is causing confusion over available slots. Report only those slots that are valid. In the case where the firmware download isn't supported, assume that only the first slot is valid (I have no hardware to test this assumption though) Sponsored by: Netflix Notes: svn path=/head/; revision=324978
* Add nvme_controller_data argument to all print functions.Warner Losh2017-10-251-15/+23
| | | | | | | | | | It's desirable to access controler data to inform printing log pages (such as limiting the printing to valid ranges). Sponsored by: Netflix Notes: svn path=/head/; revision=324977
* Print the controller's ID in identify.Warner Losh2017-08-281-1/+2
| | | | | | | | Submitted by: Matt Williams Sponsored by: Netflix Notes: svn path=/head/; revision=322992
* Fix sign of resid and add a mostly useless cast to cope with signed vsWarner Losh2017-07-011-2/+2
| | | | | | | | unsigned check warnings from traditional unix code construsts bogusly flagged as potentially unsafe. Notes: svn path=/head/; revision=320522
* Improve wdc error log pulling.Warner Losh2017-06-291-175/+29
| | | | | | | | | | | After review by the WDC engineers, improve how we pull down the so-called 'e6' logs. The 'c6' logs are obsolete and support for them has been removed because FreeBSD needed to pull them in chunks, which is incompatible with the 0xc6 opcode implementation. Rather than leave the code in place that produces bad log pulls, remove it. Notes: svn path=/head/; revision=320483
* Report some aspects of namespaces and namespace support in identifyWarner Losh2017-06-271-2/+15
| | | | | | | | | | command. Sponsored by: Netflix Submitted by: Matt Williams (via D11330) Notes: svn path=/head/; revision=320425
* Move 128-bit integer routines to util.c so they can be used by moreWarner Losh2017-06-274-49/+82
| | | | | | | | | | than just the log page code. Sponsored by: Netflix, Inc Submitted by: Matt Williams (via D11330) Notes: svn path=/head/; revision=320423
* Don't use K&R style prototypes; ANSIfy themEnji Cooper2017-03-281-3/+3
| | | | | | | | | | | This fixes several -Wold-style-definition warnings. X-MFC with: 313191 Reported by: amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316105
* sbin: normalize paths using SRCTOP-relative paths or :H when possibleEnji Cooper2017-03-041-1/+1
| | | | | | | | | | This simplifies make logic/output MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314656
* Make nvmecontrol logpage -p help list known pages.Warner Losh2017-02-253-24/+60
| | | | | | | | | | | Make -p help and -v help list all the pages we know about. Add -v to usage. Update the man page. Sponsored by: Netflix Notes: svn path=/head/; revision=314230