Adding upstream version 2.7.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
04338f02fe
commit
d6e1a5d456
663 changed files with 15529 additions and 6994 deletions
|
@ -1,7 +1,7 @@
|
|||
sources += [
|
||||
'plugins/ocp/ocp-utils.c',
|
||||
'plugins/ocp/ocp-nvme.c',
|
||||
'plugins/ocp/ocp-clear-fw-update-history.c',
|
||||
'plugins/ocp/ocp-clear-features.c',
|
||||
'plugins/ocp/ocp-smart-extended-log.c',
|
||||
'plugins/ocp/ocp-fw-activation-history.c',
|
||||
]
|
||||
|
|
93
plugins/ocp/ocp-clear-features.c
Normal file
93
plugins/ocp/ocp-clear-features.c
Normal file
|
@ -0,0 +1,93 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (c) 2022 Solidigm.
|
||||
*
|
||||
* Authors: haro.panosyan@solidigm.com
|
||||
* leonardo.da.cunha@solidigm.com
|
||||
*/
|
||||
|
||||
#include <unistd.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;
|
||||
__u32 clear = 1 << 31;
|
||||
struct nvme_dev *dev;
|
||||
int uuid_index = 0;
|
||||
bool uuid = true;
|
||||
int err;
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
OPT_FLAG("no-uuid", 'n', NULL,
|
||||
"Skip UUID index search (UUID index not required for OCP 1.0)"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
err = parse_and_open(&dev, argc, argv, desc, opts);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (opts[0].seen)
|
||||
uuid = false;
|
||||
|
||||
if (uuid) {
|
||||
/* OCP 2.0 requires UUID index support */
|
||||
err = ocp_get_uuid_index(dev, &uuid_index);
|
||||
if (err || !uuid_index) {
|
||||
fprintf(stderr, "ERROR: No OCP UUID index found\n");
|
||||
goto close_dev;
|
||||
}
|
||||
}
|
||||
|
||||
struct nvme_set_features_args args = {
|
||||
.result = &result,
|
||||
.data = NULL,
|
||||
.args_size = sizeof(args),
|
||||
.fd = dev_fd(dev),
|
||||
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
|
||||
.nsid = 0,
|
||||
.cdw11 = clear,
|
||||
.cdw12 = 0,
|
||||
.cdw13 = 0,
|
||||
.cdw15 = 0,
|
||||
.data_len = 0,
|
||||
.save = 0,
|
||||
.uuidx = uuid_index,
|
||||
.fid = fid,
|
||||
};
|
||||
|
||||
err = nvme_set_features(&args);
|
||||
|
||||
if (err == 0)
|
||||
printf("Success : %s\n", desc);
|
||||
else if (err > 0)
|
||||
nvme_show_status(err);
|
||||
else
|
||||
printf("Fail : %s\n", desc);
|
||||
close_dev:
|
||||
/* Redundant close() to make static code analysis happy */
|
||||
close(dev->direct.fd);
|
||||
dev_close(dev);
|
||||
return err;
|
||||
}
|
||||
|
||||
int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin)
|
||||
{
|
||||
const char *desc = "OCP Clear Firmware Update History";
|
||||
|
||||
return ocp_clear_feature(argc, argv, desc, OCP_FID_CLEAR_FW_ACTIVATION_HISTORY);
|
||||
}
|
||||
|
||||
int ocp_clear_pcie_correctable_errors(int argc, char **argv, struct command *cmd,
|
||||
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);
|
||||
}
|
12
plugins/ocp/ocp-clear-features.h
Normal file
12
plugins/ocp/ocp-clear-features.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright (c) 2022 Solidigm.
|
||||
*
|
||||
* Authors: haro.panosyan@solidigm.com
|
||||
* leonardo.da.cunha@solidigm.com
|
||||
*/
|
||||
|
||||
int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin);
|
||||
|
||||
int ocp_clear_pcie_correctable_errors(int argc, char **argv, struct command *cmd,
|
||||
struct plugin *plugin);
|
|
@ -1,20 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (c) 2022 Solidigm.
|
||||
*
|
||||
* Authors: haro.panosyan@solidigm.com
|
||||
* leonardo.da.cunha@solidigm.com
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include "ocp-utils.h"
|
||||
#include "nvme-print.h"
|
||||
|
||||
static const __u8 OCP_FID_CLEAR_FW_ACTIVATION_HISTORY = 0xC1;
|
||||
|
||||
int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin)
|
||||
{
|
||||
const char *desc = "OCP Clear Firmware Update History";
|
||||
|
||||
return ocp_clear_feature(argc, argv, desc, OCP_FID_CLEAR_FW_ACTIVATION_HISTORY);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright (c) 2022 Solidigm.
|
||||
*
|
||||
* Authors: haro.panosyan@solidigm.com
|
||||
* leonardo.da.cunha@solidigm.com
|
||||
*/
|
||||
|
||||
int ocp_clear_fw_update_history(int argc, char **argv,
|
||||
struct command *cmd, struct plugin *plugin);
|
|
@ -207,16 +207,18 @@ int ocp_fw_activation_history_log(int argc, char **argv, struct command *cmd,
|
|||
}
|
||||
|
||||
if (!err) {
|
||||
const enum nvme_print_flags print_flag = validate_output_format(format);
|
||||
enum nvme_print_flags print_flag;
|
||||
|
||||
err = validate_output_format(format, &print_flag);
|
||||
if (err < 0) {
|
||||
fprintf(stderr, "Error: Invalid output format.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
if (print_flag == JSON)
|
||||
ocp_fw_activation_history_json(&fw_history);
|
||||
else if (print_flag == NORMAL)
|
||||
ocp_fw_activation_history_normal(&fw_history);
|
||||
else {
|
||||
fprintf(stderr, "Error: Invalid output format.\n");
|
||||
err = -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -21,12 +21,15 @@ PLUGIN(NAME("ocp", "OCP cloud SSD extensions", NVME_VERSION),
|
|||
ENTRY("internal-log", "Retrieve and save internal device telemetry log", ocp_telemetry_log)
|
||||
ENTRY("clear-fw-activate-history", "Clear firmware update history log", clear_fw_update_history)
|
||||
ENTRY("eol-plp-failure-mode", "Define EOL or PLP circuitry failure mode.", eol_plp_failure_mode)
|
||||
ENTRY("clear-pcie-correctable-error-counters", "Clear PCIe correctable error counters", clear_pcie_corectable_error_counters)
|
||||
ENTRY("clear-pcie-correctable-errors", "Clear PCIe correctable error counters", clear_pcie_correctable_error_counters)
|
||||
ENTRY("fw-activate-history", "Get firmware activation history log", fw_activation_history_log)
|
||||
ENTRY("unsupported-reqs-log", "Get Unsupported Requirements Log Page", ocp_unsupported_requirements_log)
|
||||
ENTRY("error-recovery-log", "Retrieve Error Recovery Log Page", ocp_error_recovery_log)
|
||||
ENTRY("device-capability-log", "Get Device capabilities Requirements Log Page", ocp_device_capabilities_log)
|
||||
ENTRY("set-dssd-power-state-feature", "Get Device capabilities Requirements Log Page", set_dssd_power_state_feature)
|
||||
ENTRY("set-plp-health-check-interval", "Set PLP Health Check Interval", set_plp_health_check_interval)
|
||||
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)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -252,15 +252,15 @@ static void ocp_print_C0_log_json(void *data)
|
|||
|
||||
static int get_c0_log_page(int fd, char *format)
|
||||
{
|
||||
enum nvme_print_flags fmt;
|
||||
__u8 *data;
|
||||
int i;
|
||||
int ret = 0;
|
||||
int fmt = -1;
|
||||
int ret;
|
||||
|
||||
fmt = validate_output_format(format);
|
||||
if (fmt < 0) {
|
||||
ret = validate_output_format(format, &fmt);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "ERROR : OCP : invalid output format\n");
|
||||
return fmt;
|
||||
return ret;
|
||||
}
|
||||
|
||||
data = malloc(sizeof(__u8) * C0_SMART_CLOUD_ATTR_LEN);
|
||||
|
@ -307,6 +307,8 @@ static int get_c0_log_page(int fd, char *format)
|
|||
case JSON:
|
||||
ocp_print_C0_log_json(data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "ERROR : OCP : Unable to read C0 data from buffer\n");
|
||||
|
|
|
@ -30,66 +30,3 @@ int ocp_get_uuid_index(struct nvme_dev *dev, int *index)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int ocp_clear_feature(int argc, char **argv, const char *desc, const __u8 fid)
|
||||
{
|
||||
__u32 result = 0;
|
||||
__u32 clear = 1 << 31;
|
||||
struct nvme_dev *dev;
|
||||
int uuid_index = 0;
|
||||
bool uuid = true;
|
||||
int err;
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
OPT_FLAG("no-uuid", 'n', NULL,
|
||||
"Skip UUID index search (UUID index not required for OCP 1.0)"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
err = parse_and_open(&dev, argc, argv, desc, opts);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (opts[0].seen)
|
||||
uuid = false;
|
||||
|
||||
if (uuid) {
|
||||
/* OCP 2.0 requires UUID index support */
|
||||
err = ocp_get_uuid_index(dev, &uuid_index);
|
||||
if (err || !uuid_index) {
|
||||
fprintf(stderr, "ERROR: No OCP UUID index found\n");
|
||||
goto close_dev;
|
||||
}
|
||||
}
|
||||
|
||||
struct nvme_set_features_args args = {
|
||||
.result = &result,
|
||||
.data = NULL,
|
||||
.args_size = sizeof(args),
|
||||
.fd = dev_fd(dev),
|
||||
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
|
||||
.nsid = 0,
|
||||
.cdw11 = clear,
|
||||
.cdw12 = 0,
|
||||
.cdw13 = 0,
|
||||
.cdw15 = 0,
|
||||
.data_len = 0,
|
||||
.save = 0,
|
||||
.uuidx = uuid_index,
|
||||
.fid = fid,
|
||||
};
|
||||
|
||||
err = nvme_set_features(&args);
|
||||
|
||||
if (err == 0)
|
||||
printf("Success : %s\n", desc);
|
||||
else if (err > 0)
|
||||
nvme_show_status(err);
|
||||
else
|
||||
printf("Fail : %s\n", desc);
|
||||
close_dev:
|
||||
/* Redundant close() to make static code analysis happy */
|
||||
close(dev->direct.fd);
|
||||
dev_close(dev);
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
/**
|
||||
* ocp_get_uuid_index() - Get OCP UUID index
|
||||
* @dev: nvme device
|
||||
* @index: integer ponter to here to save the index
|
||||
* @index: integer pointer to here to save the index
|
||||
* @result: The command completion result from CQE dword0
|
||||
*
|
||||
* Return: Zero if nvme device has UUID list log page, or result of get uuid list otherwise.
|
||||
*/
|
||||
int ocp_get_uuid_index(struct nvme_dev *dev, int *index);
|
||||
|
||||
int ocp_clear_feature(int argc, char **argv, const char *desc, const __u8 fid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue