Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 1 | #ifndef CPER_SECTION_CXL_PROTOCOL_H |
| 2 | #define CPER_SECTION_CXL_PROTOCOL_H |
| 3 | |
Karthik Rajagopalan | 255bd81 | 2024-09-06 14:36:34 -0700 | [diff] [blame] | 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
Lawrence Tang | 5202bbb | 2022-08-12 14:54:36 +0100 | [diff] [blame] | 8 | #include <json.h> |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 9 | #include "../edk/Cper.h" |
| 10 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 11 | #define CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES \ |
| 12 | (const char *[]) \ |
| 13 | { \ |
| 14 | "cxlAgentTypeValid", "cxlAgentAddressValid", "deviceIDValid", \ |
| 15 | "deviceSerialValid", "capabilityStructureValid", \ |
| 16 | "cxlDVSECValid", "cxlErrorLogValid" \ |
| 17 | } |
| 18 | #define CXL_PROTOCOL_ERROR_AGENT_TYPES_KEYS \ |
| 19 | (int[]) \ |
| 20 | { \ |
| 21 | 0, 1 \ |
| 22 | } |
| 23 | #define CXL_PROTOCOL_ERROR_AGENT_TYPES_VALUES \ |
| 24 | (const char *[]) \ |
| 25 | { \ |
| 26 | "CXL 1.1 Device", "CXL 1.1 Host Downstream Port" \ |
| 27 | } |
| 28 | #define CXL_PROTOCOL_ERROR_DEVICE_AGENT 0 |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 29 | #define CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT 1 |
| 30 | |
| 31 | /// |
| 32 | /// CXL Protocol Error Section |
| 33 | /// |
| 34 | typedef struct { |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 35 | UINT64 VendorId : 16; |
| 36 | UINT64 DeviceId : 16; |
| 37 | UINT64 SubsystemVendorId : 16; |
| 38 | UINT64 SubsystemDeviceId : 16; |
| 39 | UINT64 ClassCode : 16; |
| 40 | UINT64 Reserved1 : 3; |
| 41 | UINT64 SlotNumber : 13; |
| 42 | UINT64 Reserved2 : 32; |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 43 | } EFI_CXL_DEVICE_ID; |
| 44 | |
| 45 | typedef struct { |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 46 | UINT64 FunctionNumber : 8; |
| 47 | UINT64 DeviceNumber : 8; |
| 48 | UINT64 BusNumber : 8; |
| 49 | UINT64 SegmentNumber : 16; |
| 50 | UINT64 Reserved : 24; |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 51 | } EFI_CXL_DEVICE_AGENT_ADDRESS; |
| 52 | |
| 53 | typedef union { |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 54 | EFI_CXL_DEVICE_AGENT_ADDRESS |
| 55 | DeviceAddress; //Active when the agent is a CXL1.1 device in CxlAgentType. |
| 56 | UINT64 PortRcrbBaseAddress; //Active when the agent is a CXL1.1 host downstream port in CxlAgentType. |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 57 | } EFI_CXL_AGENT_ADDRESS; |
| 58 | |
| 59 | typedef struct { |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 60 | UINT64 ValidBits; |
| 61 | UINT64 CxlAgentType; |
| 62 | EFI_CXL_AGENT_ADDRESS CxlAgentAddress; |
| 63 | EFI_CXL_DEVICE_ID DeviceId; |
| 64 | UINT64 DeviceSerial; |
| 65 | EFI_PCIE_ERROR_DATA_CAPABILITY CapabilityStructure; |
| 66 | UINT16 CxlDvsecLength; |
| 67 | UINT16 CxlErrorLogLength; |
| 68 | UINT32 Reserved; |
Lawrence Tang | 0a4b3f2 | 2022-07-21 10:40:10 +0100 | [diff] [blame] | 69 | } __attribute__((packed, aligned(1))) EFI_CXL_PROTOCOL_ERROR_DATA; |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 70 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 71 | json_object *cper_section_cxl_protocol_to_ir(void *section); |
| 72 | void ir_section_cxl_protocol_to_cper(json_object *section, FILE *out); |
Lawrence Tang | b98ec66 | 2022-07-06 16:50:21 +0100 | [diff] [blame] | 73 | |
Karthik Rajagopalan | 255bd81 | 2024-09-06 14:36:34 -0700 | [diff] [blame] | 74 | #ifdef __cplusplus |
| 75 | } |
| 76 | #endif |
| 77 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 78 | #endif |