2424
2525#define DWORD_SIZE 4
2626#define LOG_FILE_PERMISSION 0644
27+ #define ATMOS_MODEL_PREFIX "SOLIDIGM SB5"
2728
2829enum log_type {
2930 NLOG = 0 ,
3031 EVENTLOG = 1 ,
3132 ASSERTLOG = 2 ,
3233 HIT ,
3334 CIT ,
34- ALL
35+ ALL ,
36+ EXTENDED
3537};
3638
3739#pragma pack(push, internal_logs, 1)
@@ -136,7 +138,6 @@ struct ilog {
136138 struct config * cfg ;
137139 int count ;
138140 struct nvme_id_ctrl id_ctrl ;
139- enum nvme_telemetry_da max_da ;
140141};
141142
142143static void print_nlog_header (__u8 * buffer )
@@ -519,17 +520,32 @@ static int ilog_ensure_dump_id_ctrl(struct ilog *ilog)
519520 first = false;
520521 err = ilog_dump_identify_page (ilog , & idctrl , 0 );
521522
522- if (err )
523- return err ;
523+ if (!err )
524+ ilog -> count ++ ;
525+
526+ return err ;
527+ }
524528
525- ilog -> count ++ ;
529+ static bool is_atmos (struct ilog * ilog )
530+ {
531+ ilog_ensure_dump_id_ctrl (ilog );
532+ return !strncmp (ilog -> id_ctrl .mn , ATMOS_MODEL_PREFIX , sizeof (ATMOS_MODEL_PREFIX ) - 1 );
533+ }
534+
535+ static enum nvme_telemetry_da get_max_da (struct ilog * ilog , enum log_type ttype )
536+ {
537+ enum nvme_telemetry_da max_da = NVME_TELEMETRY_DA_1 ;
538+
539+ ilog_ensure_dump_id_ctrl (ilog );
540+
541+ if (is_atmos (ilog ) && ttype != EXTENDED )
542+ return NVME_TELEMETRY_DA_3 ;
526543
527544 if (ilog -> id_ctrl .lpa & 0x8 )
528- ilog -> max_da = NVME_TELEMETRY_DA_3 ;
545+ max_da = NVME_TELEMETRY_DA_3 ;
529546 if (ilog -> id_ctrl .lpa & 0x40 )
530- ilog -> max_da = NVME_TELEMETRY_DA_4 ;
531-
532- return err ;
547+ max_da = NVME_TELEMETRY_DA_4 ;
548+ return max_da ;
533549}
534550
535551static int ilog_dump_telemetry (struct ilog * ilog , enum log_type ttype )
@@ -546,7 +562,7 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
546562 if (err )
547563 return err ;
548564
549- da = ilog -> max_da ;
565+ da = get_max_da ( ilog , ttype ) ;
550566 mdts = ilog -> id_ctrl .mdts ;
551567
552568 if (da == 4 ) {
@@ -564,6 +580,8 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
564580
565581 switch (ttype ) {
566582 case HIT :
583+ case ALL :
584+ case EXTENDED :
567585 file_name = "lid_0x07_lsp_0x01_lsi_0x0000.bin" ;
568586 log .desc = "Host Initiated Telemetry" ;
569587 err = sldgm_dynamic_telemetry (dev_fd (ilog -> dev ), true, false, false, mdts ,
@@ -847,9 +865,9 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command,
847865 };
848866
849867 OPT_ARGS (opts ) = {
850- OPT_STRING ("type" , 't' , "ALL|CIT|HIT|NLOG|ASSERT|EVENT" , & cfg .type , type ),
868+ OPT_STRING ("type" , 't' , "ALL|CIT|HIT|NLOG|ASSERT|EVENT|EXTENDED " , & cfg .type , type ),
851869 OPT_STRING ("dir-name" , 'd' , "DIRECTORY" , & cfg .out_dir , out_dir ),
852- OPT_FLAG ("verbose" , 'v' , & cfg .verbose , verbose ),
870+ OPT_FLAG ("verbose" , 'v' , & cfg .verbose , verbose ),
853871 OPT_END ()
854872 };
855873
@@ -874,6 +892,8 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command,
874892 log_type = ASSERTLOG ;
875893 else if (!strcmp (cfg .type , "EVENT" ))
876894 log_type = EVENTLOG ;
895+ else if (!strcmp (cfg .type , "EXTENDED" ))
896+ log_type = EXTENDED ;
877897 else {
878898 fprintf (stderr , "Invalid log type: %s\n" , cfg .type );
879899 return - EINVAL ;
@@ -909,42 +929,42 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command,
909929 output_path = full_folder ;
910930
911931 /* Retrieve first logs that records actions to retrieve other logs */
912- if (log_type == ALL || log_type == HIT ) {
913- err = ilog_dump_telemetry (& ilog , HIT );
932+ if (log_type == ALL || log_type == HIT || log_type == EXTENDED ) {
933+ err = ilog_dump_telemetry (& ilog , log_type );
914934 if (err == 0 )
915935 ilog .count ++ ;
916936 else if (err < 0 )
917937 perror ("Error retrieving Host Initiated Telemetry" );
918938 }
919- if (log_type == ALL || log_type == NLOG ) {
939+ if (log_type == ALL || log_type == NLOG || log_type == EXTENDED ) {
920940 err = ilog_dump_nlogs (& ilog , -1 );
921941 if (err == 0 )
922942 ilog .count ++ ;
923943 else if (err < 0 )
924944 perror ("Error retrieving Nlog" );
925945 }
926- if (log_type == ALL || log_type == CIT ) {
946+ if (log_type == ALL || log_type == CIT || log_type == EXTENDED ) {
927947 err = ilog_dump_telemetry (& ilog , CIT );
928948 if (err == 0 )
929949 ilog .count ++ ;
930950 else if (err < 0 )
931951 perror ("Error retrieving Controller Initiated Telemetry" );
932952 }
933- if (log_type == ALL || log_type == ASSERTLOG ) {
953+ if (log_type == ALL || log_type == ASSERTLOG || log_type == EXTENDED ) {
934954 err = ilog_dump_assert_logs (& ilog );
935955 if (err == 0 )
936956 ilog .count ++ ;
937957 else if (err < 0 )
938958 perror ("Error retrieving Assert log" );
939959 }
940- if (log_type == ALL || log_type == EVENTLOG ) {
960+ if (log_type == ALL || log_type == EVENTLOG || log_type == EXTENDED ) {
941961 err = ilog_dump_event_logs (& ilog );
942962 if (err == 0 )
943963 ilog .count ++ ;
944964 else if (err < 0 )
945965 perror ("Error retrieving Event log" );
946966 }
947- if (log_type == ALL ) {
967+ if (log_type == ALL || log_type == EXTENDED ) {
948968 err = ilog_dump_identify_pages (& ilog );
949969 if (err < 0 )
950970 perror ("Error retrieving Identify pages" );
0 commit comments