]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Add intel marketing log page
authorKeith Busch <keith.busch@intel.com>
Wed, 8 Jun 2016 18:33:35 +0000 (12:33 -0600)
committerKeith Busch <keith.busch@intel.com>
Wed, 8 Jun 2016 23:31:10 +0000 (17:31 -0600)
Added as defined by public Intel datasheet on P3xxx series.

Signed-off-by: Keith Busch <keith.busch@intel.com>
intel-nvme.c
intel-nvme.h

index 541f3b1153b1be6744c7479ad3e9d4570359c1b5..0c004d2a2b9ba9bd3de7364daa3dab275bc95a02 100644 (file)
@@ -17,7 +17,7 @@ static struct plugin intel_nvme = {
        .next = NULL,
        .commands = commands,
 };
+
 static void init() __attribute__((constructor));
 static void init()
 {
@@ -82,3 +82,36 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
                                        nvme_status_to_string(err), err);
        return err;
 }
+
+static int get_market_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
+{
+       char log[512];
+       int err, fd;
+
+       char *desc = "Get Intel Marketing Name log and show it.";
+       const char *raw = "dump output in binary format";
+       struct config {
+               int  raw_binary;
+       };
+
+       struct config cfg = {
+       };
+
+       const struct argconfig_commandline_options command_line_options[] = {
+               {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw},
+               {0}
+       };
+
+       fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
+
+       err = nvme_get_log(fd, 0xffffffff, 0xdd, sizeof(log), log);
+       if (!err) {
+               if (!cfg.raw_binary)
+                       printf("Intel Marketing Name Log:\n%s\n", log);
+               else
+                       d_raw((unsigned char *)&log, sizeof(log));
+       } else if (err > 0)
+               fprintf(stderr, "NVMe Status:%s(%x)\n",
+                                       nvme_status_to_string(err), err);
+       return err;
+}
index 5c17df7136b288b78a767f3c8417faaa28178dd5..2bd269b185896a7a098080c756b2ff60a0b6bf72 100644 (file)
@@ -9,6 +9,7 @@
 COMMAND_LIST(
        ENTRY("id-ctrl", "Send NVMe Identify Controller", id_ctrl)
        ENTRY("smart-log-add", "Retrieve Intel SMART Log, show it", get_additional_smart_log)
+       ENTRY("market-name", "Retrieve Intel Marketing Name log, show it", get_market_log)
 );
 
 #endif