@@ -207,7 +207,7 @@ const char *cper_mem_err_type_str(unsigned int etype)
207207}
208208EXPORT_SYMBOL_GPL (cper_mem_err_type_str );
209209
210- static int cper_mem_err_location (const struct cper_sec_mem_err * mem , char * msg )
210+ static int cper_mem_err_location (struct cper_mem_err_compact * mem , char * msg )
211211{
212212 u32 len , n ;
213213
@@ -249,7 +249,7 @@ static int cper_mem_err_location(const struct cper_sec_mem_err *mem, char *msg)
249249 return n ;
250250}
251251
252- static int cper_dimm_err_location (const struct cper_sec_mem_err * mem , char * msg )
252+ static int cper_dimm_err_location (struct cper_mem_err_compact * mem , char * msg )
253253{
254254 u32 len , n ;
255255 const char * bank = NULL , * device = NULL ;
@@ -271,8 +271,44 @@ static int cper_dimm_err_location(const struct cper_sec_mem_err *mem, char *msg)
271271 return n ;
272272}
273273
274+ void cper_mem_err_pack (const struct cper_sec_mem_err * mem ,
275+ struct cper_mem_err_compact * cmem )
276+ {
277+ cmem -> validation_bits = mem -> validation_bits ;
278+ cmem -> node = mem -> node ;
279+ cmem -> card = mem -> card ;
280+ cmem -> module = mem -> module ;
281+ cmem -> bank = mem -> bank ;
282+ cmem -> device = mem -> device ;
283+ cmem -> row = mem -> row ;
284+ cmem -> column = mem -> column ;
285+ cmem -> bit_pos = mem -> bit_pos ;
286+ cmem -> requestor_id = mem -> requestor_id ;
287+ cmem -> responder_id = mem -> responder_id ;
288+ cmem -> target_id = mem -> target_id ;
289+ cmem -> rank = mem -> rank ;
290+ cmem -> mem_array_handle = mem -> mem_array_handle ;
291+ cmem -> mem_dev_handle = mem -> mem_dev_handle ;
292+ }
293+
294+ const char * cper_mem_err_unpack (struct trace_seq * p ,
295+ struct cper_mem_err_compact * cmem )
296+ {
297+ const char * ret = p -> buffer + p -> len ;
298+
299+ if (cper_mem_err_location (cmem , rcd_decode_str ))
300+ trace_seq_printf (p , "%s" , rcd_decode_str );
301+ if (cper_dimm_err_location (cmem , rcd_decode_str ))
302+ trace_seq_printf (p , "%s" , rcd_decode_str );
303+ trace_seq_putc (p , '\0' );
304+
305+ return ret ;
306+ }
307+
274308static void cper_print_mem (const char * pfx , const struct cper_sec_mem_err * mem )
275309{
310+ struct cper_mem_err_compact cmem ;
311+
276312 if (mem -> validation_bits & CPER_MEM_VALID_ERROR_STATUS )
277313 printk ("%s" "error_status: 0x%016llx\n" , pfx , mem -> error_status );
278314 if (mem -> validation_bits & CPER_MEM_VALID_PA )
@@ -281,14 +317,15 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem)
281317 if (mem -> validation_bits & CPER_MEM_VALID_PA_MASK )
282318 printk ("%s" "physical_address_mask: 0x%016llx\n" ,
283319 pfx , mem -> physical_addr_mask );
284- if (cper_mem_err_location (mem , rcd_decode_str ))
320+ cper_mem_err_pack (mem , & cmem );
321+ if (cper_mem_err_location (& cmem , rcd_decode_str ))
285322 printk ("%s%s\n" , pfx , rcd_decode_str );
286323 if (mem -> validation_bits & CPER_MEM_VALID_ERROR_TYPE ) {
287324 u8 etype = mem -> error_type ;
288325 printk ("%s" "error_type: %d, %s\n" , pfx , etype ,
289326 cper_mem_err_type_str (etype ));
290327 }
291- if (cper_dimm_err_location (mem , rcd_decode_str ))
328+ if (cper_dimm_err_location (& cmem , rcd_decode_str ))
292329 printk ("%s%s\n" , pfx , rcd_decode_str );
293330}
294331
0 commit comments