svn commit: r252670 - stable/9/sbin/nvmecontrol
Jim Harris
jimharris at FreeBSD.org
Thu Jul 4 00:06:12 UTC 2013
Author: jimharris
Date: Thu Jul 4 00:06:11 2013
New Revision: 252670
URL: http://svnweb.freebsd.org/changeset/base/252670
Log:
MFC r252277:
Add log page support to nvmecontrol(8) through a new logpage command.
This includes pretty printers for all of the standard NVMe log pages
(Error, SMART/Health, Firmware), as well as hex output for non-standard
or vendor-specific log pages.
Also add missing static keyword that glebius@ fixed as part of r252302.
Submitted by: Joe Golio <joseph.golio at emc.com>
Obtained from: EMC / Isilon Storage Division
Added:
stable/9/sbin/nvmecontrol/logpage.c
- copied, changed from r252277, head/sbin/nvmecontrol/logpage.c
Modified:
stable/9/sbin/nvmecontrol/Makefile
stable/9/sbin/nvmecontrol/nvmecontrol.8
stable/9/sbin/nvmecontrol/nvmecontrol.c
stable/9/sbin/nvmecontrol/nvmecontrol.h
Directory Properties:
stable/9/sbin/nvmecontrol/ (props changed)
Modified: stable/9/sbin/nvmecontrol/Makefile
==============================================================================
--- stable/9/sbin/nvmecontrol/Makefile Thu Jul 4 00:03:30 2013 (r252669)
+++ stable/9/sbin/nvmecontrol/Makefile Thu Jul 4 00:06:11 2013 (r252670)
@@ -1,7 +1,7 @@
# $FreeBSD$
PROG= nvmecontrol
-SRCS= nvmecontrol.c devlist.c identify.c perftest.c reset.c
+SRCS= nvmecontrol.c devlist.c identify.c logpage.c perftest.c reset.c
MAN= nvmecontrol.8
.include <bsd.prog.mk>
Copied and modified: stable/9/sbin/nvmecontrol/logpage.c (from r252277, head/sbin/nvmecontrol/logpage.c)
==============================================================================
--- head/sbin/nvmecontrol/logpage.c Wed Jun 26 23:53:54 2013 (r252277, copy source)
+++ stable/9/sbin/nvmecontrol/logpage.c Thu Jul 4 00:06:11 2013 (r252670)
@@ -227,7 +227,7 @@ print_log_firmware(void *buf, uint32_t s
}
}
-struct logpage_function {
+static struct logpage_function {
uint8_t log_page;
print_fn_t fn;
} logfuncs[] = {
Modified: stable/9/sbin/nvmecontrol/nvmecontrol.8
==============================================================================
--- stable/9/sbin/nvmecontrol/nvmecontrol.8 Thu Jul 4 00:03:30 2013 (r252669)
+++ stable/9/sbin/nvmecontrol/nvmecontrol.8 Thu Jul 4 00:06:11 2013 (r252670)
@@ -58,6 +58,12 @@
.Nm
.Ic reset
.Aq controller id
+.Nm
+.Ic logpage
+.Aq Fl p Ar page_id
+.Op Fl x
+.Aq device id
+.Aq namespace id
.Sh DESCRIPTION
NVM Express (NVMe) is a storage protocol standard, for SSDs and other
high-speed storage devices over PCI Express.
@@ -84,6 +90,16 @@ stdout when 30 seconds expires.
.Dl nvmecontrol reset nvme0
.Pp
Perform a controller-level reset of the nvme0 controller.
+.Pp
+.Dl nvmecontrol logpage -p 1 nvme0
+.Pp
+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 1 -x nvme0
+.Pp
+Display a hexidecimal dump of the nvme0 controller's Error Information Log.
.Sh AUTHORS
.An -nosplit
.Nm
Modified: stable/9/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- stable/9/sbin/nvmecontrol/nvmecontrol.c Thu Jul 4 00:03:30 2013 (r252669)
+++ stable/9/sbin/nvmecontrol/nvmecontrol.c Thu Jul 4 00:06:11 2013 (r252670)
@@ -55,6 +55,7 @@ static struct nvme_function {
{"identify", identify, IDENTIFY_USAGE},
{"perftest", perftest, PERFTEST_USAGE},
{"reset", reset, RESET_USAGE},
+ {"logpage", logpage, LOGPAGE_USAGE},
{NULL, NULL, NULL},
};
Modified: stable/9/sbin/nvmecontrol/nvmecontrol.h
==============================================================================
--- stable/9/sbin/nvmecontrol/nvmecontrol.h Thu Jul 4 00:03:30 2013 (r252669)
+++ stable/9/sbin/nvmecontrol/nvmecontrol.h Thu Jul 4 00:06:11 2013 (r252670)
@@ -49,15 +49,21 @@
#define RESET_USAGE \
" nvmecontrol reset <controller id>\n"
+#define LOGPAGE_USAGE \
+" nvmecontrol logpage <-p page_id> [-x] <controller id|namespace id>\n" \
+
void devlist(int argc, char *argv[]);
void identify(int argc, char *argv[]);
void perftest(int argc, char *argv[]);
void reset(int argc, char *argv[]);
+void logpage(int argc, char *argv[]);
int open_dev(const char *str, int *fd, int show_error, int exit_on_error);
void read_controller_data(int fd, struct nvme_controller_data *cdata);
void read_namespace_data(int fd, int nsid, struct nvme_namespace_data *nsdata);
void print_hex(void *data, uint32_t length);
+void read_logpage(int fd, uint8_t log_page, int nsid, void *payload,
+ uint32_t payload_size);
#endif
More information about the svn-src-stable-9
mailing list