Merging upstream version 2.14.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
0d9181726f
commit
f268303a51
572 changed files with 4636 additions and 1730 deletions
|
@ -524,24 +524,16 @@ enum NVME_FEATURE_IDENTIFIERS {
|
|||
};
|
||||
|
||||
/* WDC UUID value */
|
||||
const uint8_t WDC_UUID[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0xb9, 0x8c, 0x52, 0x0c, 0x4c,
|
||||
0x5a, 0x15, 0xab, 0xe6, 0x33, 0x29, 0x9a, 0x70, 0xdf, 0xd0
|
||||
static const __u8 WDC_UUID[NVME_UUID_LEN] = {
|
||||
0x2d, 0xb9, 0x8c, 0x52, 0x0c, 0x4c, 0x5a, 0x15,
|
||||
0xab, 0xe6, 0x33, 0x29, 0x9a, 0x70, 0xdf, 0xd0
|
||||
};
|
||||
|
||||
|
||||
/* WDC_UUID value for SN640_3 devices */
|
||||
const uint8_t WDC_UUID_SN640_3[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||
0x11, 0x11, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22
|
||||
};
|
||||
|
||||
/* UUID field with value of 0 indicates end of UUID List*/
|
||||
const uint8_t UUID_END[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
static const __u8 WDC_UUID_SN640_3[NVME_UUID_LEN] = {
|
||||
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22
|
||||
};
|
||||
|
||||
enum WDC_DRIVE_ESSENTIAL_TYPE {
|
||||
|
@ -930,20 +922,24 @@ struct __packed feature_latency_monitor {
|
|||
};
|
||||
|
||||
static int wdc_get_serial_name(struct nvme_dev *dev, char *file, size_t len, const char *suffix);
|
||||
static int wdc_create_log_file(char *file, __u8 *drive_log_data, __u32 drive_log_length);
|
||||
static int wdc_create_log_file(const char *file, const __u8 *drive_log_data,
|
||||
__u32 drive_log_length);
|
||||
static int wdc_do_clear_dump(struct nvme_dev *dev, __u8 opcode, __u32 cdw12);
|
||||
static int wdc_do_dump(struct nvme_dev *dev, __u32 opcode, __u32 data_len, __u32 cdw12, char *file,
|
||||
__u32 xfer_size);
|
||||
static int wdc_do_dump(struct nvme_dev *dev, __u32 opcode, __u32 data_len, __u32 cdw12,
|
||||
const char *file, __u32 xfer_size);
|
||||
static int wdc_do_crash_dump(struct nvme_dev *dev, char *file, int type);
|
||||
static int wdc_crash_dump(struct nvme_dev *dev, char *file, int type);
|
||||
static int wdc_crash_dump(struct nvme_dev *dev, const char *file, int type);
|
||||
static int wdc_get_crash_dump(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin);
|
||||
static int wdc_do_drive_log(struct nvme_dev *dev, char *file);
|
||||
static int wdc_do_drive_log(struct nvme_dev *dev, const char *file);
|
||||
static int wdc_drive_log(int argc, char **argv, struct command *command, struct plugin *plugin);
|
||||
static const char *wdc_purge_mon_status_to_string(__u32 status);
|
||||
static int wdc_purge(int argc, char **argv, struct command *command, struct plugin *plugin);
|
||||
static int wdc_purge_monitor(int argc, char **argv, struct command *command, struct plugin *plugin);
|
||||
static bool wdc_nvme_check_supported_log_page(nvme_root_t r, struct nvme_dev *dev, __u8 log_id);
|
||||
static bool wdc_nvme_check_supported_log_page(nvme_root_t r,
|
||||
struct nvme_dev *dev,
|
||||
__u8 log_id,
|
||||
__u8 uuid_index);
|
||||
static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin);
|
||||
static int wdc_do_drive_essentials(nvme_root_t r, struct nvme_dev *dev, char *dir, char *key);
|
||||
|
@ -959,7 +955,7 @@ static int wdc_namespace_resize(int argc, char **argv, struct command *command,
|
|||
static int wdc_do_namespace_resize(struct nvme_dev *dev, __u32 nsid, __u32 op_option);
|
||||
static int wdc_reason_identifier(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin);
|
||||
static int wdc_do_get_reason_id(struct nvme_dev *dev, char *file, int log_id);
|
||||
static int wdc_do_get_reason_id(struct nvme_dev *dev, const char *file, int log_id);
|
||||
static int wdc_save_reason_id(struct nvme_dev *dev, __u8 *rsn_ident, int size);
|
||||
static int wdc_clear_reason_id(struct nvme_dev *dev);
|
||||
static int wdc_log_page_directory(int argc, char **argv, struct command *command,
|
||||
|
@ -1580,6 +1576,11 @@ static bool wdc_is_sn650_e1l(__u32 device_id)
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool wdc_is_zn350(__u32 device_id)
|
||||
{
|
||||
return (device_id == WDC_NVME_ZN350_DEV_ID ||
|
||||
device_id == WDC_NVME_ZN350_DEV_ID_1);
|
||||
}
|
||||
static bool needs_c2_log_page_check(__u32 device_id)
|
||||
{
|
||||
if ((wdc_is_sn640(device_id)) ||
|
||||
|
@ -1699,12 +1700,12 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE))
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_CA_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC1 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_ADD_LOG_OPCODE))
|
||||
WDC_NVME_ADD_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_C1_LOG_PAGE;
|
||||
break;
|
||||
|
||||
|
@ -1722,12 +1723,12 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
WDC_DRIVE_CAP_RESIZE | WDC_DRIVE_CAP_CLEAR_PCIE);
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE))
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_CA_LOG_PAGE;
|
||||
|
||||
/* verify the 0xD0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE))
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_D0_LOG_PAGE;
|
||||
break;
|
||||
|
||||
|
@ -1741,7 +1742,7 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
case WDC_NVME_SN660_DEV_ID:
|
||||
/* verify the 0xC0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_ID)
|
||||
WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_ID, 0)
|
||||
== true) {
|
||||
capabilities |= WDC_DRIVE_CAP_C0_LOG_PAGE;
|
||||
}
|
||||
|
@ -1754,32 +1755,32 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
|
||||
/* verify the 0xC1 (OCP Error Recovery) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_ERROR_REC_LOG_ID))
|
||||
WDC_ERROR_REC_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_OCP_C1_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC3 (OCP Latency Monitor) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_LATENCY_MON_LOG_ID))
|
||||
WDC_LATENCY_MON_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_C3_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC4 (OCP Device Capabilities) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_DEV_CAP_LOG_ID))
|
||||
WDC_DEV_CAP_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_OCP_C4_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC5 (OCP Unsupported Requirements) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_UNSUPPORTED_REQS_LOG_ID))
|
||||
WDC_UNSUPPORTED_REQS_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_OCP_C5_LOG_PAGE;
|
||||
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE))
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_CA_LOG_PAGE;
|
||||
|
||||
/* verify the 0xD0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE))
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_D0_LOG_PAGE;
|
||||
|
||||
cust_id = wdc_get_fw_cust_id(r, dev);
|
||||
|
@ -1802,7 +1803,7 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
case WDC_NVME_SN860_DEV_ID:
|
||||
/* verify the 0xC0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_EOL_STATUS_LOG_OPCODE))
|
||||
WDC_NVME_GET_EOL_STATUS_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_C0_LOG_PAGE;
|
||||
fallthrough;
|
||||
case WDC_NVME_ZN540_DEV_ID:
|
||||
|
@ -1816,12 +1817,12 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE))
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_CA_LOG_PAGE;
|
||||
|
||||
/* verify the 0xD0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE))
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_D0_LOG_PAGE;
|
||||
break;
|
||||
|
||||
|
@ -1835,23 +1836,27 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
|
|||
case WDC_NVME_SN550_DEV_ID:
|
||||
/* verify the 0xC0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_ID))
|
||||
WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_C0_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC1 (OCP Error Recovery) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_ERROR_REC_LOG_ID))
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_ERROR_REC_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_OCP_C1_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC3 (OCP Latency Monitor) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_LATENCY_MON_LOG_ID))
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_LATENCY_MON_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_C3_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC4 (OCP Device Capabilities) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_DEV_CAP_LOG_ID))
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_DEV_CAP_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_OCP_C4_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC5 (OCP Unsupported Requirements) log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_UNSUPPORTED_REQS_LOG_ID))
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_UNSUPPORTED_REQS_LOG_ID, 0))
|
||||
capabilities |= WDC_DRIVE_CAP_OCP_C5_LOG_PAGE;
|
||||
|
||||
capabilities |= (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG |
|
||||
|
@ -2050,11 +2055,13 @@ static __u64 wdc_get_enc_drive_capabilities(nvme_root_t r,
|
|||
WDC_DRIVE_CAP_DRIVE_LOG | WDC_DRIVE_CAP_CRASH_DUMP | WDC_DRIVE_CAP_PFAIL_DUMP);
|
||||
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE) == true)
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0) == true)
|
||||
capabilities |= WDC_DRIVE_CAP_CA_LOG_PAGE;
|
||||
|
||||
/* verify the 0xC1 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_ADD_LOG_OPCODE) == true)
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_ADD_LOG_OPCODE, 0) == true)
|
||||
capabilities |= WDC_DRIVE_CAP_C1_LOG_PAGE;
|
||||
break;
|
||||
case WDC_NVME_VID_2:
|
||||
|
@ -2063,19 +2070,23 @@ static __u64 wdc_get_enc_drive_capabilities(nvme_root_t r,
|
|||
WDC_DRIVE_CAP_RESIZE);
|
||||
|
||||
/* verify the 0xC3 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_LATENCY_MON_LOG_ID) == true)
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_LATENCY_MON_LOG_ID, 0) == true)
|
||||
capabilities |= WDC_DRIVE_CAP_C3_LOG_PAGE;
|
||||
|
||||
/* verify the 0xCB log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_FW_ACT_HISTORY_LOG_ID) == true)
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_FW_ACT_HISTORY_LOG_ID, 0) == true)
|
||||
capabilities |= WDC_DRIVE_CAP_FW_ACTIVATE_HISTORY;
|
||||
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE) == true)
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0) == true)
|
||||
capabilities |= WDC_DRIVE_CAP_CA_LOG_PAGE;
|
||||
|
||||
/* verify the 0xD0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_VU_SMART_LOG_OPCODE) == true)
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE, 0) == true)
|
||||
capabilities |= WDC_DRIVE_CAP_D0_LOG_PAGE;
|
||||
|
||||
cust_id = wdc_get_fw_cust_id(r, dev);
|
||||
|
@ -2138,8 +2149,8 @@ static int wdc_get_serial_name(struct nvme_dev *dev, char *file, size_t len,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int wdc_create_log_file(char *file, __u8 *drive_log_data,
|
||||
__u32 drive_log_length)
|
||||
static int wdc_create_log_file(const char *file, const __u8 *drive_log_data,
|
||||
__u32 drive_log_length)
|
||||
{
|
||||
int fd;
|
||||
int ret;
|
||||
|
@ -2655,12 +2666,12 @@ static bool get_dev_mgment_data(nvme_root_t r, struct nvme_dev *dev,
|
|||
void **data)
|
||||
{
|
||||
bool found = false;
|
||||
*data = NULL;
|
||||
__u32 device_id = 0, vendor_id = 0;
|
||||
bool uuid_present = false;
|
||||
int index = 0, uuid_index = 0;
|
||||
int uuid_index = 0;
|
||||
struct nvme_id_uuid_list uuid_list;
|
||||
|
||||
*data = NULL;
|
||||
|
||||
/* The wdc_get_pci_ids function could fail when drives are connected
|
||||
* via a PCIe switch. Therefore, the return code is intentionally
|
||||
* being ignored. The device_id and vendor_id variables have been
|
||||
|
@ -2669,45 +2680,22 @@ static bool get_dev_mgment_data(nvme_root_t r, struct nvme_dev *dev,
|
|||
*/
|
||||
wdc_get_pci_ids(r, dev, &device_id, &vendor_id);
|
||||
|
||||
typedef struct nvme_id_uuid_list_entry *uuid_list_entry;
|
||||
|
||||
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
|
||||
if (wdc_CheckUuidListSupport(dev, &uuid_list)) {
|
||||
uuid_list_entry uuid_list_entry_ptr = (uuid_list_entry)&uuid_list.entry[0];
|
||||
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
|
||||
if (uuid_index < 0 && wdc_is_sn640_3(device_id))
|
||||
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID_SN640_3);
|
||||
|
||||
while (index <= NVME_ID_UUID_LIST_MAX &&
|
||||
!wdc_UuidEqual(uuid_list_entry_ptr, (uuid_list_entry)UUID_END)) {
|
||||
|
||||
if (wdc_UuidEqual(uuid_list_entry_ptr,
|
||||
(uuid_list_entry)WDC_UUID)) {
|
||||
uuid_present = true;
|
||||
break;
|
||||
} else if (wdc_UuidEqual(uuid_list_entry_ptr,
|
||||
(uuid_list_entry)WDC_UUID_SN640_3) &&
|
||||
wdc_is_sn640_3(device_id)) {
|
||||
uuid_present = true;
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
uuid_list_entry_ptr = (uuid_list_entry)&uuid_list.entry[index];
|
||||
}
|
||||
if (uuid_present)
|
||||
uuid_index = index + 1;
|
||||
}
|
||||
|
||||
if (uuid_present) {
|
||||
/* use the uuid index found above */
|
||||
found = get_dev_mgmt_log_page_data(dev, data, uuid_index);
|
||||
} else {
|
||||
if (!uuid_index && needs_c2_log_page_check(device_id)) {
|
||||
/* In certain devices that don't support UUID lists, there are multiple
|
||||
* definitions of the C2 logpage. In those cases, the code
|
||||
* needs to try two UUID indexes and use an identification algorithm
|
||||
* to determine which is returning the correct log page data.
|
||||
*/
|
||||
uuid_index = 1;
|
||||
}
|
||||
if (uuid_index > 0)
|
||||
found = get_dev_mgmt_log_page_data(dev, data, uuid_index);
|
||||
} else if (needs_c2_log_page_check(device_id)) {
|
||||
/* In certain devices that don't support UUID lists, there are multiple
|
||||
* definitions of the C2 logpage. In those cases, the code
|
||||
* needs to try two UUID indexes and use an identification algorithm
|
||||
* to determine which is returning the correct log page data.
|
||||
*/
|
||||
|
||||
uuid_index = 1;
|
||||
found = get_dev_mgmt_log_page_data(dev, data, uuid_index);
|
||||
|
||||
if (!found) {
|
||||
|
@ -2727,14 +2715,13 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev,
|
|||
__u8 log_id, void **cbs_data)
|
||||
{
|
||||
bool found = false;
|
||||
__u8 uuid_ix = 0;
|
||||
__u8 lid = 0;
|
||||
*cbs_data = NULL;
|
||||
__u32 device_id = 0, vendor_id = 0;
|
||||
bool uuid_present = false;
|
||||
int index = 0, uuid_index = 0;
|
||||
int uuid_index = 0;
|
||||
struct nvme_id_uuid_list uuid_list;
|
||||
|
||||
*cbs_data = NULL;
|
||||
|
||||
/* The wdc_get_pci_ids function could fail when drives are connected
|
||||
* via a PCIe switch. Therefore, the return code is intentionally
|
||||
* being ignored. The device_id and vendor_id variables have been
|
||||
|
@ -2745,93 +2732,129 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev,
|
|||
|
||||
lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID;
|
||||
|
||||
typedef struct nvme_id_uuid_list_entry *uuid_list_entry;
|
||||
|
||||
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
|
||||
if (wdc_CheckUuidListSupport(dev, &uuid_list)) {
|
||||
uuid_list_entry uuid_list_entry_ptr = (uuid_list_entry)&uuid_list.entry[0];
|
||||
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
|
||||
if (uuid_index < 0 && wdc_is_sn640_3(device_id))
|
||||
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID_SN640_3);
|
||||
|
||||
while (index <= NVME_ID_UUID_LIST_MAX &&
|
||||
!wdc_UuidEqual(uuid_list_entry_ptr, (uuid_list_entry)UUID_END)) {
|
||||
if (uuid_index < 0)
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid,
|
||||
log_id, uuid_index);
|
||||
|
||||
if (wdc_UuidEqual(uuid_list_entry_ptr,
|
||||
(uuid_list_entry)WDC_UUID)) {
|
||||
uuid_present = true;
|
||||
break;
|
||||
} else if (wdc_UuidEqual(uuid_list_entry_ptr,
|
||||
(uuid_list_entry)WDC_UUID_SN640_3) &&
|
||||
wdc_is_sn640_3(device_id)) {
|
||||
uuid_present = true;
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
uuid_list_entry_ptr = (uuid_list_entry)&uuid_list.entry[index];
|
||||
}
|
||||
if (uuid_present)
|
||||
uuid_index = index + 1;
|
||||
}
|
||||
|
||||
if (uuid_present) {
|
||||
/* use the uuid index found above */
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
|
||||
} else if (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) {
|
||||
} else if (wdc_is_zn350(device_id)) {
|
||||
uuid_index = 0;
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
|
||||
} else {
|
||||
if (!uuid_index && needs_c2_log_page_check(device_id)) {
|
||||
/* In certain devices that don't support UUID lists, there are multiple
|
||||
* definitions of the C2 logpage. In those cases, the code
|
||||
* needs to try two UUID indexes and use an identification algorithm
|
||||
* to determine which is returning the correct log page data.
|
||||
*/
|
||||
uuid_ix = 1;
|
||||
}
|
||||
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
|
||||
|
||||
} else if (needs_c2_log_page_check(device_id)) {
|
||||
/* In certain devices that don't support UUID lists, there are multiple
|
||||
* definitions of the C2 logpage. In those cases, the code
|
||||
* needs to try two UUID indexes and use an identification algorithm
|
||||
* to determine which is returning the correct log page data.
|
||||
*/
|
||||
uuid_index = 1;
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
|
||||
if (!found) {
|
||||
/* not found with uuid = 1 try with uuid = 0 */
|
||||
uuid_ix = 0;
|
||||
uuid_index = 0;
|
||||
fprintf(stderr, "Not found, requesting log page with uuid_index %d\n",
|
||||
uuid_index);
|
||||
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
|
||||
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id,
|
||||
uuid_index);
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static bool wdc_nvme_check_supported_log_page(nvme_root_t r, struct nvme_dev *dev, __u8 log_id)
|
||||
static int wdc_get_supported_log_pages(struct nvme_dev *dev,
|
||||
struct nvme_supported_log_pages *supported,
|
||||
int uuid_index)
|
||||
{
|
||||
memset(supported, 0, sizeof(*supported));
|
||||
struct nvme_get_log_args args = {
|
||||
.lpo = 0,
|
||||
.result = NULL,
|
||||
.log = supported,
|
||||
.args_size = sizeof(args),
|
||||
.fd = dev_fd(dev),
|
||||
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
|
||||
.lid = NVME_LOG_LID_SUPPORTED_LOG_PAGES,
|
||||
.len = sizeof(*supported),
|
||||
.nsid = NVME_NSID_ALL,
|
||||
.csi = NVME_CSI_NVM,
|
||||
.lsi = NVME_LOG_LSI_NONE,
|
||||
.lsp = 0,
|
||||
.uuidx = uuid_index,
|
||||
.rae = false,
|
||||
.ot = false,
|
||||
};
|
||||
|
||||
return nvme_get_log(&args);
|
||||
}
|
||||
|
||||
static bool wdc_nvme_check_supported_log_page(nvme_root_t r,
|
||||
struct nvme_dev *dev,
|
||||
__u8 log_id,
|
||||
__u8 uuid_index)
|
||||
{
|
||||
int i;
|
||||
bool found = false;
|
||||
int err = -1;
|
||||
struct wdc_c2_cbs_data *cbs_data = NULL;
|
||||
|
||||
if (get_dev_mgment_cbs_data(r, dev, WDC_C2_LOG_PAGES_SUPPORTED_ID, (void *)&cbs_data)) {
|
||||
if (cbs_data) {
|
||||
for (i = 0; i < le32_to_cpu(cbs_data->length); i++) {
|
||||
if (log_id == cbs_data->data[i]) {
|
||||
found = true;
|
||||
break;
|
||||
_cleanup_free_ struct nvme_supported_log_pages *supports = NULL;
|
||||
|
||||
/* Check log page id 0 (supported log pages) first */
|
||||
supports = nvme_alloc(sizeof(*supports));
|
||||
if (!supports)
|
||||
return -ENOMEM;
|
||||
|
||||
err = wdc_get_supported_log_pages(dev,
|
||||
supports,
|
||||
uuid_index);
|
||||
|
||||
if (!err) {
|
||||
/* Check support log page list for support */
|
||||
if (supports->lid_support[log_id])
|
||||
/* Support for Log Page found in supported log pages */
|
||||
found = true;
|
||||
}
|
||||
|
||||
/* if not found in the supported log pages (log id 0),
|
||||
* check the WDC C2 log page
|
||||
*/
|
||||
if (!found) {
|
||||
if (get_dev_mgment_cbs_data(r,
|
||||
dev,
|
||||
WDC_C2_LOG_PAGES_SUPPORTED_ID,
|
||||
(void *)&cbs_data)) {
|
||||
if (cbs_data) {
|
||||
for (i = 0; i < le32_to_cpu(cbs_data->length); i++) {
|
||||
if (log_id == cbs_data->data[i]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WDC_NVME_CLI_DEBUG
|
||||
if (!found) {
|
||||
fprintf(stderr, "ERROR: WDC: Log Page 0x%x not supported\n", log_id);
|
||||
fprintf(stderr, "WDC: Supported Log Pages:\n");
|
||||
/* print the supported pages */
|
||||
d((__u8 *)cbs_data->data, le32_to_cpu(cbs_data->length), 16, 1);
|
||||
}
|
||||
if (!found) {
|
||||
fprintf(stderr, "ERROR: WDC: Log Page 0x%x not supported\n",
|
||||
log_id);
|
||||
fprintf(stderr, "WDC: Supported Log Pages:\n");
|
||||
/* print the supported pages */
|
||||
d((__u8 *)cbs_data->data, le32_to_cpu(cbs_data->length),
|
||||
16, 1);
|
||||
}
|
||||
#endif
|
||||
free(cbs_data);
|
||||
free(cbs_data);
|
||||
} else {
|
||||
fprintf(stderr, "ERROR: WDC: cbs_data ptr = NULL\n");
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "ERROR: WDC: cbs_data ptr = NULL\n");
|
||||
fprintf(stderr, "ERROR: WDC: 0xC2 Log Page entry ID 0x%x not found\n",
|
||||
WDC_C2_LOG_PAGES_SUPPORTED_ID);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "ERROR: WDC: 0xC2 Log Page entry ID 0x%x not found\n",
|
||||
WDC_C2_LOG_PAGES_SUPPORTED_ID);
|
||||
}
|
||||
|
||||
return found;
|
||||
|
@ -2997,7 +3020,7 @@ static __u32 wdc_dump_dui_data_v2(int fd, __u32 dataLen, __u64 offset, __u8 *dum
|
|||
}
|
||||
|
||||
static int wdc_do_dump(struct nvme_dev *dev, __u32 opcode, __u32 data_len,
|
||||
__u32 cdw12, char *file, __u32 xfer_size)
|
||||
__u32 cdw12, const char *file, __u32 xfer_size)
|
||||
{
|
||||
int ret = 0;
|
||||
__u8 *dump_data;
|
||||
|
@ -3056,7 +3079,7 @@ static int wdc_do_dump(struct nvme_dev *dev, __u32 opcode, __u32 data_len,
|
|||
}
|
||||
|
||||
static int wdc_do_dump_e6(int fd, __u32 opcode, __u32 data_len,
|
||||
__u32 cdw12, char *file, __u32 xfer_size, __u8 *log_hdr)
|
||||
__u32 cdw12, char *file, __u32 xfer_size, __u8 *log_hdr)
|
||||
{
|
||||
int ret = 0;
|
||||
__u8 *dump_data;
|
||||
|
@ -3130,8 +3153,8 @@ static int wdc_do_dump_e6(int fd, __u32 opcode, __u32 data_len,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wdc_do_cap_telemetry_log(struct nvme_dev *dev, char *file,
|
||||
__u32 bs, int type, int data_area)
|
||||
static int wdc_do_cap_telemetry_log(struct nvme_dev *dev, const char *file,
|
||||
__u32 bs, int type, int data_area)
|
||||
{
|
||||
struct nvme_telemetry_log *log;
|
||||
size_t full_size = 0;
|
||||
|
@ -3773,9 +3796,9 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
|
|||
struct plugin *plugin)
|
||||
{
|
||||
nvme_root_t r;
|
||||
char *desc = "Capture Diagnostics Log.";
|
||||
char *file = "Output file pathname.";
|
||||
char *size = "Data retrieval transfer size.";
|
||||
const char *desc = "Capture Diagnostics Log.";
|
||||
const char *file = "Output file pathname.";
|
||||
const char *size = "Data retrieval transfer size.";
|
||||
__u64 capabilities = 0;
|
||||
char f[PATH_MAX] = {0};
|
||||
struct nvme_dev *dev;
|
||||
|
@ -4066,7 +4089,7 @@ free_buf:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dump_internal_logs(struct nvme_dev *dev, char *dir_name, int verbose)
|
||||
static int dump_internal_logs(struct nvme_dev *dev, const char *dir_name, int verbose)
|
||||
{
|
||||
char file_path[PATH_MAX];
|
||||
void *telemetry_log;
|
||||
|
@ -4165,14 +4188,17 @@ free_mem:
|
|||
static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Internal Firmware Log.";
|
||||
char *file = "Output file pathname.";
|
||||
char *size = "Data retrieval transfer size.";
|
||||
char *data_area = "Data area to retrieve up to. Currently only supported on the SN340, SN640, SN730, and SN840 devices.";
|
||||
char *file_size = "Output file size. Currently only supported on the SN340 device.";
|
||||
char *offset = "Output file data offset. Currently only supported on the SN340 device.";
|
||||
char *type = "Telemetry type - NONE, HOST, or CONTROLLER. Currently only supported on the SN530, SN640, SN730, SN740, SN810, SN840 and ZN350 devices.";
|
||||
char *verbose = "Display more debug messages.";
|
||||
const char *desc = "Internal Firmware Log.";
|
||||
const char *file = "Output file pathname.";
|
||||
const char *size = "Data retrieval transfer size.";
|
||||
const char *data_area =
|
||||
"Data area to retrieve up to. Currently only supported on the SN340, SN640, SN730, and SN840 devices.";
|
||||
const char *file_size = "Output file size. Currently only supported on the SN340 device.";
|
||||
const char *offset =
|
||||
"Output file data offset. Currently only supported on the SN340 device.";
|
||||
const char *type =
|
||||
"Telemetry type - NONE, HOST, or CONTROLLER Currently only supported on the SN530, SN640, SN730, SN740, SN810, SN840 and ZN350 devices.";
|
||||
const char *verbose = "Display more debug messages.";
|
||||
char f[PATH_MAX] = {0};
|
||||
char fb[PATH_MAX/2] = {0};
|
||||
char fileSuffix[PATH_MAX] = {0};
|
||||
|
@ -4502,7 +4528,7 @@ static int wdc_do_crash_dump(struct nvme_dev *dev, char *file, int type)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wdc_crash_dump(struct nvme_dev *dev, char *file, int type)
|
||||
static int wdc_crash_dump(struct nvme_dev *dev, const char *file, int type)
|
||||
{
|
||||
char f[PATH_MAX] = {0};
|
||||
const char *dump_type;
|
||||
|
@ -4524,7 +4550,7 @@ static int wdc_crash_dump(struct nvme_dev *dev, char *file, int type)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wdc_do_drive_log(struct nvme_dev *dev, char *file)
|
||||
static int wdc_do_drive_log(struct nvme_dev *dev, const char *file)
|
||||
{
|
||||
int ret;
|
||||
__u8 *drive_log_data;
|
||||
|
@ -4669,8 +4695,8 @@ static int wdc_get_crash_dump(int argc, char **argv, struct command *command,
|
|||
static int wdc_get_pfail_dump(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Get Pfail Crash Dump.";
|
||||
char *file = "Output file pathname.";
|
||||
const char *desc = "Get Pfail Crash Dump.";
|
||||
const char *file = "Output file pathname.";
|
||||
__u64 capabilities = 0;
|
||||
struct nvme_dev *dev;
|
||||
struct config {
|
||||
|
@ -5108,7 +5134,7 @@ static void wdc_print_latency_monitor_log_json(struct wdc_ssd_latency_monitor_lo
|
|||
{
|
||||
int i, j;
|
||||
char buf[128];
|
||||
char *operation[3] = {"Read", "Write", "Trim"};
|
||||
const char *operation[3] = {"Read", "Write", "Trim"};
|
||||
struct json_object *root = json_create_object();
|
||||
|
||||
json_object_add_value_int(root, "Feature Status", log_data->feature_status);
|
||||
|
@ -5348,9 +5374,9 @@ static void wdc_print_unsupported_reqs_log_json(struct wdc_ocp_C5_unsupported_re
|
|||
|
||||
json_object_add_value_int(root, "Number Unsupported Req IDs", le16_to_cpu(log_data->unsupported_count));
|
||||
|
||||
char unsup_req_list_str[40];
|
||||
char unsup_req_list_str[41];
|
||||
|
||||
memset((void *)unsup_req_list_str, 0, 40);
|
||||
memset((void *)unsup_req_list_str, 0, 41);
|
||||
for (j = 0; j < le16_to_cpu(log_data->unsupported_count); j++) {
|
||||
sprintf((char *)unsup_req_list_str, "Unsupported Requirement List %d", j);
|
||||
json_object_add_value_string(root, unsup_req_list_str, (char *)log_data->unsupported_req_list[j]);
|
||||
|
@ -5931,7 +5957,7 @@ static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries,
|
|||
__u16 oldestEntryIdx = 0, entryIdx = 0;
|
||||
uint64_t timestamp;
|
||||
__u64 timestamp_sec;
|
||||
char *null_fw = "--------";
|
||||
const char *null_fw = "--------";
|
||||
|
||||
memset((void *)time_str, '\0', 100);
|
||||
|
||||
|
@ -7504,7 +7530,8 @@ static int wdc_get_ca_log_page(nvme_root_t r, struct nvme_dev *dev, char *format
|
|||
}
|
||||
|
||||
/* verify the 0xCA log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE) == false) {
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, 0) == false) {
|
||||
fprintf(stderr, "ERROR: WDC: 0xCA Log Page not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -7924,7 +7951,9 @@ static int wdc_get_ocp_c5_log_page(nvme_root_t r, struct nvme_dev *dev, char *fo
|
|||
|
||||
/* check log page version */
|
||||
if (log_data->log_page_version != WDC_UNSUPPORTED_REQS_LOG_VERSION) {
|
||||
fprintf(stderr, "ERROR: WDC: invalid unsupported requirements log version - %d\n", log_data->log_page_version);
|
||||
fprintf(stderr, "ERROR: WDC: invalid 0xC5 log page version\n");
|
||||
fprintf(stderr, "ERROR: WDC: log page version: %d\n",
|
||||
log_data->log_page_version);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
@ -7976,7 +8005,8 @@ static int wdc_get_d0_log_page(nvme_root_t r, struct nvme_dev *dev, char *format
|
|||
}
|
||||
|
||||
/* verify the 0xD0 log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_VU_SMART_LOG_OPCODE) == false) {
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_VU_SMART_LOG_OPCODE, 0) == false) {
|
||||
fprintf(stderr, "ERROR: WDC: 0xD0 Log Page not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -8930,7 +8960,7 @@ static int wdc_do_clear_pcie_correctable_errors_fid(int fd)
|
|||
static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Clear PCIE Correctable Errors.";
|
||||
const char *desc = "Clear PCIE Correctable Errors.";
|
||||
__u64 capabilities = 0;
|
||||
struct nvme_dev *dev;
|
||||
nvme_root_t r;
|
||||
|
@ -8973,9 +9003,10 @@ out:
|
|||
static int wdc_drive_status(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Get Drive Status.";
|
||||
const char *desc = "Get Drive Status.";
|
||||
struct nvme_dev *dev;
|
||||
int ret = 0;
|
||||
int uuid_index;
|
||||
nvme_root_t r;
|
||||
void *dev_mng_log = NULL;
|
||||
__u32 system_eol_state;
|
||||
|
@ -8985,6 +9016,7 @@ static int wdc_drive_status(int argc, char **argv, struct command *command,
|
|||
__u32 assert_status = 0xFFFFFFFF;
|
||||
__u32 thermal_status = 0xFFFFFFFF;
|
||||
__u64 capabilities = 0;
|
||||
struct nvme_id_uuid_list uuid_list;
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
OPT_END()
|
||||
|
@ -9002,10 +9034,23 @@ static int wdc_drive_status(int argc, char **argv, struct command *command,
|
|||
goto out;
|
||||
}
|
||||
|
||||
uuid_index = 0;
|
||||
|
||||
/* Find the WDC UUID index */
|
||||
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
|
||||
if (wdc_CheckUuidListSupport(dev, &uuid_list))
|
||||
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
|
||||
|
||||
/* WD UUID not found, use default uuid index - 0 */
|
||||
if (uuid_index < 0)
|
||||
uuid_index = 0;
|
||||
|
||||
/* verify the 0xC2 Device Manageability log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID) == false) {
|
||||
fprintf(stderr, "ERROR: WDC: 0xC2 Log Page not supported\n");
|
||||
WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID,
|
||||
uuid_index) == false) {
|
||||
fprintf(stderr, "ERROR: WDC: 0xC2 Log Page not supported, uuid_index: %d\n",
|
||||
uuid_index);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
@ -9101,7 +9146,7 @@ out:
|
|||
static int wdc_clear_assert_dump(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Clear Assert Dump Present Status.";
|
||||
const char *desc = "Clear Assert Dump Present Status.";
|
||||
struct nvme_dev *dev;
|
||||
int ret = -1;
|
||||
nvme_root_t r;
|
||||
|
@ -9168,7 +9213,8 @@ static int wdc_get_fw_act_history(nvme_root_t r, struct nvme_dev *dev,
|
|||
}
|
||||
|
||||
/* verify the FW Activate History log page is supported */
|
||||
if (!wdc_nvme_check_supported_log_page(r, dev, WDC_NVME_GET_FW_ACT_HISTORY_LOG_ID)) {
|
||||
if (!wdc_nvme_check_supported_log_page(r, dev,
|
||||
WDC_NVME_GET_FW_ACT_HISTORY_LOG_ID, 0)) {
|
||||
fprintf(stderr, "ERROR: WDC: %d Log Page not supported\n",
|
||||
WDC_NVME_GET_FW_ACT_HISTORY_LOG_ID);
|
||||
return -1;
|
||||
|
@ -9410,7 +9456,7 @@ static int wdc_do_clear_fw_activate_history_fid(int fd)
|
|||
static int wdc_clear_fw_activate_history(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Clear FW activate history table.";
|
||||
const char *desc = "Clear FW activate history table.";
|
||||
__u64 capabilities = 0;
|
||||
struct nvme_dev *dev;
|
||||
nvme_root_t r;
|
||||
|
@ -9446,10 +9492,10 @@ out:
|
|||
static int wdc_vs_telemetry_controller_option(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Disable/Enable Controller Option of the Telemetry Log Page.";
|
||||
char *disable = "Disable controller option of the telemetry log page.";
|
||||
char *enable = "Enable controller option of the telemetry log page.";
|
||||
char *status = "Displays the current state of the controller initiated log page.";
|
||||
const char *desc = "Disable/Enable Controller Option of the Telemetry Log Page.";
|
||||
const char *disable = "Disable controller option of the telemetry log page.";
|
||||
const char *enable = "Enable controller option of the telemetry log page.";
|
||||
const char *status = "Displays the current state of the controller initiated log page.";
|
||||
__u64 capabilities = 0;
|
||||
struct nvme_dev *dev;
|
||||
nvme_root_t r;
|
||||
|
@ -9838,7 +9884,8 @@ end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wdc_de_get_dump_trace(struct nvme_dev *dev, char *filePath, __u16 binFileNameLen, char *binFileName)
|
||||
static int wdc_de_get_dump_trace(struct nvme_dev *dev, const char *filePath, __u16 binFileNameLen,
|
||||
const char *binFileName)
|
||||
{
|
||||
int ret = WDC_STATUS_FAILURE;
|
||||
__u8 *readBuffer = NULL;
|
||||
|
@ -10247,8 +10294,8 @@ static int wdc_do_drive_essentials(nvme_root_t r, struct nvme_dev *dev,
|
|||
static int wdc_drive_essentials(int argc, char **argv, struct command *command,
|
||||
struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Capture Drive Essentials.";
|
||||
char *dirName = "Output directory pathname.";
|
||||
const char *desc = "Capture Drive Essentials.";
|
||||
const char *dirName = "Output directory pathname.";
|
||||
char d[PATH_MAX] = {0};
|
||||
char k[PATH_MAX] = {0};
|
||||
__u64 capabilities = 0;
|
||||
|
@ -10262,7 +10309,7 @@ static int wdc_drive_essentials(int argc, char **argv, struct command *command,
|
|||
};
|
||||
|
||||
struct config cfg = {
|
||||
.dirName = NULL,
|
||||
.dirName = NULL,
|
||||
};
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
|
@ -10726,7 +10773,7 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command
|
|||
nvme_root_t r;
|
||||
__u64 capabilities = 0;
|
||||
struct wdc_c2_cbs_data *cbs_data = NULL;
|
||||
int i;
|
||||
int i, uuid_index = 0;
|
||||
__u8 log_id = 0;
|
||||
__u32 device_id, read_vendor_id;
|
||||
bool uuid_supported = false;
|
||||
|
@ -10763,7 +10810,6 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command
|
|||
fprintf(stderr, "ERROR: WDC: unsupported device for this command\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
|
||||
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
|
||||
if (wdc_CheckUuidListSupport(dev, &uuid_list))
|
||||
uuid_supported = true;
|
||||
|
@ -10775,16 +10821,21 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command
|
|||
|
||||
|
||||
ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id);
|
||||
log_id = (device_id == WDC_NVME_ZN350_DEV_ID ||
|
||||
device_id == WDC_NVME_ZN350_DEV_ID_1) ?
|
||||
log_id = wdc_is_zn350(device_id) ?
|
||||
WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8 :
|
||||
WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID;
|
||||
|
||||
if (!wdc_is_sn861(device_id)) {
|
||||
if (uuid_supported)
|
||||
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
|
||||
|
||||
/* WD UUID not found, use default uuid index - 0 */
|
||||
if (uuid_index < 0)
|
||||
uuid_index = 0;
|
||||
|
||||
/* verify the 0xC2 Device Manageability log page is supported */
|
||||
if (wdc_nvme_check_supported_log_page(r, dev, log_id) == false) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: WDC: 0x%x Log Page not supported\n",
|
||||
if (!wdc_nvme_check_supported_log_page(r, dev, log_id, uuid_index)) {
|
||||
fprintf(stderr, "%s: ERROR: WDC: 0x%x Log Page not supported\n",
|
||||
__func__, log_id);
|
||||
ret = -1;
|
||||
goto out;
|
||||
|
@ -10881,7 +10932,7 @@ static int wdc_get_drive_reason_id(struct nvme_dev *dev, char *drive_reason_id,
|
|||
int ret;
|
||||
int res_len = 0;
|
||||
struct nvme_id_ctrl ctrl;
|
||||
char *reason_id_str = "reason_id";
|
||||
const char *reason_id_str = "reason_id";
|
||||
|
||||
i = sizeof(ctrl.sn) - 1;
|
||||
j = sizeof(ctrl.mn) - 1;
|
||||
|
@ -11001,7 +11052,7 @@ static int wdc_dump_telemetry_hdr(struct nvme_dev *dev, int log_id, struct nvme_
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wdc_do_get_reason_id(struct nvme_dev *dev, char *file, int log_id)
|
||||
static int wdc_do_get_reason_id(struct nvme_dev *dev, const char *file, int log_id)
|
||||
{
|
||||
int ret;
|
||||
struct nvme_telemetry_log *log_hdr;
|
||||
|
@ -12205,10 +12256,10 @@ static int wdc_cloud_boot_SSD_version(int argc, char **argv, struct command *com
|
|||
|
||||
static int wdc_enc_get_log(int argc, char **argv, struct command *command, struct plugin *plugin)
|
||||
{
|
||||
char *desc = "Get Enclosure Log.";
|
||||
char *file = "Output file pathname.";
|
||||
char *size = "Data retrieval transfer size.";
|
||||
char *log = "Enclosure Log Page ID.";
|
||||
const char *desc = "Get Enclosure Log.";
|
||||
const char *file = "Output file pathname.";
|
||||
const char *size = "Data retrieval transfer size.";
|
||||
const char *log = "Enclosure Log Page ID.";
|
||||
struct nvme_dev *dev;
|
||||
FILE *output_fd;
|
||||
int xfer_size = 0;
|
||||
|
@ -12821,5 +12872,8 @@ bool run_wdc_nvme_check_supported_log_page(nvme_root_t r,
|
|||
struct nvme_dev *dev,
|
||||
__u8 log_id)
|
||||
{
|
||||
return wdc_nvme_check_supported_log_page(r, dev, log_id);
|
||||
return wdc_nvme_check_supported_log_page(r,
|
||||
dev,
|
||||
log_id,
|
||||
0);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
|
||||
#define WDC_NVME
|
||||
|
||||
#define WDC_PLUGIN_VERSION "2.12.0"
|
||||
#define WDC_PLUGIN_VERSION "2.13.0"
|
||||
#include "cmd.h"
|
||||
|
||||
PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION),
|
||||
|
|
|
@ -90,7 +90,7 @@ int wdc_UtilsGetTime(PUtilsTimeInfo timeInfo)
|
|||
return WDC_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int wdc_UtilsCreateDir(char *path)
|
||||
int wdc_UtilsCreateDir(const char *path)
|
||||
{
|
||||
int retStatus;
|
||||
int status = WDC_STATUS_SUCCESS;
|
||||
|
@ -111,7 +111,7 @@ int wdc_UtilsCreateDir(char *path)
|
|||
return status;
|
||||
}
|
||||
|
||||
int wdc_WriteToFile(char *fileName, char *buffer, unsigned int bufferLen)
|
||||
int wdc_WriteToFile(const char *fileName, const char *buffer, unsigned int bufferLen)
|
||||
{
|
||||
int status = WDC_STATUS_SUCCESS;
|
||||
FILE *file;
|
||||
|
@ -143,7 +143,7 @@ end:
|
|||
* 1 if the pcSrc string is lexically higher than pcDst or
|
||||
* -1 if the pcSrc string is lexically lower than pcDst.
|
||||
*/
|
||||
int wdc_UtilsStrCompare(char *pcSrc, char *pcDst)
|
||||
int wdc_UtilsStrCompare(const char *pcSrc, const char *pcDst)
|
||||
{
|
||||
while ((toupper(*pcSrc) == toupper(*pcDst)) && (*pcSrc != '\0')) {
|
||||
pcSrc++;
|
||||
|
@ -189,8 +189,3 @@ bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uu
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2)
|
||||
{
|
||||
return !memcmp(entry1->uuid, entry2->uuid, NVME_UUID_LEN);
|
||||
}
|
||||
|
|
|
@ -73,9 +73,8 @@ typedef struct _UtilsTimeInfo
|
|||
int wdc_UtilsSnprintf(char *buffer, unsigned int sizeOfBuffer, const char *format, ...);
|
||||
void wdc_UtilsDeleteCharFromString(char* buffer, int buffSize, char charToRemove);
|
||||
int wdc_UtilsGetTime(PUtilsTimeInfo timeInfo);
|
||||
int wdc_UtilsStrCompare(char *pcSrc, char *pcDst);
|
||||
int wdc_UtilsCreateDir(char *path);
|
||||
int wdc_WriteToFile(char *fileName, char *buffer, unsigned int bufferLen);
|
||||
int wdc_UtilsStrCompare(const char *pcSrc, const char *pcDst);
|
||||
int wdc_UtilsCreateDir(const char *path);
|
||||
int wdc_WriteToFile(const char *fileName, const char *buffer, unsigned int bufferLen);
|
||||
void wdc_StrFormat(char *formatter, size_t fmt_sz, char *tofmt, size_t tofmtsz);
|
||||
bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uuid_list);
|
||||
bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue