History

efi/cper: Add a cper_mem_err_status_str() to decode error description

Introduce a new helper function cper_mem_err_status_str() to decode the error status value into a human readable string. [ bp: Massage. ]

Shuai Xue committed 4 years ago

Commit bdae7961 parent b2fa90e2 files · +30 −1Browse files

Unified · Split

2 files
  1. drivers/firmware/efi/cper.c +29 −1
  2. include/linux/cper.h +1 −0
drivers/firmware/efi/cper.c+29−1
@@ -211,6 +211,32 @@ const char *cper_mem_err_type_str(unsigned int etype) · 210 unmodified lines
211211 }
212212 EXPORT_SYMBOL_GPL(cper_mem_err_type_str);
213213
214+const char *cper_mem_err_status_str(u64 status)
215+{
216+ switch ((status >> 8) & 0xff) {
217+ case 1: return "Error detected internal to the component";
218+ case 4: return "Storage error in DRAM memory";
219+ case 5: return "Storage error in TLB";
220+ case 6: return "Storage error in cache";
221+ case 7: return "Error in one or more functional units";
222+ case 8: return "Component failed self test";
223+ case 9: return "Overflow or undervalue of internal queue";
224+ case 16: return "Error detected in the bus";
225+ case 17: return "Virtual address not found on IO-TLB or IO-PDIR";
226+ case 18: return "Improper access error";
227+ case 19: return "Access to a memory address which is not mapped to any component";
228+ case 20: return "Loss of Lockstep";
229+ case 21: return "Response not associated with a request";
230+ case 22: return "Bus parity error - must also set the A, C, or D Bits";
231+ case 23: return "Detection of a protocol error";
232+ case 24: return "Detection of a PATH_ERROR";
233+ case 25: return "Bus operation timeout";
234+ case 26: return "A read was issued to data that has been poisoned";
235+ default: return "Reserved";
236+ }
237+}
238+EXPORT_SYMBOL_GPL(cper_mem_err_status_str);
239+
214240 static int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg)
215241 {
216242 u32 len, n;
@@ -334,7 +360,9 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, · 117 unmodified lines
334360 return;
335361 }
336362 if (mem->validation_bits & CPER_MEM_VALID_ERROR_STATUS)
337− printk("%s""error_status: 0x%016llx\n", pfx, mem->error_status);
363+ printk("%s error_status: %s (0x%016llx)\n",
364+ pfx, cper_mem_err_status_str(mem->error_status),
365+ mem->error_status);
338366 if (mem->validation_bits & CPER_MEM_VALID_PA)
339367 printk("%s""physical_address: 0x%016llx\n",
340368 pfx, mem->physical_addr);
include/linux/cper.h+1−0
@@ -558,6 +558,7 @@ extern const char *const cper_proc_error_type_strs[4]; · 557 unmodified lines
558558 u64 cper_next_record_id(void);
559559 const char *cper_severity_str(unsigned int);
560560 const char *cper_mem_err_type_str(unsigned int);
561+const char *cper_mem_err_status_str(u64 status);
561562 void cper_print_bits(const char *prefix, unsigned int bits,
562563 const char * const strs[], unsigned int strs_size);
563564 void cper_mem_err_pack(const struct cper_sec_mem_err *,