Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 1 | #ifndef CPER_UTILS_H |
| 2 | #define CPER_UTILS_H |
| 3 | |
| 4 | #define GUID_STRING_LENGTH 30 |
| 5 | #define TIMESTAMP_LENGTH 24 |
| 6 | |
Lawrence Tang | aacf0e2 | 2022-07-20 13:28:52 +0100 | [diff] [blame] | 7 | #include "common-utils.h" |
| 8 | |
Lawrence Tang | a0865e3 | 2022-07-06 11:59:52 +0100 | [diff] [blame] | 9 | json_object* cper_generic_error_status_to_ir(EFI_GENERIC_ERROR_STATUS* error_status); |
Lawrence Tang | 3b7f45b | 2022-07-14 14:14:30 +0100 | [diff] [blame] | 10 | void ir_generic_error_status_to_cper(json_object* error_status, EFI_GENERIC_ERROR_STATUS* error_status_cper); |
Lawrence Tang | 7f21db6 | 2022-07-06 11:09:39 +0100 | [diff] [blame] | 11 | json_object* uniform_struct_to_ir(UINT32* start, int len, const char* names[]); |
| 12 | json_object* uniform_struct64_to_ir(UINT64* start, int len, const char* names[]); |
Lawrence Tang | 71570a2 | 2022-07-14 11:45:28 +0100 | [diff] [blame] | 13 | void ir_to_uniform_struct(json_object* ir, UINT32* start, int len, const char* names[]); |
| 14 | void ir_to_uniform_struct64(json_object* ir, UINT64* start, int len, const char* names[]); |
Lawrence Tang | 3c87835 | 2022-07-08 14:04:50 +0100 | [diff] [blame] | 15 | json_object* integer_to_readable_pair(UINT64 value, int len, int keys[], const char* values[], const char* default_value); |
Lawrence Tang | 7f21db6 | 2022-07-06 11:09:39 +0100 | [diff] [blame] | 16 | json_object* integer_to_readable_pair_with_desc(int value, int len, int keys[], const char* values[], const char* descriptions[], const char* default_value); |
Lawrence Tang | b44314c | 2022-07-13 11:45:22 +0100 | [diff] [blame] | 17 | UINT64 readable_pair_to_integer(json_object* pair); |
Lawrence Tang | 3d0e4f2 | 2022-07-05 17:17:41 +0100 | [diff] [blame] | 18 | json_object* bitfield_to_ir(UINT64 bitfield, int num_fields, const char* names[]); |
Lawrence Tang | b44314c | 2022-07-13 11:45:22 +0100 | [diff] [blame] | 19 | UINT64 ir_to_bitfield(json_object* ir, int num_fields, const char* names[]); |
Lawrence Tang | e18aaee | 2022-07-07 09:01:30 +0100 | [diff] [blame] | 20 | json_object* uint64_array_to_ir_array(UINT64* array, int len); |
Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 21 | json_object* revision_to_ir(UINT16 revision); |
Lawrence Tang | 02c801a | 2022-07-18 14:43:52 +0100 | [diff] [blame] | 22 | const char* severity_to_string(UINT32 severity); |
Lawrence Tang | b44314c | 2022-07-13 11:45:22 +0100 | [diff] [blame] | 23 | void timestamp_to_string(char* out, EFI_ERROR_TIME_STAMP* timestamp); |
| 24 | void string_to_timestamp(EFI_ERROR_TIME_STAMP* out, const char* timestamp); |
Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 25 | void guid_to_string(char* out, EFI_GUID* guid); |
Lawrence Tang | b44314c | 2022-07-13 11:45:22 +0100 | [diff] [blame] | 26 | void string_to_guid(EFI_GUID* out, const char* guid); |
Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 27 | int guid_equal(EFI_GUID* a, EFI_GUID* b); |
Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 28 | |
| 29 | //The available severity types for CPER. |
| 30 | extern const char* CPER_SEVERITY_TYPES[4]; |
| 31 | |
| 32 | #endif |