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