@@ -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 */
537536static 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+
542547enum 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 )
0 commit comments