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