|
32 | 32 | #include "ocp-telemetry-decode.h" |
33 | 33 | #include "ocp-hardware-component-log.h" |
34 | 34 | #include "ocp-print.h" |
| 35 | +#include "ocp-types.h" |
35 | 36 |
|
36 | 37 | #define CREATE_CMD |
37 | 38 | #include "ocp-nvme.h" |
@@ -194,6 +195,8 @@ const char *data = "Error injection data structure entries"; |
194 | 195 | const char *number = "Number of valid error injection data entries"; |
195 | 196 | static const char *type = "Error injection type"; |
196 | 197 | static const char *nrtdp = "Number of reads to trigger device panic"; |
| 198 | +static const char *save = "Specifies that the controller shall save the attribute"; |
| 199 | +static const char *enable_ieee1667_silo = "enable IEEE1667 silo"; |
197 | 200 |
|
198 | 201 | static int get_c3_log_page(struct nvme_dev *dev, char *format) |
199 | 202 | { |
@@ -544,8 +547,6 @@ static int eol_plp_failure_mode(int argc, char **argv, struct command *cmd, |
544 | 547 | const char *desc = "Define EOL or PLP circuitry failure mode.\n" |
545 | 548 | "No argument prints current mode."; |
546 | 549 | const char *mode = "[0-3]: default/rom/wtm/normal"; |
547 | | - const char *save = "Specifies that the controller shall save the attribute"; |
548 | | - const char *sel = "[0-3]: current/default/saved/supported"; |
549 | 550 | const __u32 nsid = 0; |
550 | 551 | const __u8 fid = 0xc2; |
551 | 552 | struct nvme_dev *dev; |
@@ -2242,7 +2243,6 @@ static int get_plp_health_check_interval(int argc, char **argv, struct command * |
2242 | 2243 | { |
2243 | 2244 |
|
2244 | 2245 | const char *desc = "Define Issue Get Feature command (FID : 0xC6) PLP Health Check Interval"; |
2245 | | - const char *sel = "[0-3,8]: current/default/saved/supported/changed"; |
2246 | 2246 | const __u32 nsid = 0; |
2247 | 2247 | const __u8 fid = 0xc6; |
2248 | 2248 | struct nvme_dev *dev; |
@@ -2875,6 +2875,70 @@ static int get_enable_ieee1667_silo(int argc, char **argv, struct command *cmd, |
2875 | 2875 | return enable_ieee1667_silo_get(dev, cfg.sel, !argconfig_parse_seen(opts, "no-uuid")); |
2876 | 2876 | } |
2877 | 2877 |
|
| 2878 | +static int enable_ieee1667_silo_set(struct nvme_dev *dev, |
| 2879 | + struct argconfig_commandline_options *opts) |
| 2880 | +{ |
| 2881 | + struct ieee1667_get_cq_entry cq_entry; |
| 2882 | + int err; |
| 2883 | + const __u8 fid = 0xc4; |
| 2884 | + bool enable = argconfig_parse_seen(opts, "enable"); |
| 2885 | + |
| 2886 | + struct nvme_set_features_args args = { |
| 2887 | + .result = (__u32 *)&cq_entry, |
| 2888 | + .args_size = sizeof(args), |
| 2889 | + .fd = dev_fd(dev), |
| 2890 | + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, |
| 2891 | + .cdw11 = OCP_SET(enable, ENABLE_IEEE1667_SILO), |
| 2892 | + .save = argconfig_parse_seen(opts, "save"), |
| 2893 | + .fid = fid, |
| 2894 | + }; |
| 2895 | + |
| 2896 | + if (!argconfig_parse_seen(opts, "no-uuid")) { |
| 2897 | + /* OCP 2.0 requires UUID index support */ |
| 2898 | + err = ocp_get_uuid_index(dev, &args.uuidx); |
| 2899 | + if (err || !args.uuidx) { |
| 2900 | + nvme_show_error("ERROR: No OCP UUID index found"); |
| 2901 | + return err; |
| 2902 | + } |
| 2903 | + } |
| 2904 | + |
| 2905 | + err = nvme_cli_set_features(dev, &args); |
| 2906 | + if (err > 0) { |
| 2907 | + nvme_show_status(err); |
| 2908 | + } else if (err < 0) { |
| 2909 | + nvme_show_perror(enable_ieee1667_silo); |
| 2910 | + fprintf(stderr, "Command failed while parsing.\n"); |
| 2911 | + } else { |
| 2912 | + enable = OCP_GET(args.cdw11, ENABLE_IEEE1667_SILO); |
| 2913 | + nvme_show_result("Successfully set enable (feature: 0x%02x): %d (%s: %s).", fid, |
| 2914 | + enable, args.save ? "Save" : "Not save", |
| 2915 | + enable ? "Enabled" : "Disabled"); |
| 2916 | + } |
| 2917 | + |
| 2918 | + return err; |
| 2919 | +} |
| 2920 | + |
| 2921 | +static int set_enable_ieee1667_silo(int argc, char **argv, struct command *cmd, |
| 2922 | + struct plugin *plugin) |
| 2923 | +{ |
| 2924 | + int err; |
| 2925 | + |
| 2926 | + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; |
| 2927 | + |
| 2928 | + OPT_ARGS(opts) = { |
| 2929 | + OPT_FLAG("enable", 'e', NULL, no_uuid), |
| 2930 | + OPT_FLAG("save", 's', NULL, save), |
| 2931 | + OPT_FLAG("no-uuid", 'n', NULL, no_uuid), |
| 2932 | + OPT_END() |
| 2933 | + }; |
| 2934 | + |
| 2935 | + err = parse_and_open(&dev, argc, argv, enable_ieee1667_silo, opts); |
| 2936 | + if (err) |
| 2937 | + return err; |
| 2938 | + |
| 2939 | + return enable_ieee1667_silo_set(dev, opts); |
| 2940 | +} |
| 2941 | + |
2878 | 2942 | static int hwcomp_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) |
2879 | 2943 | { |
2880 | 2944 | return ocp_hwcomp_log(argc, argv, cmd, plugin); |
|
0 commit comments