xref: /openbmc/pldm/oem/meta/event/types.hpp (revision c86cd0427d889484440912722a7e5ec861673378)
1 #pragma once
2 
3 #include <array>
4 #include <cstdint>
5 
6 namespace pldm::oem_meta
7 {
8 
9 enum class RecordType : uint8_t
10 {
11     SYSTEM_EVENT_RECORD = 0x02,
12     UNIFIED_BIOS_SEL = 0xFB,
13 };
14 
15 enum class SystemError : uint8_t
16 {
17     SYSTEM_PROCESSOR_ERR = 0x7,
18     SYSTEM_POST_ERR = 0x2B,
19     SYSTEM_CXL_ERR = 0xC1,
20     SYSTEM_CXL_ERR_2_0 = 0xC2,
21 };
22 
23 enum class CxlError : uint8_t
24 {
25     PROTOCOL_ERR = 0x1,
26     COMPONENT_ERR = 0x2
27 };
28 
29 enum class CxlError2 : uint8_t
30 {
31     PROTOCOL_ERR = 0x1,
32     COMPONENT_ERR = 0x2
33 };
34 
35 enum class ProcessorError : uint8_t
36 {
37     MACHINE_CHK_ERR = 0x40,
38 };
39 
40 enum class ProcessorSeverity : uint8_t
41 {
42     UNCORRECT_SYSTEM_FATAL_ERR = 0xB,
43     CORRECTABLE_SYSTEM_ERR = 0xC,
44 };
45 
46 enum class UnifiedError : uint8_t
47 {
48     UNIFIED_PCIE_ERR = 0x0,
49     UNIFIED_MEM_ERR = 0x1,
50     UNIFIED_UPI_ERR = 0x2,
51     UNIFIED_IIO_ERR = 0x3,
52     UNIFIED_MCA_ERR = 0x4,
53     UNIFIED_MCA_ERR_EXT = 0x5,
54     UNIFIED_RP_PIO_1st = 0x6,
55     UNIFIED_RP_PIO_2nd = 0x7,
56     UNIFIED_POST_EVENT = 0x8,
57     UNIFIED_PCIE_EVENT = 0x9,
58     UNIFIED_MEM_EVENT = 0xA,
59     UNIFIED_UPI_EVENT = 0xB,
60     UNIFIED_BOOT_GUARD = 0xC,
61     UNIFIED_PPR_EVENT = 0xD,
62     UNIFIED_CXL_MEM_ERR = 0xE,
63 };
64 
65 enum class MemoryError : uint8_t
66 {
67     MEMORY_TRAINING_ERR = 0x0,
68     MEMORY_CORRECTABLE_ERR = 0x1,
69     MEMORY_UNCORRECTABLE_ERR = 0x2,
70     MEMORY_CORR_ERR_PTRL_SCR = 0x3,
71     MEMORY_UNCORR_ERR_PTRL_SCR = 0x4,
72     MEMORY_PARITY_ERR_PCC0 = 0x5,
73     MEMORY_PARITY_ERR_PCC1 = 0x6,
74     MEMORY_PMIC_ERR = 0x7,
75     MEMORY_CXL_TRAINNING_ERR = 0x8,
76     MEMORY_CXL_MEM_SPD_CRC_ERR = 0x9,
77     MEMORY_CXL_MEM_SPD_NULL_DATA_ERR = 0xA,
78     MEMORY_CXL_MEM_INIT_TIMEOUT_ERR = 0xB,
79 };
80 
81 enum class PostError : uint8_t
82 {
83     POST_PXE_BOOT_FAIL = 0x0,
84     POST_CMOS_CLEARED = 0x1,
85     POST_TPM_SELF_TEST_FAIL = 0x2,
86     POST_BOOT_DRIVE_FAIL = 0x3,
87     POST_DATA_DRIVE_FAIL = 0x4,
88     POST_INVALID_BOOT_ORDER = 0x5,
89     POST_HTTP_BOOT_FAIL = 0x6,
90     POST_GET_CERT_FAIL = 0x7,
91     POST_PASSWD_CLEARED_BY_JUMPER = 0x8,
92     POST_DXE_FV_CHK_FAIL = 0x9,
93     POST_AMD_ABL_FAIL = 0xA,
94     POST_DRAM_PAGE_RETIRED = 0xB,
95     POST_DRAM_CHANNEL_RETIRED = 0xC,
96     POST_CXL_NOT_READY = 0xD,
97     POST_CXL_ERR_RECORD_CLEARED_BY_BIOS = 0xE,
98 };
99 
100 enum class PcieEvent : uint8_t
101 {
102     PCIE_DPC = 0x0,
103 };
104 
105 enum class MemoryEvent : uint8_t
106 {
107     MEM_PPR = 0x0,
108     MEM_ADDDC = 0x5,
109     MEM_NO_DIMM = 0x7,
110     MEM_CXL_POST_PPR = 0x8,
111 };
112 
113 enum class UpiError : uint8_t
114 {
115     UPI_INIT_ERR = 0x0,
116 };
117 
118 static constexpr auto errorSeverityDetail = std::to_array(
119     {"Correctable Error", "Deferred Error", "Uncorrected Recoverable Error",
120      "Uncorrected Thread Fatal Error", "Uncorrected System Fatal Error"});
121 
122 static constexpr auto machineCheckBank = std::to_array(
123     {"LS",
124      "IF",
125      "L2",
126      "DE",
127      "RAZ",
128      "EX",
129      "FP",
130      "L3",
131      "L3",
132      "L3",
133      "L3",
134      "L3",
135      "L3",
136      "L3",
137      "L3",
138      "MP5",
139      "PCS_GMI",
140      "PCS_GMI",
141      "KPX_GMI",
142      "KPX_GMI",
143      "MPDMA",
144      "UMC",
145      "UMC",
146      "CS/RAZ",
147      "CS/RAZ",
148      "PCIE",
149      "SATA/USB/PCIE",
150      "NBIF",
151      "PIE/PSP/KPX_WALF/NBIF/USB/RAZ",
152      "SMU/SHUB",
153      "PIE/PSP/PCS_XGMI",
154      "KPX_SERDES/RAZ"});
155 
156 static constexpr auto memoryError = std::to_array(
157     {"Memory training failure", "Memory correctable error",
158      "Memory uncorrectable error", "Memory correctable error (Patrol scrub)",
159      "Memory uncorrectable error (Patrol scrub)", "Memory Parity Error (PCC=0)",
160      "Memory Parity Error (PCC=1)", "Memory PMIC Error",
161      "CXL Memory training error", "CXL Memory SPD CRC error",
162      "CXL Memory SPD NULL DATA error", "CXL Memory initialized timeout error",
163      "Reserved"});
164 
165 static constexpr auto certEvent =
166     std::to_array({"No certificate at BMC", "IPMI transaction fail",
167                    "Certificate data corrupted", "Reserved"});
168 
169 static constexpr auto postError = std::to_array(
170     {"System PXE boot fail", "CMOS/NVRAM configuration cleared",
171      "TPM Self-Test Fail", "Boot Drive failure", "Data Drive failure",
172      "Received invalid boot order request from BMC", "System HTTP boot fail",
173      "BIOS fails to get the certificate from BMC", "Password cleared by jumper",
174      "DXE FV check failure", "AMD ABL failure", "DRAM Page Retired",
175      "DRAM Channel Retired", "CXL not ready",
176      "CXL error record cleared by BIOS", "Reserved"});
177 
178 static constexpr auto cxlError = std::to_array(
179     {"CXL_ELOG_IO", "CXL_ELOG_CACHE_MEM", "CXL_ELOG_COMPONENT_EVENT",
180      "Reserved"});
181 
182 static constexpr auto pcieEvent = std::to_array(
183     {"PCIe DPC Event", "PCIe LER Event", "PCIe Link Retraining and Recovery",
184      "PCIe Link CRC Error Check and Retry", "PCIe Corrupt Data Containment",
185      "PCIe Express ECRC", "Reserved"});
186 
187 static constexpr auto memoryEvent = std::to_array(
188     {"Memory PPR event", "Memory Correctable Error logging limit reached",
189      "Memory disable/map-out for FRB", "Memory SDDC",
190      "Memory Address range/Partial mirroring", "Memory ADDDC",
191      "Memory SMBus hang recovery", "No DIMM in System", "CXL POST PPR event",
192      "Reserved"});
193 
194 static constexpr auto memoryPprRepairTime =
195     std::to_array({"Boot time", "Autonomous", "Run time", "Reserved"});
196 
197 static constexpr auto memoryPprEvent =
198     std::to_array({"PPR success", "PPR fail", "PPR request", "Reserved"});
199 
200 static constexpr auto memoryCXLPostPprEvent =
201     std::to_array({"PPR success", "PPR full"});
202 
203 static constexpr auto memoryAdddcEvent =
204     std::to_array({"Bank VLS", "r-Bank VLS + re-buddy", "r-Bank VLS + Rank VLS",
205                    "r-Rank VLS + re-buddy"});
206 
207 static constexpr auto upiEvent = std::to_array(
208     {"Successful LLR without Phy Reinit", "Successful LLR with Phy Reinit",
209      "COR Phy Lane failure, recovery in x8 width", "Reserved"});
210 
211 static constexpr auto pprEvent =
212     std::to_array({"PPR disable", "Soft PPR", "Hard PPR"});
213 
214 static constexpr auto upiError = std::to_array({"UPI Init error", "Reserved"});
215 
216 static constexpr auto memoryCxlEvent =
217     std::to_array({"DIMM A0", "DIMM B0", "DIMM A1", "DIMM B1", "Unknown"});
218 
219 struct DimmInfo
220 {
221     uint8_t sled;
222     uint8_t socket;
223     uint8_t channel;
224     uint8_t slot;
225 };
226 
227 struct BdfInfo
228 {
229     uint8_t Bus;
230     uint8_t Dev;
231     uint8_t Fun;
232     const char* Name;
233 };
234 
235 static constexpr auto cxlBdfMap = std::to_array<BdfInfo>(
236     {// Before Y4401D BIOS
237      {0xA9, 0x00, 0x00, "MCIO3"},
238      {0xD3, 0x00, 0x00, "MCIO4"},
239      // After Y4401D BIOS
240      {0xA1, 0x00, 0x00, "MCIO3"},
241      {0xC1, 0x00, 0x00, "MCIO4"}});
242 
243 } // namespace pldm::oem_meta
244