1d7e8ca34SLawrence Tang #ifndef CPER_SECTION_CXL_COMPONENT_H
2d7e8ca34SLawrence Tang #define CPER_SECTION_CXL_COMPONENT_H
3d7e8ca34SLawrence Tang 
4*255bd81aSKarthik Rajagopalan #ifdef __cplusplus
5*255bd81aSKarthik Rajagopalan extern "C" {
6*255bd81aSKarthik Rajagopalan #endif
7*255bd81aSKarthik Rajagopalan 
85202bbb4SLawrence Tang #include <json.h>
9d7e8ca34SLawrence Tang #include "../edk/Cper.h"
10d7e8ca34SLawrence Tang 
11f8fc7052SJohn Chung #define CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES                               \
12f8fc7052SJohn Chung 	(const char *[])                                                       \
13f8fc7052SJohn Chung 	{                                                                      \
14f8fc7052SJohn Chung 		"deviceIDValid", "deviceSerialValid",                          \
15f8fc7052SJohn Chung 			"cxlComponentEventLogValid"                            \
16f8fc7052SJohn Chung 	}
172721739aSLawrence Tang 
18d7e8ca34SLawrence Tang ///
19d7e8ca34SLawrence Tang /// CXL Generic Component Error Section
20d7e8ca34SLawrence Tang ///
21d7e8ca34SLawrence Tang typedef struct {
22d7e8ca34SLawrence Tang 	UINT64 VendorId : 16;
23d7e8ca34SLawrence Tang 	UINT64 DeviceId : 16;
24d7e8ca34SLawrence Tang 	UINT64 FunctionNumber : 8;
25d7e8ca34SLawrence Tang 	UINT64 DeviceNumber : 8;
26d7e8ca34SLawrence Tang 	UINT64 BusNumber : 8;
27d7e8ca34SLawrence Tang 	UINT64 SegmentNumber : 16;
28d7e8ca34SLawrence Tang 	UINT64 Resv1 : 3;
29d7e8ca34SLawrence Tang 	UINT64 SlotNumber : 13;
30d7e8ca34SLawrence Tang 	UINT64 Resv2 : 8;
310a4b3f2dSLawrence Tang } __attribute__((packed, aligned(1))) EFI_CXL_DEVICE_ID_INFO;
32d7e8ca34SLawrence Tang 
33d7e8ca34SLawrence Tang typedef struct {
34d7e8ca34SLawrence Tang 	UINT32 Length;
35d7e8ca34SLawrence Tang 	UINT64 ValidBits;
36d7e8ca34SLawrence Tang 	EFI_CXL_DEVICE_ID_INFO DeviceId;
37d7e8ca34SLawrence Tang 	UINT64 DeviceSerial;
380a4b3f2dSLawrence Tang } __attribute__((packed, aligned(1))) EFI_CXL_COMPONENT_EVENT_HEADER;
39d7e8ca34SLawrence Tang 
40f8fc7052SJohn Chung json_object *cper_section_cxl_component_to_ir(void *section);
41aec83900SLawrence Tang void ir_section_cxl_component_to_cper(json_object *section, FILE *out);
42d7e8ca34SLawrence Tang 
43*255bd81aSKarthik Rajagopalan #ifdef __cplusplus
44*255bd81aSKarthik Rajagopalan }
45*255bd81aSKarthik Rajagopalan #endif
46*255bd81aSKarthik Rajagopalan 
47d7e8ca34SLawrence Tang #endif
48