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