]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
ocp: add ocp dssd log id and feature id definitions
authorTokunori Ikegami <ikegami.t@gmail.com>
Fri, 3 Jan 2025 14:58:41 +0000 (23:58 +0900)
committerDaniel Wagner <wagi@monom.org>
Tue, 7 Jan 2025 08:27:07 +0000 (09:27 +0100)
This is to reduce the hardcoded fid and lid values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 files changed:
plugins/ocp/ocp-clear-features.c
plugins/ocp/ocp-fw-activation-history.c
plugins/ocp/ocp-hardware-component-log.c
plugins/ocp/ocp-hardware-component-log.h
plugins/ocp/ocp-nvme.c
plugins/ocp/ocp-nvme.h
plugins/ocp/ocp-print-json.c
plugins/ocp/ocp-print-stdout.c
plugins/ocp/ocp-smart-extended-log.c
plugins/ocp/ocp-telemetry-decode.h
plugins/ocp/ocp-utils.c
plugins/ocp/ocp-utils.h
plugins/solidigm/solidigm-log-page-dir.c

index 731dfeac95d92dda757abdfac3d30bc1564ec50c..6686f8551f89d8e9138e677a027fb7d5a78f1f5a 100644 (file)
@@ -7,12 +7,11 @@
  */
 
 #include <unistd.h>
+#include "util/types.h"
+#include "ocp-nvme.h"
 #include "ocp-utils.h"
 #include "nvme-print.h"
 
-static const __u8 OCP_FID_CLEAR_FW_ACTIVATION_HISTORY = 0xC1;
-static const __u8 OCP_FID_CLEAR_PCIE_CORRECTABLE_ERROR_COUNTERS = 0xC3;
-
 static int ocp_clear_feature(int argc, char **argv, const char *desc, const __u8 fid)
 {
        __u32 result = 0;
@@ -80,14 +79,13 @@ int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, stru
 {
        const char *desc = "OCP Clear Firmware Update History";
 
-       return ocp_clear_feature(argc, argv, desc, OCP_FID_CLEAR_FW_ACTIVATION_HISTORY);
+       return ocp_clear_feature(argc, argv, desc, OCP_FID_CFUH);
 }
 
 int ocp_clear_pcie_correctable_errors(int argc, char **argv, struct command *cmd,
-                                            struct plugin *plugin)
+                                     struct plugin *plugin)
 {
        const char *desc = "OCP Clear PCIe Correctable Error Counters";
 
-       return ocp_clear_feature(argc, argv, desc,
-                                OCP_FID_CLEAR_PCIE_CORRECTABLE_ERROR_COUNTERS);
+       return ocp_clear_feature(argc, argv, desc, OCP_FID_CPCIE);
 }
index 79c03b2c0a1e19a2040d2b1eb90f7832efd96a60..d3eb60c2624fd7acd90b66b49282a75998aa1ca3 100644 (file)
@@ -13,6 +13,7 @@
 #include "common.h"
 #include "nvme-print.h"
 
+#include "ocp-nvme.h"
 #include "ocp-utils.h"
 #include "ocp-print.h"
 
@@ -26,7 +27,6 @@ static const unsigned char ocp_fw_activation_history_guid[GUID_LEN] = {
 int ocp_fw_activation_history_log(int argc, char **argv, struct command *cmd,
                                  struct plugin *plugin)
 {
-       const __u8 log_id = 0xC2;
        const char *description = "Retrieves the OCP firmware activation history log.";
 
        char *format = "normal";
@@ -59,7 +59,7 @@ int ocp_fw_activation_history_log(int argc, char **argv, struct command *cmd,
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
                .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
-               .lid = log_id,
+               .lid = (enum nvme_cmd_get_log_lid)OCP_LID_FAHL_OBSOLETE,
                .len = sizeof(fw_history),
                .nsid = NVME_NSID_ALL,
                .csi = NVME_CSI_NVM,
index 230d3d92bd830f365a65626e2efbfcfd17272c0e..4dfc61e4433139e7440f542377ac26d7538f0f3d 100644 (file)
@@ -175,7 +175,7 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log)
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
                .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
-               .lid = LID_HWCOMP,
+               .lid = (enum nvme_cmd_get_log_lid)OCP_LID_HWCOMP,
                .nsid = NVME_NSID_ALL,
                .log = log,
                .len = desc_offset,
@@ -193,7 +193,7 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log)
        }
 #endif /* HWCOMP_DUMMY */
 
