xref: /openbmc/libcper/include/libcper/cper-parse.h (revision 30cd66aa7068f42bd59893c9cbd31fa2f25480d5)
1 #ifndef CPER_PARSE_H
2 #define CPER_PARSE_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <json.h>
9 #include <stdio.h>
10 
11 #define CPER_HEADER_VALID_BITFIELD_NAMES                                       \
12 	(const char *[]){ "platformIDValid", "timestampValid",                 \
13 			  "partitionIDValid" }
14 #define CPER_SECTION_DESCRIPTOR_VALID_BITFIELD_NAMES                           \
15 	(const char *[]){ "fruIDValid", "fruStringValid" }
16 #define CPER_SECTION_DESCRIPTOR_FLAGS_BITFIELD_NAMES                           \
17 	(const char *[]){ "primary",                                           \
18 			  "containmentWarning",                                \
19 			  "reset",                                             \
20 			  "errorThresholdExceeded",                            \
21 			  "resourceNotAccessible",                             \
22 			  "latentError",                                       \
23 			  "propagated",                                        \
24 			  "overflow" }
25 #define CPER_HEADER_FLAG_TYPES_KEYS (int[]){ 1, 2, 4 }
26 #define CPER_HEADER_FLAG_TYPES_VALUES                                          \
27 	(const char *[]){ "HW_ERROR_FLAGS_RECOVERED",                          \
28 			  "HW_ERROR_FLAGS_PREVERR",                            \
29 			  "HW_ERROR_FLAGS_SIMULATED" }
30 
31 json_object *cper_to_ir(FILE *cper_file);
32 json_object *cper_single_section_to_ir(FILE *cper_section_file);
33 void ir_to_cper(json_object *ir, FILE *out);
34 void ir_single_section_to_cper(json_object *ir, FILE *out);
35 
36 #ifdef __cplusplus
37 }
38 #endif
39 
40 #endif
41