Skip to content

Commit c417356

Browse files
jeff-lien-sndkigaw
authored andcommitted
sndk: Add support for the Sandisk UUID
This change will check for the Sandisk UUID first and fallback to the WDC UUID if the Sandisk UUID is not found. Signed-off-by: jeff-lien-sndk <jeff.lien@sandisk.com>
1 parent 37f0290 commit c417356

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

plugins/sandisk/sandisk-nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#if !defined(SANDISK_NVME) || defined(CMD_HEADER_MULTI_READ)
66
#define SANDISK_NVME
77

8-
#define SANDISK_PLUGIN_VERSION "3.0.2"
8+
#define SANDISK_PLUGIN_VERSION "3.0.3"
99
#include "cmd.h"
1010

1111
PLUGIN(NAME("sndk", "Sandisk vendor specific extensions", SANDISK_PLUGIN_VERSION),

plugins/wdc/wdc-nvme.c

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,18 @@ static const __u8 WDC_UUID[NVME_UUID_LEN] = {
532532
0xab, 0xe6, 0x33, 0x29, 0x9a, 0x70, 0xdf, 0xd0
533533
};
534534

535-
536535
/* WDC_UUID value for SN640_3 devices */
537536
static const __u8 WDC_UUID_SN640_3[NVME_UUID_LEN] = {
538537
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
539538
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22
540539
};
541540

541+
/* Sandisk UUID value */
542+
static const __u8 SNDK_UUID[NVME_UUID_LEN] = {
543+
0xde, 0x87, 0xd1, 0xeb, 0x72, 0xc5, 0x58, 0x0b,
544+
0xad, 0xd8, 0x3c, 0x29, 0xd1, 0x23, 0x7c, 0x70
545+
};
546+
542547
enum WDC_DRIVE_ESSENTIAL_TYPE {
543548
WDC_DE_TYPE_IDENTIFY = 0x1,
544549
WDC_DE_TYPE_SMARTATTRIBUTEDUMP = 0x2,
@@ -2693,13 +2698,26 @@ static bool get_dev_mgment_data(nvme_root_t r, struct nvme_dev *dev,
26932698

26942699
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
26952700
if (wdc_CheckUuidListSupport(dev, &uuid_list)) {
2696-
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
2697-
if (uuid_index < 0 &&
2698-
(wdc_is_sn640_3(device_id) || wdc_is_sn655(device_id)))
2699-
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID_SN640_3);
2701+
/* check for the Sandisk UUID first */
2702+
uuid_index = nvme_uuid_find(&uuid_list, SNDK_UUID);
2703+
2704+
if (uuid_index < 0) {
2705+
/* The Sandisk UUID is not found;
2706+
* check for the WDC UUID second.
2707+
*/
2708+
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
2709+
if (uuid_index < 0 &&
2710+
(wdc_is_sn640_3(device_id) || wdc_is_sn655(device_id)))
2711+
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID_SN640_3);
2712+
}
27002713

27012714
if (uuid_index >= 0)
27022715
found = get_dev_mgmt_log_page_data(dev, data, uuid_index);
2716+
else {
2717+
fprintf(stderr, "%s: UUID lists are supported but a matching ",
2718+
__func__);
2719+
fprintf(stderr, "uuid was not found\n");
2720+
}
27032721
} else if (needs_c2_log_page_check(device_id)) {
27042722
/* In certain devices that don't support UUID lists, there are multiple
27052723
* definitions of the C2 logpage. In those cases, the code
@@ -2750,15 +2768,27 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev,
27502768

27512769
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
27522770
if (wdc_CheckUuidListSupport(dev, &uuid_list)) {
2753-
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
2754-
if (uuid_index < 0 &&
2755-
(wdc_is_sn640_3(device_id) || wdc_is_sn655(device_id))) {
2756-
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID_SN640_3);
2771+
/* check for the Sandisk UUID first */
2772+
uuid_index = nvme_uuid_find(&uuid_list, SNDK_UUID);
2773+
2774+
if (uuid_index < 0) {
2775+
/* The Sandisk UUID is not found;
2776+
* check for the WDC UUID second.
2777+
*/
2778+
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
2779+
if (uuid_index < 0 &&
2780+
(wdc_is_sn640_3(device_id) || wdc_is_sn655(device_id)))
2781+
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID_SN640_3);
27572782
}
27582783

27592784
if (uuid_index >= 0)
27602785
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid,
27612786
log_id, uuid_index);
2787+
else {
2788+
fprintf(stderr, "%s: UUID lists are supported but a matching ",
2789+
__func__);
2790+
fprintf(stderr, "uuid was not found\n");
2791+
}
27622792
} else if (needs_c2_log_page_check(device_id)) {
27632793
/* In certain devices that don't support UUID lists, there are multiple
27642794
* definitions of the C2 logpage. In those cases, the code
@@ -9109,8 +9139,16 @@ static int wdc_drive_status(int argc, char **argv, struct command *command,
91099139

91109140
/* Find the WDC UUID index */
91119141
memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list));
9112-
if (wdc_CheckUuidListSupport(dev, &uuid_list))
9113-
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
9142+
if (wdc_CheckUuidListSupport(dev, &uuid_list)) {
9143+
/* check for the Sandisk UUID first */
9144+
uuid_index = nvme_uuid_find(&uuid_list, SNDK_UUID);
9145+
9146+
if (uuid_index < 0)
9147+
/* The Sandisk UUID is not found;
9148+
* check for the WDC UUID second.
9149+
*/
9150+
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
9151+
}
91149152

91159153
/* WD UUID not found, use default uuid index - 0 */
91169154
if (uuid_index < 0)
@@ -10895,8 +10933,16 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command
1089510933
WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID;
1089610934

1089710935
if (!wdc_is_sn861(device_id)) {
10898-
if (uuid_supported)
10899-
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
10936+
if (uuid_supported) {
10937+
/* check for the Sandisk UUID first */
10938+
uuid_index = nvme_uuid_find(&uuid_list, SNDK_UUID);
10939+
10940+
if (uuid_index < 0)
10941+
/* The Sandisk UUID is not found;
10942+
* check for the WDC UUID second.
10943+
*/
10944+
uuid_index = nvme_uuid_find(&uuid_list, WDC_UUID);
10945+
}
1090010946

1090110947
/* WD UUID not found, use default uuid index - 0 */
1090210948
if (uuid_index < 0)

plugins/wdc/wdc-nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
66
#define WDC_NVME
77

8-
#define WDC_PLUGIN_VERSION "2.14.4"
8+
#define WDC_PLUGIN_VERSION "2.14.5"
99
#include "cmd.h"
1010

1111
PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION),

0 commit comments

Comments
 (0)