]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/solidigm: Added Marketing Name Log support for Solidigm.
authorhsdhillo <Hardeep.Dhillon@solidigm.com>
Tue, 13 Jun 2023 20:52:34 +0000 (13:52 -0700)
committerDaniel Wagner <wagi@monom.org>
Wed, 28 Jun 2023 11:32:03 +0000 (13:32 +0200)
Signed-off-by: hsdhillo <Hardeep.Dhillon@solidigm.com>
plugins/solidigm/meson.build
plugins/solidigm/solidigm-market-log.c [new file with mode: 0644]
plugins/solidigm/solidigm-market-log.h [new file with mode: 0644]
plugins/solidigm/solidigm-nvme.c
plugins/solidigm/solidigm-nvme.h

index 688e77b17c2f1e611d44891ae86483552733f6e1..84495a1439d080d6ee91999c4fe21067700adcfc 100644 (file)
@@ -7,5 +7,7 @@ sources += [
   'plugins/solidigm/solidigm-log-page-dir.c',
   'plugins/solidigm/solidigm-telemetry.c',
   'plugins/solidigm/solidigm-internal-logs.c',
+  'plugins/solidigm/solidigm-market-log.c',
 ]
 subdir('solidigm-telemetry')
+
diff --git a/plugins/solidigm/solidigm-market-log.c b/plugins/solidigm/solidigm-market-log.c
new file mode 100644 (file)
index 0000000..d7d38da
--- /dev/null
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023 Solidigm.
+ *
+ * Authors: leonardo.da.cunha@solidigm.com
+ * Hardeep.Dhillon@solidigm.com
+ */
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <linux/limits.h>
+
+#include "common.h"
+#include "nvme.h"
+#include "libnvme.h"
+#include "plugin.h"
+#include "nvme-print.h"
+
+#define MARKET_LOG_MAX_SIZE 512
+
+int sldgm_get_market_log(int argc, char **argv, struct command *command,
+                               struct plugin *plugin)
+{
+       const char *desc = "Get Solidigm Marketing Name log and show it.";
+       const char *raw = "dump output in binary format";
+       struct nvme_dev *dev;
+       char log[MARKET_LOG_MAX_SIZE];
+       int err;
+
+       struct config {
+               bool  raw_binary;
+       };
+
+       struct config cfg = {
+       };
+
+       OPT_ARGS(opts) = {
+               OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),
+               OPT_END()
+       };
+
+       err = parse_and_open(&dev, argc, argv, desc, opts);
+       if (err)
+               return err;
+
+       err = nvme_get_log_simple(dev_fd(dev), 0xdd, sizeof(log), log);
+       if (!err) {
+               if (!cfg.raw_binary)
+                       printf("Solidigm Marketing Name Log:\n%s\n", log);
+               else
+                       d_raw((unsigned char *)&log, sizeof(log));
+       } else if (err > 0)
+
+       nvme_show_status(err);
+       /* Redundant close() to make static code analysis happy */
+       close(dev->direct.fd);
+       dev_close(dev);
+       return err;
+}
diff --git a/plugins/solidigm/solidigm-market-log.h b/plugins/solidigm/solidigm-market-log.h
new file mode 100644 (file)
index 0000000..6f808c4
--- /dev/null
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2023 Solidigm.
+ *
+ * Author: hardeep.dhillon@solidigm.com
+ */
+
+int sldgm_get_market_log(int argc, char **argv, struct command *cmd, struct plugin *plugin);
index bcc23146c34f3b9b2bfd8810739b96b160d1821e..b0db1ea2a4d67191e2802a53dd697fdf74ba63c9 100644 (file)
@@ -17,6 +17,7 @@
 #include "solidigm-latency-tracking.h"
 #include "solidigm-telemetry.h"
 #include "solidigm-log-page-dir.h"
+#include "solidigm-market-log.h"
 
 #include "plugins/ocp/ocp-clear-fw-update-history.h"
 #include "plugins/ocp/ocp-smart-extended-log.h"
@@ -75,3 +76,9 @@ static int get_log_page_directory_log(int argc, char **argv, struct command *cmd
 {
        return solidigm_get_log_page_directory_log(argc, argv, cmd, plugin);
 }
+
+static int get_market_log(int argc, char **argv, struct command *cmd,
+                                     struct plugin *plugin)
+{
+       return sldgm_get_market_log(argc, argv, cmd, plugin);
+}
index 937ceafc2c97efe071ebf8e9b6b9022f9444bbf8..69b63e5a7eb074a66f4887822e56c681ca05483c 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "cmd.h"
 
-#define SOLIDIGM_PLUGIN_VERSION "0.13"
+#define SOLIDIGM_PLUGIN_VERSION "0.14"
 
 PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION),
        COMMAND_LIST(
@@ -22,6 +22,7 @@ PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_V
                ENTRY("vs-smart-add-log", "Get SMART / health extended log (redirects to ocp plug-in)", smart_cloud)
                ENTRY("vs-internal-log", "Retrieve Debug log binaries", get_internal_log)
                ENTRY("garbage-collect-log", "Retrieve Garbage Collection Log", get_garbage_collection_log)
+               ENTRY("market-log", "Retrieve Market Log", get_market_log)
                ENTRY("latency-tracking-log", "Enable/Retrieve Latency tracking Log", get_latency_tracking_log)
                ENTRY("parse-telemetry-log", "Parse Telemetry Log binary", get_telemetry_log)
                ENTRY("clear-fw-activate-history", "Clear firmware update history log (redirects to ocp plug-in)", clear_fw_update_history)