11b0b00e3SLawrence Tang #ifndef CPER_UTILS_H 21b0b00e3SLawrence Tang #define CPER_UTILS_H 31b0b00e3SLawrence Tang 41b0b00e3SLawrence Tang #define GUID_STRING_LENGTH 30 51b0b00e3SLawrence Tang #define TIMESTAMP_LENGTH 24 61b0b00e3SLawrence Tang 7a0865e38SLawrence Tang json_object* cper_generic_error_status_to_ir(EFI_GENERIC_ERROR_STATUS* error_status); 83b7f45b5SLawrence Tang void ir_generic_error_status_to_cper(json_object* error_status, EFI_GENERIC_ERROR_STATUS* error_status_cper); 97f21db6cSLawrence Tang json_object* uniform_struct_to_ir(UINT32* start, int len, const char* names[]); 107f21db6cSLawrence Tang json_object* uniform_struct64_to_ir(UINT64* start, int len, const char* names[]); 1171570a2aSLawrence Tang void ir_to_uniform_struct(json_object* ir, UINT32* start, int len, const char* names[]); 1271570a2aSLawrence Tang void ir_to_uniform_struct64(json_object* ir, UINT64* start, int len, const char* names[]); 133c878352SLawrence Tang json_object* integer_to_readable_pair(UINT64 value, int len, int keys[], const char* values[], const char* default_value); 147f21db6cSLawrence Tang json_object* integer_to_readable_pair_with_desc(int value, int len, int keys[], const char* values[], const char* descriptions[], const char* default_value); 15b44314c7SLawrence Tang UINT64 readable_pair_to_integer(json_object* pair); 163d0e4f24SLawrence Tang json_object* bitfield_to_ir(UINT64 bitfield, int num_fields, const char* names[]); 17b44314c7SLawrence Tang UINT64 ir_to_bitfield(json_object* ir, int num_fields, const char* names[]); 18e18aaee9SLawrence Tang json_object* uint64_array_to_ir_array(UINT64* array, int len); 191b0b00e3SLawrence Tang json_object* revision_to_ir(UINT16 revision); 20*02c801a5SLawrence Tang const char* severity_to_string(UINT32 severity); 21b44314c7SLawrence Tang void timestamp_to_string(char* out, EFI_ERROR_TIME_STAMP* timestamp); 22b44314c7SLawrence Tang void string_to_timestamp(EFI_ERROR_TIME_STAMP* out, const char* timestamp); 231b0b00e3SLawrence Tang void guid_to_string(char* out, EFI_GUID* guid); 24b44314c7SLawrence Tang void string_to_guid(EFI_GUID* out, const char* guid); 251b0b00e3SLawrence Tang int guid_equal(EFI_GUID* a, EFI_GUID* b); 264dbe3d72SLawrence Tang int bcd_to_int(UINT8 bcd); 273b7f45b5SLawrence Tang UINT8 int_to_bcd(int value); 281b0b00e3SLawrence Tang 291b0b00e3SLawrence Tang //The available severity types for CPER. 301b0b00e3SLawrence Tang extern const char* CPER_SEVERITY_TYPES[4]; 311b0b00e3SLawrence Tang 321b0b00e3SLawrence Tang #endif