blob: 9339f576e642b0d6da9ae9a682d965d8959e41b6 [file] [log] [blame]
Lawrence Tangb98ec662022-07-06 16:50:21 +01001#ifndef CPER_SECTION_CXL_PROTOCOL_H
2#define CPER_SECTION_CXL_PROTOCOL_H
3
Lawrence Tang5202bbb2022-08-12 14:54:36 +01004#include <json.h>
Lawrence Tangb98ec662022-07-06 16:50:21 +01005#include "../edk/Cper.h"
6
John Chungf8fc7052024-05-03 20:05:29 +08007#define CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES \
8 (const char *[]) \
9 { \
10 "cxlAgentTypeValid", "cxlAgentAddressValid", "deviceIDValid", \
11 "deviceSerialValid", "capabilityStructureValid", \
12 "cxlDVSECValid", "cxlErrorLogValid" \
13 }
14#define CXL_PROTOCOL_ERROR_AGENT_TYPES_KEYS \
15 (int[]) \
16 { \
17 0, 1 \
18 }
19#define CXL_PROTOCOL_ERROR_AGENT_TYPES_VALUES \
20 (const char *[]) \
21 { \
22 "CXL 1.1 Device", "CXL 1.1 Host Downstream Port" \
23 }
24#define CXL_PROTOCOL_ERROR_DEVICE_AGENT 0
Lawrence Tangb98ec662022-07-06 16:50:21 +010025#define CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT 1
26
27///
28/// CXL Protocol Error Section
29///
30typedef struct {
John Chungf8fc7052024-05-03 20:05:29 +080031 UINT64 VendorId : 16;
32 UINT64 DeviceId : 16;
33 UINT64 SubsystemVendorId : 16;
34 UINT64 SubsystemDeviceId : 16;
35 UINT64 ClassCode : 16;
36 UINT64 Reserved1 : 3;
37 UINT64 SlotNumber : 13;
38 UINT64 Reserved2 : 32;
Lawrence Tangb98ec662022-07-06 16:50:21 +010039} EFI_CXL_DEVICE_ID;
40
41typedef struct {
John Chungf8fc7052024-05-03 20:05:29 +080042 UINT64 FunctionNumber : 8;
43 UINT64 DeviceNumber : 8;
44 UINT64 BusNumber : 8;
45 UINT64 SegmentNumber : 16;
46 UINT64 Reserved : 24;
Lawrence Tangb98ec662022-07-06 16:50:21 +010047} EFI_CXL_DEVICE_AGENT_ADDRESS;
48
49typedef union {
John Chungf8fc7052024-05-03 20:05:29 +080050 EFI_CXL_DEVICE_AGENT_ADDRESS
51 DeviceAddress; //Active when the agent is a CXL1.1 device in CxlAgentType.
52 UINT64 PortRcrbBaseAddress; //Active when the agent is a CXL1.1 host downstream port in CxlAgentType.
Lawrence Tangb98ec662022-07-06 16:50:21 +010053} EFI_CXL_AGENT_ADDRESS;
54
55typedef struct {
John Chungf8fc7052024-05-03 20:05:29 +080056 UINT64 ValidBits;
57 UINT64 CxlAgentType;
58 EFI_CXL_AGENT_ADDRESS CxlAgentAddress;
59 EFI_CXL_DEVICE_ID DeviceId;
60 UINT64 DeviceSerial;
61 EFI_PCIE_ERROR_DATA_CAPABILITY CapabilityStructure;
62 UINT16 CxlDvsecLength;
63 UINT16 CxlErrorLogLength;
64 UINT32 Reserved;
Lawrence Tang0a4b3f22022-07-21 10:40:10 +010065} __attribute__((packed, aligned(1))) EFI_CXL_PROTOCOL_ERROR_DATA;
Lawrence Tangb98ec662022-07-06 16:50:21 +010066
John Chungf8fc7052024-05-03 20:05:29 +080067json_object *cper_section_cxl_protocol_to_ir(void *section);
68void ir_section_cxl_protocol_to_cper(json_object *section, FILE *out);
Lawrence Tangb98ec662022-07-06 16:50:21 +010069
John Chungf8fc7052024-05-03 20:05:29 +080070#endif