xref: /openbmc/libcper/include/libcper/sections/cper-section-cxl-component.h (revision 12dbd4fd4fd341e83ce31f6af710dbc211fb47fd)
1 #ifndef CPER_SECTION_CXL_COMPONENT_H
2 #define CPER_SECTION_CXL_COMPONENT_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <stdio.h>
9 #include <json.h>
10 #include <libcper/Cper.h>
11 
12 #define CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES                               \
13 	(const char *[]){ "deviceIDValid", "deviceSerialValid",                \
14 			  "cxlComponentEventLogValid" }
15 
16 ///
17 /// CXL Generic Component Error Section
18 ///
19 typedef struct {
20 	UINT64 VendorId : 16;
21 	UINT64 DeviceId : 16;
22 	UINT64 FunctionNumber : 8;
23 	UINT64 DeviceNumber : 8;
24 	UINT64 BusNumber : 8;
25 	UINT64 SegmentNumber : 16;
26 	UINT64 Resv1 : 3;
27 	UINT64 SlotNumber : 13;
28 	UINT64 Resv2 : 8;
29 } __attribute__((packed, aligned(1))) EFI_CXL_DEVICE_ID_INFO;
30 
31 typedef struct {
32 	UINT32 Length;
33 	UINT64 ValidBits;
34 	EFI_CXL_DEVICE_ID_INFO DeviceId;
35 	UINT64 DeviceSerial;
36 } __attribute__((packed, aligned(1))) EFI_CXL_COMPONENT_EVENT_HEADER;
37 
38 json_object *cper_section_cxl_component_to_ir(const UINT8 *section,
39 					      UINT32 size);
40 void ir_section_cxl_component_to_cper(json_object *section, FILE *out);
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 #endif
47