1d7e8ca34SLawrence Tang #ifndef CPER_SECTION_CXL_COMPONENT_H
2d7e8ca34SLawrence Tang #define CPER_SECTION_CXL_COMPONENT_H
3d7e8ca34SLawrence Tang 
4*5202bbb4SLawrence Tang #include <json.h>
5d7e8ca34SLawrence Tang #include "../edk/Cper.h"
6d7e8ca34SLawrence Tang 
72721739aSLawrence Tang #define CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES (const char*[]) {"deviceIDValid", "deviceSerialValid", \
82721739aSLawrence Tang     "cxlComponentEventLogValid"}
92721739aSLawrence Tang 
10d7e8ca34SLawrence Tang ///
11d7e8ca34SLawrence Tang /// CXL Generic Component Error Section
12d7e8ca34SLawrence Tang ///
13d7e8ca34SLawrence Tang typedef struct {
14d7e8ca34SLawrence Tang   UINT64 VendorId : 16;
15d7e8ca34SLawrence Tang   UINT64 DeviceId : 16;
16d7e8ca34SLawrence Tang   UINT64 FunctionNumber : 8;
17d7e8ca34SLawrence Tang   UINT64 DeviceNumber : 8;
18d7e8ca34SLawrence Tang   UINT64 BusNumber : 8;
19d7e8ca34SLawrence Tang   UINT64 SegmentNumber : 16;
20d7e8ca34SLawrence Tang   UINT64 Resv1 : 3;
21d7e8ca34SLawrence Tang   UINT64 SlotNumber : 13;
22d7e8ca34SLawrence Tang   UINT64 Resv2 : 8;
230a4b3f2dSLawrence Tang } __attribute__((packed, aligned(1))) EFI_CXL_DEVICE_ID_INFO;
24d7e8ca34SLawrence Tang 
25d7e8ca34SLawrence Tang typedef struct {
26d7e8ca34SLawrence Tang     UINT32 Length;
27d7e8ca34SLawrence Tang     UINT64 ValidBits;
28d7e8ca34SLawrence Tang     EFI_CXL_DEVICE_ID_INFO DeviceId;
29d7e8ca34SLawrence Tang     UINT64 DeviceSerial;
300a4b3f2dSLawrence Tang } __attribute__((packed, aligned(1))) EFI_CXL_COMPONENT_EVENT_HEADER;
31d7e8ca34SLawrence Tang 
32d7e8ca34SLawrence Tang json_object* cper_section_cxl_component_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor);
33aec83900SLawrence Tang void ir_section_cxl_component_to_cper(json_object* section, FILE* out);
34d7e8ca34SLawrence Tang 
35d7e8ca34SLawrence Tang #endif