blob: fef58e6c1c7cf7e1834d73632e6c6173f9adb962 [file] [log] [blame]
Lawrence Tang1b0b00e2022-07-05 10:33:10 +01001#ifndef CPER_UTILS_H
2#define CPER_UTILS_H
3
4#define GUID_STRING_LENGTH 30
5#define TIMESTAMP_LENGTH 24
6
Lawrence Tanga0865e32022-07-06 11:59:52 +01007json_object* cper_generic_error_status_to_ir(EFI_GENERIC_ERROR_STATUS* error_status);
Lawrence Tang7f21db62022-07-06 11:09:39 +01008json_object* uniform_struct_to_ir(UINT32* start, int len, const char* names[]);
9json_object* uniform_struct64_to_ir(UINT64* start, int len, const char* names[]);
Lawrence Tang3c43f742022-07-05 11:37:17 +010010json_object* integer_to_readable_pair(int value, int len, int keys[], const char* values[], const char* default_value);
Lawrence Tang7f21db62022-07-06 11:09:39 +010011json_object* integer_to_readable_pair_with_desc(int value, int len, int keys[], const char* values[], const char* descriptions[], const char* default_value);
Lawrence Tang3d0e4f22022-07-05 17:17:41 +010012json_object* bitfield_to_ir(UINT64 bitfield, int num_fields, const char* names[]);
Lawrence Tange18aaee2022-07-07 09:01:30 +010013json_object* uint64_array_to_ir_array(UINT64* array, int len);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +010014json_object* revision_to_ir(UINT16 revision);
15const char* severity_to_string(UINT8 severity);
16void guid_to_string(char* out, EFI_GUID* guid);
17int guid_equal(EFI_GUID* a, EFI_GUID* b);
Lawrence Tang4dbe3d72022-07-06 13:51:01 +010018int bcd_to_int(UINT8 bcd);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +010019
20//The available severity types for CPER.
21extern const char* CPER_SEVERITY_TYPES[4];
22
23#endif