--- /dev/null
+nvme-ocp-get-dssd-async-event-config(1)
+=======================================
+
+NAME
+----
+nvme-ocp-get-dssd-async-event-config - Get dssd-async-event-config value
+
+SYNOPSIS
+--------
+[verse]
+'nvme ocp get-dssd-async-event-config' <device> [--sel=<select> | -s <select>]
+
+DESCRIPTION
+-----------
+Get dssd-async-event-config.
+
+The <device> parameter is mandatory and may be either the NVMe character
+device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).
+
+This will only work on OCP compliant devices supporting this feature.
+Results for any other device are undefined.
+
+On success it returns 0, error code otherwise.
+
+OPTIONS
+-------
+
+-s <select>::
+--sel=<select>::
+ Select (SEL): This field specifies which value of the attributes
+ to return in the provided data:
++
+[]
+|==================
+|Select|Description
+|0|Current
+|1|Default
+|2|Saved
+|3|Supported capabilities
+|4-7|Reserved
+|==================
+
+EXAMPLES
+--------
+* Has the program issue a get-dssd-async-event-config to retrieve the saved 0xC9 get features.
++
+------------
+# nvme ocp get-dssd-async-event-config /dev/nvme0 -s 2
+------------
+
+NVME
+----
+Part of the nvme-user suite.
--- /dev/null
+nvme-ocp-set-dssd-async-event-config(1)
+=======================================
+
+NAME
+----
+nvme-ocp-set-dssd-async-event-config - Set DSSD asynchronous event configuration
+
+SYNOPSIS
+--------
+[verse]
+'nvme ocp set-dssd-async-event-config' <device> [--enable-panic-notices | -e] [--save | -s]
+
+
+DESCRIPTION
+-----------
+Set DSSD asynchronous event configuration
+
+The <device> parameter is mandatory and may be either the NVMe character
+device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).
+
+This will only work on OCP compliant devices supporting this feature.
+Results for any other device are undefined.
+
+On success it returns 0, error code otherwise.
+
+OPTIONS
+-------
+-e::
+--enable-panic-notices::
+ Set enable panic notices [0]
+
+-s::
+--save::
+ Save the attribute so that it persists through all power states and resets.
+
+
+EXAMPLES
+--------
+* Has the program issue a set-dssd-async-event-config to enable panic notices,
+persisting through power states.
++
+------------
+# nvme ocp set-dssd-async-event-config /dev/nvme0 -e -s
+------------
+
+NVME
+----
+Part of the nvme-user suite.
_arguments '*:: :->subcmds'
_describe -t commands "nvme ocp telemetry-string-log options" _telemetry_string_log
;;
+ (set-dssd-async-event-config)
+ local _set_dssd_async_event_config
+ _set_dssd_async_event_config=(
+ /dev/nvme':supply a device to use (required)'
+ --enable-panic-notices':Specifies whether an asynchronous event notification
+ is sent to the host for a panic event'
+ -e':alias for --enable-panic-notices'
+ --save':Specifies that the controller shall save the attribute'
+ -s':alias for --save'
+ )
+ _arguments '*:: :->subcmds'
+ _describe -t commands "nvme ocp set-dssd-async-event-config options" _set_dssd_async_event_config
+ ;;
+ (get-dssd-async-event-config)
+ local _get_dssd_async_event_config
+ _get_dssd_async_event_config=(
+ /dev/nvme':supply a device to use (required)'
+ --sel=':select from 0 - current, 1 - default, 2 - saved, 3 - supported'
+ -S':alias to --sel'
+ )
+ _arguments '*:: :->subcmds'
+ _describe -t commands "nvme ocp get-dssd-async-event-config options" _get_dssd_async_event_config
+ ;;
(*)
_files
;;
"set-telemetry-profile")
opts+=" --telemetry-profile-select= -t"
;;
+ "set-dssd-async-event-config")
+ opts+=" --enable-panic-notices -e --save -s"
+ ;;
+ "get-dssd-power-state-feature")
+ opts+=" --sel= -S"
+ ;;
"help")
opts+=$NO_OPTS
;;
clear-pcie-correctable-error-counters \
vs-fw-activate-history device-capability-log \
set-dssd-power-state-feature telemetry-string-log \
- set-telemetry-profile"
+ set-telemetry-profile set-dssd-async-event-config \
+ get-dssd-async-event-config"
)
# Associative array mapping plugins to corresponding option completions
return err;
}
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+/// dssd_async_event_config
+
+static int set_dssd_async_event_config(int argc, char **argv, struct command *cmd,
+ struct plugin *plugin)
+{
+
+ const char *desc = "Issue Set Feature command (FID : 0xC9) DSSD Async Event Config";
+ 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;
+ int uuid_index = 0;
+
+ struct config {
+ bool epn;
+ bool save;
+ };
+
+ struct config cfg = {
+ .epn = false,
+ .save = false,
+ };
+
+ OPT_ARGS(opts) = {
+ OPT_FLAG("enable-panic-notices", 'e', &cfg.epn, epn),
+ OPT_FLAG("save", 's', &cfg.save, save),
+ OPT_END()
+ };
+
+ err = parse_and_open(&dev, argc, argv, desc, opts);
+ if (err)
+ return err;
+
+ /* OCP 2.0 requires UUID index support */
+ err = ocp_get_uuid_index(dev, &uuid_index);
+ if (err || !uuid_index) {
+ printf("ERROR: No OCP UUID index found\n");
+ return err;
+ }
+
+ struct nvme_set_features_args args = {
+ .args_size = sizeof(args),
+ .fd = dev_fd(dev),
+ .fid = fid,
+ .nsid = nsid,
+ .cdw11 = cfg.epn ? 1 : 0,
+ .cdw12 = 0,
+ .save = cfg.save,
+ .uuidx = uuid_index,
+ .cdw15 = 0,
+ .data_len = 0,
+ .data = NULL,
+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
+ .result = &result,
+ };
+
+ err = nvme_set_features(&args);
+ if (err > 0) {
+ nvme_show_status(err);
+ } else if (err < 0) {
+ nvme_show_perror("Set DSSD Asynchronous Event Configuration\n");
+ fprintf(stderr, "Command failed while parsing.\n");
+ } else {
+ printf("Successfully set the DSSD Asynchronous Event Configuration\n");
+ printf("Enable Panic Notices bit Value: 0x%x\n", cfg.epn);
+ printf("Save bit Value: 0x%x\n", cfg.save);
+ }
+ return err;
+}
+
+static int get_dssd_async_event_config(int argc, char **argv, struct command *cmd,
+ struct plugin *plugin)
+{
+
+ 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;
+ struct nvme_dev *dev;
+ __u32 result;
+ int err;
+
+ struct config {
+ __u8 sel;
+ };
+
+ struct config cfg = {
+ .sel = 0,
+ };
+
+ OPT_ARGS(opts) = {
+ OPT_BYTE("sel", 'S', &cfg.sel, sel),
+ OPT_END()
+ };
+
+ err = parse_and_open(&dev, argc, argv, desc, opts);
+ if (err)
+ return err;
+
+
+ struct nvme_get_features_args args = {
+ .args_size = sizeof(args),
+ .fd = dev_fd(dev),
+ .fid = fid,
+ .nsid = nsid,
+ .sel = cfg.sel,
+ .cdw11 = 0,
+ .uuidx = 0,
+ .data_len = 0,
+ .data = NULL,
+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
+ .result = &result,
+ };
+
+ err = nvme_get_features(&args);
+ if (!err) {
+ printf("get-feature:0xC9 %s value: %#08x\n", nvme_select_to_string(cfg.sel), result);
+
+ if (cfg.sel == NVME_GET_FEATURES_SEL_SUPPORTED)
+ nvme_show_select_result(fid, result);
+ } else {
+ nvme_show_error("Could not get feature: 0xC9\n");
+ }
+
+ return err;
+}
+
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
ENTRY("get-plp-health-check-interval", "Get PLP Health Check Interval", get_plp_health_check_interval)
ENTRY("telemetry-string-log", "Retrieve Telemetry string Log Page", ocp_telemetry_str_log_format)
ENTRY("set-telemetry-profile", "Set Telemetry Profile Feature", ocp_set_telemetry_profile_feature)
+ ENTRY("set-dssd-async-event-config", "Set DSSD Async Event Config", set_dssd_async_event_config)
+ ENTRY("get-dssd-async-event-config", "Get DSSD Async Event Config", get_dssd_async_event_config)
)
);