xref: /openbmc/libcper/cper-parse.h (revision 255bd81a)
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 
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 	}
38 
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);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif
49