1
0
Fork 0

Merging upstream version 2.13.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-13 11:50:38 +02:00
parent adb2e5e05d
commit 8599c7290c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
579 changed files with 6165 additions and 1687 deletions

View file

@ -0,0 +1,307 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2025 Sandisk Corporation or its affiliates.
*
* Author: Jeff Lien <jeff.lien@sandisk.com>
* Brandon Paupore <brandon.paupore@sandisk.com>
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
#include <unistd.h>
#include "common.h"
#include "nvme.h"
#include "libnvme.h"
#include "plugin.h"
#include "linux/types.h"
#include "util/cleanup.h"
#include "util/types.h"
#include "nvme-print.h"
#define CREATE_CMD
#include "sandisk-nvme.h"
#include "sandisk-utils.h"
#include "plugins/wdc/wdc-nvme-cmds.h"
static int sndk_vs_internal_fw_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_internal_fw_log(argc, argv, command, plugin);
}
static int sndk_vs_nand_stats(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_nand_stats(argc, argv, command, plugin);
}
static int sndk_vs_smart_add_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_smart_add_log(argc, argv, command, plugin);
}
static int sndk_clear_pcie_correctable_errors(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_clear_pcie_correctable_errors(argc, argv, command, plugin);
}
static int sndk_drive_status(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_drive_status(argc, argv, command, plugin);
}
static int sndk_clear_assert_dump(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_clear_assert_dump(argc, argv, command, plugin);
}
static int sndk_drive_resize(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_drive_resize(argc, argv, command, plugin);
}
static int sndk_vs_fw_activate_history(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_fw_activate_history(argc, argv, command, plugin);
}
static int sndk_clear_fw_activate_history(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_clear_fw_activate_history(argc, argv, command, plugin);
}
static int sndk_vs_telemetry_controller_option(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_telemetry_controller_option(argc, argv, command, plugin);
}
static int sndk_reason_identifier(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_reason_identifier(argc, argv, command, plugin);
}
static int sndk_log_page_directory(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_log_page_directory(argc, argv, command, plugin);
}
static int sndk_namespace_resize(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_namespace_resize(argc, argv, command, plugin);
}
static int sndk_vs_drive_info(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_drive_info(argc, argv, command, plugin);
}
static int sndk_capabilities(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
const char *desc = "Send a capabilities command.";
uint64_t capabilities = 0;
struct nvme_dev *dev;
nvme_root_t r;
int ret;
OPT_ARGS(opts) = {
OPT_END()
};
ret = parse_and_open(&dev, argc, argv, desc, opts);
if (ret)
return ret;
/* get capabilities */
r = nvme_scan(NULL);
sndk_check_device(r, dev);
capabilities = sndk_get_drive_capabilities(r, dev);
/* print command and supported status */
printf("Sandisk Plugin Capabilities for NVME device:%s\n", dev->name);
printf("vs-internal-log : %s\n",
capabilities & SNDK_DRIVE_CAP_INTERNAL_LOG_MASK ? "Supported" : "Not Supported");
printf("vs-nand-stats : %s\n",
capabilities & SNDK_DRIVE_CAP_NAND_STATS ? "Supported" : "Not Supported");
printf("vs-smart-add-log : %s\n",
capabilities & SNDK_DRIVE_CAP_SMART_LOG_MASK ? "Supported" : "Not Supported");
printf("--C0 Log Page : %s\n",
capabilities & SNDK_DRIVE_CAP_C0_LOG_PAGE ? "Supported" : "Not Supported");
printf("--C1 Log Page : %s\n",
capabilities & SNDK_DRIVE_CAP_C1_LOG_PAGE ? "Supported" : "Not Supported");
printf("--C3 Log Page : %s\n",
capabilities & SNDK_DRIVE_CAP_C3_LOG_PAGE ? "Supported" : "Not Supported");
printf("--CA Log Page : %s\n",
capabilities & SNDK_DRIVE_CAP_CA_LOG_PAGE ? "Supported" : "Not Supported");
printf("--D0 Log Page : %s\n",
capabilities & SNDK_DRIVE_CAP_D0_LOG_PAGE ? "Supported" : "Not Supported");
printf("clear-pcie-correctable-errors : %s\n",
capabilities & SNDK_DRIVE_CAP_CLEAR_PCIE_MASK ? "Supported" : "Not Supported");
printf("get-drive-status : %s\n",
capabilities & SNDK_DRIVE_CAP_DRIVE_STATUS ? "Supported" : "Not Supported");
printf("drive-resize : %s\n",
capabilities & SNDK_DRIVE_CAP_RESIZE ? "Supported" : "Not Supported");
printf("vs-fw-activate-history : %s\n",
capabilities & SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_MASK ? "Supported" :
"Not Supported");
printf("clear-fw-activate-history : %s\n",
capabilities & SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY_MASK ? "Supported" :
"Not Supported");
printf("vs-telemetry-controller-option: %s\n",
capabilities & SNDK_DRIVE_CAP_DISABLE_CTLR_TELE_LOG ? "Supported" : "Not Supported");
printf("vs-error-reason-identifier : %s\n",
capabilities & SNDK_DRIVE_CAP_REASON_ID ? "Supported" : "Not Supported");
printf("log-page-directory : %s\n",
capabilities & SNDK_DRIVE_CAP_LOG_PAGE_DIR ? "Supported" : "Not Supported");
printf("namespace-resize : %s\n",
capabilities & SNDK_DRIVE_CAP_NS_RESIZE ? "Supported" : "Not Supported");
printf("vs-drive-info : %s\n",
capabilities & SNDK_DRIVE_CAP_INFO ? "Supported" : "Not Supported");
printf("vs-temperature-stats : %s\n",
capabilities & SNDK_DRIVE_CAP_TEMP_STATS ? "Supported" : "Not Supported");
printf("cloud-SSD-plugin-version : %s\n",
capabilities & SNDK_DRIVE_CAP_CLOUD_SSD_VERSION ? "Supported" : "Not Supported");
printf("vs-pcie-stats : %s\n",
capabilities & SNDK_DRIVE_CAP_PCIE_STATS ? "Supported" : "Not Supported");
printf("get-error-recovery-log : %s\n",
capabilities & SNDK_DRIVE_CAP_OCP_C1_LOG_PAGE ? "Supported" : "Not Supported");
printf("get-dev-capabilities-log : %s\n",
capabilities & SNDK_DRIVE_CAP_OCP_C4_LOG_PAGE ? "Supported" : "Not Supported");
printf("get-unsupported-reqs-log : %s\n",
capabilities & SNDK_DRIVE_CAP_OCP_C5_LOG_PAGE ? "Supported" : "Not Supported");
printf("get-latency-monitor-log : %s\n",
capabilities & SNDK_DRIVE_CAP_C3_LOG_PAGE ? "Supported" : "Not Supported");
printf("cloud-boot-SSD-version : %s\n",
capabilities & SNDK_DRIVE_CAP_CLOUD_BOOT_SSD_VERSION ? "Supported" :
"Not Supported");
printf("vs-cloud-log : %s\n",
capabilities & SNDK_DRIVE_CAP_CLOUD_LOG_PAGE ? "Supported" : "Not Supported");
printf("vs-hw-rev-log : %s\n",
capabilities & SNDK_DRIVE_CAP_HW_REV_LOG_PAGE ? "Supported" : "Not Supported");
printf("vs-device_waf : %s\n",
capabilities & SNDK_DRIVE_CAP_DEVICE_WAF ? "Supported" : "Not Supported");
printf("set-latency-monitor-feature : %s\n",
capabilities & SNDK_DRIVE_CAP_SET_LATENCY_MONITOR ? "Supported" : "Not Supported");
printf("capabilities : Supported\n");
nvme_free_tree(r);
dev_close(dev);
return 0;
}
static int sndk_cloud_ssd_plugin_version(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_cloud_ssd_plugin_version(argc, argv, command, plugin);
}
static int sndk_vs_pcie_stats(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_pcie_stats(argc, argv, command, plugin);
}
static int sndk_get_latency_monitor_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_get_latency_monitor_log(argc, argv, command, plugin);
}
static int sndk_get_error_recovery_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_get_error_recovery_log(argc, argv, command, plugin);
}
static int sndk_get_dev_capabilities_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_get_dev_capabilities_log(argc, argv, command, plugin);
}
static int sndk_get_unsupported_reqs_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_get_unsupported_reqs_log(argc, argv, command, plugin);
}
static int sndk_cloud_boot_SSD_version(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_cloud_boot_SSD_version(argc, argv, command, plugin);
}
static int sndk_vs_cloud_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_cloud_log(argc, argv, command, plugin);
}
static int sndk_vs_hw_rev_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_hw_rev_log(argc, argv, command, plugin);
}
static int sndk_vs_device_waf(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_device_waf(argc, argv, command, plugin);
}
static int sndk_set_latency_monitor_feature(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_set_latency_monitor_feature(argc, argv, command, plugin);
}
static int sndk_vs_temperature_stats(int argc, char **argv,
struct command *command,
struct plugin *plugin)
{
return run_wdc_vs_temperature_stats(argc, argv, command, plugin);
}

