Add the ability to dump log pages directly in binary to stdout.
Update man page to include this flag, and an example of dumping a vendor-specific page while I'm here.
This commit is contained in:
parent
033ccbc91f
commit
ba6da68645
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313258
|
@ -74,6 +74,12 @@ kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key)
|
|||
return bad;
|
||||
}
|
||||
|
||||
static void
|
||||
print_bin(void *data, uint32_t length)
|
||||
{
|
||||
write(STDOUT_FILENO, data, length);
|
||||
}
|
||||
|
||||
/*
|
||||
* 128-bit integer augments to standard values. On i386 this
|
||||
* doesn't exist, so we use 64-bit values. The 128-bit counters
|
||||
|
@ -872,7 +878,7 @@ logpage(int argc, char *argv[])
|
|||
{
|
||||
int fd, nsid;
|
||||
int log_page = 0, pageflag = false;
|
||||
int hexflag = false, ns_specified;
|
||||
int binflag = false, hexflag = false, ns_specified;
|
||||
char ch, *p;
|
||||
char cname[64];
|
||||
uint32_t size;
|
||||
|
@ -882,8 +888,11 @@ logpage(int argc, char *argv[])
|
|||
struct nvme_controller_data cdata;
|
||||
print_fn_t print_fn;
|
||||
|
||||
while ((ch = getopt(argc, argv, "p:xv:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "bp:xv:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
binflag = true;
|
||||
break;
|
||||
case 'p':
|
||||
/* TODO: Add human-readable ASCII page IDs */
|
||||
log_page = strtol(optarg, &p, 0);
|
||||
|
@ -942,7 +951,9 @@ logpage(int argc, char *argv[])
|
|||
|
||||
print_fn = print_hex;
|
||||
size = DEFAULT_SIZE;
|
||||
if (!hexflag) {
|
||||
if (binflag)
|
||||
print_fn = print_bin;
|
||||
if (!binflag && !hexflag) {
|
||||
/*
|
||||
* See if there is a pretty print function for the specified log
|
||||
* page. If one isn't found, we just revert to the default
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 10, 2016
|
||||
.Dd February 4, 2017
|
||||
.Dt NVMECONTROL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -63,6 +63,7 @@
|
|||
.Aq Fl p Ar page_id
|
||||
.Op Fl x
|
||||
.Op Fl v Ar vendor-string
|
||||
.Op Fl b
|
||||
.Aq device id
|
||||
.Aq namespace id
|
||||
.Nm
|
||||
|
@ -147,10 +148,21 @@ Display a human-readable summary of the nvme0 controller's Error Information Log
|
|||
Log pages defined by the NVMe specification include Error Information Log (ID=1),
|
||||
SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3).
|
||||
.Pp
|
||||
.Dl nvmecontrol logpage -p 0xc1 -v wdc nvme0
|
||||
.Pp
|
||||
Display a human-readable summary of the nvme0's wdc-specific advanced
|
||||
SMART data.
|
||||
.Pp
|
||||
.Dl nvmecontrol logpage -p 1 -x nvme0
|
||||
.Pp
|
||||
Display a hexadecimal dump of the nvme0 controller's Error Information Log.
|
||||
.Pp
|
||||
.Dl nvmecontrol logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin
|
||||
.Pp
|
||||
Print the contents of vendor specific page 0xcb as binary data on
|
||||
standard out.
|
||||
Redirect it to a temporary file.
|
||||
.Pp
|
||||
.Dl nvmecontrol firmware -s 2 -f /tmp/nvme_firmware nvme0
|
||||
.Pp
|
||||
Download the firmware image contained in "/tmp/nvme_firmware" to slot 2 of the
|
||||
|
|
Loading…
Reference in New Issue
Block a user