154da4414SLawrence Tang #ifndef CPER_SECTION_MEMORY_H
254da4414SLawrence Tang #define CPER_SECTION_MEMORY_H
37f21db6cSLawrence Tang 
45202bbb4SLawrence Tang #include <json.h>
57f21db6cSLawrence Tang #include "../edk/Cper.h"
67f21db6cSLawrence Tang 
7*f8fc7052SJohn Chung #define MEMORY_ERROR_VALID_BITFIELD_NAMES                                      \
8*f8fc7052SJohn Chung 	(const char *[])                                                       \
9*f8fc7052SJohn Chung 	{                                                                      \
10*f8fc7052SJohn Chung 		"errorStatusValid", "physicalAddressValid",                    \
11*f8fc7052SJohn Chung 			"physicalAddressMaskValid", "nodeValid", "cardValid",  \
12*f8fc7052SJohn Chung 			"moduleValid", "bankValid", "deviceValid", "rowValid", \
13*f8fc7052SJohn Chung 			"columnValid", "bitPositionValid",                     \
14*f8fc7052SJohn Chung 			"platformRequestorIDValid",                            \
15*f8fc7052SJohn Chung 			"platformResponderIDValid",                            \
16*f8fc7052SJohn Chung 			"memoryPlatformTargetValid", "memoryErrorTypeValid",   \
17*f8fc7052SJohn Chung 			"rankNumberValid", "cardHandleValid",                  \
18*f8fc7052SJohn Chung 			"moduleHandleValid", "extendedRowBitsValid",           \
19*f8fc7052SJohn Chung 			"bankGroupValid", "bankAddressValid",                  \
20*f8fc7052SJohn Chung 			"chipIdentificationValid"                              \
21*f8fc7052SJohn Chung 	}
22*f8fc7052SJohn Chung #define MEMORY_ERROR_TYPES_KEYS                                                \
23*f8fc7052SJohn Chung 	(int[])                                                                \
24*f8fc7052SJohn Chung 	{                                                                      \
25*f8fc7052SJohn Chung 		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15           \
26*f8fc7052SJohn Chung 	}
27*f8fc7052SJohn Chung #define MEMORY_ERROR_TYPES_VALUES                                              \
28*f8fc7052SJohn Chung 	(const char *[])                                                       \
29*f8fc7052SJohn Chung 	{                                                                      \
30*f8fc7052SJohn Chung 		"Unknown", "No Error", "Single-bit ECC", "Multi-bit ECC",      \
31*f8fc7052SJohn Chung 			"Single-symbol ChipKill ECC",                          \
32*f8fc7052SJohn Chung 			"Multi-symbol ChipKill ECC", "Master Abort",           \
33*f8fc7052SJohn Chung 			"Target Abort", "Parity Error", "Watchdog Timeout",    \
34*f8fc7052SJohn Chung 			"Invalid Address", "Mirror Broken", "Memory Sparing",  \
35*f8fc7052SJohn Chung 			"Scrub Corrected Error", "Scrub Uncorrected Error",    \
36*f8fc7052SJohn Chung 			"Physical Memory Map-out Event"                        \
37*f8fc7052SJohn Chung 	}
38*f8fc7052SJohn Chung #define MEMORY_ERROR_2_VALID_BITFIELD_NAMES                                    \
39*f8fc7052SJohn Chung 	(const char *[])                                                       \
40*f8fc7052SJohn Chung 	{                                                                      \
41*f8fc7052SJohn Chung 		"errorStatusValid", "physicalAddressValid",                    \
42*f8fc7052SJohn Chung 			"physicalAddressMaskValid", "nodeValid", "cardValid",  \
43*f8fc7052SJohn Chung 			"moduleValid", "bankValid", "deviceValid", "rowValid", \
44*f8fc7052SJohn Chung 			"columnValid", "rankValid", "bitPositionValid",        \
45*f8fc7052SJohn Chung 			"chipIDValid", "memoryErrorTypeValid", "statusValid",  \
46*f8fc7052SJohn Chung 			"requestorIDValid", "responderIDValid",                \
47*f8fc7052SJohn Chung 			"targetIDValid", "cardHandleValid",                    \
48*f8fc7052SJohn Chung 			"moduleHandleValid", "bankGroupValid",                 \
49*f8fc7052SJohn Chung 			"bankAddressValid"                                     \
50*f8fc7052SJohn Chung 	}
517f21db6cSLawrence Tang 
52*f8fc7052SJohn Chung json_object *cper_section_platform_memory_to_ir(void *section);
53*f8fc7052SJohn Chung json_object *cper_section_platform_memory2_to_ir(void *section);
543b7f45b5SLawrence Tang void ir_section_memory_to_cper(json_object *section, FILE *out);
553b7f45b5SLawrence Tang void ir_section_memory2_to_cper(json_object *section, FILE *out);
563b7f45b5SLawrence Tang 
577f21db6cSLawrence Tang #endif
58