xref: /openbmc/libcper/include/libcper/Cper.h (revision ad6c880fc739b6ca750c3ab594e270efd972c2ac)
1 /** @file
2   GUIDs and definitions used for Common Platform Error Record.
3 
4   Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
5   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6   SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8   @par Revision Reference:
9   GUIDs defined in UEFI 2.7 Specification.
10 
11 **/
12 
13 #ifndef CPER_GUID_H
14 #define CPER_GUID_H
15 
16 #include <libcper/BaseTypes.h>
17 #include <libcper/common-utils.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #pragma pack(push, 1)
24 
25 #define EFI_ERROR_RECORD_SIGNATURE_START SIGNATURE_32('C', 'P', 'E', 'R')
26 #define EFI_ERROR_RECORD_SIGNATURE_END	 0xFFFFFFFF
27 
28 #define EFI_ERROR_RECORD_REVISION 0x0101
29 
30 ///
31 /// Error Severity in Error Record Header and Error Section Descriptor
32 ///@{
33 #define EFI_GENERIC_ERROR_RECOVERABLE 0x00000000
34 #define EFI_GENERIC_ERROR_FATAL	      0x00000001
35 #define EFI_GENERIC_ERROR_CORRECTED   0x00000002
36 #define EFI_GENERIC_ERROR_INFO	      0x00000003
37 ///@}
38 
39 ///
40 /// The validation bit mask indicates the validity of the following fields
41 /// in Error Record Header.
42 ///@{
43 #define EFI_ERROR_RECORD_HEADER_PLATFORM_ID_VALID  BIT0
44 #define EFI_ERROR_RECORD_HEADER_TIME_STAMP_VALID   BIT1
45 #define EFI_ERROR_RECORD_HEADER_PARTITION_ID_VALID BIT2
46 ///@}
47 
48 ///
49 /// Timestamp is precise if this bit is set and correlates to the time of the
50 /// error event.
51 ///
52 #define EFI_ERROR_TIME_STAMP_PRECISE BIT0
53 
54 ///
55 /// Hexadecimal string representation of a 64bit integer
56 /// 16 digits + 2 char + 1 null termination
57 ///
58 #define EFI_UINT64_HEX_STRING_LEN 19
59 
60 ///
61 /// Length of a single line description for the entire section.
62 ///
63 #define SECTION_DESC_STRING_SIZE 512
64 
65 ///
66 /// Length of the description of certain fields within the section.
67 ///
68 #define EFI_ERROR_DESCRIPTION_STRING_LEN	     64
69 #define EFI_ERROR_INFORMATION_DESCRIPTION_STRING_LEN 128
70 
71 ///
72 /// The timestamp correlates to the time when the error information was collected
73 /// by the system software and may not necessarily represent the time of the error
74 /// event. The timestamp contains the local time in BCD format.
75 ///
76 typedef struct {
77 	UINT8 Seconds;
78 	UINT8 Minutes;
79 	UINT8 Hours;
80 	UINT8 Flag;
81 	UINT8 Day;
82 	UINT8 Month;
83 	UINT8 Year;
84 	UINT8 Century;
85 } EFI_ERROR_TIME_STAMP;
86 
87 ///
88 /// GUID value indicating the record association with an error event notification type.
89 ///@{
90 #define EFI_EVENT_NOTIFICATION_TYEP_CMC_GUID                                   \
91 	{ 0x2DCE8BB1,                                                          \
92 	  0xBDD7,                                                              \
93 	  0x450e,                                                              \
94 	  { 0xB9, 0xAD, 0x9C, 0xF4, 0xEB, 0xD4, 0xF8, 0x90 } }
95 #define EFI_EVENT_NOTIFICATION_TYEP_CPE_GUID                                   \
96 	{ 0x4E292F96,                                                          \
97 	  0xD843,                                                              \
98 	  0x4a55,                                                              \
99 	  { 0xA8, 0xC2, 0xD4, 0x81, 0xF2, 0x7E, 0xBE, 0xEE } }
100 #define EFI_EVENT_NOTIFICATION_TYEP_MCE_GUID                                   \
101 	{ 0xE8F56FFE,                                                          \
102 	  0x919C,                                                              \
103 	  0x4cc5,                                                              \
104 	  { 0xBA, 0x88, 0x65, 0xAB, 0xE1, 0x49, 0x13, 0xBB } }
105 #define EFI_EVENT_NOTIFICATION_TYEP_PCIE_GUID                                  \
106 	{ 0xCF93C01F,                                                          \
107 	  0x1A16,                                                              \
108 	  0x4dfc,                                                              \
109 	  { 0xB8, 0xBC, 0x9C, 0x4D, 0xAF, 0x67, 0xC1, 0x04 } }
110 #define EFI_EVENT_NOTIFICATION_TYEP_INIT_GUID                                  \
111 	{ 0xCC5263E8,                                                          \
112 	  0x9308,                                                              \
113 	  0x454a,                                                              \
114 	  { 0x89, 0xD0, 0x34, 0x0B, 0xD3, 0x9B, 0xC9, 0x8E } }
115 #define EFI_EVENT_NOTIFICATION_TYEP_NMI_GUID                                   \
116 	{ 0x5BAD89FF,                                                          \
117 	  0xB7E6,                                                              \
118 	  0x42c9,                                                              \
119 	  { 0x81, 0x4A, 0xCF, 0x24, 0x85, 0xD6, 0xE9, 0x8A } }
120 #define EFI_EVENT_NOTIFICATION_TYEP_BOOT_GUID                                  \
121 	{ 0x3D61A466,                                                          \
122 	  0xAB40,                                                              \
123 	  0x409a,                                                              \
124 	  { 0xA6, 0x98, 0xF3, 0x62, 0xD4, 0x64, 0xB3, 0x8F } }
125 #define EFI_EVENT_NOTIFICATION_TYEP_DMAR_GUID                                  \
126 	{ 0x667DD791,                                                          \
127 	  0xC6B3,                                                              \
128 	  0x4c27,                                                              \
129 	  { 0x8A, 0x6B, 0x0F, 0x8E, 0x72, 0x2D, 0xEB, 0x41 } }
130 #define EFI_EVENT_NOTIFICATION_TYPE_DMAR_SEA                                   \
131 	{ 0x9A78788A,                                                          \
132 	  0xBBE8,                                                              \
133 	  0x11E4,                                                              \
134 	  { 0x80, 0x9E, 0x67, 0x61, 0x1E, 0x5D, 0x46, 0xB0 } }
135 #define EFI_EVENT_NOTIFICATION_TYPE_DMAR_SEI                                   \
136 	{ 0x5C284C81,                                                          \
137 	  0xB0AE,                                                              \
138 	  0x4E87,                                                              \
139 	  { 0xA3, 0x22, 0xB0, 0x4C, 0x85, 0x62, 0x43, 0x23 } }
140 #define EFI_EVENT_NOTIFICATION_TYPE_DMAR_PEI                                   \
141 	{ 0x09A9D5AC,                                                          \
142 	  0x5204,                                                              \
143 	  0x4214,                                                              \
144 	  { 0x96, 0xE5, 0x94, 0x99, 0x2E, 0x75, 0x2B, 0xCD } }
145 ///@}
146 
147 ///
148 /// Error Record Header Flags
149 ///@{
150 #define EFI_HW_ERROR_FLAGS_RECOVERED 0x00000001
151 #define EFI_HW_ERROR_FLAGS_PREVERR   0x00000002
152 #define EFI_HW_ERROR_FLAGS_SIMULATED 0x00000004
153 ///@}
154 
155 ///
156 /// Common error record header
157 ///
158 typedef struct {
159 	UINT32 SignatureStart;
160 	UINT16 Revision;
161 	UINT32 SignatureEnd;
162 	UINT16 SectionCount;
163 	UINT32 ErrorSeverity;
164 	UINT32 ValidationBits;
165 	UINT32 RecordLength;
166 	EFI_ERROR_TIME_STAMP TimeStamp;
167 	EFI_GUID PlatformID;
168 	EFI_GUID PartitionID;
169 	EFI_GUID CreatorID;
170 	EFI_GUID NotificationType;
171 	UINT64 RecordID;
172 	UINT32 Flags;
173 	UINT64 PersistenceInfo;
174 	UINT8 Resv1[12];
175 	///
176 	/// An array of SectionCount descriptors for the associated
177 	/// sections. The number of valid sections is equivalent to the
178 	/// SectionCount. The buffer size of the record may include
179 	/// more space to dynamically add additional Section
180 	/// Descriptors to the error record.
181 	///
182 } EFI_COMMON_ERROR_RECORD_HEADER;
183 
184 #define EFI_ERROR_SECTION_REVISION 0x0100
185 
186 ///
187 /// Validity Fields in Error Section Descriptor.
188 ///
189 #define EFI_ERROR_SECTION_FRU_ID_VALID	   BIT0
190 #define EFI_ERROR_SECTION_FRU_STRING_VALID BIT1
191 
192 ///
193 /// Flag field contains information that describes the error section
194 /// in Error Section Descriptor.
195 ///
196 #define EFI_ERROR_SECTION_FLAGS_PRIMARY			 BIT0
197 #define EFI_ERROR_SECTION_FLAGS_CONTAINMENT_WARNING	 BIT1
198 #define EFI_ERROR_SECTION_FLAGS_RESET			 BIT2
199 #define EFI_ERROR_SECTION_FLAGS_ERROR_THRESHOLD_EXCEEDED BIT3
200 #define EFI_ERROR_SECTION_FLAGS_RESOURCE_NOT_ACCESSIBLE	 BIT4
201 #define EFI_ERROR_SECTION_FLAGS_LATENT_ERROR		 BIT5
202 
203 ///
204 /// Error Sectition Type GUIDs in Error Section Descriptor
205 ///@{
206 #define EFI_ERROR_SECTION_PROCESSOR_GENERIC_GUID                               \
207 	{ 0x9876ccad,                                                          \
208 	  0x47b4,                                                              \
209 	  0x4bdb,                                                              \
210 	  { 0xb6, 0x5e, 0x16, 0xf1, 0x93, 0xc4, 0xf3, 0xdb } }
211 #define EFI_ERROR_SECTION_PROCESSOR_SPECIFIC_GUID                              \
212 	{ 0xdc3ea0b0,                                                          \
213 	  0xa144,                                                              \
214 	  0x4797,                                                              \
215 	  { 0xb9, 0x5b, 0x53, 0xfa, 0x24, 0x2b, 0x6e, 0x1d } }
216 #define EFI_ERROR_SECTION_PROCESSOR_SPECIFIC_IA32X64_GUID                      \
217 	{ 0xdc3ea0b0,                                                          \
218 	  0xa144,                                                              \
219 	  0x4797,                                                              \
220 	  { 0xb9, 0x5b, 0x53, 0xfa, 0x24, 0x2b, 0x6e, 0x1d } }
221 #define EFI_ERROR_SECTION_PROCESSOR_SPECIFIC_ARM_GUID                          \
222 	{ 0xe19e3d16,                                                          \
223 	  0xbc11,                                                              \
224 	  0x11e4,                                                              \
225 	  { 0x9c, 0xaa, 0xc2, 0x05, 0x1d, 0x5d, 0x46, 0xb0 } }
226 #define EFI_ERROR_SECTION_PLATFORM_MEMORY_GUID                                 \
227 	{ 0xa5bc1114,                                                          \
228 	  0x6f64,                                                              \
229 	  0x4ede,                                                              \
230 	  { 0xb8, 0x63, 0x3e, 0x83, 0xed, 0x7c, 0x83, 0xb1 } }
231 #define EFI_ERROR_SECTION_PLATFORM_MEMORY2_GUID                                \
232 	{ 0x61EC04FC,                                                          \
233 	  0x48E6,                                                              \
234 	  0xD813,                                                              \
235 	  { 0x25, 0xC9, 0x8D, 0xAA, 0x44, 0x75, 0x0B, 0x12 } }
236 #define EFI_ERROR_SECTION_PCIE_GUID                                            \
237 	{ 0xd995e954,                                                          \
238 	  0xbbc1,                                                              \
239 	  0x430f,                                                              \
240 	  { 0xad, 0x91, 0xb4, 0x4d, 0xcb, 0x3c, 0x6f, 0x35 } }
241 #define EFI_ERROR_SECTION_FW_ERROR_RECORD_GUID                                 \
242 	{ 0x81212a96,                                                          \
243 	  0x09ed,                                                              \
244 	  0x4996,                                                              \
245 	  { 0x94, 0x71, 0x8d, 0x72, 0x9c, 0x8e, 0x69, 0xed } }
246 #define EFI_ERROR_SECTION_PCI_PCIX_BUS_GUID                                    \
247 	{ 0xc5753963,                                                          \
248 	  0x3b84,                                                              \
249 	  0x4095,                                                              \
250 	  { 0xbf, 0x78, 0xed, 0xda, 0xd3, 0xf9, 0xc9, 0xdd } }
251 #define EFI_ERROR_SECTION_PCI_DEVICE_GUID                                      \
252 	{ 0xeb5e4685,                                                          \
253 	  0xca66,                                                              \
254 	  0x4769,                                                              \
255 	  { 0xb6, 0xa2, 0x26, 0x06, 0x8b, 0x00, 0x13, 0x26 } }
256 #define EFI_ERROR_SECTION_DMAR_GENERIC_GUID                                    \
257 	{ 0x5b51fef7,                                                          \
258 	  0xc79d,                                                              \
259 	  0x4434,                                                              \
260 	  { 0x8f, 0x1b, 0xaa, 0x62, 0xde, 0x3e, 0x2c, 0x64 } }
261 #define EFI_ERROR_SECTION_DIRECTED_IO_DMAR_GUID                                \
262 	{ 0x71761d37,                                                          \
263 	  0x32b2,                                                              \
264 	  0x45cd,                                                              \
265 	  { 0xa7, 0xd0, 0xb0, 0xfe, 0xdd, 0x93, 0xe8, 0xcf } }
266 #define EFI_ERROR_SECTION_IOMMU_DMAR_GUID                                      \
267 	{ 0x036f84e1,                                                          \
268 	  0x7f37,                                                              \
269 	  0x428c,                                                              \
270 	  { 0xa7, 0x9e, 0x57, 0x5f, 0xdf, 0xaa, 0x84, 0xec } }
271 #define EFI_ERROR_SECTION_AMPERE_SPECIFIC_GUID                                 \
272 	{ 0x2826cc9f,                                                          \
273 	  0x448c,                                                              \
274 	  0x4c2b,                                                              \
275 	  { 0x86, 0xb6, 0xa9, 0x53, 0x94, 0xb7, 0xef, 0x33 } }
276 ///@}
277 
278 ///
279 /// Error Section Descriptor
280 ///
281 typedef struct {
282 	UINT32 SectionOffset;
283 	UINT32 SectionLength;
284 	UINT16 Revision;
285 	UINT8 SecValidMask;
286 	UINT8 Resv1;
287 	UINT32 SectionFlags;
288 	EFI_GUID SectionType;
289 	EFI_GUID FruId;
290 	UINT32 Severity;
291 	CHAR8 FruString[20];
292 } EFI_ERROR_SECTION_DESCRIPTOR;
293 
294 ///
295 /// The validation bit mask indicates whether or not each of the following fields are
296 /// valid in Proessor Generic Error section.
297 ///@{
298 #define EFI_GENERIC_ERROR_PROC_TYPE_VALID	  BIT0
299 #define EFI_GENERIC_ERROR_PROC_ISA_VALID	  BIT1
300 #define EFI_GENERIC_ERROR_PROC_ERROR_TYPE_VALID	  BIT2
301 #define EFI_GENERIC_ERROR_PROC_OPERATION_VALID	  BIT3
302 #define EFI_GENERIC_ERROR_PROC_FLAGS_VALID	  BIT4
303 #define EFI_GENERIC_ERROR_PROC_LEVEL_VALID	  BIT5
304 #define EFI_GENERIC_ERROR_PROC_VERSION_VALID	  BIT6
305 #define EFI_GENERIC_ERROR_PROC_BRAND_VALID	  BIT7
306 #define EFI_GENERIC_ERROR_PROC_ID_VALID		  BIT8
307 #define EFI_GENERIC_ERROR_PROC_TARGET_ADDR_VALID  BIT9
308 #define EFI_GENERIC_ERROR_PROC_REQUESTER_ID_VALID BIT10
309 #define EFI_GENERIC_ERROR_PROC_RESPONDER_ID_VALID BIT11
310 #define EFI_GENERIC_ERROR_PROC_INST_IP_VALID	  BIT12
311 ///@}
312 
313 ///
314 /// The type of the processor architecture in Proessor Generic Error section.
315 ///@{
316 #define EFI_GENERIC_ERROR_PROC_TYPE_IA32_X64 0x00
317 #define EFI_GENERIC_ERROR_PROC_TYPE_IA64     0x01
318 #define EFI_GENERIC_ERROR_PROC_TYPE_ARM	     0x02
319 ///@}
320 
321 ///
322 /// The type of the instruction set executing when the error occurred in Proessor
323 /// Generic Error section.
324 ///@{
325 #define EFI_GENERIC_ERROR_PROC_ISA_IA32	       0x00
326 #define EFI_GENERIC_ERROR_PROC_ISA_IA64	       0x01
327 #define EFI_GENERIC_ERROR_PROC_ISA_X64	       0x02
328 #define EFI_GENERIC_ERROR_PROC_ISA_ARM_A32_T32 0x03
329 #define EFI_GENERIC_ERROR_PROC_ISA_ARM_A64     0x04
330 ///@}
331 
332 ///
333 /// The type of error that occurred in Proessor Generic Error section.
334 ///@{
335 #define EFI_GENERIC_ERROR_PROC_ERROR_TYPE_UNKNOWN    0x00
336 #define EFI_GENERIC_ERROR_PROC_ERROR_TYPE_CACHE	     0x01
337 #define EFI_GENERIC_ERROR_PROC_ERROR_TYPE_TLB	     0x02
338 #define EFI_GENERIC_ERROR_PROC_ERROR_TYPE_BUS	     0x04
339 #define EFI_GENERIC_ERROR_PROC_ERROR_TYPE_MICRO_ARCH 0x08
340 ///@}
341 
342 ///
343 /// The type of operation in Proessor Generic Error section.
344 ///@{
345 #define EFI_GENERIC_ERROR_PROC_OPERATION_GENERIC	  0x00
346 #define EFI_GENERIC_ERROR_PROC_OPERATION_DATA_READ	  0x01
347 #define EFI_GENERIC_ERROR_PROC_OPERATION_DATA_WRITE	  0x02
348 #define EFI_GENERIC_ERROR_PROC_OPERATION_INSTRUCTION_EXEC 0x03
349 ///@}
350 
351 ///
352 /// Flags bit mask indicates additional information about the error in Proessor Generic
353 /// Error section
354 ///@{
355 #define EFI_GENERIC_ERROR_PROC_FLAGS_RESTARTABLE BIT0
356 #define EFI_GENERIC_ERROR_PROC_FLAGS_PRECISE_IP	 BIT1
357 #define EFI_GENERIC_ERROR_PROC_FLAGS_OVERFLOW	 BIT2
358 #define EFI_GENERIC_ERROR_PROC_FLAGS_CORRECTED	 BIT3
359 ///@}
360 
361 ///
362 /// Processor Generic Error Section
363 /// describes processor reported hardware errors for logical processors in the system.
364 ///
365 typedef struct {
366 	UINT64 ValidFields;
367 	UINT8 Type;
368 	UINT8 Isa;
369 	UINT8 ErrorType;
370 	UINT8 Operation;
371 	UINT8 Flags;
372 	UINT8 Level;
373 	UINT16 Resv1;
374 	UINT64 VersionInfo;
375 	CHAR8 BrandString[128];
376 	UINT64 ApicId;
377 	UINT64 TargetAddr;
378 	UINT64 RequestorId;
379 	UINT64 ResponderId;
380 	UINT64 InstructionIP;
381 } EFI_PROCESSOR_GENERIC_ERROR_DATA;
382 
383 ///
384 /// IA32 and x64 Specific definitions.
385 ///
386 
387 ///
388 /// GUID value indicating the type of Processor Error Information structure
389 /// in IA32/X64 Processor Error Information Structure.
390 ///@{
391 #define EFI_IA32_X64_ERROR_TYPE_CACHE_CHECK_GUID                               \
392 	{ 0xA55701F5,                                                          \
393 	  0xE3EF,                                                              \
394 	  0x43de,                                                              \
395 	  { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C } }
396 #define EFI_IA32_X64_ERROR_TYPE_TLB_CHECK_GUID                                 \
397 	{ 0xFC06B535,                                                          \
398 	  0x5E1F,                                                              \
399 	  0x4562,                                                              \
400 	  { 0x9F, 0x25, 0x0A, 0x3B, 0x9A, 0xDB, 0x63, 0xC3 } }
401 #define EFI_IA32_X64_ERROR_TYPE_BUS_CHECK_GUID                                 \
402 	{ 0x1CF3F8B3,                                                          \
403 	  0xC5B1,                                                              \
404 	  0x49a2,                                                              \
405 	  { 0xAA, 0x59, 0x5E, 0xEF, 0x92, 0xFF, 0xA6, 0x3C } }
406 #define EFI_IA32_X64_ERROR_TYPE_MS_CHECK_GUID                                  \
407 	{ 0x48AB7F57,                                                          \
408 	  0xDC34,                                                              \
409 	  0x4f6c,                                                              \
410 	  { 0xA7, 0xD3, 0xB0, 0xB5, 0xB0, 0xA7, 0x43, 0x14 } }
411 extern EFI_GUID gEfiIa32x64ErrorTypeCacheCheckGuid;
412 extern EFI_GUID gEfiIa32x64ErrorTypeTlbCheckGuid;
413 extern EFI_GUID gEfiIa32x64ErrorTypeBusCheckGuid;
414 extern EFI_GUID gEfiIa32x64ErrorTypeMsCheckGuid;
415 
416 ///@}
417 
418 ///
419 /// The validation bit mask indicates which fields in the IA32/X64 Processor
420 /// Error Record structure are valid.
421 ///@{
422 #define EFI_IA32_X64_PROCESSOR_ERROR_APIC_ID_VALID     BIT0
423 #define EFI_IA32_X64_PROCESSOR_ERROR_CPU_ID_INFO_VALID BIT1
424 ///@}
425 
426 ///
427 /// IA32/X64 Processor Error Record
428 ///
429 typedef struct {
430 	UINT64 ValidFields;
431 	UINT64 ApicId;
432 	UINT8 CpuIdInfo[48];
433 } EFI_IA32_X64_PROCESSOR_ERROR_RECORD;
434 
435 ///
436 /// The validation bit mask indicates which fields in the Cache Check structure
437 /// are valid.
438 ///@{
439 #define EFI_CACHE_CHECK_TRANSACTION_TYPE_VALID BIT0
440 #define EFI_CACHE_CHECK_OPERATION_VALID	       BIT1
441 #define EFI_CACHE_CHECK_LEVEL_VALID	       BIT2
442 #define EFI_CACHE_CHECK_CONTEXT_CORRUPT_VALID  BIT3
443 #define EFI_CACHE_CHECK_UNCORRECTED_VALID      BIT4
444 #define EFI_CACHE_CHECK_PRECISE_IP_VALID       BIT5
445 #define EFI_CACHE_CHECK_RESTARTABLE_VALID      BIT6
446 #define EFI_CACHE_CHECK_OVERFLOW_VALID	       BIT7
447 ///@}
448 
449 ///
450 /// Type of cache error in the Cache Check structure
451 ///@{
452 #define EFI_CACHE_CHECK_ERROR_TYPE_INSTRUCTION 0
453 #define EFI_CACHE_CHECK_ERROR_TYPE_DATA_ACCESS 1
454 #define EFI_CACHE_CHECK_ERROR_TYPE_GENERIC     2
455 ///@}
456 
457 ///
458 /// Type of cache operation that caused the error in the Cache
459 /// Check structure
460 ///@{
461 #define EFI_CACHE_CHECK_OPERATION_TYPE_GENERIC		 0
462 #define EFI_CACHE_CHECK_OPERATION_TYPE_GENERIC_READ	 1
463 #define EFI_CACHE_CHECK_OPERATION_TYPE_GENERIC_WRITE	 2
464 #define EFI_CACHE_CHECK_OPERATION_TYPE_DATA_READ	 3
465 #define EFI_CACHE_CHECK_OPERATION_TYPE_DATA_WRITE	 4
466 #define EFI_CACHE_CHECK_OPERATION_TYPE_INSTRUCTION_FETCH 5
467 #define EFI_CACHE_CHECK_OPERATION_TYPE_PREFETCH		 6
468 #define EFI_CACHE_CHECK_OPERATION_TYPE_EVICTION		 7
469 #define EFI_CACHE_CHECK_OPERATION_TYPE_SNOOP		 8
470 ///@}
471 
472 ///
473 /// IA32/X64 Cache Check Structure
474 ///
475 typedef struct {
476 	UINT64 ValidFields : 16;
477 	UINT64 TransactionType : 2;
478 	UINT64 Operation : 4;
479 	UINT64 Level : 3;
480 	UINT64 ContextCorrupt : 1;
481 	UINT64 ErrorUncorrected : 1;
482 	UINT64 PreciseIp : 1;
483 	UINT64 RestartableIp : 1;
484 	UINT64 Overflow : 1;
485 	UINT64 Resv1 : 34;
486 } EFI_IA32_X64_CACHE_CHECK_INFO;
487 
488 ///
489 /// The validation bit mask indicates which fields in the TLB Check structure
490 /// are valid.
491 ///@{
492 #define EFI_TLB_CHECK_TRANSACTION_TYPE_VALID BIT0
493 #define EFI_TLB_CHECK_OPERATION_VALID	     BIT1
494 #define EFI_TLB_CHECK_LEVEL_VALID	     BIT2
495 #define EFI_TLB_CHECK_CONTEXT_CORRUPT_VALID  BIT3
496 #define EFI_TLB_CHECK_UNCORRECTED_VALID	     BIT4
497 #define EFI_TLB_CHECK_PRECISE_IP_VALID	     BIT5
498 #define EFI_TLB_CHECK_RESTARTABLE_VALID	     BIT6
499 #define EFI_TLB_CHECK_OVERFLOW_VALID	     BIT7
500 ///@}
501 
502 ///
503 /// Type of cache error in the TLB Check structure
504 ///@{
505 #define EFI_TLB_CHECK_ERROR_TYPE_INSTRUCTION 0
506 #define EFI_TLB_CHECK_ERROR_TYPE_DATA_ACCESS 1
507 #define EFI_TLB_CHECK_ERROR_TYPE_GENERIC     2
508 ///@}
509 
510 ///
511 /// Type of cache operation that caused the error in the TLB
512 /// Check structure
513 ///@{
514 #define EFI_TLB_CHECK_OPERATION_TYPE_GENERIC	   0
515 #define EFI_TLB_CHECK_OPERATION_TYPE_GENERIC_READ  1
516 #define EFI_TLB_CHECK_OPERATION_TYPE_GENERIC_WRITE 2
517 #define EFI_TLB_CHECK_OPERATION_TYPE_DATA_READ	   3
518 #define EFI_TLB_CHECK_OPERATION_TYPE_DATA_WRITE	   4
519 #define EFI_TLB_CHECK_OPERATION_TYPE_INST_FETCH	   5
520 #define EFI_TLB_CHECK_OPERATION_TYPE_PREFETCH	   6
521 ///@}
522 
523 ///
524 /// IA32/X64 TLB Check Structure
525 ///
526 typedef struct {
527 	UINT64 ValidFields : 16;
528 	UINT64 TransactionType : 2;
529 	UINT64 Operation : 4;
530 	UINT64 Level : 3;
531 	UINT64 ContextCorrupt : 1;
532 	UINT64 ErrorUncorrected : 1;
533 	UINT64 PreciseIp : 1;
534 	UINT64 RestartableIp : 1;
535 	UINT64 Overflow : 1;
536 	UINT64 Resv1 : 34;
537 } EFI_IA32_X64_TLB_CHECK_INFO;
538 
539 ///
540 /// The validation bit mask indicates which fields in the MS Check structure
541 /// are valid.
542 ///@{
543 #define EFI_BUS_CHECK_TRANSACTION_TYPE_VALID   BIT0
544 #define EFI_BUS_CHECK_OPERATION_VALID	       BIT1
545 #define EFI_BUS_CHECK_LEVEL_VALID	       BIT2
546 #define EFI_BUS_CHECK_CONTEXT_CORRUPT_VALID    BIT3
547 #define EFI_BUS_CHECK_UNCORRECTED_VALID	       BIT4
548 #define EFI_BUS_CHECK_PRECISE_IP_VALID	       BIT5
549 #define EFI_BUS_CHECK_RESTARTABLE_VALID	       BIT6
550 #define EFI_BUS_CHECK_OVERFLOW_VALID	       BIT7
551 #define EFI_BUS_CHECK_PARTICIPATION_TYPE_VALID BIT8
552 #define EFI_BUS_CHECK_TIME_OUT_VALID	       BIT9
553 #define EFI_BUS_CHECK_ADDRESS_SPACE_VALID      BIT10
554 ///@}
555 
556 ///
557 /// Type of cache error in the Bus Check structure
558 ///@{
559 #define EFI_BUS_CHECK_ERROR_TYPE_INSTRUCTION 0
560 #define EFI_BUS_CHECK_ERROR_TYPE_DATA_ACCESS 1
561 #define EFI_BUS_CHECK_ERROR_TYPE_GENERIC     2
562 ///@}
563 
564 ///
565 /// Type of cache operation that caused the error in the Bus
566 /// Check structure
567 ///@{
568 #define EFI_BUS_CHECK_OPERATION_TYPE_GENERIC	   0
569 #define EFI_BUS_CHECK_OPERATION_TYPE_GENERIC_READ  1
570 #define EFI_BUS_CHECK_OPERATION_TYPE_GENERIC_WRITE 2
571 #define EFI_BUS_CHECK_OPERATION_TYPE_DATA_READ	   3
572 #define EFI_BUS_CHECK_OPERATION_TYPE_DATA_WRITE	   4
573 #define EFI_BUS_CHECK_OPERATION_TYPE_INST_FETCH	   5
574 #define EFI_BUS_CHECK_OPERATION_TYPE_PREFETCH	   6
575 ///@}
576 
577 ///
578 /// Type of Participation
579 ///@{
580 #define EFI_BUS_CHECK_PARTICIPATION_TYPE_REQUEST   0
581 #define EFI_BUS_CHECK_PARTICIPATION_TYPE_RESPONDED 1
582 #define EFI_BUS_CHECK_PARTICIPATION_TYPE_OBSERVED  2
583 #define EFI_BUS_CHECK_PARTICIPATION_TYPE_GENERIC   3
584 ///@}
585 
586 ///
587 /// Type of Address Space
588 ///@{
589 #define EFI_BUS_CHECK_ADDRESS_SPACE_TYPE_MEMORY	  0
590 #define EFI_BUS_CHECK_ADDRESS_SPACE_TYPE_RESERVED 1
591 #define EFI_BUS_CHECK_ADDRESS_SPACE_TYPE_IO	  2
592 #define EFI_BUS_CHECK_ADDRESS_SPACE_TYPE_OTHER	  3
593 ///@}
594 
595 ///
596 /// IA32/X64 Bus Check Structure
597 ///
598 typedef struct {
599 	UINT64 ValidFields : 16;
600 	UINT64 TransactionType : 2;
601 	UINT64 Operation : 4;
602 	UINT64 Level : 3;
603 	UINT64 ContextCorrupt : 1;
604 	UINT64 ErrorUncorrected : 1;
605 	UINT64 PreciseIp : 1;
606 	UINT64 RestartableIp : 1;
607 	UINT64 Overflow : 1;
608 	UINT64 ParticipationType : 2;
609 	UINT64 TimeOut : 1;
610 	UINT64 AddressSpace : 2;
611 	UINT64 Resv1 : 29;
612 } EFI_IA32_X64_BUS_CHECK_INFO;
613 
614 ///
615 /// The validation bit mask indicates which fields in the MS Check structure
616 /// are valid.
617 ///@{
618 #define EFI_MS_CHECK_ERROR_TYPE_VALID	   BIT0
619 #define EFI_MS_CHECK_CONTEXT_CORRUPT_VALID BIT1
620 #define EFI_MS_CHECK_UNCORRECTED_VALID	   BIT2
621 #define EFI_MS_CHECK_PRECISE_IP_VALID	   BIT3
622 #define EFI_MS_CHECK_RESTARTABLE_VALID	   BIT4
623 #define EFI_MS_CHECK_OVERFLOW_VALID	   BIT5
624 ///@}
625 
626 ///
627 /// Error type identifies the operation that caused the error.
628 ///@{
629 #define EFI_MS_CHECK_ERROR_TYPE_NO		      0
630 #define EFI_MS_CHECK_ERROR_TYPE_UNCLASSIFIED	      1
631 #define EFI_MS_CHECK_ERROR_TYPE_MICROCODE_PARITY      2
632 #define EFI_MS_CHECK_ERROR_TYPE_EXTERNAL	      3
633 #define EFI_MS_CHECK_ERROR_TYPE_FRC		      4
634 #define EFI_MS_CHECK_ERROR_TYPE_INTERNAL_UNCLASSIFIED 5
635 ///@}
636 
637 ///
638 /// IA32/X64 MS Check Field Description
639 ///
640 typedef struct {
641 	UINT64 ValidFields : 16;
642 	UINT64 ErrorType : 3;
643 	UINT64 ContextCorrupt : 1;
644 	UINT64 ErrorUncorrected : 1;
645 	UINT64 PreciseIp : 1;
646 	UINT64 RestartableIp : 1;
647 	UINT64 Overflow : 1;
648 	UINT64 Resv1 : 40;
649 } EFI_IA32_X64_MS_CHECK_INFO;
650 
651 ///
652 /// IA32/X64 Check Information Item
653 ///
654 typedef union {
655 	EFI_IA32_X64_CACHE_CHECK_INFO CacheCheck;
656 	EFI_IA32_X64_TLB_CHECK_INFO TlbCheck;
657 	EFI_IA32_X64_BUS_CHECK_INFO BusCheck;
658 	EFI_IA32_X64_MS_CHECK_INFO MsCheck;
659 	UINT64 Data64;
660 } EFI_IA32_X64_CHECK_INFO_ITEM;
661 
662 ///
663 /// The validation bit mask indicates which fields in the IA32/X64 Processor Error
664 /// Information Structure are valid.
665 ///@{
666 #define EFI_IA32_X64_ERROR_PROC_CHECK_INFO_VALID   BIT0
667 #define EFI_IA32_X64_ERROR_PROC_TARGET_ADDR_VALID  BIT1
668 #define EFI_IA32_X64_ERROR_PROC_REQUESTER_ID_VALID BIT2
669 #define EFI_IA32_X64_ERROR_PROC_RESPONDER_ID_VALID BIT3
670 #define EFI_IA32_X64_ERROR_PROC_INST_IP_VALID	   BIT4
671 ///@}
672 
673 ///
674 /// IA32/X64 Processor Error Information Structure
675 ///
676 typedef struct {
677 	EFI_GUID ErrorType;
678 	UINT64 ValidFields;
679 	EFI_IA32_X64_CHECK_INFO_ITEM CheckInfo;
680 	UINT64 TargetId;
681 	UINT64 RequestorId;
682 	UINT64 ResponderId;
683 	UINT64 InstructionIP;
684 } EFI_IA32_X64_PROCESS_ERROR_INFO;
685 
686 ///
687 /// IA32/X64 Processor Context Information Structure
688 ///
689 typedef struct {
690 	UINT16 RegisterType;
691 	UINT16 ArraySize;
692 	UINT32 MsrAddress;
693 	UINT64 MmRegisterAddress;
694 	//
695 	// This field will provide the contents of the actual registers or raw data.
696 	// The number of Registers or size of the raw data reported is determined
697 	// by (Array Size / 8) or otherwise specified by the context structure type
698 	// definition.
699 	//
700 } EFI_IA32_X64_PROCESSOR_CONTEXT_INFO;
701 
702 ///
703 /// Register Context Type
704 ///@{
705 #define EFI_REG_CONTEXT_TYPE_UNCLASSIFIED 0x0000
706 #define EFI_REG_CONTEXT_TYPE_MSR	  0x0001
707 #define EFI_REG_CONTEXT_TYPE_IA32	  0x0002
708 #define EFI_REG_CONTEXT_TYPE_X64	  0x0003
709 #define EFI_REG_CONTEXT_TYPE_FXSAVE	  0x0004
710 #define EFI_REG_CONTEXT_TYPE_DR_IA32	  0x0005
711 #define EFI_REG_CONTEXT_TYPE_DR_X64	  0x0006
712 #define EFI_REG_CONTEXT_TYPE_MEM_MAP	  0x0007
713 ///@}
714 
715 ///
716 /// IA32 Register State
717 ///
718 typedef struct {
719 	UINT32 Eax;
720 	UINT32 Ebx;
721 	UINT32 Ecx;
722 	UINT32 Edx;
723 	UINT32 Esi;
724 	UINT32 Edi;
725 	UINT32 Ebp;
726 	UINT32 Esp;
727 	UINT16 Cs;
728 	UINT16 Ds;
729 	UINT16 Ss;
730 	UINT16 Es;
731 	UINT16 Fs;
732 	UINT16 Gs;
733 	UINT32 Eflags;
734 	UINT32 Eip;
735 	UINT32 Cr0;
736 	UINT32 Cr1;
737 	UINT32 Cr2;
738 	UINT32 Cr3;
739 	UINT32 Cr4;
740 	UINT32 Gdtr[2];
741 	UINT32 Idtr[2];
742 	UINT16 Ldtr;
743 	UINT16 Tr;
744 } EFI_CONTEXT_IA32_REGISTER_STATE;
745 
746 ///
747 /// X64 Register State
748 ///
749 typedef struct {
750 	UINT64 Rax;
751 	UINT64 Rbx;
752 	UINT64 Rcx;
753 	UINT64 Rdx;
754 	UINT64 Rsi;
755 	UINT64 Rdi;
756 	UINT64 Rbp;
757 	UINT64 Rsp;
758 	UINT64 R8;
759 	UINT64 R9;
760 	UINT64 R10;
761 	UINT64 R11;
762 	UINT64 R12;
763 	UINT64 R13;
764 	UINT64 R14;
765 	UINT64 R15;
766 	UINT16 Cs;
767 	UINT16 Ds;
768 	UINT16 Ss;
769 	UINT16 Es;
770 	UINT16 Fs;
771 	UINT16 Gs;
772 	UINT32 Resv1;
773 	UINT64 Rflags;
774 	UINT64 Rip;
775 	UINT64 Cr0;
776 	UINT64 Cr1;
777 	UINT64 Cr2;
778 	UINT64 Cr3;
779 	UINT64 Cr4;
780 	UINT64 Cr8;
781 	UINT64 Gdtr[2];
782 	UINT64 Idtr[2];
783 	UINT16 Ldtr;
784 	UINT16 Tr;
785 } EFI_CONTEXT_X64_REGISTER_STATE;
786 
787 ///
788 /// The validation bit mask indicates each of the following field is in IA32/X64
789 /// Processor Error Section.
790 ///
791 typedef struct {
792 	UINT64 ApicIdValid : 1;
793 	UINT64 CpuIdInforValid : 1;
794 	UINT64 ErrorInfoNum : 6;
795 	UINT64 ContextNum : 6;
796 	UINT64 Resv1 : 50;
797 } EFI_IA32_X64_VALID_BITS;
798 
799 ///
800 /// Error Status Fields
801 ///
802 typedef struct {
803 	UINT64 Resv1 : 8;
804 	UINT64 Type : 8;
805 	UINT64 AddressSignal : 1; ///< Error in Address signals or in Address portion of transaction
806 	UINT64 ControlSignal : 1; ///< Error in Control signals or in Control portion of transaction
807 	UINT64 DataSignal : 1; ///< Error in Data signals or in Data portion of transaction
808 	UINT64 DetectedByResponder : 1; ///< Error detected by responder
809 	UINT64 DetectedByRequester : 1; ///< Error detected by requestor
810 	UINT64 FirstError : 1; ///< First Error in the sequence - option field
811 	UINT64 OverflowNotLogged : 1; ///< Additional errors were not logged due to lack of resources
812 	UINT64 Resv2 : 41;
813 } EFI_GENERIC_ERROR_STATUS;
814 
815 ///
816 /// CPER Generic Error Codes
817 ///
818 #define CPER_GENERIC_ERROR_TYPES_KEYS                                          \
819 	(                                                                      \
820 		int[]){ 1,  16, 4,  5,	6,  7,	8,  9,	17,                    \
821 			18, 19, 20, 21, 22, 23, 24, 25, 26 }
822 #define CPER_GENERIC_ERROR_TYPES_VALUES                                        \
823 	(const char *[]){ "ERR_INTERNAL", "ERR_BUS",	 "ERR_MEM",            \
824 			  "ERR_TLB",	  "ERR_CACHE",	 "ERR_FUNCTION",       \
825 			  "ERR_SELFTEST", "ERR_FLOW",	 "ERR_MAP",            \
826 			  "ERR_IMPROPER", "ERR_UNIMPL",	 "ERR_LOL",            \
827 			  "ERR_RESPONSE", "ERR_PARITY",	 "ERR_PROTOCOL",       \
828 			  "ERR_ERROR",	  "ERR_TIMEOUT", "ERR_POISONED" }
829 #define CPER_GENERIC_ERROR_TYPES_DESCRIPTIONS                                       \
830 	(const char *[]){                                                           \
831 		"Error detected internal to the component.",                        \
832 		"Error detected in the bus.",                                       \
833 		"Storage error in memory (DRAM).",                                  \
834 		"Storage error in TLB.",                                            \
835 		"Storage error in cache.",                                          \
836 		"Error in one or more functional units.",                           \
837 		"Component failed self test.",                                      \
838 		"Overflow or underflow of internal queue.",                         \
839 		"Virtual address not found on IO-TLB or IO-PDIR.",                  \
840 		"Improper access error.",                                           \
841 		"Access to a memory address which is not mapped to any component.", \
842 		"Loss of Lockstep error.",                                          \
843 		"Response not associated with a request.",                          \
844 		"Bus parity error (must also set the A, C, or D bits).",            \
845 		"Detection of a protocol error.",                                   \
846 		"Detection of a PATH_ERROR.",                                       \
847 		"Bus operation timeout.",                                           \
848 		"A read was issued to data that has been poisoned."                 \
849 	}
850 
851 ///
852 /// Error Type
853 ///
854 typedef enum {
855 	///
856 	/// General Internal errors
857 	///
858 	ErrorInternal = 1,
859 	ErrorBus = 16,
860 	///
861 	/// Component Internal errors
862 	///
863 	ErrorMemStorage = 4, // Error in memory device
864 	ErrorTlbStorage = 5, // TLB error in cache
865 	ErrorCacheStorage = 6,
866 	ErrorFunctionalUnit = 7,
867 	ErrorSelftest = 8,
868 	ErrorOverflow = 9,
869 	///
870 	/// Bus internal errors
871 	///
872 	ErrorVirtualMap = 17,
873 	ErrorAccessInvalid = 18,   // Improper access
874 	ErrorUnimplAccess = 19,	   // Unimplemented memory access
875 	ErrorLossOfLockstep = 20,
876 	ErrorResponseInvalid = 21, // Response not associated with request
877 	ErrorParity = 22,
878 	ErrorProtocol = 23,
879 	ErrorPath = 24,	   // Detected path error
880 	ErrorTimeout = 25, // Bus timeout
881 	ErrorPoisoned = 26 // Read data poisoned
882 } EFI_GENERIC_ERROR_STATUS_ERROR_TYPE;
883 
884 ///
885 /// Validation bit mask indicates which fields in the memory error record are valid
886 /// in Memory Error section
887 ///@{
888 #define EFI_PLATFORM_MEMORY_ERROR_STATUS_VALID		       BIT0
889 #define EFI_PLATFORM_MEMORY_PHY_ADDRESS_VALID		       BIT1
890 #define EFI_PLATFORM_MEMORY_PHY_ADDRESS_MASK_VALID	       BIT2
891 #define EFI_PLATFORM_MEMORY_NODE_VALID			       BIT3
892 #define EFI_PLATFORM_MEMORY_CARD_VALID			       BIT4
893 #define EFI_PLATFORM_MEMORY_MODULE_VALID		       BIT5
894 #define EFI_PLATFORM_MEMORY_BANK_VALID			       BIT6
895 #define EFI_PLATFORM_MEMORY_DEVICE_VALID		       BIT7
896 #define EFI_PLATFORM_MEMORY_ROW_VALID			       BIT8
897 #define EFI_PLATFORM_MEMORY_COLUMN_VALID		       BIT9
898 #define EFI_PLATFORM_MEMORY_BIT_POS_VALID		       BIT10
899 #define EFI_PLATFORM_MEMORY_REQUESTOR_ID_VALID		       BIT11
900 #define EFI_PLATFORM_MEMORY_RESPONDER_ID_VALID		       BIT12
901 #define EFI_PLATFORM_MEMORY_TARGET_ID_VALID		       BIT13
902 #define EFI_PLATFORM_MEMORY_ERROR_TYPE_VALID		       BIT14
903 #define EFI_PLATFORM_MEMORY_ERROR_RANK_NUM_VALID	       BIT15
904 #define EFI_PLATFORM_MEMORY_ERROR_CARD_HANDLE_VALID	       BIT16
905 #define EFI_PLATFORM_MEMORY_ERROR_MODULE_HANDLE_VALID	       BIT17
906 #define EFI_PLATFORM_MEMORY_ERROR_EXTENDED_ROW_BIT_16_17_VALID BIT18
907 #define EFI_PLATFORM_MEMORY_ERROR_BANK_GROUP_VALID	       BIT19
908 #define EFI_PLATFORM_MEMORY_ERROR_BANK_ADDRESS_VALID	       BIT20
909 #define EFI_PLATFORM_MEMORY_ERROR_CHIP_IDENTIFICATION_VALID    BIT21
910 ///@}
911 
912 ///
913 /// Memory Error Type identifies the type of error that occurred in Memory
914 /// Error section
915 ///@{
916 #define EFI_PLATFORM_MEMORY_ERROR_UNKNOWN		 0x00
917 #define EFI_PLATFORM_MEMORY_ERROR_NONE			 0x01
918 #define EFI_PLATFORM_MEMORY_ERROR_SINGLEBIT_ECC		 0x02
919 #define EFI_PLATFORM_MEMORY_ERROR_MLTIBIT_ECC		 0x03
920 #define EFI_PLATFORM_MEMORY_ERROR_SINGLESYMBOLS_CHIPKILL 0x04
921 #define EFI_PLATFORM_MEMORY_ERROR_MULTISYMBOL_CHIPKILL	 0x05
922 #define EFI_PLATFORM_MEMORY_ERROR_MATER_ABORT		 0x06
923 #define EFI_PLATFORM_MEMORY_ERROR_TARGET_ABORT		 0x07
924 #define EFI_PLATFORM_MEMORY_ERROR_PARITY		 0x08
925 #define EFI_PLATFORM_MEMORY_ERROR_WDT			 0x09
926 #define EFI_PLATFORM_MEMORY_ERROR_INVALID_ADDRESS	 0x0A
927 #define EFI_PLATFORM_MEMORY_ERROR_MIRROR_FAILED		 0x0B
928 #define EFI_PLATFORM_MEMORY_ERROR_SPARING		 0x0C
929 #define EFI_PLATFORM_MEMORY_ERROR_SCRUB_CORRECTED	 0x0D
930 #define EFI_PLATFORM_MEMORY_ERROR_SCRUB_UNCORRECTED	 0x0E
931 #define EFI_PLATFORM_MEMORY_ERROR_MEMORY_MAP_EVENT	 0x0F
932 ///@}
933 
934 ///
935 /// Memory Error Section
936 ///
937 typedef struct {
938 	UINT64 ValidFields;
939 	EFI_GENERIC_ERROR_STATUS ErrorStatus;
940 	UINT64 PhysicalAddress;	    // Error physical address
941 	UINT64 PhysicalAddressMask; // Grnaularity
942 	UINT16 Node;		    // Node #
943 	UINT16 Card;
944 	UINT16 ModuleRank;	    // Module or Rank#
945 	UINT16 Bank;
946 	UINT16 Device;
947 	UINT16 Row;
948 	UINT16 Column;
949 	UINT16 BitPosition;
950 	UINT64 RequestorId;
951 	UINT64 ResponderId;
952 	UINT64 TargetId;
953 	UINT8 ErrorType;
954 	UINT8 Extended;
955 	UINT16 RankNum;
956 	UINT16 CardHandle;
957 	UINT16 ModuleHandle;
958 } EFI_PLATFORM_MEMORY_ERROR_DATA;
959 
960 ///
961 /// Validation bit mask indicates which fields in the memory error record 2 are valid
962 /// in Memory Error section 2
963 ///@{
964 #define EFI_PLATFORM_MEMORY2_ERROR_STATUS_VALID	     BIT0
965 #define EFI_PLATFORM_MEMORY2_PHY_ADDRESS_VALID	     BIT1
966 #define EFI_PLATFORM_MEMORY2_PHY_ADDRESS_MASK_VALID  BIT2
967 #define EFI_PLATFORM_MEMORY2_NODE_VALID		     BIT3
968 #define EFI_PLATFORM_MEMORY2_CARD_VALID		     BIT4
969 #define EFI_PLATFORM_MEMORY2_MODULE_VALID	     BIT5
970 #define EFI_PLATFORM_MEMORY2_BANK_VALID		     BIT6
971 #define EFI_PLATFORM_MEMORY2_DEVICE_VALID	     BIT7
972 #define EFI_PLATFORM_MEMORY2_ROW_VALID		     BIT8
973 #define EFI_PLATFORM_MEMORY2_COLUMN_VALID	     BIT9
974 #define EFI_PLATFORM_MEMORY2_RANK_VALID		     BIT10
975 #define EFI_PLATFORM_MEMORY2_BIT_POS_VALID	     BIT11
976 #define EFI_PLATFORM_MEMORY2_CHIP_ID_VALID	     BIT12
977 #define EFI_PLATFORM_MEMORY2_MEMORY_ERROR_TYPE_VALID BIT13
978 #define EFI_PLATFORM_MEMORY2_STATUS_VALID	     BIT14
979 #define EFI_PLATFORM_MEMORY2_REQUESTOR_ID_VALID	     BIT15
980 #define EFI_PLATFORM_MEMORY2_RESPONDER_ID_VALID	     BIT16
981 #define EFI_PLATFORM_MEMORY2_TARGET_ID_VALID	     BIT17
982 #define EFI_PLATFORM_MEMORY2_CARD_HANDLE_VALID	     BIT18
983 #define EFI_PLATFORM_MEMORY2_MODULE_HANDLE_VALID     BIT19
984 #define EFI_PLATFORM_MEMORY2_BANK_GROUP_VALID	     BIT20
985 #define EFI_PLATFORM_MEMORY2_BANK_ADDRESS_VALID	     BIT21
986 ///@}
987 
988 ///
989 /// Memory Error Type identifies the type of error that occurred in Memory
990 /// Error section 2
991 ///@{
992 #define EFI_PLATFORM_MEMORY2_ERROR_UNKNOWN		 0x00
993 #define EFI_PLATFORM_MEMORY2_ERROR_NONE			 0x01
994 #define EFI_PLATFORM_MEMORY2_ERROR_SINGLEBIT_ECC	 0x02
995 #define EFI_PLATFORM_MEMORY2_ERROR_MLTIBIT_ECC		 0x03
996 #define EFI_PLATFORM_MEMORY2_ERROR_SINGLESYMBOL_CHIPKILL 0x04
997 #define EFI_PLATFORM_MEMORY2_ERROR_MULTISYMBOL_CHIPKILL	 0x05
998 #define EFI_PLATFORM_MEMORY2_ERROR_MASTER_ABORT		 0x06
999 #define EFI_PLATFORM_MEMORY2_ERROR_TARGET_ABORT		 0x07
1000 #define EFI_PLATFORM_MEMORY2_ERROR_PARITY		 0x08
1001 #define EFI_PLATFORM_MEMORY2_ERROR_WDT			 0x09
1002 #define EFI_PLATFORM_MEMORY2_ERROR_INVALID_ADDRESS	 0x0A
1003 #define EFI_PLATFORM_MEMORY2_ERROR_MIRROR_BROKEN	 0x0B
1004 #define EFI_PLATFORM_MEMORY2_ERROR_MEMORY_SPARING	 0x0C
1005 #define EFI_PLATFORM_MEMORY2_ERROR_SCRUB_CORRECTED	 0x0D
1006 #define EFI_PLATFORM_MEMORY2_ERROR_SCRUB_UNCORRECTED	 0x0E
1007 #define EFI_PLATFORM_MEMORY2_ERROR_MEMORY_MAP_EVENT	 0x0F
1008 ///@}
1009 
1010 ///
1011 /// Memory Error Section 2
1012 ///
1013 typedef struct {
1014 	UINT64 ValidFields;
1015 	EFI_GENERIC_ERROR_STATUS ErrorStatus;
1016 	UINT64 PhysicalAddress;	    // Error physical address
1017 	UINT64 PhysicalAddressMask; // Grnaularity
1018 	UINT16 Node;		    // Node #
1019 	UINT16 Card;
1020 	UINT16 Module;		    // Module or Rank#
1021 	UINT16 Bank;
1022 	UINT32 Device;
1023 	UINT32 Row;
1024 	UINT32 Column;
1025 	UINT32 Rank;
1026 	UINT32 BitPosition;
1027 	UINT8 ChipId;
1028 	UINT8 MemErrorType;
1029 	UINT8 Status;
1030 	UINT8 Reserved;
1031 	UINT64 RequestorId;
1032 	UINT64 ResponderId;
1033 	UINT64 TargetId;
1034 	UINT32 CardHandle;
1035 	UINT32 ModuleHandle;
1036 } EFI_PLATFORM_MEMORY2_ERROR_DATA;
1037 
1038 ///
1039 /// Validation bits mask indicates which of the following fields is valid
1040 /// in PCI Express Error Record.
1041 ///@{
1042 #define EFI_PCIE_ERROR_PORT_TYPE_VALID	     BIT0
1043 #define EFI_PCIE_ERROR_VERSION_VALID	     BIT1
1044 #define EFI_PCIE_ERROR_COMMAND_STATUS_VALID  BIT2
1045 #define EFI_PCIE_ERROR_DEVICE_ID_VALID	     BIT3
1046 #define EFI_PCIE_ERROR_SERIAL_NO_VALID	     BIT4
1047 #define EFI_PCIE_ERROR_BRIDGE_CRL_STS_VALID  BIT5
1048 #define EFI_PCIE_ERROR_CAPABILITY_INFO_VALID BIT6
1049 #define EFI_PCIE_ERROR_AER_INFO_VALID	     BIT7
1050 ///@}
1051 
1052 ///
1053 /// PCIe Device/Port Type as defined in the PCI Express capabilities register
1054 ///@{
1055 #define EFI_PCIE_ERROR_PORT_PCIE_ENDPOINT	 0x00000000
1056 #define EFI_PCIE_ERROR_PORT_PCI_ENDPOINT	 0x00000001
1057 #define EFI_PCIE_ERROR_PORT_ROOT_PORT		 0x00000004
1058 #define EFI_PCIE_ERROR_PORT_UPSWITCH_PORT	 0x00000005
1059 #define EFI_PCIE_ERROR_PORT_DOWNSWITCH_PORT	 0x00000006
1060 #define EFI_PCIE_ERROR_PORT_PCIE_TO_PCI_BRIDGE	 0x00000007
1061 #define EFI_PCIE_ERROR_PORT_PCI_TO_PCIE_BRIDGE	 0x00000008
1062 #define EFI_PCIE_ERROR_PORT_ROOT_INT_ENDPOINT	 0x00000009
1063 #define EFI_PCIE_ERROR_PORT_ROOT_EVENT_COLLECTOR 0x0000000A
1064 ///@}
1065 
1066 ///
1067 /// PCI Slot number
1068 ///
1069 typedef struct {
1070 	UINT16 Resv1 : 3;
1071 	UINT16 Number : 13;
1072 } EFI_GENERIC_ERROR_PCI_SLOT;
1073 
1074 ///
1075 /// PCIe Root Port PCI/bridge PCI compatible device number and
1076 /// bus number information to uniquely identify the root port or
1077 /// bridge. Default values for both the bus numbers is zero.
1078 ///
1079 typedef struct {
1080 	UINT16 VendorId;
1081 	UINT16 DeviceId;
1082 	UINT8 ClassCode[3];
1083 	UINT8 Function;
1084 	UINT8 Device;
1085 	UINT16 Segment;
1086 	UINT8 PrimaryOrDeviceBus;
1087 	UINT8 SecondaryBus;
1088 	EFI_GENERIC_ERROR_PCI_SLOT Slot;
1089 	UINT8 Resv1;
1090 } EFI_GENERIC_ERROR_PCIE_DEV_BRIDGE_ID;
1091 
1092 ///
1093 /// PCIe Capability Structure
1094 ///
1095 typedef struct {
1096 	UINT8 PcieCap[60];
1097 } EFI_PCIE_ERROR_DATA_CAPABILITY;
1098 
1099 ///
1100 /// PCIe Advanced Error Reporting Extended Capability Structure.
1101 ///
1102 typedef struct {
1103 	UINT8 PcieAer[96];
1104 } EFI_PCIE_ERROR_DATA_AER;
1105 
1106 ///
1107 /// PCI Express Error Record
1108 ///
1109 typedef struct {
1110 	UINT64 ValidFields;
1111 	UINT32 PortType;
1112 	UINT32 Version;
1113 	UINT32 CommandStatus;
1114 	UINT32 Resv2;
1115 	EFI_GENERIC_ERROR_PCIE_DEV_BRIDGE_ID DevBridge;
1116 	UINT64 SerialNo;
1117 	UINT32 BridgeControlStatus;
1118 	EFI_PCIE_ERROR_DATA_CAPABILITY Capability;
1119 	EFI_PCIE_ERROR_DATA_AER AerInfo;
1120 } EFI_PCIE_ERROR_DATA;
1121 
1122 ///
1123 /// Validation bits Indicates which of the following fields is valid
1124 /// in PCI/PCI-X Bus Error Section.
1125 ///@{
1126 #define EFI_PCI_PCIX_BUS_ERROR_STATUS_VALID	  BIT0
1127 #define EFI_PCI_PCIX_BUS_ERROR_TYPE_VALID	  BIT1
1128 #define EFI_PCI_PCIX_BUS_ERROR_BUS_ID_VALID	  BIT2
1129 #define EFI_PCI_PCIX_BUS_ERROR_BUS_ADDRESS_VALID  BIT3
1130 #define EFI_PCI_PCIX_BUS_ERROR_BUS_DATA_VALID	  BIT4
1131 #define EFI_PCI_PCIX_BUS_ERROR_COMMAND_VALID	  BIT5
1132 #define EFI_PCI_PCIX_BUS_ERROR_REQUESTOR_ID_VALID BIT6
1133 #define EFI_PCI_PCIX_BUS_ERROR_COMPLETER_ID_VALID BIT7
1134 #define EFI_PCI_PCIX_BUS_ERROR_TARGET_ID_VALID	  BIT8
1135 ///@}
1136 
1137 ///
1138 /// PCI Bus Error Type in PCI/PCI-X Bus Error Section
1139 ///@{
1140 #define EFI_PCI_PCIX_BUS_ERROR_UNKNOWN		  0x0000
1141 #define EFI_PCI_PCIX_BUS_ERROR_DATA_PARITY	  0x0001
1142 #define EFI_PCI_PCIX_BUS_ERROR_SYSTEM		  0x0002
1143 #define EFI_PCI_PCIX_BUS_ERROR_MASTER_ABORT	  0x0003
1144 #define EFI_PCI_PCIX_BUS_ERROR_BUS_TIMEOUT	  0x0004
1145 #define EFI_PCI_PCIX_BUS_ERROR_MASTER_DATA_PARITY 0x0005
1146 #define EFI_PCI_PCIX_BUS_ERROR_ADDRESS_PARITY	  0x0006
1147 #define EFI_PCI_PCIX_BUS_ERROR_COMMAND_PARITY	  0x0007
1148 ///@}
1149 
1150 ///
1151 /// PCI/PCI-X Bus Error Section
1152 ///
1153 typedef struct {
1154 	UINT64 ValidFields;
1155 	EFI_GENERIC_ERROR_STATUS ErrorStatus;
1156 	UINT16 Type;
1157 	UINT16 BusId;
1158 	UINT32 Resv2;
1159 	UINT64 BusAddress;
1160 	UINT64 BusData;
1161 	UINT64 BusCommand;
1162 	UINT64 RequestorId;
1163 	UINT64 ResponderId;
1164 	UINT64 TargetId;
1165 } EFI_PCI_PCIX_BUS_ERROR_DATA;
1166 
1167 ///
1168 /// Validation bits Indicates which of the following fields is valid
1169 /// in PCI/PCI-X Component Error Section.
1170 ///@{
1171 #define EFI_PCI_PCIX_DEVICE_ERROR_STATUS_VALID	      BIT0
1172 #define EFI_PCI_PCIX_DEVICE_ERROR_ID_INFO_VALID	      BIT1
1173 #define EFI_PCI_PCIX_DEVICE_ERROR_MEM_NUM_VALID	      BIT2
1174 #define EFI_PCI_PCIX_DEVICE_ERROR_IO_NUM_VALID	      BIT3
1175 #define EFI_PCI_PCIX_DEVICE_ERROR_REG_DATA_PAIR_VALID BIT4
1176 ///@}
1177 
1178 ///
1179 /// PCI/PCI-X Device Identification Information
1180 ///
1181 typedef struct {
1182 	UINT16 VendorId;
1183 	UINT16 DeviceId;
1184 	UINT8 ClassCode[3];
1185 	UINT8 Function;
1186 	UINT8 Device;
1187 	UINT8 Bus;
1188 	UINT8 Segment;
1189 	UINT8 Resv1;
1190 	UINT32 Resv2;
1191 } EFI_GENERIC_ERROR_PCI_DEVICE_ID;
1192 
1193 ///
1194 /// Identifies the type of firmware error record
1195 ///@{
1196 #define EFI_FIRMWARE_ERROR_TYPE_IPF_SAL	  0x00
1197 #define EFI_FIRMWARE_ERROR_TYPE_SOC_TYPE1 0x01
1198 #define EFI_FIRMWARE_ERROR_TYPE_SOC_TYPE2 0x02
1199 ///@}
1200 
1201 ///
1202 /// Firmware Error Record Section
1203 ///
1204 typedef struct {
1205 	UINT8 ErrorType;
1206 	UINT8 Revision;
1207 	UINT8 Resv1[6];
1208 	UINT64 RecordId;
1209 	EFI_GUID RecordIdGuid;
1210 } EFI_FIRMWARE_ERROR_DATA;
1211 
1212 ///
1213 /// Fault Reason in DMAr Generic Error Section
1214 ///@{
1215 #define EFI_DMA_FAULT_REASON_TABLE_ENTRY_NOT_PRESENT	       0x01
1216 #define EFI_DMA_FAULT_REASON_TABLE_ENTRY_INVALID	       0x02
1217 #define EFI_DMA_FAULT_REASON_ACCESS_MAPPING_TABLE_ERROR	       0x03
1218 #define EFI_DMA_FAULT_REASON_RESV_BIT_ERROR_IN_MAPPING_TABLE   0x04
1219 #define EFI_DMA_FAULT_REASON_ACCESS_ADDR_OUT_OF_SPACE	       0x05
1220 #define EFI_DMA_FAULT_REASON_INVALID_ACCESS		       0x06
1221 #define EFI_DMA_FAULT_REASON_INVALID_REQUEST		       0x07
1222 #define EFI_DMA_FAULT_REASON_ACCESS_TRANSLATE_TABLE_ERROR      0x08
1223 #define EFI_DMA_FAULT_REASON_RESV_BIT_ERROR_IN_TRANSLATE_TABLE 0x09
1224 #define EFI_DMA_FAULT_REASON_INVALID_COMMAOND		       0x0A
1225 #define EFI_DMA_FAULT_REASON_ACCESS_COMMAND_BUFFER_ERROR       0x0B
1226 ///@}
1227 
1228 ///
1229 /// DMA access type in DMAr Generic Error Section
1230 ///@{
1231 #define EFI_DMA_ACCESS_TYPE_READ  0x00
1232 #define EFI_DMA_ACCESS_TYPE_WRITE 0x01
1233 ///@}
1234 
1235 ///
1236 /// DMA address type in DMAr Generic Error Section
1237 ///@{
1238 #define EFI_DMA_ADDRESS_UNTRANSLATED 0x00
1239 #define EFI_DMA_ADDRESS_TRANSLATION  0x01
1240 ///@}
1241 
1242 ///
1243 /// Architecture type in DMAr Generic Error Section
1244 ///@{
1245 #define EFI_DMA_ARCH_TYPE_VT	0x01
1246 #define EFI_DMA_ARCH_TYPE_IOMMU 0x02
1247 ///@}
1248 
1249 ///
1250 /// DMAr Generic Error Section
1251 ///
1252 typedef struct {
1253 	UINT16 RequesterId;
1254 	UINT16 SegmentNumber;
1255 	UINT8 FaultReason;
1256 	UINT8 AccessType;
1257 	UINT8 AddressType;
1258 	UINT8 ArchType;
1259 	UINT64 DeviceAddr;
1260 	UINT8 Resv1[16];
1261 } EFI_DMAR_GENERIC_ERROR_DATA;
1262 
1263 ///
1264 /// Intel VT for Directed I/O specific DMAr Errors
1265 ///
1266 typedef struct {
1267 	UINT8 Version;
1268 	UINT8 Revision;
1269 	UINT8 OemId[6];
1270 	UINT64 Capability;
1271 	UINT64 CapabilityEx;
1272 	UINT32 GlobalCommand;
1273 	UINT32 GlobalStatus;
1274 	UINT32 FaultStatus;
1275 	UINT8 Resv1[12];
1276 	UINT64 FaultRecord[2];
1277 	UINT64 RootEntry[2];
1278 	UINT64 ContextEntry[2];
1279 	UINT64 PteL6;
1280 	UINT64 PteL5;
1281 	UINT64 PteL4;
1282 	UINT64 PteL3;
1283 	UINT64 PteL2;
1284 	UINT64 PteL1;
1285 } EFI_DIRECTED_IO_DMAR_ERROR_DATA;
1286 
1287 ///
1288 /// IOMMU specific DMAr Errors
1289 ///
1290 typedef struct {
1291 	UINT8 Revision;
1292 	UINT8 Resv1[7];
1293 	UINT64 Control;
1294 	UINT64 Status;
1295 	UINT8 Resv2[8];
1296 	UINT64 EventLogEntry[2];
1297 	UINT8 Resv3[16];
1298 	UINT64 DeviceTableEntry[4];
1299 	UINT64 PteL6;
1300 	UINT64 PteL5;
1301 	UINT64 PteL4;
1302 	UINT64 PteL3;
1303 	UINT64 PteL2;
1304 	UINT64 PteL1;
1305 } EFI_IOMMU_DMAR_ERROR_DATA;
1306 
1307 extern EFI_GUID gEfiEventNotificationTypeCmcGuid;
1308 extern EFI_GUID gEfiEventNotificationTypeCpeGuid;
1309 extern EFI_GUID gEfiEventNotificationTypeMceGuid;
1310 extern EFI_GUID gEfiEventNotificationTypePcieGuid;
1311 extern EFI_GUID gEfiEventNotificationTypeInitGuid;
1312 extern EFI_GUID gEfiEventNotificationTypeNmiGuid;
1313 extern EFI_GUID gEfiEventNotificationTypeBootGuid;
1314 extern EFI_GUID gEfiEventNotificationTypeDmarGuid;
1315 extern EFI_GUID gEfiEventNotificationTypeSeaGuid;
1316 extern EFI_GUID gEfiEventNotificationTypeSeiGuid;
1317 extern EFI_GUID gEfiEventNotificationTypePeiGuid;
1318 extern EFI_GUID gEfiEventNotificationTypeCxlGuid;
1319 extern EFI_GUID gEfiProcessorGenericErrorSectionGuid;
1320 extern EFI_GUID gEfiProcessorSpecificErrorSectionGuid;
1321 extern EFI_GUID gEfiIa32X64ProcessorErrorSectionGuid;
1322 extern EFI_GUID gEfiIpfProcessorErrorSectionGuid;
1323 extern EFI_GUID gEfiArmProcessorErrorSectionGuid;
1324 extern EFI_GUID gEfiPlatformMemoryErrorSectionGuid;
1325 extern EFI_GUID gEfiPlatformMemoryError2SectionGuid;
1326 extern EFI_GUID gEfiPcieErrorSectionGuid;
1327 extern EFI_GUID gEfiFirmwareErrorSectionGuid;
1328 extern EFI_GUID gEfiPciBusErrorSectionGuid;
1329 extern EFI_GUID gEfiPciDevErrorSectionGuid;
1330 extern EFI_GUID gEfiDMArGenericErrorSectionGuid;
1331 extern EFI_GUID gEfiDirectedIoDMArErrorSectionGuid;
1332 extern EFI_GUID gEfiIommuDMArErrorSectionGuid;
1333 extern EFI_GUID gEfiCcixPerLogErrorSectionGuid;
1334 extern EFI_GUID gEfiCxlProtocolErrorSectionGuid;
1335 extern EFI_GUID gEfiCxlGeneralMediaErrorSectionGuid;
1336 extern EFI_GUID gEfiCxlDramEventErrorSectionGuid;
1337 extern EFI_GUID gEfiCxlMemoryModuleErrorSectionGuid;
1338 extern EFI_GUID gEfiCxlPhysicalSwitchErrorSectionGuid;
1339 extern EFI_GUID gEfiCxlVirtualSwitchErrorSectionGuid;
1340 extern EFI_GUID gEfiCxlMldPortErrorSectionGuid;
1341 
1342 #if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
1343 ///
1344 /// IA32 and x64 Specific definitions.
1345 ///
1346 
1347 extern EFI_GUID gEfiIa32X64ErrorTypeCacheCheckGuid;
1348 extern EFI_GUID gEfiIa32X64ErrorTypeTlbCheckGuid;
1349 extern EFI_GUID gEfiIa32X64ErrorTypeBusCheckGuid;
1350 extern EFI_GUID gEfiIa32X64ErrorTypeMsCheckGuid;
1351 
1352 #endif
1353 
1354 ///
1355 /// NVIDIA Error Record Section
1356 ///
1357 typedef struct {
1358 	UINT32 ErrorCount;
1359 	UINT32 ChannelEnabled : 1;
1360 	UINT32 ChannelIsSpare : 1;
1361 	UINT32 ChannelPermanentlyDisabled : 1;
1362 	UINT32 DisabledReason : 2;
1363 	UINT32 Reserved : 27;
1364 } EFI_NVIDIA_CMET_CHANNEL_INFO;
1365 
1366 typedef struct {
1367 	CHAR8 initiating_firmware[8];
1368 	UINT64 task_checkpoint;
1369 	UINT64 mb1_error_code;
1370 	CHAR8 mb1_version_string[8];
1371 	UINT64 bad_pages_retired_mask;
1372 	UINT64 training_or_alias_check_retired_mask;
1373 	UINT32 worst_bad_pages_channel_number;
1374 	UINT32 worst_bad_pages_bad_page_count;
1375 	UINT32 second_worst_bad_pages_channel_number;
1376 	UINT32 second_worst_bad_pages_bad_page_count;
1377 	UINT32 third_worst_bad_pages_channel_number;
1378 	UINT32 third_worst_bad_pages_bad_page_count;
1379 	UINT64 mss_aon_cfg_scratch_register_0;
1380 	UINT64 scratch_dram_disable;
1381 } EFI_NVIDIA_FWERROR;
1382 
1383 typedef struct {
1384 	UINT64 Address;
1385 	union {
1386 		UINT64 Value;
1387 		EFI_NVIDIA_CMET_CHANNEL_INFO CmetInfo;
1388 	};
1389 } EFI_NVIDIA_REGISTER_DATA;
1390 
1391 typedef struct {
1392 	CHAR8 Signature[16];
1393 	UINT16 ErrorType;
1394 	UINT16 ErrorInstance;
1395 	UINT8 Severity;
1396 	UINT8 Socket;
1397 	UINT8 NumberRegs;
1398 	UINT8 Reserved;
1399 	UINT64 InstanceBase;
1400 	// Keep this at the end of this struct
1401 	// and allocate based on NumberRegs
1402 #ifndef __cplusplus
1403 	EFI_NVIDIA_REGISTER_DATA Register[] LIBCPER_CC_COUNTED_BY(NumberRegs);
1404 #endif
1405 } EFI_NVIDIA_ERROR_DATA;
1406 
1407 extern EFI_GUID gEfiNvidiaErrorSectionGuid;
1408 
1409 ///
1410 /// Ampere Error Record Section
1411 ///
1412 typedef struct {
1413 	UINT16 TypeId;
1414 	UINT16 SubtypeId;
1415 	UINT32 InstanceId;
1416 } __attribute__((packed)) EFI_AMPERE_ERROR_DATA;
1417 
1418 extern EFI_GUID gEfiAmpereErrorSectionGuid;
1419 
1420 ///
1421 /// Arm Error Record Section
1422 ///
1423 typedef struct {
1424 	UINT32 ValidFields;
1425 	UINT16 ErrInfoNum;
1426 	UINT16 ContextInfoNum;
1427 	UINT32 SectionLength;
1428 	UINT32 ErrorAffinityLevel;
1429 	UINT64 MPIDR_EL1;
1430 	UINT64 MIDR_EL1;
1431 	UINT32 RunningState;
1432 	UINT32 PsciState;
1433 } __attribute__((packed, aligned(1))) EFI_ARM_ERROR_RECORD;
1434 
1435 ///
1436 /// ARM Processor Error Information Structure
1437 ///
1438 #define ARM_ERROR_INFORMATION_TYPE_CACHE     0
1439 #define ARM_ERROR_INFORMATION_TYPE_TLB	     1
1440 #define ARM_ERROR_INFORMATION_TYPE_BUS	     2
1441 #define ARM_ERROR_INFORMATION_TYPE_MICROARCH 3
1442 
1443 typedef struct {
1444 	UINT64 ValidationBits : 16;
1445 	UINT64 TransactionType : 2;
1446 	UINT64 Operation : 4;
1447 	UINT64 Level : 3;
1448 	UINT64 ProcessorContextCorrupt : 1;
1449 	UINT64 Corrected : 1;
1450 	UINT64 PrecisePC : 1;
1451 	UINT64 RestartablePC : 1;
1452 	UINT64 Reserved : 34;
1453 } EFI_ARM_CACHE_ERROR_STRUCTURE;
1454 
1455 typedef struct {
1456 	UINT64 ValidationBits : 16;
1457 	UINT64 TransactionType : 2;
1458 	UINT64 Operation : 4;
1459 	UINT64 Level : 3;
1460 	UINT64 ProcessorContextCorrupt : 1;
1461 	UINT64 Corrected : 1;
1462 	UINT64 PrecisePC : 1;
1463 	UINT64 RestartablePC : 1;
1464 	UINT64 Reserved : 34;
1465 } EFI_ARM_TLB_ERROR_STRUCTURE;
1466 
1467 typedef struct {
1468 	UINT64 ValidationBits : 16;
1469 	UINT64 TransactionType : 2;
1470 	UINT64 Operation : 4;
1471 	UINT64 Level : 3;
1472 	UINT64 ProcessorContextCorrupt : 1;
1473 	UINT64 Corrected : 1;
1474 	UINT64 PrecisePC : 1;
1475 	UINT64 RestartablePC : 1;
1476 	UINT64 ParticipationType : 2;
1477 	UINT64 TimeOut : 1;
1478 	UINT64 AddressSpace : 2;
1479 	UINT64 MemoryAddressAttributes : 9;
1480 	UINT64 AccessMode : 1;
1481 	UINT64 Reserved : 20;
1482 } EFI_ARM_BUS_ERROR_STRUCTURE;
1483 
1484 typedef union {
1485 	UINT64 Value;
1486 	EFI_ARM_CACHE_ERROR_STRUCTURE CacheError;
1487 	EFI_ARM_TLB_ERROR_STRUCTURE TlbError;
1488 	EFI_ARM_BUS_ERROR_STRUCTURE BusError;
1489 } EFI_ARM_ERROR_INFORMATION_STRUCTURE;
1490 
1491 typedef struct {
1492 	UINT8 Version;
1493 	UINT8 Length;
1494 	UINT16 ValidationBits;
1495 	UINT8 Type;
1496 	UINT16 MultipleError;
1497 	UINT8 Flags;
1498 	EFI_ARM_ERROR_INFORMATION_STRUCTURE ErrorInformation;
1499 	UINT64 VirtualFaultAddress;
1500 	UINT64 PhysicalFaultAddress;
1501 } __attribute__((packed, aligned(1))) EFI_ARM_ERROR_INFORMATION_ENTRY;
1502 
1503 ///
1504 /// ARM Processor Context Information Structure
1505 ///
1506 typedef struct {
1507 	UINT16 Version;
1508 	UINT16 RegisterContextType;
1509 	UINT32 RegisterArraySize;
1510 } __attribute__((packed, aligned(1))) EFI_ARM_CONTEXT_INFORMATION_HEADER;
1511 
1512 ///
1513 /// ARM Processor Context Register Types
1514 ///
1515 #define EFI_ARM_CONTEXT_TYPE_AARCH32_GPR    0
1516 #define EFI_ARM_CONTEXT_TYPE_AARCH32_EL1    1
1517 #define EFI_ARM_CONTEXT_TYPE_AARCH32_EL2    2
1518 #define EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE 3
1519 #define EFI_ARM_CONTEXT_TYPE_AARCH64_GPR    4
1520 #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL1    5
1521 #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL2    6
1522 #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL3    7
1523 #define EFI_ARM_CONTEXT_TYPE_MISC	    8
1524 
1525 typedef struct {
1526 	UINT32 R0;
1527 	UINT32 R1;
1528 	UINT32 R2;
1529 	UINT32 R3;
1530 	UINT32 R4;
1531 	UINT32 R5;
1532 	UINT32 R6;
1533 	UINT32 R7;
1534 	UINT32 R8;
1535 	UINT32 R9;
1536 	UINT32 R10;
1537 	UINT32 R11;
1538 	UINT32 R12;
1539 	UINT32 R13_sp;
1540 	UINT32 R14_lr;
1541 	UINT32 R15_pc;
1542 } EFI_ARM_V8_AARCH32_GPR;
1543 
1544 typedef struct {
1545 	UINT32 Dfar;
1546 	UINT32 Dfsr;
1547 	UINT32 Ifar;
1548 	UINT32 Isr;
1549 	UINT32 Mair0;
1550 	UINT32 Mair1;
1551 	UINT32 Midr;
1552 	UINT32 Mpidr;
1553 	UINT32 Nmrr;
1554 	UINT32 Prrr;
1555 	UINT32 Sctlr_Ns;
1556 	UINT32 Spsr;
1557 	UINT32 Spsr_Abt;
1558 	UINT32 Spsr_Fiq;
1559 	UINT32 Spsr_Irq;
1560 	UINT32 Spsr_Svc;
1561 	UINT32 Spsr_Und;
1562 	UINT32 Tpidrprw;
1563 	UINT32 Tpidruro;
1564 	UINT32 Tpidrurw;
1565 	UINT32 Ttbcr;
1566 	UINT32 Ttbr0;
1567 	UINT32 Ttbr1;
1568 	UINT32 Dacr;
1569 } EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS;
1570 
1571 typedef struct {
1572 	UINT32 Elr_Hyp;
1573 	UINT32 Hamair0;
1574 	UINT32 Hamair1;
1575 	UINT32 Hcr;
1576 	UINT32 Hcr2;
1577 	UINT32 Hdfar;
1578 	UINT32 Hifar;
1579 	UINT32 Hpfar;
1580 	UINT32 Hsr;
1581 	UINT32 Htcr;
1582 	UINT32 Htpidr;
1583 	UINT32 Httbr;
1584 	UINT32 Spsr_Hyp;
1585 	UINT32 Vtcr;
1586 	UINT32 Vttbr;
1587 	UINT32 Dacr32_El2;
1588 } EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS;
1589 
1590 typedef struct {
1591 	UINT32 Sctlr_S;
1592 	UINT32 Spsr_Mon;
1593 } EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS;
1594 
1595 typedef struct {
1596 	UINT64 X0;
1597 	UINT64 X1;
1598 	UINT64 X2;
1599 	UINT64 X3;
1600 	UINT64 X4;
1601 	UINT64 X5;
1602 	UINT64 X6;
1603 	UINT64 X7;
1604 	UINT64 X8;
1605 	UINT64 X9;
1606 	UINT64 X10;
1607 	UINT64 X11;
1608 	UINT64 X12;
1609 	UINT64 X13;
1610 	UINT64 X14;
1611 	UINT64 X15;
1612 	UINT64 X16;
1613 	UINT64 X17;
1614 	UINT64 X18;
1615 	UINT64 X19;
1616 	UINT64 X20;
1617 	UINT64 X21;
1618 	UINT64 X22;
1619 	UINT64 X23;
1620 	UINT64 X24;
1621 	UINT64 X25;
1622 	UINT64 X26;
1623 	UINT64 X27;
1624 	UINT64 X28;
1625 	UINT64 X29;
1626 	UINT64 X30;
1627 	UINT64 Sp;
1628 } EFI_ARM_V8_AARCH64_GPR;
1629 
1630 typedef struct {
1631 	UINT64 Elr_El1;
1632 	UINT64 Esr_El1;
1633 	UINT64 Far_El1;
1634 	UINT64 Isr_El1;
1635 	UINT64 Mair_El1;
1636 	UINT64 Midr_El1;
1637 	UINT64 Mpidr_El1;
1638 	UINT64 Sctlr_El1;
1639 	UINT64 Sp_El0;
1640 	UINT64 Sp_El1;
1641 	UINT64 Spsr_El1;
1642 	UINT64 Tcr_El1;
1643 	UINT64 Tpidr_El0;
1644 	UINT64 Tpidr_El1;
1645 	UINT64 Tpidrro_El0;
1646 	UINT64 Ttbr0_El1;
1647 	UINT64 Ttbr1_El1;
1648 } EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS;
1649 
1650 typedef struct {
1651 	UINT64 Elr_El2;
1652 	UINT64 Esr_El2;
1653 	UINT64 Far_El2;
1654 	UINT64 Hacr_El2;
1655 	UINT64 Hcr_El2;
1656 	UINT64 Hpfar_El2;
1657 	UINT64 Mair_El2;
1658 	UINT64 Sctlr_El2;
1659 	UINT64 Sp_El2;
1660 	UINT64 Spsr_El2;
1661 	UINT64 Tcr_El2;
1662 	UINT64 Tpidr_El2;
1663 	UINT64 Ttbr0_El2;
1664 	UINT64 Vtcr_El2;
1665 	UINT64 Vttbr_El2;
1666 } EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS;
1667 
1668 typedef struct {
1669 	UINT64 Elr_El3;
1670 	UINT64 Esr_El3;
1671 	UINT64 Far_El3;
1672 	UINT64 Mair_El3;
1673 	UINT64 Sctlr_El3;
1674 	UINT64 Sp_El3;
1675 	UINT64 Spsr_El3;
1676 	UINT64 Tcr_El3;
1677 	UINT64 Tpidr_El3;
1678 	UINT64 Ttbr0_El3;
1679 } EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS;
1680 
1681 typedef struct {
1682 	UINT64 MrsOp2 : 3;
1683 	UINT64 MrsCrm : 4;
1684 	UINT64 MrsCrn : 4;
1685 	UINT64 MrsOp1 : 3;
1686 	UINT64 MrsO0 : 2;
1687 	UINT64 Value : 64;
1688 } EFI_ARM_MISC_CONTEXT_REGISTER;
1689 #pragma pack(pop)
1690 
1691 #ifdef __cplusplus
1692 }
1693 #endif
1694 
1695 #endif
1696