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