Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 1 | #ifndef CPER_PARSE_H |
| 2 | #define CPER_PARSE_H |
Karthik Rajagopalan | 255bd81 | 2024-09-06 14:36:34 -0700 | [diff] [blame] | 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
Lawrence Tang | 5202bbb | 2022-08-12 14:54:36 +0100 | [diff] [blame] | 8 | #include <json.h> |
Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 9 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 10 | #define CPER_HEADER_VALID_BITFIELD_NAMES \ |
| 11 | (const char *[]) \ |
| 12 | { \ |
| 13 | "platformIDValid", "timestampValid", "partitionIDValid" \ |
| 14 | } |
| 15 | #define CPER_SECTION_DESCRIPTOR_VALID_BITFIELD_NAMES \ |
| 16 | (const char *[]) \ |
| 17 | { \ |
| 18 | "fruIDValid", "fruStringValid" \ |
| 19 | } |
| 20 | #define CPER_SECTION_DESCRIPTOR_FLAGS_BITFIELD_NAMES \ |
| 21 | (const char *[]) \ |
| 22 | { \ |
| 23 | "primary", "containmentWarning", "reset", \ |
| 24 | "errorThresholdExceeded", "resourceNotAccessible", \ |
| 25 | "latentError", "propagated", "overflow" \ |
| 26 | } |
| 27 | #define CPER_HEADER_FLAG_TYPES_KEYS \ |
| 28 | (int[]) \ |
| 29 | { \ |
| 30 | 1, 2, 4 \ |
| 31 | } |
| 32 | #define CPER_HEADER_FLAG_TYPES_VALUES \ |
| 33 | (const char *[]) \ |
| 34 | { \ |
| 35 | "HW_ERROR_FLAGS_RECOVERED", "HW_ERROR_FLAGS_PREVERR", \ |
| 36 | "HW_ERROR_FLAGS_SIMULATED" \ |
| 37 | } |
Lawrence Tang | 3c43f74 | 2022-07-05 11:37:17 +0100 | [diff] [blame] | 38 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 39 | json_object *cper_to_ir(FILE *cper_file); |
| 40 | json_object *cper_single_section_to_ir(FILE *cper_section_file); |
| 41 | void ir_to_cper(json_object *ir, FILE *out); |
| 42 | void ir_single_section_to_cper(json_object *ir, FILE *out); |
Lawrence Tang | 1b0b00e | 2022-07-05 10:33:10 +0100 | [diff] [blame] | 43 | |
Karthik Rajagopalan | 255bd81 | 2024-09-06 14:36:34 -0700 | [diff] [blame] | 44 | #ifdef __cplusplus |
| 45 | } |
| 46 | #endif |
| 47 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 48 | #endif |