-       print_info("id: %02Xh\n", LID_HWCOMP);
+       print_info("id: %02Xh\n", OCP_LID_HWCOMP);
        print_info("version: %04Xh\n", log->ver);
        print_info_array("guid", log->guid, ARRAY_SIZE(log->guid));
        print_info("size: %s\n", uint128_t_to_string(le128_to_cpu(log->size)));
@@ -219,7 +219,7 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log)
        ret = nvme_get_log_page(dev_fd(dev), NVME_LOG_PAGE_PDU_SIZE, &args);
        if (ret) {
                print_info_error("error: ocp: failed to get log page (hwcomp: %02X, ret: %d)\n",
-                                LID_HWCOMP, ret);
+                                OCP_LID_HWCOMP, ret);
                return ret;
        }
 #endif /* HWCOMP_DUMMY */
@@ -246,7 +246,7 @@ static int get_hwcomp_log(struct nvme_dev *dev, __u32 id, bool list)
        ret = get_hwcomp_log_data(dev, &log);
        if (ret) {
                print_info_error("error: ocp: failed get hwcomp log: %02X data, ret: %d\n",
-                                LID_HWCOMP, ret);
+                                OCP_LID_HWCOMP, ret);
                return ret;
        }
 
@@ -293,8 +293,8 @@ int ocp_hwcomp_log(int argc, char **argv, struct command *cmd, struct plugin *pl
 
        ret = get_hwcomp_log(dev, cfg.id, cfg.list);
        if (ret)
-               fprintf(stderr, "error: ocp: failed to get hwcomp log: %02X, ret: %d\n", LID_HWCOMP,
-                       ret);
+               fprintf(stderr, "error: ocp: failed to get hwcomp log: %02X, ret: %d\n",
+                       OCP_LID_HWCOMP, ret);
 
        return ret;
 }
index f0e5c1f9cc47ffea89899d6128dfa7f589cab34e..1755388fc67225f8e9d4ed4bc6eb826018067679 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef OCP_HARDWARE_COMPONENT_LOG_H
 #define OCP_HARDWARE_COMPONENT_LOG_H
 
-#define LID_HWCOMP 0xc6
 #define HWCOMP_RSVD2_LEN 14
 #define HWCOMP_SIZE_LEN 16
 #define HWCOMP_RSVD48_LEN 16
index 20916209486ba62599f11c29d1f03a85355edea4..94ef06e62d2e66bbb8fabbdba4dcb07ba7a69845 100644 (file)
@@ -45,8 +45,6 @@
 /// Latency Monitor Log
 
 #define C3_LATENCY_MON_LOG_BUF_LEN             0x200
-#define C3_LATENCY_MON_OPCODE                  0xC3
-#define NVME_FEAT_OCP_LATENCY_MONITOR          0xC5
 
 static __u8 lat_mon_guid[GUID_LEN] = {
        0x92, 0x7a, 0xc0, 0x8c,
@@ -219,8 +217,7 @@ static int get_c3_log_page(struct nvme_dev *dev, char *format)
        }
        memset(data, 0, sizeof(__u8) * C3_LATENCY_MON_LOG_BUF_LEN);
 
-       ret = ocp_get_log_simple(dev, C3_LATENCY_MON_OPCODE, C3_LATENCY_MON_LOG_BUF_LEN,
-                                data);
+       ret = ocp_get_log_simple(dev, OCP_LID_LMLOG, C3_LATENCY_MON_LOG_BUF_LEN, data);
 
        if (strcmp(format, "json"))
                fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret, false), ret);