View file

@ -0,0 +1,81 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#undef CMD_INC_FILE
#define CMD_INC_FILE plugins/sandisk/sandisk-nvme
#if !defined(SANDISK_NVME) || defined(CMD_HEADER_MULTI_READ)
#define SANDISK_NVME
#define SANDISK_PLUGIN_VERSION "2.12.0"
#include "cmd.h"
PLUGIN(NAME("sndk", "Sandisk vendor specific extensions", SANDISK_PLUGIN_VERSION),
COMMAND_LIST(
ENTRY("vs-internal-log", "Sandisk Internal Firmware Log",
sndk_vs_internal_fw_log)
ENTRY("vs-nand-stats", "Sandisk NAND Statistics", sndk_vs_nand_stats)
ENTRY("vs-smart-add-log", "Sandisk Additional Smart Log",
sndk_vs_smart_add_log)
ENTRY("clear-pcie-correctable-errors",
"Sandisk Clear PCIe Correctable Error Count",
sndk_clear_pcie_correctable_errors)
ENTRY("get-drive-status", "Sandisk Get Drive Status",
sndk_drive_status)
ENTRY("clear-assert-dump", "Sandisk Clear Assert Dump",
sndk_clear_assert_dump)
ENTRY("drive-resize", "Sandisk Drive Resize", sndk_drive_resize)
ENTRY("vs-fw-activate-history", "Sandisk Get FW Activate History",
sndk_vs_fw_activate_history)
ENTRY("clear-fw-activate-history",
"Sandisk Clear FW Activate History",
sndk_clear_fw_activate_history)
ENTRY("vs-telemetry-controller-option",
"Sandisk Enable/Disable Controller Initiated Telemetry Log",
sndk_vs_telemetry_controller_option)
ENTRY("vs-error-reason-identifier",
"Sandisk Telemetry Reason Identifier",
sndk_reason_identifier)
ENTRY("log-page-directory", "Sandisk Get Log Page Directory",
sndk_log_page_directory)
ENTRY("namespace-resize", "Sandisk NamespaceDrive Resize",
sndk_namespace_resize)
ENTRY("vs-drive-info", "Sandisk Get Drive Info", sndk_vs_drive_info)
ENTRY("vs-temperature-stats", "Sandisk Get Temperature Stats",
sndk_vs_temperature_stats)
ENTRY("capabilities", "Sandisk Device Capabilities",
sndk_capabilities)
ENTRY("cloud-SSD-plugin-version",
"Sandisk Cloud SSD Plugin Version",
sndk_cloud_ssd_plugin_version)
ENTRY("vs-pcie-stats", "Sandisk VS PCIE Statistics",
sndk_vs_pcie_stats)
ENTRY("get-latency-monitor-log",
"Sandisk Get Latency Monitor Log Page",
sndk_get_latency_monitor_log)
ENTRY("get-error-recovery-log",
"Sandisk Get Error Recovery Log Page",
sndk_get_error_recovery_log)
ENTRY("get-dev-capabilities-log",
"Sandisk Get Device Capabilities Log Page",
sndk_get_dev_capabilities_log)
ENTRY("get-unsupported-reqs-log",
"Sandisk Get Unsupported Requirements Log Page",
sndk_get_unsupported_reqs_log)
ENTRY("cloud-boot-SSD-version",
"Sandisk Get the Cloud Boot SSD Version",
sndk_cloud_boot_SSD_version)
ENTRY("vs-cloud-log", "Sandisk Get the Cloud Log Page",
sndk_vs_cloud_log)
ENTRY("vs-hw-rev-log", "Sandisk Get the Hardware Revision Log Page",
sndk_vs_hw_rev_log)
ENTRY("vs-device-waf",
"Sandisk Calculate Device Write Amplication Factor",
sndk_vs_device_waf)
ENTRY("set-latency-monitor-feature",
"Sandisk set Latency Monitor feature",
sndk_set_latency_monitor_feature)
)
);
#endif
#include "define_cmd.h"

