@@ -57,6 +57,28 @@ struct reason_indentifier_1_2 {
5757static_assert (sizeof (const struct reason_indentifier_1_2 ) ==
5858 MEMBER_SIZE (struct nvme_telemetry_log , rsnident ),
5959 "Size mismatch for reason_indentifier_1_2" );
60+
61+ struct reason_identifier_ocp_2_5 {
62+ char errorId [64 ];
63+ char fileId [8 ];
64+ uint16_t lineNum ;
65+ union {
66+ struct {
67+ uint8_t validLineNum :1 ;
68+ uint8_t validFileId :1 ;
69+ uint8_t validErrorId :1 ;
70+ uint8_t validVuExtension :1 ;
71+ uint8_t reservedBits :4 ;
72+ };
73+ uint8_t raw ;
74+ } validFlags ;
75+ uint8_t reserved [21 ];
76+ uint8_t vuExtension [32 ];
77+ };
78+ static_assert (sizeof (const struct reason_identifier_ocp_2_5 ) ==
79+ MEMBER_SIZE (struct nvme_telemetry_log , rsnident ),
80+ "Size mismatch for reason_identifier_ocp_2_5" );
81+
6082#pragma pack(pop, reason_indentifier)
6183
6284static void telemetry_log_reason_id_parse1_0_ext (const struct telemetry_log * tl ,
@@ -153,6 +175,43 @@ static void telemetry_log_reason_id_parse1_2_ext(const struct telemetry_log *tl,
153175 json_object_array_add (dp_reserved , val );
154176 }
155177}
178+ static void telemetry_log_reason_id_parse_ocp_2_5 (const struct telemetry_log * tl ,
179+ struct json_object * reason_id )
180+ {
181+ const struct reason_identifier_ocp_2_5 * ri ;
182+ struct json_object * reserved ;
183+ struct json_object * vu_extension ;
184+
185+ ri = (struct reason_identifier_ocp_2_5 * ) tl -> log -> rsnident ;
186+
187+ json_object_object_add (reason_id , "errorId" ,
188+ json_object_new_string_len (ri -> errorId ,
189+ sizeof (ri -> errorId )));
190+ json_object_object_add (reason_id , "fileId" ,
191+ json_object_new_string_len (ri -> fileId ,
192+ sizeof (ri -> fileId )));
193+ json_object_add_value_uint (reason_id , "lineNum" , le16_to_cpu (ri -> lineNum ));
194+ json_object_add_value_uint (reason_id , "validLineNum" , ri -> validFlags .validLineNum );
195+ json_object_add_value_uint (reason_id , "validFileId" , ri -> validFlags .validFileId );
196+ json_object_add_value_uint (reason_id , "validErrorId" , ri -> validFlags .validErrorId );
197+ json_object_add_value_uint (reason_id , "validVuExtension" , ri -> validFlags .validVuExtension );
198+
199+ reserved = json_create_array ();
200+ json_object_add_value_array (reason_id , "reserved" , reserved );
201+ for (int i = 0 ; i < sizeof (ri -> reserved ); i ++ ) {
202+ struct json_object * val = json_object_new_int (ri -> reserved [i ]);
203+
204+ json_object_array_add (reserved , val );
205+ }
206+
207+ vu_extension = json_create_array ();
208+ json_object_add_value_array (reason_id , "vuExtension" , vu_extension );
209+ for (int i = 0 ; i < sizeof (ri -> vuExtension ); i ++ ) {
210+ struct json_object * val = json_object_new_int (ri -> vuExtension [i ]);
211+
212+ json_object_array_add (vu_extension , val );
213+ }
214+ }
156215
157216static void solidigm_telemetry_log_reason_id_parse (const struct telemetry_log * tl , struct json_object * reason_id )
158217{
@@ -161,12 +220,18 @@ static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *t
161220 uint16_t version_major = le16_to_cpu (ri1_0 -> versionMajor );
162221 uint16_t version_minor = le16_to_cpu (ri1_0 -> versionMinor );
163222
223+ if (tl -> is_ocp ) {
224+ telemetry_log_reason_id_parse_ocp_2_5 (tl , reason_id );
225+ return ;
226+ }
227+
164228 json_object_add_value_uint (reason_id , "versionMajor" , version_major );
165229 json_object_add_value_uint (reason_id , "versionMinor" , version_minor );
166230 json_object_add_value_uint (reason_id , "reasonCode" , le32_to_cpu (ri1_0 -> reasonCode ));
167231 json_object_add_value_object (reason_id , "driveStatus" ,
168232 json_object_new_string_len (ri1_0 -> DriveStatus ,
169233 sizeof (ri1_0 -> DriveStatus )));
234+
170235 if (version_major == 1 ) {
171236 switch (version_minor ) {
172237 case 0 :
@@ -211,6 +276,7 @@ bool solidigm_telemetry_log_header_parse(const struct telemetry_log *tl)
211276 json_object_add_value_uint (header , "dataArea1LastBlock" , log -> dalb1 );
212277 json_object_add_value_uint (header , "dataArea2LastBlock" , log -> dalb2 );
213278 json_object_add_value_uint (header , "dataArea3LastBlock" , log -> dalb3 );
279+ json_object_add_value_uint (header , "dataArea4LastBlock" , log -> dalb4 );
214280 json_object_add_value_uint (header , "hostInitiatedDataGeneration" , log -> hostdgn );
215281 json_object_add_value_uint (header , "controllerInitiatedDataAvailable" , log -> ctrlavail );
216282 json_object_add_value_uint (header , "controllerInitiatedDataGeneration" , log -> ctrldgn );
0 commit comments