1 #ifndef CPER_UTILS_H 2 #define CPER_UTILS_H 3 4 #define GUID_STRING_LENGTH 30 5 #define TIMESTAMP_LENGTH 24 6 7 json_object* cper_generic_error_status_to_ir(EFI_GENERIC_ERROR_STATUS* error_status); 8 json_object* uniform_struct_to_ir(UINT32* start, int len, const char* names[]); 9 json_object* uniform_struct64_to_ir(UINT64* start, int len, const char* names[]); 10 json_object* integer_to_readable_pair(UINT64 value, int len, int keys[], const char* values[], const char* default_value); 11 json_object* integer_to_readable_pair_with_desc(int value, int len, int keys[], const char* values[], const char* descriptions[], const char* default_value); 12 UINT64 readable_pair_to_integer(json_object* pair); 13 json_object* bitfield_to_ir(UINT64 bitfield, int num_fields, const char* names[]); 14 UINT64 ir_to_bitfield(json_object* ir, int num_fields, const char* names[]); 15 json_object* uint64_array_to_ir_array(UINT64* array, int len); 16 json_object* revision_to_ir(UINT16 revision); 17 const char* severity_to_string(UINT8 severity); 18 void timestamp_to_string(char* out, EFI_ERROR_TIME_STAMP* timestamp); 19 void string_to_timestamp(EFI_ERROR_TIME_STAMP* out, const char* timestamp); 20 void guid_to_string(char* out, EFI_GUID* guid); 21 void string_to_guid(EFI_GUID* out, const char* guid); 22 int guid_equal(EFI_GUID* a, EFI_GUID* b); 23 int bcd_to_int(UINT8 bcd); 24 25 //The available severity types for CPER. 26 extern const char* CPER_SEVERITY_TYPES[4]; 27 28 #endif