@@ -392,7 +389,7 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
        struct nvme_set_features_args args = {
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
-               .fid = NVME_FEAT_OCP_LATENCY_MONITOR,
+               .fid = OCP_FID_LM,
                .nsid = 0,
                .cdw12 = 0,
                .save = 1,
@@ -406,7 +403,7 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
        if (err < 0) {
                perror("set-feature");
        } else if (!err) {
-               printf("NVME_FEAT_OCP_LATENCY_MONITOR: 0x%02x\n", NVME_FEAT_OCP_LATENCY_MONITOR);
+               printf("NVME_FEAT_OCP_LATENCY_MONITOR: 0x%02x\n", OCP_FID_LM);
                printf("active bucket timer threshold: 0x%x\n",
                       le16_to_cpu(buf.active_bucket_timer_threshold));
                printf("active threshold a: 0x%x\n", buf.active_threshold_a);
@@ -548,7 +545,7 @@ static int eol_plp_failure_mode(int argc, char **argv, struct command *cmd,
                           "No argument prints current mode.";
        const char *mode = "[0-3]: default/rom/wtm/normal";
        const __u32 nsid = 0;
-       const __u8 fid = 0xc2;
+       const __u8 fid = OCP_FID_ROWTM;
        struct nvme_dev *dev;
        int err;
 
@@ -1286,8 +1283,7 @@ static int get_c9_log_page_data(struct nvme_dev *dev, int print_data, int save_b
        }
        memset(header_data, 0, sizeof(__u8) * C9_TELEMETRY_STR_LOG_LEN);
 
-       ret = ocp_get_log_simple(dev, C9_TELEMETRY_STRING_LOG_ENABLE_OPCODE,
-                                C9_TELEMETRY_STR_LOG_LEN, header_data);
+       ret = ocp_get_log_simple(dev, OCP_LID_TELSLG, C9_TELEMETRY_STR_LOG_LEN, header_data);
 
        if (!ret) {
                log_data = (struct telemetry_str_log_format *)header_data;
@@ -1329,8 +1325,7 @@ static int get_c9_log_page_data(struct nvme_dev *dev, int print_data, int save_b
                }
                memset(pC9_string_buffer, 0, sizeof(__u8) * total_log_page_sz);
 
-               ret = ocp_get_log_simple(dev, C9_TELEMETRY_STRING_LOG_ENABLE_OPCODE,
-                                        total_log_page_sz, pC9_string_buffer);
+               ret = ocp_get_log_simple(dev, OCP_LID_TELSLG, total_log_page_sz, pC9_string_buffer);
        } else {
                fprintf(stderr, "ERROR : OCP : Unable to read C9 data.\n");
        }
@@ -1566,7 +1561,6 @@ out:
 
 /* C5 Unsupported Requirement Log Page */
 #define C5_UNSUPPORTED_REQS_LEN            4096
-#define C5_UNSUPPORTED_REQS_OPCODE         0xC5
 
 static __u8 unsupported_req_guid[GUID_LEN] = {
        0x2F, 0x72, 0x9C, 0x0E,
@@ -1601,7 +1595,7 @@ static int get_c5_log_page(struct nvme_dev *dev, char *format)
        }
        memset(data, 0, sizeof(__u8) * C5_UNSUPPORTED_REQS_LEN);
 
-       ret = ocp_get_log_simple(dev, C5_UNSUPPORTED_REQS_OPCODE, C5_UNSUPPORTED_REQS_LEN, data);
+       ret = ocp_get_log_simple(dev, OCP_LID_URLP, C5_UNSUPPORTED_REQS_LEN, data);
        if (!ret) {
                log_data = (struct unsupported_requirement_log *)data;
 
@@ -1673,7 +1667,6 @@ static int ocp_unsupported_requirements_log(int argc, char **argv, struct comman
 /// Error Recovery Log Page(0xC1)
 
 #define C1_ERROR_RECOVERY_LOG_BUF_LEN       0x200
-#define C1_ERROR_RECOVERY_OPCODE            0xC1
 
 static __u8 error_recovery_guid[GUID_LEN] = {
        0x44, 0xd9, 0x31, 0x21,
@@ -1706,8 +1699,7 @@ static int get_c1_log_page(struct nvme_dev *dev, char *format)
        }
        memset(data, 0, sizeof(__u8) * C1_ERROR_RECOVERY_LOG_BUF_LEN);
 
-       ret = ocp_get_log_simple(dev, C1_ERROR_RECOVERY_OPCODE, C1_ERROR_RECOVERY_LOG_BUF_LEN,
-                                data);
+       ret = ocp_get_log_simple(dev, OCP_LID_EREC, C1_ERROR_RECOVERY_LOG_BUF_LEN, data);
 
        if (!ret) {
                log_data = (struct ocp_error_recovery_log_page *)data;
@@ -1778,7 +1770,6 @@ static int ocp_error_recovery_log(int argc, char **argv, struct command *cmd, st
 /// Device Capabilities (Log Identifier C4h) Requirements
 
 #define C4_DEV_CAP_REQ_LEN                     0x1000
-#define C4_DEV_CAP_REQ_OPCODE          0xC4
 static __u8 dev_cap_req_guid[GUID_LEN] = {
        0x97, 0x42, 0x05, 0x0d,
        0xd1, 0xe1, 0xc9, 0x98,
@@ -1810,7 +1801,7 @@ static int get_c4_log_page(struct nvme_dev *dev, char *format)
        }
        memset(data, 0, sizeof(__u8) * C4_DEV_CAP_REQ_LEN);
 
-       ret = ocp_get_log_simple(dev, C4_DEV_CAP_REQ_OPCODE, C4_DEV_CAP_REQ_LEN, data);
+       ret = ocp_get_log_simple(dev, OCP_LID_DCLP, C4_DEV_CAP_REQ_LEN, data);
 
        if (!ret) {
                log_data = (struct ocp_device_capabilities_log_page *)data;
@@ -1896,7 +1887,7 @@ static int ocp_set_telemetry_profile(struct nvme_dev *dev, __u8 tps)
        struct nvme_set_features_args args = {
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
-               .fid = 0xC8,
+               .fid = OCP_FID_TEL_CFG,
                .nsid = 0xFFFFFFFF,
                .cdw11 = tps,
                .cdw12 = 0,
@@ -2019,7 +2010,6 @@ static int set_dssd_power_state_feature(int argc, char **argv, struct command *c
        const char *power_state = "DSSD Power State to set in watts";
        const char *save = "Specifies that the controller shall save the attribute";
        const __u32 nsid = 0;
-       const __u8 fid = 0xC7;
        struct nvme_dev *dev;
        int err;
 
@@ -2046,9 +2036,8 @@ static int set_dssd_power_state_feature(int argc, char **argv, struct command *c
                return err;
 
        if (argconfig_parse_seen(opts, "power-state"))
-               err = set_dssd_power_state(dev, nsid, fid, cfg.power_state,
-                                              cfg.save,
-                                              !argconfig_parse_seen(opts, "no-uuid"));
+               err = set_dssd_power_state(dev, nsid, OCP_FID_DSSDPS, cfg.power_state, cfg.save,
+                                          !argconfig_parse_seen(opts, "no-uuid"));
 
        dev_close(dev);
 
@@ -2111,7 +2100,7 @@ static int get_dssd_power_state_feature(int argc, char **argv, struct command *c
        const char *all = "Print out all 3 values at once - Current, Default, and Saved";
        const char *sel = "[0-3]: current/default/saved/supported/";
        const __u32 nsid = 0;
-       const __u8 fid = 0xC7;
+       const __u8 fid = OCP_FID_DSSDPS;
        struct nvme_dev *dev;
        int i, err;
 
@@ -2169,7 +2158,6 @@ static int set_plp_health_check_interval(int argc, char **argv, struct command *
        const char *plp_health_interval = "[31:16]:PLP Health Check Interval";
        const char *save = "Specifies that the controller shall save the attribute";
        const __u32 nsid = 0;
-       const __u8 fid = 0xc6;
        struct nvme_dev *dev;
        int err;
        __u32 result;
@@ -2211,7 +2199,7 @@ static int set_plp_health_check_interval(int argc, char **argv, struct command *
        struct nvme_set_features_args args = {
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
-               .fid = fid,
+               .fid = OCP_FID_PLPI,
                .nsid = nsid,
                .cdw11 = cfg.plp_health_interval << 16,
                .cdw12 = 0,
@@ -2270,7 +2258,7 @@ static int get_plp_health_check_interval(int argc, char **argv, struct command *
        struct nvme_get_features_args args = {
                .args_size  = sizeof(args),
                .fd         = dev_fd(dev),
-               .fid        = fid,
+               .fid        = OCP_FID_PLPI,
                .nsid       = nsid,
                .sel        = cfg.sel,
                .cdw11      = 0,
@@ -2308,7 +2296,6 @@ static int set_dssd_async_event_config(int argc, char **argv, struct command *cm
        const char *epn = "[0]:Enable Panic Notices";
        const char *save = "Specifies that the controller shall save the attribute";
        const __u32 nsid = 0;
-       const __u8 fid = 0xc9;
        struct nvme_dev *dev;
        int err;
        __u32 result;
@@ -2344,7 +2331,7 @@ static int set_dssd_async_event_config(int argc, char **argv, struct command *cm
        struct nvme_set_features_args args = {
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
-               .fid = fid,
+               .fid = OCP_FID_DAEC,
                .nsid = nsid,
                .cdw11 = cfg.epn ? 1 : 0,
                .cdw12 = 0,
@@ -2378,7 +2365,7 @@ static int get_dssd_async_event_config(int argc, char **argv, struct command *cm
        const char *desc = "Issue Get Feature command (FID : 0xC9) DSSD Async Event Config";
        const char *sel = "[0-3]: current/default/saved/supported";
        const __u32 nsid = 0;
-       const __u8 fid = 0xc9;
+       const __u8 fid = OCP_FID_DAEC;
        struct nvme_dev *dev;
        __u32 result;
        int err;
@@ -2506,7 +2493,6 @@ static int ocp_telemetry_str_log_format(int argc, char **argv, struct command *c
 
 /* C7 TCG Configuration Log Page */
 #define C7_TCG_CONFIGURATION_LEN           512
-#define C7_TCG_CONFIGURATION_OPCODE        0xC7
 
 static __u8 tcg_configuration_guid[GUID_LEN] = {
        0x06, 0x40, 0x24, 0xBD,
@@ -2541,7 +2527,7 @@ static int get_c7_log_page(struct nvme_dev *dev, char *format)
        }
        memset(data, 0, sizeof(__u8) * C7_TCG_CONFIGURATION_LEN);
 
-       ret = ocp_get_log_simple(dev, C7_TCG_CONFIGURATION_OPCODE, C7_TCG_CONFIGURATION_LEN, data);
+       ret = ocp_get_log_simple(dev, OCP_LID_TCGL, C7_TCG_CONFIGURATION_LEN, data);
        if (!ret) {
                log_data = (struct tcg_configuration_log *)data;
 
@@ -2641,7 +2627,7 @@ static int error_injection_get(struct nvme_dev *dev, const __u8 sel, bool uuid)
        struct erri_get_cq_entry cq_entry;
        int err;
        int i;
-       const __u8 fid = 0xc0;
+       const __u8 fid = OCP_FID_ERRI;
 
        _cleanup_free_ struct erri_entry *entry = NULL;
 
@@ -2722,7 +2708,7 @@ static int error_injection_set(struct nvme_dev *dev, struct erri_config *cfg, bo
        struct nvme_set_features_args args = {
                .args_size = sizeof(args),
                .fd = dev_fd(dev),
-               .fid = 0xc0,
+               .fid = OCP_FID_ERRI,
                .cdw11 = cfg->number,
                .data_len = cfg->number * sizeof(struct erri_entry),
                .timeout = nvme_cfg.timeout,
@@ -2814,7 +2800,7 @@ static int enable_ieee1667_silo_get(struct nvme_dev *dev, const __u8 sel, bool u
 {
        struct ieee1667_get_cq_entry cq_entry;
        int err;
-       const __u8 fid = 0xc4;
+       const __u8 fid = OCP_FID_1667;
 
        struct nvme_get_features_args args = {
                .result = (__u32 *)&cq_entry,
@@ -2879,7 +2865,7 @@ static int enable_ieee1667_silo_set(struct nvme_dev *dev,
 {
        struct ieee1667_get_cq_entry cq_entry;
        int err;
-       const __u8 fid = 0xc4;
+       const __u8 fid = OCP_FID_1667;
        bool enable = argconfig_parse_seen(opts, "enable");
 
        struct nvme_set_features_args args = {
index 0d964c2e6c2572c6657490bbe621858093ce1e6b..d3f8e4fa3e3c781a99288b08ed737b3e3b267200 100644 (file)
@@ -51,6 +51,8 @@ PLUGIN(NAME("ocp", "OCP cloud SSD extensions", OCP_PLUGIN_VERSION),
 
 #ifndef OCP_NVME_H
 #define OCP_NVME_H
+#include "common.h"
+
 struct __packed ssd_latency_monitor_log {
        __u8    feature_status;                 /* 0x00 */
        __u8    rsvd1;                          /* 0x01 */
@@ -245,4 +247,31 @@ struct __packed tcg_configuration_log {
        __u8    log_page_guid[GUID_LEN];
 
 };
+
+enum ocp_dssd_log_id {
+       OCP_LID_SMART = 0xc0, /* SMART / Helth Information Extended */
+       OCP_LID_EREC, /* Error Recovery */
+       OCP_LID_FAHL_OBSOLETE, /* Firmware Activation History (Obsolete) */
+       OCP_LID_LMLOG, /* Latency Monitor */
+       OCP_LID_DCLP, /* Device Capabilities */
+       OCP_LID_URLP, /* Unsupported Requirements */
+       OCP_LID_HWCOMP, /* Hardware Component */
+       OCP_LID_TCGL, /* TCG Configuration */
+       OCP_LID_RESERVED, /* Reserved for future use */
+       OCP_LID_TELSLG, /* Telemetry String */
+       OCP_LID_LMLOG_DEBUG, /* Latency Monitor Debug Telemetry */
+};
+
+enum ocp_dssd_feature_id {
+       OCP_FID_ERRI = 0xc0, /* Error Injection */
+       OCP_FID_CFUH, /* Clear Firmware Update History (Obsolete) */
+       OCP_FID_ROWTM, /* EOL/PLP Failure Mode */
+       OCP_FID_CPCIE, /* Clear PCIe Correctable Error Counters */
+       OCP_FID_1667, /* Enable IEEE1667 Silo */
+       OCP_FID_LM, /* Latency Monitor */
+       OCP_FID_PLPI, /* PLP Health Check Interval */
+       OCP_FID_DSSDPS, /* DSSD Power State */
+       OCP_FID_TEL_CFG, /* Telemetry Profile */
+       OCP_FID_DAEC, /* DSSD Asynchronous Event Configuration */
+};
 #endif /* OCP_NVME_H */
index 146dd0305e17978376b0aed1cb4075dc11d45f1c..fa48b9177820c199f3150e862f357c64cba274c5 100644 (file)
@@ -71,7 +71,7 @@ static void json_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
        if (log->ver == 1)
                log_size *= sizeof(__le32);
 
-       json_object_add_uint_02x(r, "Log Identifier", LID_HWCOMP);
+       json_object_add_uint_02x(r, "Log Identifier", OCP_LID_HWCOMP);
        json_object_add_uint_0x(r, "Log Page Version", le16_to_cpu(log->ver));
        json_object_add_byte_array(r, "Reserved2", log->rsvd2, ARRAY_SIZE(log->rsvd2));
        json_object_add_byte_array(r, "Log page GUID", log->guid, ARRAY_SIZE(log->guid));
index 5880104af6947f5471f9cb9681f3db90b5bbbe12..b4f284c3e27c529642f90cceca1bcc2bd2af0249 100644 (file)
@@ -36,7 +36,7 @@ static void stdout_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
        if (log->ver == 1)
                log_size *= sizeof(__le32);
 
-       printf("Log Identifier: 0x%02xh\n", LID_HWCOMP);
+       printf("Log Identifier: 0x%02xh\n", OCP_LID_HWCOMP);
        printf("Log Page Version: 0x%x\n", le16_to_cpu(log->ver));
        print_array("Reserved2", log->rsvd2, ARRAY_SIZE(log->rsvd2));
        print_array("Log page GUID", log->guid, ARRAY_SIZE(log->guid));
index 6a1b9812893115cb53efbf1480fc6f3e3556fd21..2db4e7c4d0f88dde37b612bd5872a32a1c8b94ca 100644 (file)
@@ -18,7 +18,6 @@
 
 /* C0 SCAO Log Page */
 #define C0_SMART_CLOUD_ATTR_LEN                        0x200
-#define C0_SMART_CLOUD_ATTR_OPCODE             0xC0
 
 static __u8 scao_guid[GUID_LEN] = {
        0xC5, 0xAF, 0x10, 0x28,
@@ -38,7 +37,7 @@ static int get_c0_log_page(struct nvme_dev *dev, char *format,
        struct nvme_get_log_args args = {
                .args_size = sizeof(args),
                .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
-               .lid = C0_SMART_CLOUD_ATTR_OPCODE,
+               .lid = (enum nvme_cmd_get_log_lid)OCP_LID_SMART,
                .nsid = NVME_NSID_ALL,
                .len = C0_SMART_CLOUD_ATTR_LEN,
        };
index 094c920e24489fd4eac02ae56868d02626c13690..2ac065af092656edc9d80b8984247764fa6004c4 100644 (file)
@@ -437,7 +437,6 @@ struct telemetry_data_area_1 {
 #define DEFAULT_OUTPUT_FORMAT_JSON "json"
 
 /* C9 Telemetry String Log Format Log Page */
-#define C9_TELEMETRY_STRING_LOG_ENABLE_OPCODE    0xC9
 #define C9_TELEMETRY_STR_LOG_LEN                 432
 #define C9_TELEMETRY_STR_LOG_SIST_OFST           431
 
index d492bdbf8556889899ff863a23b5fb9894332fb8..e3c0747fa962a3e3b712746a81d85ae6b893181f 100644 (file)
@@ -7,6 +7,8 @@
 
 #include <unistd.h>
 #include <errno.h>
+#include "util/types.h"
+#include "ocp-nvme.h"
 #include "ocp-utils.h"
 
 const unsigned char ocp_uuid[NVME_UUID_LEN] = {
@@ -38,7 +40,7 @@ int ocp_get_uuid_index(struct nvme_dev *dev, __u8 *index)
        return ocp_find_uuid_index(&uuid_list, index);
 }
 
-int ocp_get_log_simple(struct nvme_dev *dev, enum nvme_cmd_get_log_lid lid, __u32 len, void *log)
+int ocp_get_log_simple(struct nvme_dev *dev, enum ocp_dssd_log_id lid, __u32 len, void *log)
 {
        int fd = dev_fd(dev);
        struct nvme_get_log_args args = {
@@ -46,7 +48,7 @@ int ocp_get_log_simple(struct nvme_dev *dev, enum nvme_cmd_get_log_lid lid, __u3
                .args_size = sizeof(args),
                .fd = fd,
                .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
-               .lid = lid,
+               .lid = (enum nvme_cmd_get_log_lid)lid,
                .len = len,
                .nsid = NVME_NSID_ALL,
                .lsi = NVME_LOG_LSI_NONE,
index 4370b624e43604112451f033d757d90e2a223102..9832474eacb8a661bad96dac6b3c45e0faaaa4a4 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Author: leonardo.da.cunha@solidigm.com
  */
-
 #include "nvme.h"
 
 /*
@@ -31,4 +30,4 @@ int ocp_get_uuid_index(struct nvme_dev *dev, __u8 *index);
  */
 int ocp_find_uuid_index(struct nvme_id_uuid_list *uuid_list, __u8 *index);
 
-int ocp_get_log_simple(struct nvme_dev *dev, enum nvme_cmd_get_log_lid lid, __u32 len, void *log);
+int ocp_get_log_simple(struct nvme_dev *dev, enum ocp_dssd_log_id lid, __u32 len, void *log);
index f8d19743f0340c60b0050a30c29db09b7c349ed4..886097bf8ae87bbbcb639904ac9fd052eda6b953 100644 (file)
@@ -14,6 +14,7 @@
 #include "common.h"
 #include "nvme-print.h"
 
+#include "plugins/ocp/ocp-nvme.h"
 #include "plugins/ocp/ocp-utils.h"
 #include "solidigm-util.h"