View file

@ -0,0 +1,534 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2025 Sandisk Corporation or its affiliates.
*
* Author: Jeff Lien <jeff.lien@sandisk.com>
* Brandon Paupore <brandon.paupore@sandisk.com>
*/
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include "nvme.h"
#include "libnvme.h"
#include "nvme-print.h"
#include "sandisk-utils.h"
#include "plugins/wdc/wdc-nvme-cmds.h"
int sndk_get_pci_ids(nvme_root_t r, struct nvme_dev *dev,
uint32_t *device_id, uint32_t *vendor_id)
{
char vid[256], did[256], id[32];
nvme_ctrl_t c = NULL;
nvme_ns_t n = NULL;
int fd, ret;
c = nvme_scan_ctrl(r, dev->name);
if (c) {
snprintf(vid, sizeof(vid), "%s/device/vendor",
nvme_ctrl_get_sysfs_dir(c));
snprintf(did, sizeof(did), "%s/device/device",
nvme_ctrl_get_sysfs_dir(c));
nvme_free_ctrl(c);
} else {
n = nvme_scan_namespace(dev->name);
if (!n) {
fprintf(stderr, "Unable to find %s\n", dev->name);
return -1;
}
snprintf(vid, sizeof(vid), "%s/device/device/vendor",
nvme_ns_get_sysfs_dir(n));
snprintf(did, sizeof(did), "%s/device/device/device",
nvme_ns_get_sysfs_dir(n));
nvme_free_ns(n);
}
fd = open(vid, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "ERROR: SNDK: %s : Open vendor file failed\n", __func__);
return -1;
}
ret = read(fd, id, 32);
close(fd);
if (ret < 0) {
fprintf(stderr, "%s: Read of pci vendor id failed\n", __func__);
return -1;
}
id[ret < 32 ? ret : 31] = '\0';
if (id[strlen(id) - 1] == '\n')
id[strlen(id) - 1] = '\0';
*vendor_id = strtol(id, NULL, 0);
ret = 0;
fd = open(did, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "ERROR: SNDK: %s : Open device file failed\n", __func__);
return -1;
}
ret = read(fd, id, 32);
close(fd);
if (ret < 0) {
fprintf(stderr, "ERROR: SNDK: %s: Read of pci device id failed\n", __func__);
return -1;
}
id[ret < 32 ? ret : 31] = '\0';
if (id[strlen(id) - 1] == '\n')
id[strlen(id) - 1] = '\0';
*device_id = strtol(id, NULL, 0);
return 0;
}
int sndk_get_vendor_id(struct nvme_dev *dev, uint32_t *vendor_id)
{
int ret;
struct nvme_id_ctrl ctrl;
memset(&ctrl, 0, sizeof(struct nvme_id_ctrl));
ret = nvme_identify_ctrl(dev_fd(dev), &ctrl);
if (ret) {
fprintf(stderr, "ERROR: SNDK: nvme_identify_ctrl() failed 0x%x\n", ret);
return -1;
}
*vendor_id = (uint32_t) ctrl.vid;
return ret;
}
bool sndk_check_device(nvme_root_t r, struct nvme_dev *dev)
{
int ret;
bool supported;
uint32_t read_device_id = -1, read_vendor_id = -1;
ret = sndk_get_pci_ids(r, dev, &read_device_id, &read_vendor_id);
if (ret < 0) {
/* Use the identify nvme command to get vendor id due to NVMeOF device. */
if (sndk_get_vendor_id(dev, &read_vendor_id) < 0)
return false;
}
supported = false;
if (read_vendor_id == SNDK_NVME_SNDK_VID ||
read_vendor_id == SNDK_NVME_WDC_VID)
supported = true;
else
fprintf(stderr,
"ERROR: SNDK: unsupported Sandisk device, Vendor ID = 0x%x, Device ID = 0x%x\n",
read_vendor_id, read_device_id);
return supported;
}
__u64 sndk_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
{
__u64 capabilities = 0;
int ret;
uint32_t read_device_id = -1, read_vendor_id = -1;
__u32 cust_id;
ret = sndk_get_pci_ids(r, dev, &read_device_id, &read_vendor_id);
if (ret < 0) {
if (sndk_get_vendor_id(dev, &read_vendor_id) < 0)
return capabilities;
}
/*
* Below check condition is added due in NVMeOF device
* We aren't able to read the device_id in this case
* so we can only use the vendor_id
*/
if (read_device_id == -1 && read_vendor_id != -1) {
capabilities = sndk_get_enc_drive_capabilities(r, dev);
return capabilities;
}
switch (read_vendor_id) {
case SNDK_NVME_WDC_VID:
switch (read_device_id) {
case SNDK_NVME_SN630_DEV_ID:
case SNDK_NVME_SN630_DEV_ID_1:
capabilities = (SNDK_DRIVE_CAP_INTERNAL_LOG |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_CLEAR_ASSERT |
SNDK_DRIVE_CAP_RESIZE |
SNDK_DRIVE_CAP_CLEAR_PCIE);
/* verify the 0xCA log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_DEVICE_INFO_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_CA_LOG_PAGE;
/* verify the 0xD0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_VU_SMART_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_D0_LOG_PAGE;
break;
case SNDK_NVME_SN640_DEV_ID:
case SNDK_NVME_SN640_DEV_ID_1:
case SNDK_NVME_SN640_DEV_ID_2:
case SNDK_NVME_SN640_DEV_ID_3:
/* verify the 0xC0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_SMART_CLOUD_ATTR_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_C0_LOG_PAGE;
capabilities |= (SNDK_DRIVE_CAP_INTERNAL_LOG |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_CLEAR_ASSERT |
SNDK_DRIVE_CAP_RESIZE |
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY |
SNDK_DRIVE_CAP_DISABLE_CTLR_TELE_LOG |
SNDK_DRIVE_CAP_REASON_ID |
SNDK_DRIVE_CAP_LOG_PAGE_DIR);
/* verify the 0xC1 (OCP Error Recovery) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_ERROR_REC_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_OCP_C1_LOG_PAGE;
/* verify the 0xC3 (OCP Latency Monitor) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_LATENCY_MON_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_C3_LOG_PAGE;
/* verify the 0xC4 (OCP Device Capabilities) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_DEV_CAP_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_OCP_C4_LOG_PAGE;
/* verify the 0xC5 (OCP Unsupported Requirements) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_UNSUPPORTED_REQS_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_OCP_C5_LOG_PAGE;
/* verify the 0xCA log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_DEVICE_INFO_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_CA_LOG_PAGE;
/* verify the 0xD0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_VU_SMART_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_D0_LOG_PAGE;
cust_id = run_wdc_get_fw_cust_id(r, dev);
if (cust_id == SNDK_INVALID_CUSTOMER_ID) {
fprintf(stderr, "%s: ERROR: SNDK: invalid customer id\n", __func__);
return -1;
}
if ((cust_id == SNDK_CUSTOMER_ID_0x1004) ||
(cust_id == SNDK_CUSTOMER_ID_0x1008) ||
(cust_id == SNDK_CUSTOMER_ID_0x1005) ||
(cust_id == SNDK_CUSTOMER_ID_0x1304))
capabilities |= (SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_CLOUD_SSD_VERSION);
else
capabilities |= (SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_CLEAR_PCIE);
break;
case SNDK_NVME_SN840_DEV_ID:
case SNDK_NVME_SN840_DEV_ID_1:
/* verify the 0xC0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_EOL_STATUS_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_C0_LOG_PAGE;
capabilities |= (SNDK_DRIVE_CAP_INTERNAL_LOG |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_CLEAR_ASSERT |
SNDK_DRIVE_CAP_RESIZE |
SNDK_DRIVE_CAP_CLEAR_PCIE |
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY |
SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_DISABLE_CTLR_TELE_LOG |
SNDK_DRIVE_CAP_REASON_ID |
SNDK_DRIVE_CAP_LOG_PAGE_DIR);
/* verify the 0xCA log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_DEVICE_INFO_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_CA_LOG_PAGE;
/* verify the 0xD0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_VU_SMART_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_D0_LOG_PAGE;
break;
case SNDK_NVME_SN650_DEV_ID:
case SNDK_NVME_SN650_DEV_ID_1:
case SNDK_NVME_SN650_DEV_ID_2:
case SNDK_NVME_SN650_DEV_ID_3:
case SNDK_NVME_SN650_DEV_ID_4:
case SNDK_NVME_SN655_DEV_ID:
case SNDK_NVME_SN655_DEV_ID_1:
/* verify the 0xC0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_SMART_CLOUD_ATTR_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_C0_LOG_PAGE;
/* verify the 0xC1 (OCP Error Recovery) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_ERROR_REC_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_OCP_C1_LOG_PAGE;
/* verify the 0xC3 (OCP Latency Monitor) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_LATENCY_MON_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_C3_LOG_PAGE;
/* verify the 0xC4 (OCP Device Capabilities) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_DEV_CAP_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_OCP_C4_LOG_PAGE;
/* verify the 0xC5 (OCP Unsupported Requirements) log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_UNSUPPORTED_REQS_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_OCP_C5_LOG_PAGE;
capabilities |= (SNDK_DRIVE_CAP_INTERNAL_LOG |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_CLEAR_ASSERT |
SNDK_DRIVE_CAP_RESIZE |
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY |
SNDK_DRIVE_CAP_DISABLE_CTLR_TELE_LOG |
SNDK_DRIVE_CAP_REASON_ID |
SNDK_DRIVE_CAP_LOG_PAGE_DIR);
cust_id = run_wdc_get_fw_cust_id(r, dev);
if (cust_id == SNDK_INVALID_CUSTOMER_ID) {
fprintf(stderr, "%s: ERROR: SNDK: invalid customer id\n", __func__);
return -1;
}
if ((cust_id == SNDK_CUSTOMER_ID_0x1004) ||
(cust_id == SNDK_CUSTOMER_ID_0x1008) ||
(cust_id == SNDK_CUSTOMER_ID_0x1005) ||
(cust_id == SNDK_CUSTOMER_ID_0x1304))
capabilities |= (SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_CLOUD_SSD_VERSION);
else
capabilities |= (SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_CLEAR_PCIE);
break;
case SNDK_NVME_SN861_DEV_ID:
case SNDK_NVME_SN861_DEV_ID_1:
case SNDK_NVME_SN861_DEV_ID_2:
capabilities |= (SNDK_DRIVE_CAP_C0_LOG_PAGE |
SNDK_DRIVE_CAP_C3_LOG_PAGE |
SNDK_DRIVE_CAP_CA_LOG_PAGE |
SNDK_DRIVE_CAP_OCP_C4_LOG_PAGE |
SNDK_DRIVE_CAP_OCP_C5_LOG_PAGE |
SNDK_DRIVE_CAP_INTERNAL_LOG |
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2 |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE |
SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_CLOUD_SSD_VERSION |
SNDK_DRIVE_CAP_LOG_PAGE_DIR |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_SET_LATENCY_MONITOR);
break;
case SNDK_NVME_SNTMP_DEV_ID:
capabilities |= (SNDK_DRIVE_CAP_C0_LOG_PAGE |
SNDK_DRIVE_CAP_C3_LOG_PAGE |
SNDK_DRIVE_CAP_CA_LOG_PAGE |
SNDK_DRIVE_CAP_OCP_C4_LOG_PAGE |
SNDK_DRIVE_CAP_OCP_C5_LOG_PAGE |
SNDK_DRIVE_CAP_DUI |
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2 |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE |
SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_CLOUD_SSD_VERSION |
SNDK_DRIVE_CAP_LOG_PAGE_DIR |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_SET_LATENCY_MONITOR);
break;
default:
capabilities = 0;
}
break;
case SNDK_NVME_SNDK_VID:
switch (read_device_id) {
case SNDK_NVME_SN520_DEV_ID:
case SNDK_NVME_SN520_DEV_ID_1:
case SNDK_NVME_SN520_DEV_ID_2:
case SNDK_NVME_SN810_DEV_ID:
capabilities = SNDK_DRIVE_CAP_DUI_DATA;
break;
case SNDK_NVME_SN820CL_DEV_ID:
capabilities = SNDK_DRIVE_CAP_DUI_DATA |
SNDK_DRIVE_CAP_CLOUD_BOOT_SSD_VERSION |
SNDK_DRIVE_CAP_CLOUD_LOG_PAGE |
SNDK_DRIVE_CAP_C0_LOG_PAGE |
SNDK_DRIVE_CAP_HW_REV_LOG_PAGE |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE |
SNDK_DRIVE_CAP_NAND_STATS |
SNDK_DRIVE_CAP_DEVICE_WAF |
SNDK_DRIVE_CAP_TEMP_STATS;
break;
case SNDK_NVME_SN720_DEV_ID:
capabilities = SNDK_DRIVE_CAP_DUI_DATA |
SNDK_DRIVE_CAP_NAND_STATS |
SNDK_DRIVE_CAP_NS_RESIZE;
break;
case SNDK_NVME_SN730_DEV_ID:
capabilities = SNDK_DRIVE_CAP_DUI |
SNDK_DRIVE_CAP_NAND_STATS |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_TEMP_STATS |
SNDK_DRIVE_CAP_VUC_CLEAR_PCIE |
SNDK_DRIVE_CAP_PCIE_STATS;
break;
case SNDK_NVME_SN530_DEV_ID_1:
case SNDK_NVME_SN530_DEV_ID_2:
case SNDK_NVME_SN530_DEV_ID_3:
case SNDK_NVME_SN530_DEV_ID_4:
case SNDK_NVME_SN530_DEV_ID_5:
case SNDK_NVME_SN350_DEV_ID:
case SNDK_NVME_SN570_DEV_ID:
case SNDK_NVME_SN850X_DEV_ID:
case SNDK_NVME_SN5000_DEV_ID_1:
case SNDK_NVME_SN5000_DEV_ID_2:
case SNDK_NVME_SN5000_DEV_ID_3:
case SNDK_NVME_SN5000_DEV_ID_4:
case SNDK_NVME_SN7000S_DEV_ID_1:
case SNDK_NVME_SN7150_DEV_ID_1:
case SNDK_NVME_SN7150_DEV_ID_2:
case SNDK_NVME_SN7150_DEV_ID_3:
case SNDK_NVME_SN7150_DEV_ID_4:
case SNDK_NVME_SN7150_DEV_ID_5:
case SNDK_NVME_SN7100_DEV_ID_1:
case SNDK_NVME_SN7100_DEV_ID_2:
case SNDK_NVME_SN7100_DEV_ID_3:
case SNDK_NVME_SN8000S_DEV_ID:
case SNDK_NVME_SN5100S_DEV_ID_1:
case SNDK_NVME_SN5100S_DEV_ID_2:
case SNDK_NVME_SN5100S_DEV_ID_3:
case SNDK_NVME_SN740_DEV_ID:
case SNDK_NVME_SN740_DEV_ID_1:
case SNDK_NVME_SN740_DEV_ID_2:
case SNDK_NVME_SN740_DEV_ID_3:
case SNDK_NVME_SN340_DEV_ID:
capabilities = SNDK_DRIVE_CAP_DUI;
break;
case SNDK_NVME_ZN350_DEV_ID:
case SNDK_NVME_ZN350_DEV_ID_1:
capabilities = SNDK_DRIVE_CAP_DUI_DATA |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE |
SNDK_DRIVE_CAP_C0_LOG_PAGE |
SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2 |
SNDK_DRIVE_CAP_INFO |
SNDK_DRIVE_CAP_CLOUD_SSD_VERSION |
SNDK_DRIVE_CAP_LOG_PAGE_DIR;
break;
default:
capabilities = 0;
}
break;
default:
capabilities = 0;
}
return capabilities;
}
__u64 sndk_get_enc_drive_capabilities(nvme_root_t r,
struct nvme_dev *dev)
{
int ret;
uint32_t read_vendor_id;
__u64 capabilities = 0;
__u32 cust_id;
ret = sndk_get_vendor_id(dev, &read_vendor_id);
if (ret < 0)
return capabilities;
switch (read_vendor_id) {
case SNDK_NVME_WDC_VID:
capabilities = (SNDK_DRIVE_CAP_INTERNAL_LOG |
SNDK_DRIVE_CAP_DRIVE_STATUS |
SNDK_DRIVE_CAP_CLEAR_ASSERT |
SNDK_DRIVE_CAP_RESIZE);
/* verify the 0xC3 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_LATENCY_MON_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_C3_LOG_PAGE;
/* verify the 0xCB log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_FW_ACT_HISTORY_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY;
/* verify the 0xCA log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_DEVICE_INFO_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_CA_LOG_PAGE;
/* verify the 0xD0 log page is supported */
if (run_wdc_nvme_check_supported_log_page(r, dev,
SNDK_NVME_GET_VU_SMART_LOG_ID))
capabilities |= SNDK_DRIVE_CAP_D0_LOG_PAGE;
cust_id = run_wdc_get_fw_cust_id(r, dev);
if (cust_id == SNDK_INVALID_CUSTOMER_ID) {
fprintf(stderr, "%s: ERROR: SNDK: invalid customer id\n", __func__);
return -1;
}
if ((cust_id == SNDK_CUSTOMER_ID_0x1004) ||
(cust_id == SNDK_CUSTOMER_ID_0x1008) ||
(cust_id == SNDK_CUSTOMER_ID_0x1005) ||
(cust_id == SNDK_CUSTOMER_ID_0x1304))
capabilities |= (SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE);
else
capabilities |= (SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY |
SNDK_DRIVE_CAP_CLEAR_PCIE);
break;
default:
capabilities = 0;
}
return capabilities;
}

View file

@ -0,0 +1,192 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (c) 2025 Sandisk Corporation or its affiliates.
*
* Author: Jeff Lien <jeff.lien@sandisk.com>
* Brandon Paupore <brandon.paupore@sandisk.com>
*/
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <assert.h>
#include <time.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
/* Device Config */
#define SNDK_NVME_WDC_VID 0x1b96
#define SNDK_NVME_SNDK_VID 0x15b7
#define SNDK_NVME_SN630_DEV_ID 0x2200
#define SNDK_NVME_SN630_DEV_ID_1 0x2201
#define SNDK_NVME_SN840_DEV_ID 0x2300
#define SNDK_NVME_SN840_DEV_ID_1 0x2500
#define SNDK_NVME_SN640_DEV_ID 0x2400
#define SNDK_NVME_SN640_DEV_ID_1 0x2401
#define SNDK_NVME_SN640_DEV_ID_2 0x2402
#define SNDK_NVME_SN640_DEV_ID_3 0x2404
#define SNDK_NVME_SN650_DEV_ID 0x2700
#define SNDK_NVME_SN650_DEV_ID_1 0x2701
#define SNDK_NVME_SN650_DEV_ID_2 0x2702
#define SNDK_NVME_SN650_DEV_ID_3 0x2720
#define SNDK_NVME_SN650_DEV_ID_4 0x2721
#define SNDK_NVME_SN655_DEV_ID 0x2722
#define SNDK_NVME_SN655_DEV_ID_1 0x2723
#define SNDK_NVME_SN861_DEV_ID 0x2750
#define SNDK_NVME_SN861_DEV_ID_1 0x2751
#define SNDK_NVME_SN861_DEV_ID_2 0x2752
#define SNDK_NVME_SNTMP_DEV_ID 0x2761
#define SNDK_NVME_SN520_DEV_ID 0x5003
#define SNDK_NVME_SN520_DEV_ID_1 0x5004
#define SNDK_NVME_SN520_DEV_ID_2 0x5005
#define SNDK_NVME_SN530_DEV_ID_1 0x5007
#define SNDK_NVME_SN530_DEV_ID_2 0x5008
#define SNDK_NVME_SN530_DEV_ID_3 0x5009
#define SNDK_NVME_SN530_DEV_ID_4 0x500b
#define SNDK_NVME_SN530_DEV_ID_5 0x501d
#define SNDK_NVME_SN350_DEV_ID 0x5019
#define SNDK_NVME_SN570_DEV_ID 0x501A
#define SNDK_NVME_SN850X_DEV_ID 0x5030
#define SNDK_NVME_SN5000_DEV_ID_1 0x5034
#define SNDK_NVME_SN5000_DEV_ID_2 0x5035
#define SNDK_NVME_SN5000_DEV_ID_3 0x5036
#define SNDK_NVME_SN5000_DEV_ID_4 0x504A
#define SNDK_NVME_SN7000S_DEV_ID_1 0x5039
#define SNDK_NVME_SN7150_DEV_ID_1 0x503b
#define SNDK_NVME_SN7150_DEV_ID_2 0x503c
#define SNDK_NVME_SN7150_DEV_ID_3 0x503d
#define SNDK_NVME_SN7150_DEV_ID_4 0x503e
#define SNDK_NVME_SN7150_DEV_ID_5 0x503f
#define SNDK_NVME_SN7100_DEV_ID_1 0x5043
#define SNDK_NVME_SN7100_DEV_ID_2 0x5044
#define SNDK_NVME_SN7100_DEV_ID_3 0x5045
#define SNDK_NVME_SN8000S_DEV_ID 0x5049
#define SNDK_NVME_SN720_DEV_ID 0x5002
#define SNDK_NVME_SN730_DEV_ID 0x5006
#define SNDK_NVME_SN740_DEV_ID 0x5015
#define SNDK_NVME_SN740_DEV_ID_1 0x5016
#define SNDK_NVME_SN740_DEV_ID_2 0x5017
#define SNDK_NVME_SN740_DEV_ID_3 0x5025
#define SNDK_NVME_SN340_DEV_ID 0x500d
#define SNDK_NVME_ZN350_DEV_ID 0x5010
#define SNDK_NVME_ZN350_DEV_ID_1 0x5018
#define SNDK_NVME_SN810_DEV_ID 0x5011
#define SNDK_NVME_SN820CL_DEV_ID 0x5037
#define SNDK_NVME_SN5100S_DEV_ID_1 0x5061
#define SNDK_NVME_SN5100S_DEV_ID_2 0x5062
#define SNDK_NVME_SN5100S_DEV_ID_3 0x5063
#define SNDK_DRIVE_CAP_INTERNAL_LOG 0x0000000000000001
#define SNDK_DRIVE_CAP_C1_LOG_PAGE 0x0000000000000002
#define SNDK_DRIVE_CAP_CA_LOG_PAGE 0x0000000000000004
#define SNDK_DRIVE_CAP_D0_LOG_PAGE 0x0000000000000008
#define SNDK_DRIVE_CAP_DRIVE_STATUS 0x0000000000000010
#define SNDK_DRIVE_CAP_CLEAR_ASSERT 0x0000000000000020
#define SNDK_DRIVE_CAP_CLEAR_PCIE 0x0000000000000040
#define SNDK_DRIVE_CAP_RESIZE 0x0000000000000080
#define SNDK_DRIVE_CAP_NAND_STATS 0x0000000000000100
#define SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY 0x0000000000000200
#define SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY 0x0000000000000400
#define SNDK_DRIVE_CAP_DISABLE_CTLR_TELE_LOG 0x0000000000000800
#define SNDK_DRIVE_CAP_REASON_ID 0x0000000000001000
#define SNDK_DRIVE_CAP_LOG_PAGE_DIR 0x0000000000002000
#define SNDK_DRIVE_CAP_NS_RESIZE 0x0000000000004000
#define SNDK_DRIVE_CAP_INFO 0x0000000000008000
#define SNDK_DRIVE_CAP_C0_LOG_PAGE 0x0000000000010000
#define SNDK_DRIVE_CAP_TEMP_STATS 0x0000000000020000
#define SNDK_DRIVE_CAP_VUC_CLEAR_PCIE 0x0000000000040000
#define SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE 0x0000000000080000
#define SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2 0x0000000000100000
#define SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY 0x0000000000200000
#define SNDK_DRIVE_CAP_CLOUD_SSD_VERSION 0x0000000000400000
#define SNDK_DRIVE_CAP_PCIE_STATS 0x0000000000800000
#define SNDK_DRIVE_CAP_HW_REV_LOG_PAGE 0x0000000001000000
#define SNDK_DRIVE_CAP_C3_LOG_PAGE 0x0000000002000000
#define SNDK_DRIVE_CAP_CLOUD_BOOT_SSD_VERSION 0x0000000004000000
#define SNDK_DRIVE_CAP_CLOUD_LOG_PAGE 0x0000000008000000
#define SNDK_DRIVE_CAP_DUI_DATA 0x0000000010000000
#define SNDK_DRIVE_CAP_VUC_LOG 0x0000000020000000
#define SNDK_DRIVE_CAP_DUI 0x0000000040000000
#define SNDK_DRIVE_CAP_OCP_C1_LOG_PAGE 0x0000000080000000
#define SNDK_DRIVE_CAP_OCP_C4_LOG_PAGE 0x0000000100000000
#define SNDK_DRIVE_CAP_OCP_C5_LOG_PAGE 0x0000000200000000
#define SNDK_DRIVE_CAP_DEVICE_WAF 0x0000000400000000
#define SNDK_DRIVE_CAP_SET_LATENCY_MONITOR 0x0000000800000000
#define SNDK_DRIVE_CAP_SMART_LOG_MASK (SNDK_DRIVE_CAP_C0_LOG_PAGE | \
SNDK_DRIVE_CAP_C1_LOG_PAGE | \
SNDK_DRIVE_CAP_CA_LOG_PAGE | \
SNDK_DRIVE_CAP_D0_LOG_PAGE)
#define SNDK_DRIVE_CAP_CLEAR_PCIE_MASK (SNDK_DRIVE_CAP_CLEAR_PCIE | \
SNDK_DRIVE_CAP_VUC_CLEAR_PCIE | \
SNDK_DRIVE_CAP_VU_FID_CLEAR_PCIE)
#define SNDK_DRIVE_CAP_INTERNAL_LOG_MASK (SNDK_DRIVE_CAP_INTERNAL_LOG | \
SNDK_DRIVE_CAP_DUI | \
SNDK_DRIVE_CAP_DUI_DATA | \
SNDK_DRIVE_CAP_VUC_LOG)
#define SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_MASK (SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY | \
SNDK_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2)
#define SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY_MASK (SNDK_DRIVE_CAP_CLEAR_FW_ACT_HISTORY | \
SNDK_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY)
/* Vendor defined Log Page IDs */
#define SNDK_NVME_GET_SMART_CLOUD_ATTR_LOG_ID 0xC0
#define SNDK_NVME_GET_EOL_STATUS_LOG_ID 0xC0
#define SNDK_ERROR_REC_LOG_ID 0xC1
#define SNDK_NVME_GET_FW_ACT_HISTORY_C2_LOG_ID 0xC2
#define SNDK_LATENCY_MON_LOG_ID 0xC3
#define SNDK_DEV_CAP_LOG_ID 0xC4
#define SNDK_UNSUPPORTED_REQS_LOG_ID 0xC5
#define SNDK_NVME_GET_DEVICE_INFO_LOG_ID 0xCA
#define SNDK_NVME_GET_FW_ACT_HISTORY_LOG_ID 0xCB
#define SNDK_NVME_GET_VU_SMART_LOG_ID 0xD0
/* Customer ID's */
#define SNDK_CUSTOMER_ID_GN 0x0001
#define SNDK_CUSTOMER_ID_GD 0x0101
#define SNDK_CUSTOMER_ID_BD 0x1009
#define SNDK_CUSTOMER_ID_0x1004 0x1004
#define SNDK_CUSTOMER_ID_0x1005 0x1005
#define SNDK_CUSTOMER_ID_0x1008 0x1008
#define SNDK_CUSTOMER_ID_0x1304 0x1304
#define SNDK_INVALID_CUSTOMER_ID -1
int sndk_get_pci_ids(nvme_root_t r,
struct nvme_dev *dev,
uint32_t *device_id,
uint32_t *vendor_id);
int sndk_get_vendor_id(struct nvme_dev *dev,
uint32_t *vendor_id);
bool sndk_check_device(nvme_root_t r,
struct nvme_dev *dev);
__u64 sndk_get_drive_capabilities(nvme_root_t r,
struct nvme_dev *dev);
__u64 sndk_get_enc_drive_capabilities(nvme_root_t r,
struct nvme_dev *dev);