1 /** @file
2   ACPI 6.1 definitions from the ACPI Specification Revision 6.1 January, 2016.
3 
4   Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>
5  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6   Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 **/
9 
10 #ifndef _ACPI_6_1_H_
11 #define _ACPI_6_1_H_
12 
13 #include <IndustryStandard/Acpi60.h>
14 
15 //
16 // Ensure proper structure formats
17 //
18 #pragma pack(1)
19 
20 ///
21 /// ACPI 6.1 Generic Address Space definition
22 ///
23 typedef struct {
24   UINT8     AddressSpaceId;
25   UINT8     RegisterBitWidth;
26   UINT8     RegisterBitOffset;
27   UINT8     AccessSize;
28   UINT64    Address;
29 } EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE;
30 
31 //
32 // Generic Address Space Address IDs
33 //
34 #define EFI_ACPI_6_1_SYSTEM_MEMORY                   0
35 #define EFI_ACPI_6_1_SYSTEM_IO                       1
36 #define EFI_ACPI_6_1_PCI_CONFIGURATION_SPACE         2
37 #define EFI_ACPI_6_1_EMBEDDED_CONTROLLER             3
38 #define EFI_ACPI_6_1_SMBUS                           4
39 #define EFI_ACPI_6_1_PLATFORM_COMMUNICATION_CHANNEL  0x0A
40 #define EFI_ACPI_6_1_FUNCTIONAL_FIXED_HARDWARE       0x7F
41 
42 //
43 // Generic Address Space Access Sizes
44 //
45 #define EFI_ACPI_6_1_UNDEFINED  0
46 #define EFI_ACPI_6_1_BYTE       1
47 #define EFI_ACPI_6_1_WORD       2
48 #define EFI_ACPI_6_1_DWORD      3
49 #define EFI_ACPI_6_1_QWORD      4
50 
51 //
52 // ACPI 6.1 table structures
53 //
54 
55 ///
56 /// Root System Description Pointer Structure
57 ///
58 typedef struct {
59   UINT64    Signature;
60   UINT8     Checksum;
61   UINT8     OemId[6];
62   UINT8     Revision;
63   UINT32    RsdtAddress;
64   UINT32    Length;
65   UINT64    XsdtAddress;
66   UINT8     ExtendedChecksum;
67   UINT8     Reserved[3];
68 } EFI_ACPI_6_1_ROOT_SYSTEM_DESCRIPTION_POINTER;
69 
70 ///
71 /// RSD_PTR Revision (as defined in ACPI 6.1 spec.)
72 ///
73 #define EFI_ACPI_6_1_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION  0x02 ///< ACPISpec (Revision 6.1) says current value is 2
74 
75 ///
76 /// Common table header, this prefaces all ACPI tables, including FACS, but
77 /// excluding the RSD PTR structure
78 ///
79 typedef struct {
80   UINT32    Signature;
81   UINT32    Length;
82 } EFI_ACPI_6_1_COMMON_HEADER;
83 
84 //
85 // Root System Description Table
86 // No definition needed as it is a common description table header, the same with
87 // EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT32 table pointers.
88 //
89 
90 ///
91 /// RSDT Revision (as defined in ACPI 6.1 spec.)
92 ///
93 #define EFI_ACPI_6_1_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION  0x01
94 
95 //
96 // Extended System Description Table
97 // No definition needed as it is a common description table header, the same with
98 // EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT64 table pointers.
99 //
100 
101 ///
102 /// XSDT Revision (as defined in ACPI 6.1 spec.)
103 ///
104 #define EFI_ACPI_6_1_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION  0x01
105 
106 ///
107 /// Fixed ACPI Description Table Structure (FADT)
108 ///
109 typedef struct {
110   EFI_ACPI_DESCRIPTION_HEADER               Header;
111   UINT32                                    FirmwareCtrl;
112   UINT32                                    Dsdt;
113   UINT8                                     Reserved0;
114   UINT8                                     PreferredPmProfile;
115   UINT16                                    SciInt;
116   UINT32                                    SmiCmd;
117   UINT8                                     AcpiEnable;
118   UINT8                                     AcpiDisable;
119   UINT8                                     S4BiosReq;
120   UINT8                                     PstateCnt;
121   UINT32                                    Pm1aEvtBlk;
122   UINT32                                    Pm1bEvtBlk;
123   UINT32                                    Pm1aCntBlk;
124   UINT32                                    Pm1bCntBlk;
125   UINT32                                    Pm2CntBlk;
126   UINT32                                    PmTmrBlk;
127   UINT32                                    Gpe0Blk;
128   UINT32                                    Gpe1Blk;
129   UINT8                                     Pm1EvtLen;
130   UINT8                                     Pm1CntLen;
131   UINT8                                     Pm2CntLen;
132   UINT8                                     PmTmrLen;
133   UINT8                                     Gpe0BlkLen;
134   UINT8                                     Gpe1BlkLen;
135   UINT8                                     Gpe1Base;
136   UINT8                                     CstCnt;
137   UINT16                                    PLvl2Lat;
138   UINT16                                    PLvl3Lat;
139   UINT16                                    FlushSize;
140   UINT16                                    FlushStride;
141   UINT8                                     DutyOffset;
142   UINT8                                     DutyWidth;
143   UINT8                                     DayAlrm;
144   UINT8                                     MonAlrm;
145   UINT8                                     Century;
146   UINT16                                    IaPcBootArch;
147   UINT8                                     Reserved1;
148   UINT32                                    Flags;
149   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    ResetReg;
150   UINT8                                     ResetValue;
151   UINT16                                    ArmBootArch;
152   UINT8                                     MinorVersion;
153   UINT64                                    XFirmwareCtrl;
154   UINT64                                    XDsdt;
155   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XPm1aEvtBlk;
156   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XPm1bEvtBlk;
157   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XPm1aCntBlk;
158   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XPm1bCntBlk;
159   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XPm2CntBlk;
160   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XPmTmrBlk;
161   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XGpe0Blk;
162   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    XGpe1Blk;
163   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    SleepControlReg;
164   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    SleepStatusReg;
165   UINT64                                    HypervisorVendorIdentity;
166 } EFI_ACPI_6_1_FIXED_ACPI_DESCRIPTION_TABLE;
167 
168 ///
169 /// FADT Version (as defined in ACPI 6.1 spec.)
170 ///
171 #define EFI_ACPI_6_1_FIXED_ACPI_DESCRIPTION_TABLE_REVISION        0x06
172 #define EFI_ACPI_6_1_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION  0x01
173 
174 //
175 // Fixed ACPI Description Table Preferred Power Management Profile
176 //
177 #define EFI_ACPI_6_1_PM_PROFILE_UNSPECIFIED         0
178 #define EFI_ACPI_6_1_PM_PROFILE_DESKTOP             1
179 #define EFI_ACPI_6_1_PM_PROFILE_MOBILE              2
180 #define EFI_ACPI_6_1_PM_PROFILE_WORKSTATION         3
181 #define EFI_ACPI_6_1_PM_PROFILE_ENTERPRISE_SERVER   4
182 #define EFI_ACPI_6_1_PM_PROFILE_SOHO_SERVER         5
183 #define EFI_ACPI_6_1_PM_PROFILE_APPLIANCE_PC        6
184 #define EFI_ACPI_6_1_PM_PROFILE_PERFORMANCE_SERVER  7
185 #define EFI_ACPI_6_1_PM_PROFILE_TABLET              8
186 
187 //
188 // Fixed ACPI Description Table Boot Architecture Flags
189 // All other bits are reserved and must be set to 0.
190 //
191 #define EFI_ACPI_6_1_LEGACY_DEVICES        BIT0
192 #define EFI_ACPI_6_1_8042                  BIT1
193 #define EFI_ACPI_6_1_VGA_NOT_PRESENT       BIT2
194 #define EFI_ACPI_6_1_MSI_NOT_SUPPORTED     BIT3
195 #define EFI_ACPI_6_1_PCIE_ASPM_CONTROLS    BIT4
196 #define EFI_ACPI_6_1_CMOS_RTC_NOT_PRESENT  BIT5
197 
198 //
199 // Fixed ACPI Description Table Arm Boot Architecture Flags
200 // All other bits are reserved and must be set to 0.
201 //
202 #define EFI_ACPI_6_1_ARM_PSCI_COMPLIANT  BIT0
203 #define EFI_ACPI_6_1_ARM_PSCI_USE_HVC    BIT1
204 
205 //
206 // Fixed ACPI Description Table Fixed Feature Flags
207 // All other bits are reserved and must be set to 0.
208 //
209 #define EFI_ACPI_6_1_WBINVD                                BIT0
210 #define EFI_ACPI_6_1_WBINVD_FLUSH                          BIT1
211 #define EFI_ACPI_6_1_PROC_C1                               BIT2
212 #define EFI_ACPI_6_1_P_LVL2_UP                             BIT3
213 #define EFI_ACPI_6_1_PWR_BUTTON                            BIT4
214 #define EFI_ACPI_6_1_SLP_BUTTON                            BIT5
215 #define EFI_ACPI_6_1_FIX_RTC                               BIT6
216 #define EFI_ACPI_6_1_RTC_S4                                BIT7
217 #define EFI_ACPI_6_1_TMR_VAL_EXT                           BIT8
218 #define EFI_ACPI_6_1_DCK_CAP                               BIT9
219 #define EFI_ACPI_6_1_RESET_REG_SUP                         BIT10
220 #define EFI_ACPI_6_1_SEALED_CASE                           BIT11
221 #define EFI_ACPI_6_1_HEADLESS                              BIT12
222 #define EFI_ACPI_6_1_CPU_SW_SLP                            BIT13
223 #define EFI_ACPI_6_1_PCI_EXP_WAK                           BIT14
224 #define EFI_ACPI_6_1_USE_PLATFORM_CLOCK                    BIT15
225 #define EFI_ACPI_6_1_S4_RTC_STS_VALID                      BIT16
226 #define EFI_ACPI_6_1_REMOTE_POWER_ON_CAPABLE               BIT17
227 #define EFI_ACPI_6_1_FORCE_APIC_CLUSTER_MODEL              BIT18
228 #define EFI_ACPI_6_1_FORCE_APIC_PHYSICAL_DESTINATION_MODE  BIT19
229 #define EFI_ACPI_6_1_HW_REDUCED_ACPI                       BIT20
230 #define EFI_ACPI_6_1_LOW_POWER_S0_IDLE_CAPABLE             BIT21
231 
232 ///
233 /// Firmware ACPI Control Structure
234 ///
235 typedef struct {
236   UINT32    Signature;
237   UINT32    Length;
238   UINT32    HardwareSignature;
239   UINT32    FirmwareWakingVector;
240   UINT32    GlobalLock;
241   UINT32    Flags;
242   UINT64    XFirmwareWakingVector;
243   UINT8     Version;
244   UINT8     Reserved0[3];
245   UINT32    OspmFlags;
246   UINT8     Reserved1[24];
247 } EFI_ACPI_6_1_FIRMWARE_ACPI_CONTROL_STRUCTURE;
248 
249 ///
250 /// FACS Version (as defined in ACPI 6.1 spec.)
251 ///
252 #define EFI_ACPI_6_1_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION  0x02
253 
254 ///
255 /// Firmware Control Structure Feature Flags
256 /// All other bits are reserved and must be set to 0.
257 ///
258 #define EFI_ACPI_6_1_S4BIOS_F                BIT0
259 #define EFI_ACPI_6_1_64BIT_WAKE_SUPPORTED_F  BIT1
260 
261 ///
262 /// OSPM Enabled Firmware Control Structure Flags
263 /// All other bits are reserved and must be set to 0.
264 ///
265 #define EFI_ACPI_6_1_OSPM_64BIT_WAKE_F  BIT0
266 
267 //
268 // Differentiated System Description Table,
269 // Secondary System Description Table
270 // and Persistent System Description Table,
271 // no definition needed as they are common description table header, the same with
272 // EFI_ACPI_DESCRIPTION_HEADER, followed by a definition block.
273 //
274 #define EFI_ACPI_6_1_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION  0x02
275 #define EFI_ACPI_6_1_SECONDARY_SYSTEM_DESCRIPTION_TABLE_REVISION       0x02
276 
277 ///
278 /// Multiple APIC Description Table header definition.  The rest of the table
279 /// must be defined in a platform specific manner.
280 ///
281 typedef struct {
282   EFI_ACPI_DESCRIPTION_HEADER    Header;
283   UINT32                         LocalApicAddress;
284   UINT32                         Flags;
285 } EFI_ACPI_6_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
286 
287 ///
288 /// MADT Revision (as defined in ACPI 6.1 spec.)
289 ///
290 #define EFI_ACPI_6_1_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION  0x04
291 
292 ///
293 /// Multiple APIC Flags
294 /// All other bits are reserved and must be set to 0.
295 ///
296 #define EFI_ACPI_6_1_PCAT_COMPAT  BIT0
297 
298 //
299 // Multiple APIC Description Table APIC structure types
300 // All other values between 0x0D and 0x7F are reserved and
301 // will be ignored by OSPM. 0x80 ~ 0xFF are reserved for OEM.
302 //
303 #define EFI_ACPI_6_1_PROCESSOR_LOCAL_APIC           0x00
304 #define EFI_ACPI_6_1_IO_APIC                        0x01
305 #define EFI_ACPI_6_1_INTERRUPT_SOURCE_OVERRIDE      0x02
306 #define EFI_ACPI_6_1_NON_MASKABLE_INTERRUPT_SOURCE  0x03
307 #define EFI_ACPI_6_1_LOCAL_APIC_NMI                 0x04
308 #define EFI_ACPI_6_1_LOCAL_APIC_ADDRESS_OVERRIDE    0x05
309 #define EFI_ACPI_6_1_IO_SAPIC                       0x06
310 #define EFI_ACPI_6_1_LOCAL_SAPIC                    0x07
311 #define EFI_ACPI_6_1_PLATFORM_INTERRUPT_SOURCES     0x08
312 #define EFI_ACPI_6_1_PROCESSOR_LOCAL_X2APIC         0x09
313 #define EFI_ACPI_6_1_LOCAL_X2APIC_NMI               0x0A
314 #define EFI_ACPI_6_1_GIC                            0x0B
315 #define EFI_ACPI_6_1_GICD                           0x0C
316 #define EFI_ACPI_6_1_GIC_MSI_FRAME                  0x0D
317 #define EFI_ACPI_6_1_GICR                           0x0E
318 #define EFI_ACPI_6_1_GIC_ITS                        0x0F
319 
320 //
321 // APIC Structure Definitions
322 //
323 
324 ///
325 /// Processor Local APIC Structure Definition
326 ///
327 typedef struct {
328   UINT8     Type;
329   UINT8     Length;
330   UINT8     AcpiProcessorUid;
331   UINT8     ApicId;
332   UINT32    Flags;
333 } EFI_ACPI_6_1_PROCESSOR_LOCAL_APIC_STRUCTURE;
334 
335 ///
336 /// Local APIC Flags.  All other bits are reserved and must be 0.
337 ///
338 #define EFI_ACPI_6_1_LOCAL_APIC_ENABLED  BIT0
339 
340 ///
341 /// IO APIC Structure
342 ///
343 typedef struct {
344   UINT8     Type;
345   UINT8     Length;
346   UINT8     IoApicId;
347   UINT8     Reserved;
348   UINT32    IoApicAddress;
349   UINT32    GlobalSystemInterruptBase;
350 } EFI_ACPI_6_1_IO_APIC_STRUCTURE;
351 
352 ///
353 /// Interrupt Source Override Structure
354 ///
355 typedef struct {
356   UINT8     Type;
357   UINT8     Length;
358   UINT8     Bus;
359   UINT8     Source;
360   UINT32    GlobalSystemInterrupt;
361   UINT16    Flags;
362 } EFI_ACPI_6_1_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
363 
364 ///
365 /// Platform Interrupt Sources Structure Definition
366 ///
367 typedef struct {
368   UINT8     Type;
369   UINT8     Length;
370   UINT16    Flags;
371   UINT8     InterruptType;
372   UINT8     ProcessorId;
373   UINT8     ProcessorEid;
374   UINT8     IoSapicVector;
375   UINT32    GlobalSystemInterrupt;
376   UINT32    PlatformInterruptSourceFlags;
377   UINT8     CpeiProcessorOverride;
378   UINT8     Reserved[31];
379 } EFI_ACPI_6_1_PLATFORM_INTERRUPT_APIC_STRUCTURE;
380 
381 //
382 // MPS INTI flags.
383 // All other bits are reserved and must be set to 0.
384 //
385 #define EFI_ACPI_6_1_POLARITY      (3 << 0)
386 #define EFI_ACPI_6_1_TRIGGER_MODE  (3 << 2)
387 
388 ///
389 /// Non-Maskable Interrupt Source Structure
390 ///
391 typedef struct {
392   UINT8     Type;
393   UINT8     Length;
394   UINT16    Flags;
395   UINT32    GlobalSystemInterrupt;
396 } EFI_ACPI_6_1_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
397 
398 ///
399 /// Local APIC NMI Structure
400 ///
401 typedef struct {
402   UINT8     Type;
403   UINT8     Length;
404   UINT8     AcpiProcessorUid;
405   UINT16    Flags;
406   UINT8     LocalApicLint;
407 } EFI_ACPI_6_1_LOCAL_APIC_NMI_STRUCTURE;
408 
409 ///
410 /// Local APIC Address Override Structure
411 ///
412 typedef struct {
413   UINT8     Type;
414   UINT8     Length;
415   UINT16    Reserved;
416   UINT64    LocalApicAddress;
417 } EFI_ACPI_6_1_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
418 
419 ///
420 /// IO SAPIC Structure
421 ///
422 typedef struct {
423   UINT8     Type;
424   UINT8     Length;
425   UINT8     IoApicId;
426   UINT8     Reserved;
427   UINT32    GlobalSystemInterruptBase;
428   UINT64    IoSapicAddress;
429 } EFI_ACPI_6_1_IO_SAPIC_STRUCTURE;
430 
431 ///
432 /// Local SAPIC Structure
433 /// This struct followed by a null-terminated ASCII string - ACPI Processor UID String
434 ///
435 typedef struct {
436   UINT8     Type;
437   UINT8     Length;
438   UINT8     AcpiProcessorId;
439   UINT8     LocalSapicId;
440   UINT8     LocalSapicEid;
441   UINT8     Reserved[3];
442   UINT32    Flags;
443   UINT32    ACPIProcessorUIDValue;
444 } EFI_ACPI_6_1_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
445 
446 ///
447 /// Platform Interrupt Sources Structure
448 ///
449 typedef struct {
450   UINT8     Type;
451   UINT8     Length;
452   UINT16    Flags;
453   UINT8     InterruptType;
454   UINT8     ProcessorId;
455   UINT8     ProcessorEid;
456   UINT8     IoSapicVector;
457   UINT32    GlobalSystemInterrupt;
458   UINT32    PlatformInterruptSourceFlags;
459 } EFI_ACPI_6_1_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
460 
461 ///
462 /// Platform Interrupt Source Flags.
463 /// All other bits are reserved and must be set to 0.
464 ///
465 #define EFI_ACPI_6_1_CPEI_PROCESSOR_OVERRIDE  BIT0
466 
467 ///
468 /// Processor Local x2APIC Structure Definition
469 ///
470 typedef struct {
471   UINT8     Type;
472   UINT8     Length;
473   UINT8     Reserved[2];
474   UINT32    X2ApicId;
475   UINT32    Flags;
476   UINT32    AcpiProcessorUid;
477 } EFI_ACPI_6_1_PROCESSOR_LOCAL_X2APIC_STRUCTURE;
478 
479 ///
480 /// Local x2APIC NMI Structure
481 ///
482 typedef struct {
483   UINT8     Type;
484   UINT8     Length;
485   UINT16    Flags;
486   UINT32    AcpiProcessorUid;
487   UINT8     LocalX2ApicLint;
488   UINT8     Reserved[3];
489 } EFI_ACPI_6_1_LOCAL_X2APIC_NMI_STRUCTURE;
490 
491 ///
492 /// GIC Structure
493 ///
494 typedef struct {
495   UINT8     Type;
496   UINT8     Length;
497   UINT16    Reserved;
498   UINT32    CPUInterfaceNumber;
499   UINT32    AcpiProcessorUid;
500   UINT32    Flags;
501   UINT32    ParkingProtocolVersion;
502   UINT32    PerformanceInterruptGsiv;
503   UINT64    ParkedAddress;
504   UINT64    PhysicalBaseAddress;
505   UINT64    GICV;
506   UINT64    GICH;
507   UINT32    VGICMaintenanceInterrupt;
508   UINT64    GICRBaseAddress;
509   UINT64    MPIDR;
510   UINT8     ProcessorPowerEfficiencyClass;
511   UINT8     Reserved2[3];
512 } EFI_ACPI_6_1_GIC_STRUCTURE;
513 
514 ///
515 /// GIC Flags.  All other bits are reserved and must be 0.
516 ///
517 #define EFI_ACPI_6_1_GIC_ENABLED                            BIT0
518 #define EFI_ACPI_6_1_PERFORMANCE_INTERRUPT_MODEL            BIT1
519 #define EFI_ACPI_6_1_VGIC_MAINTENANCE_INTERRUPT_MODE_FLAGS  BIT2
520 
521 ///
522 /// GIC Distributor Structure
523 ///
524 typedef struct {
525   UINT8     Type;
526   UINT8     Length;
527   UINT16    Reserved1;
528   UINT32    GicId;
529   UINT64    PhysicalBaseAddress;
530   UINT32    SystemVectorBase;
531   UINT8     GicVersion;
532   UINT8     Reserved2[3];
533 } EFI_ACPI_6_1_GIC_DISTRIBUTOR_STRUCTURE;
534 
535 ///
536 /// GIC Version
537 ///
538 #define EFI_ACPI_6_1_GIC_V1  0x01
539 #define EFI_ACPI_6_1_GIC_V2  0x02
540 #define EFI_ACPI_6_1_GIC_V3  0x03
541 #define EFI_ACPI_6_1_GIC_V4  0x04
542 
543 ///
544 /// GIC MSI Frame Structure
545 ///
546 typedef struct {
547   UINT8     Type;
548   UINT8     Length;
549   UINT16    Reserved1;
550   UINT32    GicMsiFrameId;
551   UINT64    PhysicalBaseAddress;
552   UINT32    Flags;
553   UINT16    SPICount;
554   UINT16    SPIBase;
555 } EFI_ACPI_6_1_GIC_MSI_FRAME_STRUCTURE;
556 
557 ///
558 /// GIC MSI Frame Flags.  All other bits are reserved and must be 0.
559 ///
560 #define EFI_ACPI_6_1_SPI_COUNT_BASE_SELECT  BIT0
561 
562 ///
563 /// GICR Structure
564 ///
565 typedef struct {
566   UINT8     Type;
567   UINT8     Length;
568   UINT16    Reserved;
569   UINT64    DiscoveryRangeBaseAddress;
570   UINT32    DiscoveryRangeLength;
571 } EFI_ACPI_6_1_GICR_STRUCTURE;
572 
573 ///
574 /// GIC Interrupt Translation Service Structure
575 ///
576 typedef struct {
577   UINT8     Type;
578   UINT8     Length;
579   UINT16    Reserved;
580   UINT32    GicItsId;
581   UINT64    PhysicalBaseAddress;
582   UINT32    Reserved2;
583 } EFI_ACPI_6_1_GIC_ITS_STRUCTURE;
584 
585 ///
586 /// Smart Battery Description Table (SBST)
587 ///
588 typedef struct {
589   EFI_ACPI_DESCRIPTION_HEADER    Header;
590   UINT32                         WarningEnergyLevel;
591   UINT32                         LowEnergyLevel;
592   UINT32                         CriticalEnergyLevel;
593 } EFI_ACPI_6_1_SMART_BATTERY_DESCRIPTION_TABLE;
594 
595 ///
596 /// SBST Version (as defined in ACPI 6.1 spec.)
597 ///
598 #define EFI_ACPI_6_1_SMART_BATTERY_DESCRIPTION_TABLE_REVISION  0x01
599 
600 ///
601 /// Embedded Controller Boot Resources Table (ECDT)
602 /// The table is followed by a null terminated ASCII string that contains
603 /// a fully qualified reference to the name space object.
604 ///
605 typedef struct {
606   EFI_ACPI_DESCRIPTION_HEADER               Header;
607   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    EcControl;
608   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    EcData;
609   UINT32                                    Uid;
610   UINT8                                     GpeBit;
611 } EFI_ACPI_6_1_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
612 
613 ///
614 /// ECDT Version (as defined in ACPI 6.1 spec.)
615 ///
616 #define EFI_ACPI_6_1_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION  0x01
617 
618 ///
619 /// System Resource Affinity Table (SRAT).  The rest of the table
620 /// must be defined in a platform specific manner.
621 ///
622 typedef struct {
623   EFI_ACPI_DESCRIPTION_HEADER    Header;
624   UINT32                         Reserved1; ///< Must be set to 1
625   UINT64                         Reserved2;
626 } EFI_ACPI_6_1_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER;
627 
628 ///
629 /// SRAT Version (as defined in ACPI 6.1 spec.)
630 ///
631 #define EFI_ACPI_6_1_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION  0x03
632 
633 //
634 // SRAT structure types.
635 // All other values between 0x04 an 0xFF are reserved and
636 // will be ignored by OSPM.
637 //
638 #define EFI_ACPI_6_1_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY  0x00
639 #define EFI_ACPI_6_1_MEMORY_AFFINITY                      0x01
640 #define EFI_ACPI_6_1_PROCESSOR_LOCAL_X2APIC_AFFINITY      0x02
641 #define EFI_ACPI_6_1_GICC_AFFINITY                        0x03
642 
643 ///
644 /// Processor Local APIC/SAPIC Affinity Structure Definition
645 ///
646 typedef struct {
647   UINT8     Type;
648   UINT8     Length;
649   UINT8     ProximityDomain7To0;
650   UINT8     ApicId;
651   UINT32    Flags;
652   UINT8     LocalSapicEid;
653   UINT8     ProximityDomain31To8[3];
654   UINT32    ClockDomain;
655 } EFI_ACPI_6_1_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE;
656 
657 ///
658 /// Local APIC/SAPIC Flags.  All other bits are reserved and must be 0.
659 ///
660 #define EFI_ACPI_6_1_PROCESSOR_LOCAL_APIC_SAPIC_ENABLED  (1 << 0)
661 
662 ///
663 /// Memory Affinity Structure Definition
664 ///
665 typedef struct {
666   UINT8     Type;
667   UINT8     Length;
668   UINT32    ProximityDomain;
669   UINT16    Reserved1;
670   UINT32    AddressBaseLow;
671   UINT32    AddressBaseHigh;
672   UINT32    LengthLow;
673   UINT32    LengthHigh;
674   UINT32    Reserved2;
675   UINT32    Flags;
676   UINT64    Reserved3;
677 } EFI_ACPI_6_1_MEMORY_AFFINITY_STRUCTURE;
678 
679 //
680 // Memory Flags.  All other bits are reserved and must be 0.
681 //
682 #define EFI_ACPI_6_1_MEMORY_ENABLED        (1 << 0)
683 #define EFI_ACPI_6_1_MEMORY_HOT_PLUGGABLE  (1 << 1)
684 #define EFI_ACPI_6_1_MEMORY_NONVOLATILE    (1 << 2)
685 
686 ///
687 /// Processor Local x2APIC Affinity Structure Definition
688 ///
689 typedef struct {
690   UINT8     Type;
691   UINT8     Length;
692   UINT8     Reserved1[2];
693   UINT32    ProximityDomain;
694   UINT32    X2ApicId;
695   UINT32    Flags;
696   UINT32    ClockDomain;
697   UINT8     Reserved2[4];
698 } EFI_ACPI_6_1_PROCESSOR_LOCAL_X2APIC_AFFINITY_STRUCTURE;
699 
700 ///
701 /// GICC Affinity Structure Definition
702 ///
703 typedef struct {
704   UINT8     Type;
705   UINT8     Length;
706   UINT32    ProximityDomain;
707   UINT32    AcpiProcessorUid;
708   UINT32    Flags;
709   UINT32    ClockDomain;
710 } EFI_ACPI_6_1_GICC_AFFINITY_STRUCTURE;
711 
712 ///
713 /// GICC Flags.  All other bits are reserved and must be 0.
714 ///
715 #define EFI_ACPI_6_1_GICC_ENABLED  (1 << 0)
716 
717 ///
718 /// System Locality Distance Information Table (SLIT).
719 /// The rest of the table is a matrix.
720 ///
721 typedef struct {
722   EFI_ACPI_DESCRIPTION_HEADER    Header;
723   UINT64                         NumberOfSystemLocalities;
724 } EFI_ACPI_6_1_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER;
725 
726 ///
727 /// SLIT Version (as defined in ACPI 6.1 spec.)
728 ///
729 #define EFI_ACPI_6_1_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_REVISION  0x01
730 
731 ///
732 /// Corrected Platform Error Polling Table (CPEP)
733 ///
734 typedef struct {
735   EFI_ACPI_DESCRIPTION_HEADER    Header;
736   UINT8                          Reserved[8];
737 } EFI_ACPI_6_1_CORRECTED_PLATFORM_ERROR_POLLING_TABLE_HEADER;
738 
739 ///
740 /// CPEP Version (as defined in ACPI 6.1 spec.)
741 ///
742 #define EFI_ACPI_6_1_CORRECTED_PLATFORM_ERROR_POLLING_TABLE_REVISION  0x01
743 
744 //
745 // CPEP processor structure types.
746 //
747 #define EFI_ACPI_6_1_CPEP_PROCESSOR_APIC_SAPIC  0x00
748 
749 ///
750 /// Corrected Platform Error Polling Processor Structure Definition
751 ///
752 typedef struct {
753   UINT8     Type;
754   UINT8     Length;
755   UINT8     ProcessorId;
756   UINT8     ProcessorEid;
757   UINT32    PollingInterval;
758 } EFI_ACPI_6_1_CPEP_PROCESSOR_APIC_SAPIC_STRUCTURE;
759 
760 ///
761 /// Maximum System Characteristics Table (MSCT)
762 ///
763 typedef struct {
764   EFI_ACPI_DESCRIPTION_HEADER    Header;
765   UINT32                         OffsetProxDomInfo;
766   UINT32                         MaximumNumberOfProximityDomains;
767   UINT32                         MaximumNumberOfClockDomains;
768   UINT64                         MaximumPhysicalAddress;
769 } EFI_ACPI_6_1_MAXIMUM_SYSTEM_CHARACTERISTICS_TABLE_HEADER;
770 
771 ///
772 /// MSCT Version (as defined in ACPI 6.1 spec.)
773 ///
774 #define EFI_ACPI_6_1_MAXIMUM_SYSTEM_CHARACTERISTICS_TABLE_REVISION  0x01
775 
776 ///
777 /// Maximum Proximity Domain Information Structure Definition
778 ///
779 typedef struct {
780   UINT8     Revision;
781   UINT8     Length;
782   UINT32    ProximityDomainRangeLow;
783   UINT32    ProximityDomainRangeHigh;
784   UINT32    MaximumProcessorCapacity;
785   UINT64    MaximumMemoryCapacity;
786 } EFI_ACPI_6_1_MAXIMUM_PROXIMITY_DOMAIN_INFORMATION_STRUCTURE;
787 
788 ///
789 /// ACPI RAS Feature Table definition.
790 ///
791 typedef struct {
792   EFI_ACPI_DESCRIPTION_HEADER    Header;
793   UINT8                          PlatformCommunicationChannelIdentifier[12];
794 } EFI_ACPI_6_1_RAS_FEATURE_TABLE;
795 
796 ///
797 /// RASF Version (as defined in ACPI 6.1 spec.)
798 ///
799 #define EFI_ACPI_6_1_RAS_FEATURE_TABLE_REVISION  0x01
800 
801 ///
802 /// ACPI RASF Platform Communication Channel Shared Memory Region definition.
803 ///
804 typedef struct {
805   UINT32    Signature;
806   UINT16    Command;
807   UINT16    Status;
808   UINT16    Version;
809   UINT8     RASCapabilities[16];
810   UINT8     SetRASCapabilities[16];
811   UINT16    NumberOfRASFParameterBlocks;
812   UINT32    SetRASCapabilitiesStatus;
813 } EFI_ACPI_6_1_RASF_PLATFORM_COMMUNICATION_CHANNEL_SHARED_MEMORY_REGION;
814 
815 ///
816 /// ACPI RASF PCC command code
817 ///
818 #define EFI_ACPI_6_1_RASF_PCC_COMMAND_CODE_EXECUTE_RASF_COMMAND  0x01
819 
820 ///
821 /// ACPI RASF Platform RAS Capabilities
822 ///
823 #define EFI_ACPI_6_1_RASF_PLATFORM_RAS_CAPABILITY_HARDWARE_BASED_PATROL_SCRUB_SUPPOTED                          0x01
824 #define EFI_ACPI_6_1_RASF_PLATFORM_RAS_CAPABILITY_HARDWARE_BASED_PATROL_SCRUB_SUPPOTED_AND_EXPOSED_TO_SOFTWARE  0x02
825 
826 ///
827 /// ACPI RASF Parameter Block structure for PATROL_SCRUB
828 ///
829 typedef struct {
830   UINT16    Type;
831   UINT16    Version;
832   UINT16    Length;
833   UINT16    PatrolScrubCommand;
834   UINT64    RequestedAddressRange[2];
835   UINT64    ActualAddressRange[2];
836   UINT16    Flags;
837   UINT8     RequestedSpeed;
838 } EFI_ACPI_6_1_RASF_PATROL_SCRUB_PLATFORM_BLOCK_STRUCTURE;
839 
840 ///
841 /// ACPI RASF Patrol Scrub command
842 ///
843 #define EFI_ACPI_6_1_RASF_PATROL_SCRUB_COMMAND_GET_PATROL_PARAMETERS  0x01
844 #define EFI_ACPI_6_1_RASF_PATROL_SCRUB_COMMAND_START_PATROL_SCRUBBER  0x02
845 #define EFI_ACPI_6_1_RASF_PATROL_SCRUB_COMMAND_STOP_PATROL_SCRUBBER   0x03
846 
847 ///
848 /// Memory Power State Table definition.
849 ///
850 typedef struct {
851   EFI_ACPI_DESCRIPTION_HEADER    Header;
852   UINT8                          PlatformCommunicationChannelIdentifier;
853   UINT8                          Reserved[3];
854   // Memory Power Node Structure
855   // Memory Power State Characteristics
856 } EFI_ACPI_6_1_MEMORY_POWER_STATUS_TABLE;
857 
858 ///
859 /// MPST Version (as defined in ACPI 6.1 spec.)
860 ///
861 #define EFI_ACPI_6_1_MEMORY_POWER_STATE_TABLE_REVISION  0x01
862 
863 ///
864 /// MPST Platform Communication Channel Shared Memory Region definition.
865 ///
866 typedef struct {
867   UINT32    Signature;
868   UINT16    Command;
869   UINT16    Status;
870   UINT32    MemoryPowerCommandRegister;
871   UINT32    MemoryPowerStatusRegister;
872   UINT32    PowerStateId;
873   UINT32    MemoryPowerNodeId;
874   UINT64    MemoryEnergyConsumed;
875   UINT64    ExpectedAveragePowerComsuned;
876 } EFI_ACPI_6_1_MPST_PLATFORM_COMMUNICATION_CHANNEL_SHARED_MEMORY_REGION;
877 
878 ///
879 /// ACPI MPST PCC command code
880 ///
881 #define EFI_ACPI_6_1_MPST_PCC_COMMAND_CODE_EXECUTE_MPST_COMMAND  0x03
882 
883 ///
884 /// ACPI MPST Memory Power command
885 ///
886 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_COMMAND_GET_MEMORY_POWER_STATE      0x01
887 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_COMMAND_SET_MEMORY_POWER_STATE      0x02
888 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_COMMAND_GET_AVERAGE_POWER_CONSUMED  0x03
889 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_COMMAND_GET_MEMORY_ENERGY_CONSUMED  0x04
890 
891 ///
892 /// MPST Memory Power Node Table
893 ///
894 typedef struct {
895   UINT8    PowerStateValue;
896   UINT8    PowerStateInformationIndex;
897 } EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE;
898 
899 typedef struct {
900   UINT8     Flag;
901   UINT8     Reserved;
902   UINT16    MemoryPowerNodeId;
903   UINT32    Length;
904   UINT64    AddressBase;
905   UINT64    AddressLength;
906   UINT32    NumberOfPowerStates;
907   UINT32    NumberOfPhysicalComponents;
908   // EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE              MemoryPowerState[NumberOfPowerStates];
909   // UINT16                                            PhysicalComponentIdentifier[NumberOfPhysicalComponents];
910 } EFI_ACPI_6_1_MPST_MEMORY_POWER_STRUCTURE;
911 
912 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_STRUCTURE_FLAG_ENABLE         0x01
913 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_STRUCTURE_FLAG_POWER_MANAGED  0x02
914 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_STRUCTURE_FLAG_HOT_PLUGGABLE  0x04
915 
916 typedef struct {
917   UINT16    MemoryPowerNodeCount;
918   UINT8     Reserved[2];
919 } EFI_ACPI_6_1_MPST_MEMORY_POWER_NODE_TABLE;
920 
921 ///
922 /// MPST Memory Power State Characteristics Table
923 ///
924 typedef struct {
925   UINT8     PowerStateStructureID;
926   UINT8     Flag;
927   UINT16    Reserved;
928   UINT32    AveragePowerConsumedInMPS0;
929   UINT32    RelativePowerSavingToMPS0;
930   UINT64    ExitLatencyToMPS0;
931 } EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE_CHARACTERISTICS_STRUCTURE;
932 
933 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE_CHARACTERISTICS_STRUCTURE_FLAG_MEMORY_CONTENT_PRESERVED             0x01
934 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE_CHARACTERISTICS_STRUCTURE_FLAG_AUTONOMOUS_MEMORY_POWER_STATE_ENTRY  0x02
935 #define EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE_CHARACTERISTICS_STRUCTURE_FLAG_AUTONOMOUS_MEMORY_POWER_STATE_EXIT   0x04
936 
937 typedef struct {
938   UINT16    MemoryPowerStateCharacteristicsCount;
939   UINT8     Reserved[2];
940 } EFI_ACPI_6_1_MPST_MEMORY_POWER_STATE_CHARACTERISTICS_TABLE;
941 
942 ///
943 /// Memory Topology Table definition.
944 ///
945 typedef struct {
946   EFI_ACPI_DESCRIPTION_HEADER    Header;
947   UINT32                         Reserved;
948 } EFI_ACPI_6_1_MEMORY_TOPOLOGY_TABLE;
949 
950 ///
951 /// PMTT Version (as defined in ACPI 6.1 spec.)
952 ///
953 #define EFI_ACPI_6_1_MEMORY_TOPOLOGY_TABLE_REVISION  0x01
954 
955 ///
956 /// Common Memory Aggregator Device Structure.
957 ///
958 typedef struct {
959   UINT8     Type;
960   UINT8     Reserved;
961   UINT16    Length;
962   UINT16    Flags;
963   UINT16    Reserved1;
964 } EFI_ACPI_6_1_PMMT_COMMON_MEMORY_AGGREGATOR_DEVICE_STRUCTURE;
965 
966 ///
967 /// Memory Aggregator Device Type
968 ///
969 #define EFI_ACPI_6_1_PMMT_MEMORY_AGGREGATOR_DEVICE_TYPE_SOCKET             0x0
970 #define EFI_ACPI_6_1_PMMT_MEMORY_AGGREGATOR_DEVICE_TYPE_MEMORY_CONTROLLER  0x1
971 #define EFI_ACPI_6_1_PMMT_MEMORY_AGGREGATOR_DEVICE_TYPE_DIMM               0x2
972 
973 ///
974 /// Socket Memory Aggregator Device Structure.
975 ///
976 typedef struct {
977   EFI_ACPI_6_1_PMMT_COMMON_MEMORY_AGGREGATOR_DEVICE_STRUCTURE    Header;
978   UINT16                                                         SocketIdentifier;
979   UINT16                                                         Reserved;
980   // EFI_ACPI_6_1_PMMT_MEMORY_CONTROLLER_MEMORY_AGGREGATOR_DEVICE_STRUCTURE  MemoryController[];
981 } EFI_ACPI_6_1_PMMT_SOCKET_MEMORY_AGGREGATOR_DEVICE_STRUCTURE;
982 
983 ///
984 /// MemoryController Memory Aggregator Device Structure.
985 ///
986 typedef struct {
987   EFI_ACPI_6_1_PMMT_COMMON_MEMORY_AGGREGATOR_DEVICE_STRUCTURE    Header;
988   UINT32                                                         ReadLatency;
989   UINT32                                                         WriteLatency;
990   UINT32                                                         ReadBandwidth;
991   UINT32                                                         WriteBandwidth;
992   UINT16                                                         OptimalAccessUnit;
993   UINT16                                                         OptimalAccessAlignment;
994   UINT16                                                         Reserved;
995   UINT16                                                         NumberOfProximityDomains;
996   // UINT32                                                       ProximityDomain[NumberOfProximityDomains];
997   // EFI_ACPI_6_1_PMMT_DIMM_MEMORY_AGGREGATOR_DEVICE_STRUCTURE    PhysicalComponent[];
998 } EFI_ACPI_6_1_PMMT_MEMORY_CONTROLLER_MEMORY_AGGREGATOR_DEVICE_STRUCTURE;
999 
1000 ///
1001 /// DIMM Memory Aggregator Device Structure.
1002 ///
1003 typedef struct {
1004   EFI_ACPI_6_1_PMMT_COMMON_MEMORY_AGGREGATOR_DEVICE_STRUCTURE    Header;
1005   UINT16                                                         PhysicalComponentIdentifier;
1006   UINT16                                                         Reserved;
1007   UINT32                                                         SizeOfDimm;
1008   UINT32                                                         SmbiosHandle;
1009 } EFI_ACPI_6_1_PMMT_DIMM_MEMORY_AGGREGATOR_DEVICE_STRUCTURE;
1010 
1011 ///
1012 /// Boot Graphics Resource Table definition.
1013 ///
1014 typedef struct {
1015   EFI_ACPI_DESCRIPTION_HEADER    Header;
1016   ///
1017   /// 2-bytes (16 bit) version ID. This value must be 1.
1018   ///
1019   UINT16                         Version;
1020   ///
1021   /// 1-byte status field indicating current status about the table.
1022   ///     Bits[7:1] = Reserved (must be zero)
1023   ///     Bit [0] = Valid. A one indicates the boot image graphic is valid.
1024   ///
1025   UINT8                          Status;
1026   ///
1027   /// 1-byte enumerated type field indicating format of the image.
1028   ///     0 = Bitmap
1029   ///     1 - 255  Reserved (for future use)
1030   ///
1031   UINT8                          ImageType;
1032   ///
1033   /// 8-byte (64 bit) physical address pointing to the firmware's in-memory copy
1034   /// of the image bitmap.
1035   ///
1036   UINT64                         ImageAddress;
1037   ///
1038   /// A 4-byte (32-bit) unsigned long describing the display X-offset of the boot image.
1039   /// (X, Y) display offset of the top left corner of the boot image.
1040   /// The top left corner of the display is at offset (0, 0).
1041   ///
1042   UINT32                         ImageOffsetX;
1043   ///
1044   /// A 4-byte (32-bit) unsigned long describing the display Y-offset of the boot image.
1045   /// (X, Y) display offset of the top left corner of the boot image.
1046   /// The top left corner of the display is at offset (0, 0).
1047   ///
1048   UINT32                         ImageOffsetY;
1049 } EFI_ACPI_6_1_BOOT_GRAPHICS_RESOURCE_TABLE;
1050 
1051 ///
1052 /// BGRT Revision
1053 ///
1054 #define EFI_ACPI_6_1_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION  1
1055 
1056 ///
1057 /// BGRT Version
1058 ///
1059 #define EFI_ACPI_6_1_BGRT_VERSION  0x01
1060 
1061 ///
1062 /// BGRT Status
1063 ///
1064 #define EFI_ACPI_6_1_BGRT_STATUS_NOT_DISPLAYED  0x00
1065 #define EFI_ACPI_6_1_BGRT_STATUS_DISPLAYED      0x01
1066 
1067 ///
1068 /// BGRT Image Type
1069 ///
1070 #define EFI_ACPI_6_1_BGRT_IMAGE_TYPE_BMP  0x00
1071 
1072 ///
1073 /// FPDT Version (as defined in ACPI 6.1 spec.)
1074 ///
1075 #define EFI_ACPI_6_1_FIRMWARE_PERFORMANCE_DATA_TABLE_REVISION  0x01
1076 
1077 ///
1078 /// FPDT Performance Record Types
1079 ///
1080 #define EFI_ACPI_6_1_FPDT_RECORD_TYPE_FIRMWARE_BASIC_BOOT_POINTER   0x0000
1081 #define EFI_ACPI_6_1_FPDT_RECORD_TYPE_S3_PERFORMANCE_TABLE_POINTER  0x0001
1082 
1083 ///
1084 /// FPDT Performance Record Revision
1085 ///
1086 #define EFI_ACPI_6_1_FPDT_RECORD_REVISION_FIRMWARE_BASIC_BOOT_POINTER   0x01
1087 #define EFI_ACPI_6_1_FPDT_RECORD_REVISION_S3_PERFORMANCE_TABLE_POINTER  0x01
1088 
1089 ///
1090 /// FPDT Runtime Performance Record Types
1091 ///
1092 #define EFI_ACPI_6_1_FPDT_RUNTIME_RECORD_TYPE_S3_RESUME            0x0000
1093 #define EFI_ACPI_6_1_FPDT_RUNTIME_RECORD_TYPE_S3_SUSPEND           0x0001
1094 #define EFI_ACPI_6_1_FPDT_RUNTIME_RECORD_TYPE_FIRMWARE_BASIC_BOOT  0x0002
1095 
1096 ///
1097 /// FPDT Runtime Performance Record Revision
1098 ///
1099 #define EFI_ACPI_6_1_FPDT_RUNTIME_RECORD_REVISION_S3_RESUME            0x01
1100 #define EFI_ACPI_6_1_FPDT_RUNTIME_RECORD_REVISION_S3_SUSPEND           0x01
1101 #define EFI_ACPI_6_1_FPDT_RUNTIME_RECORD_REVISION_FIRMWARE_BASIC_BOOT  0x02
1102 
1103 ///
1104 /// FPDT Performance Record header
1105 ///
1106 typedef struct {
1107   UINT16    Type;
1108   UINT8     Length;
1109   UINT8     Revision;
1110 } EFI_ACPI_6_1_FPDT_PERFORMANCE_RECORD_HEADER;
1111 
1112 ///
1113 /// FPDT Performance Table header
1114 ///
1115 typedef struct {
1116   UINT32    Signature;
1117   UINT32    Length;
1118 } EFI_ACPI_6_1_FPDT_PERFORMANCE_TABLE_HEADER;
1119 
1120 ///
1121 /// FPDT Firmware Basic Boot Performance Pointer Record Structure
1122 ///
1123 typedef struct {
1124   EFI_ACPI_6_1_FPDT_PERFORMANCE_RECORD_HEADER    Header;
1125   UINT32                                         Reserved;
1126   ///
1127   /// 64-bit processor-relative physical address of the Basic Boot Performance Table.
1128   ///
1129   UINT64                                         BootPerformanceTablePointer;
1130 } EFI_ACPI_6_1_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD;
1131 
1132 ///
1133 /// FPDT S3 Performance Table Pointer Record Structure
1134 ///
1135 typedef struct {
1136   EFI_ACPI_6_1_FPDT_PERFORMANCE_RECORD_HEADER    Header;
1137   UINT32                                         Reserved;
1138   ///
1139   /// 64-bit processor-relative physical address of the S3 Performance Table.
1140   ///
1141   UINT64                                         S3PerformanceTablePointer;
1142 } EFI_ACPI_6_1_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD;
1143 
1144 ///
1145 /// FPDT Firmware Basic Boot Performance Record Structure
1146 ///
1147 typedef struct {
1148   EFI_ACPI_6_1_FPDT_PERFORMANCE_RECORD_HEADER    Header;
1149   UINT32                                         Reserved;
1150   ///
1151   /// Timer value logged at the beginning of firmware image execution.
1152   /// This may not always be zero or near zero.
1153   ///
1154   UINT64                                         ResetEnd;
1155   ///
1156   /// Timer value logged just prior to loading the OS boot loader into memory.
1157   /// For non-UEFI compatible boots, this field must be zero.
1158   ///
1159   UINT64                                         OsLoaderLoadImageStart;
1160   ///
1161   /// Timer value logged just prior to launching the previously loaded OS boot loader image.
1162   /// For non-UEFI compatible boots, the timer value logged will be just prior
1163   /// to the INT 19h handler invocation.
1164   ///
1165   UINT64                                         OsLoaderStartImageStart;
1166   ///
1167   /// Timer value logged at the point when the OS loader calls the
1168   /// ExitBootServices function for UEFI compatible firmware.
1169   /// For non-UEFI compatible boots, this field must be zero.
1170   ///
1171   UINT64                                         ExitBootServicesEntry;
1172   ///
1173   /// Timer value logged at the point just prior to when the OS loader gaining
1174   /// control back from calls the ExitBootServices function for UEFI compatible firmware.
1175   /// For non-UEFI compatible boots, this field must be zero.
1176   ///
1177   UINT64                                         ExitBootServicesExit;
1178 } EFI_ACPI_6_1_FPDT_FIRMWARE_BASIC_BOOT_RECORD;
1179 
1180 ///
1181 /// FPDT Firmware Basic Boot Performance Table signature
1182 ///
1183 #define EFI_ACPI_6_1_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE  SIGNATURE_32('F', 'B', 'P', 'T')
1184 
1185 //
1186 // FPDT Firmware Basic Boot Performance Table
1187 //
1188 typedef struct {
1189   EFI_ACPI_6_1_FPDT_PERFORMANCE_TABLE_HEADER    Header;
1190   //
1191   // one or more Performance Records.
1192   //
1193 } EFI_ACPI_6_1_FPDT_FIRMWARE_BASIC_BOOT_TABLE;
1194 
1195 ///
1196 /// FPDT "S3PT" S3 Performance Table
1197 ///
1198 #define EFI_ACPI_6_1_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE  SIGNATURE_32('S', '3', 'P', 'T')
1199 
1200 //
1201 // FPDT Firmware S3 Boot Performance Table
1202 //
1203 typedef struct {
1204   EFI_ACPI_6_1_FPDT_PERFORMANCE_TABLE_HEADER    Header;
1205   //
1206   // one or more Performance Records.
1207   //
1208 } EFI_ACPI_6_1_FPDT_FIRMWARE_S3_BOOT_TABLE;
1209 
1210 ///
1211 /// FPDT Basic S3 Resume Performance Record
1212 ///
1213 typedef struct {
1214   EFI_ACPI_6_1_FPDT_PERFORMANCE_RECORD_HEADER    Header;
1215   ///
1216   /// A count of the number of S3 resume cycles since the last full boot sequence.
1217   ///
1218   UINT32                                         ResumeCount;
1219   ///
1220   /// Timer recorded at the end of BIOS S3 resume, just prior to handoff to the
1221   /// OS waking vector. Only the most recent resume cycle's time is retained.
1222   ///
1223   UINT64                                         FullResume;
1224   ///
1225   /// Average timer value of all resume cycles logged since the last full boot
1226   /// sequence, including the most recent resume.  Note that the entire log of
1227   /// timer values does not need to be retained in order to calculate this average.
1228   ///
1229   UINT64                                         AverageResume;
1230 } EFI_ACPI_6_1_FPDT_S3_RESUME_RECORD;
1231 
1232 ///
1233 /// FPDT Basic S3 Suspend Performance Record
1234 ///
1235 typedef struct {
1236   EFI_ACPI_6_1_FPDT_PERFORMANCE_RECORD_HEADER    Header;
1237   ///
1238   /// Timer value recorded at the OS write to SLP_TYP upon entry to S3.
1239   /// Only the most recent suspend cycle's timer value is retained.
1240   ///
1241   UINT64                                         SuspendStart;
1242   ///
1243   /// Timer value recorded at the final firmware write to SLP_TYP (or other
1244   /// mechanism) used to trigger hardware entry to S3.
1245   /// Only the most recent suspend cycle's timer value is retained.
1246   ///
1247   UINT64                                         SuspendEnd;
1248 } EFI_ACPI_6_1_FPDT_S3_SUSPEND_RECORD;
1249 
1250 ///
1251 /// Firmware Performance Record Table definition.
1252 ///
1253 typedef struct {
1254   EFI_ACPI_DESCRIPTION_HEADER    Header;
1255 } EFI_ACPI_6_1_FIRMWARE_PERFORMANCE_RECORD_TABLE;
1256 
1257 ///
1258 /// Generic Timer Description Table definition.
1259 ///
1260 typedef struct {
1261   EFI_ACPI_DESCRIPTION_HEADER    Header;
1262   UINT64                         CntControlBasePhysicalAddress;
1263   UINT32                         Reserved;
1264   UINT32                         SecurePL1TimerGSIV;
1265   UINT32                         SecurePL1TimerFlags;
1266   UINT32                         NonSecurePL1TimerGSIV;
1267   UINT32                         NonSecurePL1TimerFlags;
1268   UINT32                         VirtualTimerGSIV;
1269   UINT32                         VirtualTimerFlags;
1270   UINT32                         NonSecurePL2TimerGSIV;
1271   UINT32                         NonSecurePL2TimerFlags;
1272   UINT64                         CntReadBasePhysicalAddress;
1273   UINT32                         PlatformTimerCount;
1274   UINT32                         PlatformTimerOffset;
1275 } EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE;
1276 
1277 ///
1278 /// GTDT Version (as defined in ACPI 6.1 spec.)
1279 ///
1280 #define EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION  0x02
1281 
1282 ///
1283 /// Timer Flags.  All other bits are reserved and must be 0.
1284 ///
1285 #define EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE      BIT0
1286 #define EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY  BIT1
1287 #define EFI_ACPI_6_1_GTDT_TIMER_FLAG_ALWAYS_ON_CAPABILITY      BIT2
1288 
1289 ///
1290 /// Platform Timer Type
1291 ///
1292 #define EFI_ACPI_6_1_GTDT_GT_BLOCK               0
1293 #define EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG  1
1294 
1295 ///
1296 /// GT Block Structure
1297 ///
1298 typedef struct {
1299   UINT8     Type;
1300   UINT16    Length;
1301   UINT8     Reserved;
1302   UINT64    CntCtlBase;
1303   UINT32    GTBlockTimerCount;
1304   UINT32    GTBlockTimerOffset;
1305 } EFI_ACPI_6_1_GTDT_GT_BLOCK_STRUCTURE;
1306 
1307 ///
1308 /// GT Block Timer Structure
1309 ///
1310 typedef struct {
1311   UINT8     GTFrameNumber;
1312   UINT8     Reserved[3];
1313   UINT64    CntBaseX;
1314   UINT64    CntEL0BaseX;
1315   UINT32    GTxPhysicalTimerGSIV;
1316   UINT32    GTxPhysicalTimerFlags;
1317   UINT32    GTxVirtualTimerGSIV;
1318   UINT32    GTxVirtualTimerFlags;
1319   UINT32    GTxCommonFlags;
1320 } EFI_ACPI_6_1_GTDT_GT_BLOCK_TIMER_STRUCTURE;
1321 
1322 ///
1323 /// GT Block Physical Timers and Virtual Timers Flags.  All other bits are reserved and must be 0.
1324 ///
1325 #define EFI_ACPI_6_1_GTDT_GT_BLOCK_TIMER_FLAG_TIMER_INTERRUPT_MODE      BIT0
1326 #define EFI_ACPI_6_1_GTDT_GT_BLOCK_TIMER_FLAG_TIMER_INTERRUPT_POLARITY  BIT1
1327 
1328 ///
1329 /// Common Flags Flags.  All other bits are reserved and must be 0.
1330 ///
1331 #define EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER          BIT0
1332 #define EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_ALWAYS_ON_CAPABILITY  BIT1
1333 
1334 ///
1335 /// SBSA Generic Watchdog Structure
1336 ///
1337 typedef struct {
1338   UINT8     Type;
1339   UINT16    Length;
1340   UINT8     Reserved;
1341   UINT64    RefreshFramePhysicalAddress;
1342   UINT64    WatchdogControlFramePhysicalAddress;
1343   UINT32    WatchdogTimerGSIV;
1344   UINT32    WatchdogTimerFlags;
1345 } EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE;
1346 
1347 ///
1348 /// SBSA Generic Watchdog Timer Flags.  All other bits are reserved and must be 0.
1349 ///
1350 #define EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_TIMER_INTERRUPT_MODE      BIT0
1351 #define EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_TIMER_INTERRUPT_POLARITY  BIT1
1352 #define EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_SECURE_TIMER              BIT2
1353 
1354 //
1355 // NVDIMM Firmware Interface Table definition.
1356 //
1357 typedef struct {
1358   EFI_ACPI_DESCRIPTION_HEADER    Header;
1359   UINT32                         Reserved;
1360 } EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE;
1361 
1362 //
1363 // NFIT Version (as defined in ACPI 6.1 spec.)
1364 //
1365 #define EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE_REVISION  0x1
1366 
1367 //
1368 // Definition for NFIT Table Structure Types
1369 //
1370 #define EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE_TYPE    0
1371 #define EFI_ACPI_6_1_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE_TYPE            1
1372 #define EFI_ACPI_6_1_NFIT_INTERLEAVE_STRUCTURE_TYPE                       2
1373 #define EFI_ACPI_6_1_NFIT_SMBIOS_MANAGEMENT_INFORMATION_STRUCTURE_TYPE    3
1374 #define EFI_ACPI_6_1_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE_TYPE            4
1375 #define EFI_ACPI_6_1_NFIT_NVDIMM_BLOCK_DATA_WINDOW_REGION_STRUCTURE_TYPE  5
1376 #define EFI_ACPI_6_1_NFIT_FLUSH_HINT_ADDRESS_STRUCTURE_TYPE               6
1377 
1378 //
1379 // Definition for NFIT Structure Header
1380 //
1381 typedef struct {
1382   UINT16    Type;
1383   UINT16    Length;
1384 } EFI_ACPI_6_1_NFIT_STRUCTURE_HEADER;
1385 
1386 //
1387 // Definition for System Physical Address Range Structure
1388 //
1389 #define EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_FLAGS_CONTROL_REGION_FOR_MANAGEMENT  BIT0
1390 #define EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_FLAGS_PROXIMITY_DOMAIN_VALID         BIT1
1391 #define EFI_ACPI_6_1_NFIT_GUID_VOLATILE_MEMORY_REGION                                        { 0x7305944F, 0xFDDA, 0x44E3, { 0xB1, 0x6C, 0x3F, 0x22, 0xD2, 0x52, 0xE5, 0xD0 }}
1392 #define EFI_ACPI_6_1_NFIT_GUID_BYTE_ADDRESSABLE_PERSISTENT_MEMORY_REGION                     { 0x66F0D379, 0xB4F3, 0x4074, { 0xAC, 0x43, 0x0D, 0x33, 0x18, 0xB7, 0x8C, 0xDB }}
1393 #define EFI_ACPI_6_1_NFIT_GUID_NVDIMM_CONTROL_REGION                                         { 0x92F701F6, 0x13B4, 0x405D, { 0x91, 0x0B, 0x29, 0x93, 0x67, 0xE8, 0x23, 0x4C }}
1394 #define EFI_ACPI_6_1_NFIT_GUID_NVDIMM_BLOCK_DATA_WINDOW_REGION                               { 0x91AF0530, 0x5D86, 0x470E, { 0xA6, 0xB0, 0x0A, 0x2D, 0xB9, 0x40, 0x82, 0x49 }}
1395 #define EFI_ACPI_6_1_NFIT_GUID_RAM_DISK_SUPPORTING_VIRTUAL_DISK_REGION_VOLATILE              { 0x77AB535A, 0x45FC, 0x624B, { 0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }}
1396 #define EFI_ACPI_6_1_NFIT_GUID_RAM_DISK_SUPPORTING_VIRTUAL_CD_REGION_VOLATILE                { 0x3D5ABD30, 0x4175, 0x87CE, { 0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }}
1397 #define EFI_ACPI_6_1_NFIT_GUID_RAM_DISK_SUPPORTING_VIRTUAL_DISK_REGION_PERSISTENT            { 0x5CEA02C9, 0x4D07, 0x69D3, { 0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }}
1398 #define EFI_ACPI_6_1_NFIT_GUID_RAM_DISK_SUPPORTING_VIRTUAL_CD_REGION_PERSISTENT              { 0x08018188, 0x42CD, 0xBB48, { 0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }}
1399 typedef struct {
1400   UINT16    Type;
1401   UINT16    Length;
1402   UINT16    SPARangeStructureIndex;
1403   UINT16    Flags;
1404   UINT32    Reserved_8;
1405   UINT32    ProximityDomain;
1406   GUID      AddressRangeTypeGUID;
1407   UINT64    SystemPhysicalAddressRangeBase;
1408   UINT64    SystemPhysicalAddressRangeLength;
1409   UINT64    AddressRangeMemoryMappingAttribute;
1410 } EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE;
1411 
1412 //
1413 // Definition for Memory Device to System Physical Address Range Mapping Structure
1414 //
1415 typedef struct {
1416   UINT32    DIMMNumber          : 4;
1417   UINT32    MemoryChannelNumber : 4;
1418   UINT32    MemoryControllerID  : 4;
1419   UINT32    SocketID            : 4;
1420   UINT32    NodeControllerID    : 12;
1421   UINT32    Reserved_28         : 4;
1422 } EFI_ACPI_6_1_NFIT_DEVICE_HANDLE;
1423 
1424 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_PREVIOUS_SAVE_FAIL                                      BIT0
1425 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_LAST_RESTORE_FAIL                                       BIT1
1426 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_PLATFORM_FLUSH_FAIL                                     BIT2
1427 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_NOT_ARMED_PRIOR_TO_OSPM_HAND_OFF                        BIT3
1428 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_SMART_HEALTH_EVENTS_PRIOR_OSPM_HAND_OFF                 BIT4
1429 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_FIRMWARE_ENABLED_TO_NOTIFY_OSPM_ON_SMART_HEALTH_EVENTS  BIT5
1430 #define EFI_ACPI_6_1_NFIT_MEMORY_DEVICE_STATE_FLAGS_FIRMWARE_NOT_MAP_NVDIMM_TO_SPA                          BIT6
1431 typedef struct {
1432   UINT16                             Type;
1433   UINT16                             Length;
1434   EFI_ACPI_6_1_NFIT_DEVICE_HANDLE    NFITDeviceHandle;
1435   UINT16                             NVDIMMPhysicalID;
1436   UINT16                             NVDIMMRegionID;
1437   UINT16                             SPARangeStructureIndex;
1438   UINT16                             NVDIMMControlRegionStructureIndex;
1439   UINT64                             NVDIMMRegionSize;
1440   UINT64                             RegionOffset;
1441   UINT64                             NVDIMMPhysicalAddressRegionBase;
1442   UINT16                             InterleaveStructureIndex;
1443   UINT16                             InterleaveWays;
1444   UINT16                             NVDIMMStateFlags;
1445   UINT16                             Reserved_46;
1446 } EFI_ACPI_6_1_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE;
1447 
1448 //
1449 // Definition for Interleave Structure
1450 //
1451 typedef struct {
1452   UINT16    Type;
1453   UINT16    Length;
1454   UINT16    InterleaveStructureIndex;
1455   UINT16    Reserved_6;
1456   UINT32    NumberOfLines;
1457   UINT32    LineSize;
1458   // UINT32                                      LineOffset[NumberOfLines];
1459 } EFI_ACPI_6_1_NFIT_INTERLEAVE_STRUCTURE;
1460 
1461 //
1462 // Definition for SMBIOS Management Information Structure
1463 //
1464 typedef struct {
1465   UINT16    Type;
1466   UINT16    Length;
1467   UINT32    Reserved_4;
1468   // UINT8                                       Data[];
1469 } EFI_ACPI_6_1_NFIT_SMBIOS_MANAGEMENT_INFORMATION_STRUCTURE;
1470 
1471 //
1472 // Definition for NVDIMM Control Region Structure
1473 //
1474 #define EFI_ACPI_6_1_NFIT_NVDIMM_CONTROL_REGION_VALID_FIELDS_MANUFACTURING  BIT0
1475 
1476 #define EFI_ACPI_6_1_NFIT_NVDIMM_CONTROL_REGION_FLAGS_BLOCK_DATA_WINDOWS_BUFFERED  BIT0
1477 typedef struct {
1478   UINT16    Type;
1479   UINT16    Length;
1480   UINT16    NVDIMMControlRegionStructureIndex;
1481   UINT16    VendorID;
1482   UINT16    DeviceID;
1483   UINT16    RevisionID;
1484   UINT16    SubsystemVendorID;
1485   UINT16    SubsystemDeviceID;
1486   UINT16    SubsystemRevisionID;
1487   UINT8     ValidFields;
1488   UINT8     ManufacturingLocation;
1489   UINT16    ManufacturingDate;
1490   UINT8     Reserved_22[2];
1491   UINT32    SerialNumber;
1492   UINT16    RegionFormatInterfaceCode;
1493   UINT16    NumberOfBlockControlWindows;
1494   UINT64    SizeOfBlockControlWindow;
1495   UINT64    CommandRegisterOffsetInBlockControlWindow;
1496   UINT64    SizeOfCommandRegisterInBlockControlWindows;
1497   UINT64    StatusRegisterOffsetInBlockControlWindow;
1498   UINT64    SizeOfStatusRegisterInBlockControlWindows;
1499   UINT16    NVDIMMControlRegionFlag;
1500   UINT8     Reserved_74[6];
1501 } EFI_ACPI_6_1_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE;
1502 
1503 //
1504 // Definition for NVDIMM Block Data Window Region Structure
1505 //
1506 typedef struct {
1507   UINT16    Type;
1508   UINT16    Length;
1509   UINT16    NVDIMMControlRegionStructureIndex;
1510   UINT16    NumberOfBlockDataWindows;
1511   UINT64    BlockDataWindowStartOffset;
1512   UINT64    SizeOfBlockDataWindow;
1513   UINT64    BlockAccessibleMemoryCapacity;
1514   UINT64    BeginningAddressOfFirstBlockInBlockAccessibleMemory;
1515 } EFI_ACPI_6_1_NFIT_NVDIMM_BLOCK_DATA_WINDOW_REGION_STRUCTURE;
1516 
1517 //
1518 // Definition for Flush Hint Address Structure
1519 //
1520 typedef struct {
1521   UINT16                             Type;
1522   UINT16                             Length;
1523   EFI_ACPI_6_1_NFIT_DEVICE_HANDLE    NFITDeviceHandle;
1524   UINT16                             NumberOfFlushHintAddresses;
1525   UINT8                              Reserved_10[6];
1526   // UINT64                                      FlushHintAddress[NumberOfFlushHintAddresses];
1527 } EFI_ACPI_6_1_NFIT_FLUSH_HINT_ADDRESS_STRUCTURE;
1528 
1529 ///
1530 /// Boot Error Record Table (BERT)
1531 ///
1532 typedef struct {
1533   EFI_ACPI_DESCRIPTION_HEADER    Header;
1534   UINT32                         BootErrorRegionLength;
1535   UINT64                         BootErrorRegion;
1536 } EFI_ACPI_6_1_BOOT_ERROR_RECORD_TABLE_HEADER;
1537 
1538 ///
1539 /// BERT Version (as defined in ACPI 6.1 spec.)
1540 ///
1541 #define EFI_ACPI_6_1_BOOT_ERROR_RECORD_TABLE_REVISION  0x01
1542 
1543 ///
1544 /// Boot Error Region Block Status Definition
1545 ///
1546 typedef struct {
1547   UINT32    UncorrectableErrorValid     : 1;
1548   UINT32    CorrectableErrorValid       : 1;
1549   UINT32    MultipleUncorrectableErrors : 1;
1550   UINT32    MultipleCorrectableErrors   : 1;
1551   UINT32    ErrorDataEntryCount         : 10;
1552   UINT32    Reserved                    : 18;
1553 } EFI_ACPI_6_1_ERROR_BLOCK_STATUS;
1554 
1555 ///
1556 /// Boot Error Region Definition
1557 ///
1558 typedef struct {
1559   EFI_ACPI_6_1_ERROR_BLOCK_STATUS    BlockStatus;
1560   UINT32                             RawDataOffset;
1561   UINT32                             RawDataLength;
1562   UINT32                             DataLength;
1563   UINT32                             ErrorSeverity;
1564 } EFI_ACPI_6_1_BOOT_ERROR_REGION_STRUCTURE;
1565 
1566 //
1567 // Boot Error Severity types
1568 //
1569 #define EFI_ACPI_6_1_ERROR_SEVERITY_RECOVERABLE  0x00
1570 #define EFI_ACPI_6_1_ERROR_SEVERITY_FATAL        0x01
1571 #define EFI_ACPI_6_1_ERROR_SEVERITY_CORRECTED    0x02
1572 #define EFI_ACPI_6_1_ERROR_SEVERITY_NONE         0x03
1573 //
1574 // The term 'Correctable' is no longer being used as an error severity of the
1575 // reported error since ACPI Specification Version 5.1 Errata B.
1576 // The below macro is considered as deprecated and should no longer be used.
1577 //
1578 #define EFI_ACPI_6_1_ERROR_SEVERITY_CORRECTABLE  0x00
1579 
1580 ///
1581 /// Generic Error Data Entry Definition
1582 ///
1583 typedef struct {
1584   UINT8     SectionType[16];
1585   UINT32    ErrorSeverity;
1586   UINT16    Revision;
1587   UINT8     ValidationBits;
1588   UINT8     Flags;
1589   UINT32    ErrorDataLength;
1590   UINT8     FruId[16];
1591   UINT8     FruText[20];
1592   UINT8     Timestamp[8];
1593 } EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_STRUCTURE;
1594 
1595 ///
1596 /// Generic Error Data Entry Version (as defined in ACPI 6.1 spec.)
1597 ///
1598 #define EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_REVISION  0x0300
1599 
1600 ///
1601 /// HEST - Hardware Error Source Table
1602 ///
1603 typedef struct {
1604   EFI_ACPI_DESCRIPTION_HEADER    Header;
1605   UINT32                         ErrorSourceCount;
1606 } EFI_ACPI_6_1_HARDWARE_ERROR_SOURCE_TABLE_HEADER;
1607 
1608 ///
1609 /// HEST Version (as defined in ACPI 6.1 spec.)
1610 ///
1611 #define EFI_ACPI_6_1_HARDWARE_ERROR_SOURCE_TABLE_REVISION  0x01
1612 
1613 //
1614 // Error Source structure types.
1615 //
1616 #define EFI_ACPI_6_1_IA32_ARCHITECTURE_MACHINE_CHECK_EXCEPTION  0x00
1617 #define EFI_ACPI_6_1_IA32_ARCHITECTURE_CORRECTED_MACHINE_CHECK  0x01
1618 #define EFI_ACPI_6_1_IA32_ARCHITECTURE_NMI_ERROR                0x02
1619 #define EFI_ACPI_6_1_PCI_EXPRESS_ROOT_PORT_AER                  0x06
1620 #define EFI_ACPI_6_1_PCI_EXPRESS_DEVICE_AER                     0x07
1621 #define EFI_ACPI_6_1_PCI_EXPRESS_BRIDGE_AER                     0x08
1622 #define EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR                     0x09
1623 #define EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_VERSION_2           0x0A
1624 
1625 //
1626 // Error Source structure flags.
1627 //
1628 #define EFI_ACPI_6_1_ERROR_SOURCE_FLAG_FIRMWARE_FIRST  (1 << 0)
1629 #define EFI_ACPI_6_1_ERROR_SOURCE_FLAG_GLOBAL          (1 << 1)
1630 
1631 ///
1632 /// IA-32 Architecture Machine Check Exception Structure Definition
1633 ///
1634 typedef struct {
1635   UINT16    Type;
1636   UINT16    SourceId;
1637   UINT8     Reserved0[2];
1638   UINT8     Flags;
1639   UINT8     Enabled;
1640   UINT32    NumberOfRecordsToPreAllocate;
1641   UINT32    MaxSectionsPerRecord;
1642   UINT64    GlobalCapabilityInitData;
1643   UINT64    GlobalControlInitData;
1644   UINT8     NumberOfHardwareBanks;
1645   UINT8     Reserved1[7];
1646 } EFI_ACPI_6_1_IA32_ARCHITECTURE_MACHINE_CHECK_EXCEPTION_STRUCTURE;
1647 
1648 ///
1649 /// IA-32 Architecture Machine Check Bank Structure Definition
1650 ///
1651 typedef struct {
1652   UINT8     BankNumber;
1653   UINT8     ClearStatusOnInitialization;
1654   UINT8     StatusDataFormat;
1655   UINT8     Reserved0;
1656   UINT32    ControlRegisterMsrAddress;
1657   UINT64    ControlInitData;
1658   UINT32    StatusRegisterMsrAddress;
1659   UINT32    AddressRegisterMsrAddress;
1660   UINT32    MiscRegisterMsrAddress;
1661 } EFI_ACPI_6_1_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_BANK_STRUCTURE;
1662 
1663 ///
1664 /// IA-32 Architecture Machine Check Bank Structure MCA data format
1665 ///
1666 #define EFI_ACPI_6_1_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_DATA_FORMAT_IA32     0x00
1667 #define EFI_ACPI_6_1_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_DATA_FORMAT_INTEL64  0x01
1668 #define EFI_ACPI_6_1_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_DATA_FORMAT_AMD64    0x02
1669 
1670 //
1671 // Hardware Error Notification types. All other values are reserved
1672 //
1673 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_POLLED              0x00
1674 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_EXTERNAL_INTERRUPT  0x01
1675 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_LOCAL_INTERRUPT     0x02
1676 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_SCI                 0x03
1677 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_NMI                 0x04
1678 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_CMCI                0x05
1679 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_MCE                 0x06
1680 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_GPIO_SIGNAL         0x07
1681 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_ARMV8_SEA           0x08
1682 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_ARMV8_SEI           0x09
1683 #define EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_GSIV                0x0A
1684 
1685 ///
1686 /// Hardware Error Notification Configuration Write Enable Structure Definition
1687 ///
1688 typedef struct {
1689   UINT16    Type                           : 1;
1690   UINT16    PollInterval                   : 1;
1691   UINT16    SwitchToPollingThresholdValue  : 1;
1692   UINT16    SwitchToPollingThresholdWindow : 1;
1693   UINT16    ErrorThresholdValue            : 1;
1694   UINT16    ErrorThresholdWindow           : 1;
1695   UINT16    Reserved                       : 10;
1696 } EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_CONFIGURATION_WRITE_ENABLE_STRUCTURE;
1697 
1698 ///
1699 /// Hardware Error Notification Structure Definition
1700 ///
1701 typedef struct {
1702   UINT8                                                                            Type;
1703   UINT8                                                                            Length;
1704   EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_CONFIGURATION_WRITE_ENABLE_STRUCTURE    ConfigurationWriteEnable;
1705   UINT32                                                                           PollInterval;
1706   UINT32                                                                           Vector;
1707   UINT32                                                                           SwitchToPollingThresholdValue;
1708   UINT32                                                                           SwitchToPollingThresholdWindow;
1709   UINT32                                                                           ErrorThresholdValue;
1710   UINT32                                                                           ErrorThresholdWindow;
1711 } EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_STRUCTURE;
1712 
1713 ///
1714 /// IA-32 Architecture Corrected Machine Check Structure Definition
1715 ///
1716 typedef struct {
1717   UINT16                                                Type;
1718   UINT16                                                SourceId;
1719   UINT8                                                 Reserved0[2];
1720   UINT8                                                 Flags;
1721   UINT8                                                 Enabled;
1722   UINT32                                                NumberOfRecordsToPreAllocate;
1723   UINT32                                                MaxSectionsPerRecord;
1724   EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_STRUCTURE    NotificationStructure;
1725   UINT8                                                 NumberOfHardwareBanks;
1726   UINT8                                                 Reserved1[3];
1727 } EFI_ACPI_6_1_IA32_ARCHITECTURE_CORRECTED_MACHINE_CHECK_STRUCTURE;
1728 
1729 ///
1730 /// IA-32 Architecture NMI Error Structure Definition
1731 ///
1732 typedef struct {
1733   UINT16    Type;
1734   UINT16    SourceId;
1735   UINT8     Reserved0[2];
1736   UINT32    NumberOfRecordsToPreAllocate;
1737   UINT32    MaxSectionsPerRecord;
1738   UINT32    MaxRawDataLength;
1739 } EFI_ACPI_6_1_IA32_ARCHITECTURE_NMI_ERROR_STRUCTURE;
1740 
1741 ///
1742 /// PCI Express Root Port AER Structure Definition
1743 ///
1744 typedef struct {
1745   UINT16    Type;
1746   UINT16    SourceId;
1747   UINT8     Reserved0[2];
1748   UINT8     Flags;
1749   UINT8     Enabled;
1750   UINT32    NumberOfRecordsToPreAllocate;
1751   UINT32    MaxSectionsPerRecord;
1752   UINT32    Bus;
1753   UINT16    Device;
1754   UINT16    Function;
1755   UINT16    DeviceControl;
1756   UINT8     Reserved1[2];
1757   UINT32    UncorrectableErrorMask;
1758   UINT32    UncorrectableErrorSeverity;
1759   UINT32    CorrectableErrorMask;
1760   UINT32    AdvancedErrorCapabilitiesAndControl;
1761   UINT32    RootErrorCommand;
1762 } EFI_ACPI_6_1_PCI_EXPRESS_ROOT_PORT_AER_STRUCTURE;
1763 
1764 ///
1765 /// PCI Express Device AER Structure Definition
1766 ///
1767 typedef struct {
1768   UINT16    Type;
1769   UINT16    SourceId;
1770   UINT8     Reserved0[2];
1771   UINT8     Flags;
1772   UINT8     Enabled;
1773   UINT32    NumberOfRecordsToPreAllocate;
1774   UINT32    MaxSectionsPerRecord;
1775   UINT32    Bus;
1776   UINT16    Device;
1777   UINT16    Function;
1778   UINT16    DeviceControl;
1779   UINT8     Reserved1[2];
1780   UINT32    UncorrectableErrorMask;
1781   UINT32    UncorrectableErrorSeverity;
1782   UINT32    CorrectableErrorMask;
1783   UINT32    AdvancedErrorCapabilitiesAndControl;
1784 } EFI_ACPI_6_1_PCI_EXPRESS_DEVICE_AER_STRUCTURE;
1785 
1786 ///
1787 /// PCI Express Bridge AER Structure Definition
1788 ///
1789 typedef struct {
1790   UINT16    Type;
1791   UINT16    SourceId;
1792   UINT8     Reserved0[2];
1793   UINT8     Flags;
1794   UINT8     Enabled;
1795   UINT32    NumberOfRecordsToPreAllocate;
1796   UINT32    MaxSectionsPerRecord;
1797   UINT32    Bus;
1798   UINT16    Device;
1799   UINT16    Function;
1800   UINT16    DeviceControl;
1801   UINT8     Reserved1[2];
1802   UINT32    UncorrectableErrorMask;
1803   UINT32    UncorrectableErrorSeverity;
1804   UINT32    CorrectableErrorMask;
1805   UINT32    AdvancedErrorCapabilitiesAndControl;
1806   UINT32    SecondaryUncorrectableErrorMask;
1807   UINT32    SecondaryUncorrectableErrorSeverity;
1808   UINT32    SecondaryAdvancedErrorCapabilitiesAndControl;
1809 } EFI_ACPI_6_1_PCI_EXPRESS_BRIDGE_AER_STRUCTURE;
1810 
1811 ///
1812 /// Generic Hardware Error Source Structure Definition
1813 ///
1814 typedef struct {
1815   UINT16                                                Type;
1816   UINT16                                                SourceId;
1817   UINT16                                                RelatedSourceId;
1818   UINT8                                                 Flags;
1819   UINT8                                                 Enabled;
1820   UINT32                                                NumberOfRecordsToPreAllocate;
1821   UINT32                                                MaxSectionsPerRecord;
1822   UINT32                                                MaxRawDataLength;
1823   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE                ErrorStatusAddress;
1824   EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_STRUCTURE    NotificationStructure;
1825   UINT32                                                ErrorStatusBlockLength;
1826 } EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_STRUCTURE;
1827 
1828 ///
1829 /// Generic Hardware Error Source Version 2 Structure Definition
1830 ///
1831 typedef struct {
1832   UINT16                                                Type;
1833   UINT16                                                SourceId;
1834   UINT16                                                RelatedSourceId;
1835   UINT8                                                 Flags;
1836   UINT8                                                 Enabled;
1837   UINT32                                                NumberOfRecordsToPreAllocate;
1838   UINT32                                                MaxSectionsPerRecord;
1839   UINT32                                                MaxRawDataLength;
1840   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE                ErrorStatusAddress;
1841   EFI_ACPI_6_1_HARDWARE_ERROR_NOTIFICATION_STRUCTURE    NotificationStructure;
1842   UINT32                                                ErrorStatusBlockLength;
1843   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE                ReadAckRegister;
1844   UINT64                                                ReadAckPreserve;
1845   UINT64                                                ReadAckWrite;
1846 } EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE;
1847 
1848 ///
1849 /// Generic Error Status Definition
1850 ///
1851 typedef struct {
1852   EFI_ACPI_6_1_ERROR_BLOCK_STATUS    BlockStatus;
1853   UINT32                             RawDataOffset;
1854   UINT32                             RawDataLength;
1855   UINT32                             DataLength;
1856   UINT32                             ErrorSeverity;
1857 } EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE;
1858 
1859 ///
1860 /// ERST - Error Record Serialization Table
1861 ///
1862 typedef struct {
1863   EFI_ACPI_DESCRIPTION_HEADER    Header;
1864   UINT32                         SerializationHeaderSize;
1865   UINT8                          Reserved0[4];
1866   UINT32                         InstructionEntryCount;
1867 } EFI_ACPI_6_1_ERROR_RECORD_SERIALIZATION_TABLE_HEADER;
1868 
1869 ///
1870 /// ERST Version (as defined in ACPI 6.1 spec.)
1871 ///
1872 #define EFI_ACPI_6_1_ERROR_RECORD_SERIALIZATION_TABLE_REVISION  0x01
1873 
1874 ///
1875 /// ERST Serialization Actions
1876 ///
1877 #define EFI_ACPI_6_1_ERST_BEGIN_WRITE_OPERATION                   0x00
1878 #define EFI_ACPI_6_1_ERST_BEGIN_READ_OPERATION                    0x01
1879 #define EFI_ACPI_6_1_ERST_BEGIN_CLEAR_OPERATION                   0x02
1880 #define EFI_ACPI_6_1_ERST_END_OPERATION                           0x03
1881 #define EFI_ACPI_6_1_ERST_SET_RECORD_OFFSET                       0x04
1882 #define EFI_ACPI_6_1_ERST_EXECUTE_OPERATION                       0x05
1883 #define EFI_ACPI_6_1_ERST_CHECK_BUSY_STATUS                       0x06
1884 #define EFI_ACPI_6_1_ERST_GET_COMMAND_STATUS                      0x07
1885 #define EFI_ACPI_6_1_ERST_GET_RECORD_IDENTIFIER                   0x08
1886 #define EFI_ACPI_6_1_ERST_SET_RECORD_IDENTIFIER                   0x09
1887 #define EFI_ACPI_6_1_ERST_GET_RECORD_COUNT                        0x0A
1888 #define EFI_ACPI_6_1_ERST_BEGIN_DUMMY_WRITE_OPERATION             0x0B
1889 #define EFI_ACPI_6_1_ERST_GET_ERROR_LOG_ADDRESS_RANGE             0x0D
1890 #define EFI_ACPI_6_1_ERST_GET_ERROR_LOG_ADDRESS_RANGE_LENGTH      0x0E
1891 #define EFI_ACPI_6_1_ERST_GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES  0x0F
1892 #define EFI_ACPI_6_1_ERST_GET_EXECUTE_OPERATION_TIMINGS           0x10
1893 
1894 ///
1895 /// ERST Action Command Status
1896 ///
1897 #define EFI_ACPI_6_1_ERST_STATUS_SUCCESS                 0x00
1898 #define EFI_ACPI_6_1_ERST_STATUS_NOT_ENOUGH_SPACE        0x01
1899 #define EFI_ACPI_6_1_ERST_STATUS_HARDWARE_NOT_AVAILABLE  0x02
1900 #define EFI_ACPI_6_1_ERST_STATUS_FAILED                  0x03
1901 #define EFI_ACPI_6_1_ERST_STATUS_RECORD_STORE_EMPTY      0x04
1902 #define EFI_ACPI_6_1_ERST_STATUS_RECORD_NOT_FOUND        0x05
1903 
1904 ///
1905 /// ERST Serialization Instructions
1906 ///
1907 #define EFI_ACPI_6_1_ERST_READ_REGISTER                  0x00
1908 #define EFI_ACPI_6_1_ERST_READ_REGISTER_VALUE            0x01
1909 #define EFI_ACPI_6_1_ERST_WRITE_REGISTER                 0x02
1910 #define EFI_ACPI_6_1_ERST_WRITE_REGISTER_VALUE           0x03
1911 #define EFI_ACPI_6_1_ERST_NOOP                           0x04
1912 #define EFI_ACPI_6_1_ERST_LOAD_VAR1                      0x05
1913 #define EFI_ACPI_6_1_ERST_LOAD_VAR2                      0x06
1914 #define EFI_ACPI_6_1_ERST_STORE_VAR1                     0x07
1915 #define EFI_ACPI_6_1_ERST_ADD                            0x08
1916 #define EFI_ACPI_6_1_ERST_SUBTRACT                       0x09
1917 #define EFI_ACPI_6_1_ERST_ADD_VALUE                      0x0A
1918 #define EFI_ACPI_6_1_ERST_SUBTRACT_VALUE                 0x0B
1919 #define EFI_ACPI_6_1_ERST_STALL                          0x0C
1920 #define EFI_ACPI_6_1_ERST_STALL_WHILE_TRUE               0x0D
1921 #define EFI_ACPI_6_1_ERST_SKIP_NEXT_INSTRUCTION_IF_TRUE  0x0E
1922 #define EFI_ACPI_6_1_ERST_GOTO                           0x0F
1923 #define EFI_ACPI_6_1_ERST_SET_SRC_ADDRESS_BASE           0x10
1924 #define EFI_ACPI_6_1_ERST_SET_DST_ADDRESS_BASE           0x11
1925 #define EFI_ACPI_6_1_ERST_MOVE_DATA                      0x12
1926 
1927 ///
1928 /// ERST Instruction Flags
1929 ///
1930 #define EFI_ACPI_6_1_ERST_PRESERVE_REGISTER  0x01
1931 
1932 ///
1933 /// ERST Serialization Instruction Entry
1934 ///
1935 typedef struct {
1936   UINT8                                     SerializationAction;
1937   UINT8                                     Instruction;
1938   UINT8                                     Flags;
1939   UINT8                                     Reserved0;
1940   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    RegisterRegion;
1941   UINT64                                    Value;
1942   UINT64                                    Mask;
1943 } EFI_ACPI_6_1_ERST_SERIALIZATION_INSTRUCTION_ENTRY;
1944 
1945 ///
1946 /// EINJ - Error Injection Table
1947 ///
1948 typedef struct {
1949   EFI_ACPI_DESCRIPTION_HEADER    Header;
1950   UINT32                         InjectionHeaderSize;
1951   UINT8                          InjectionFlags;
1952   UINT8                          Reserved0[3];
1953   UINT32                         InjectionEntryCount;
1954 } EFI_ACPI_6_1_ERROR_INJECTION_TABLE_HEADER;
1955 
1956 ///
1957 /// EINJ Version (as defined in ACPI 6.1 spec.)
1958 ///
1959 #define EFI_ACPI_6_1_ERROR_INJECTION_TABLE_REVISION  0x01
1960 
1961 ///
1962 /// EINJ Error Injection Actions
1963 ///
1964 #define EFI_ACPI_6_1_EINJ_BEGIN_INJECTION_OPERATION       0x00
1965 #define EFI_ACPI_6_1_EINJ_GET_TRIGGER_ERROR_ACTION_TABLE  0x01
1966 #define EFI_ACPI_6_1_EINJ_SET_ERROR_TYPE                  0x02
1967 #define EFI_ACPI_6_1_EINJ_GET_ERROR_TYPE                  0x03
1968 #define EFI_ACPI_6_1_EINJ_END_OPERATION                   0x04
1969 #define EFI_ACPI_6_1_EINJ_EXECUTE_OPERATION               0x05
1970 #define EFI_ACPI_6_1_EINJ_CHECK_BUSY_STATUS               0x06
1971 #define EFI_ACPI_6_1_EINJ_GET_COMMAND_STATUS              0x07
1972 #define EFI_ACPI_6_1_EINJ_TRIGGER_ERROR                   0xFF
1973 
1974 ///
1975 /// EINJ Action Command Status
1976 ///
1977 #define EFI_ACPI_6_1_EINJ_STATUS_SUCCESS          0x00
1978 #define EFI_ACPI_6_1_EINJ_STATUS_UNKNOWN_FAILURE  0x01
1979 #define EFI_ACPI_6_1_EINJ_STATUS_INVALID_ACCESS   0x02
1980 
1981 ///
1982 /// EINJ Error Type Definition
1983 ///
1984 #define EFI_ACPI_6_1_EINJ_ERROR_PROCESSOR_CORRECTABLE               (1 << 0)
1985 #define EFI_ACPI_6_1_EINJ_ERROR_PROCESSOR_UNCORRECTABLE_NONFATAL    (1 << 1)
1986 #define EFI_ACPI_6_1_EINJ_ERROR_PROCESSOR_UNCORRECTABLE_FATAL       (1 << 2)
1987 #define EFI_ACPI_6_1_EINJ_ERROR_MEMORY_CORRECTABLE                  (1 << 3)
1988 #define EFI_ACPI_6_1_EINJ_ERROR_MEMORY_UNCORRECTABLE_NONFATAL       (1 << 4)
1989 #define EFI_ACPI_6_1_EINJ_ERROR_MEMORY_UNCORRECTABLE_FATAL          (1 << 5)
1990 #define EFI_ACPI_6_1_EINJ_ERROR_PCI_EXPRESS_CORRECTABLE             (1 << 6)
1991 #define EFI_ACPI_6_1_EINJ_ERROR_PCI_EXPRESS_UNCORRECTABLE_NONFATAL  (1 << 7)
1992 #define EFI_ACPI_6_1_EINJ_ERROR_PCI_EXPRESS_UNCORRECTABLE_FATAL     (1 << 8)
1993 #define EFI_ACPI_6_1_EINJ_ERROR_PLATFORM_CORRECTABLE                (1 << 9)
1994 #define EFI_ACPI_6_1_EINJ_ERROR_PLATFORM_UNCORRECTABLE_NONFATAL     (1 << 10)
1995 #define EFI_ACPI_6_1_EINJ_ERROR_PLATFORM_UNCORRECTABLE_FATAL        (1 << 11)
1996 
1997 ///
1998 /// EINJ Injection Instructions
1999 ///
2000 #define EFI_ACPI_6_1_EINJ_READ_REGISTER         0x00
2001 #define EFI_ACPI_6_1_EINJ_READ_REGISTER_VALUE   0x01
2002 #define EFI_ACPI_6_1_EINJ_WRITE_REGISTER        0x02
2003 #define EFI_ACPI_6_1_EINJ_WRITE_REGISTER_VALUE  0x03
2004 #define EFI_ACPI_6_1_EINJ_NOOP                  0x04
2005 
2006 ///
2007 /// EINJ Instruction Flags
2008 ///
2009 #define EFI_ACPI_6_1_EINJ_PRESERVE_REGISTER  0x01
2010 
2011 ///
2012 /// EINJ Injection Instruction Entry
2013 ///
2014 typedef struct {
2015   UINT8                                     InjectionAction;
2016   UINT8                                     Instruction;
2017   UINT8                                     Flags;
2018   UINT8                                     Reserved0;
2019   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    RegisterRegion;
2020   UINT64                                    Value;
2021   UINT64                                    Mask;
2022 } EFI_ACPI_6_1_EINJ_INJECTION_INSTRUCTION_ENTRY;
2023 
2024 ///
2025 /// EINJ Trigger Action Table
2026 ///
2027 typedef struct {
2028   UINT32    HeaderSize;
2029   UINT32    Revision;
2030   UINT32    TableSize;
2031   UINT32    EntryCount;
2032 } EFI_ACPI_6_1_EINJ_TRIGGER_ACTION_TABLE;
2033 
2034 ///
2035 /// Platform Communications Channel Table (PCCT)
2036 ///
2037 typedef struct {
2038   EFI_ACPI_DESCRIPTION_HEADER    Header;
2039   UINT32                         Flags;
2040   UINT64                         Reserved;
2041 } EFI_ACPI_6_1_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER;
2042 
2043 ///
2044 /// PCCT Version (as defined in ACPI 6.1 spec.)
2045 ///
2046 #define EFI_ACPI_6_1_PLATFORM_COMMUNICATION_CHANNEL_TABLE_REVISION  0x01
2047 
2048 ///
2049 /// PCCT Global Flags
2050 ///
2051 #define EFI_ACPI_6_1_PCCT_FLAGS_SCI_DOORBELL  BIT0
2052 
2053 //
2054 // PCCT Subspace type
2055 //
2056 #define EFI_ACPI_6_1_PCCT_SUBSPACE_TYPE_GENERIC                      0x00
2057 #define EFI_ACPI_6_1_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS  0x01
2058 #define EFI_ACPI_6_1_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS  0x02
2059 
2060 ///
2061 /// PCC Subspace Structure Header
2062 ///
2063 typedef struct {
2064   UINT8    Type;
2065   UINT8    Length;
2066 } EFI_ACPI_6_1_PCCT_SUBSPACE_HEADER;
2067 
2068 ///
2069 /// Generic Communications Subspace Structure
2070 ///
2071 typedef struct {
2072   UINT8                                     Type;
2073   UINT8                                     Length;
2074   UINT8                                     Reserved[6];
2075   UINT64                                    BaseAddress;
2076   UINT64                                    AddressLength;
2077   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    DoorbellRegister;
2078   UINT64                                    DoorbellPreserve;
2079   UINT64                                    DoorbellWrite;
2080   UINT32                                    NominalLatency;
2081   UINT32                                    MaximumPeriodicAccessRate;
2082   UINT16                                    MinimumRequestTurnaroundTime;
2083 } EFI_ACPI_6_1_PCCT_SUBSPACE_GENERIC;
2084 
2085 ///
2086 /// Generic Communications Channel Shared Memory Region
2087 ///
2088 
2089 typedef struct {
2090   UINT8    Command;
2091   UINT8    Reserved    : 7;
2092   UINT8    GenerateSci : 1;
2093 } EFI_ACPI_6_1_PCCT_GENERIC_SHARED_MEMORY_REGION_COMMAND;
2094 
2095 typedef struct {
2096   UINT8    CommandComplete      : 1;
2097   UINT8    SciDoorbell          : 1;
2098   UINT8    Error                : 1;
2099   UINT8    PlatformNotification : 1;
2100   UINT8    Reserved             : 4;
2101   UINT8    Reserved1;
2102 } EFI_ACPI_6_1_PCCT_GENERIC_SHARED_MEMORY_REGION_STATUS;
2103 
2104 typedef struct {
2105   UINT32                                                    Signature;
2106   EFI_ACPI_6_1_PCCT_GENERIC_SHARED_MEMORY_REGION_COMMAND    Command;
2107   EFI_ACPI_6_1_PCCT_GENERIC_SHARED_MEMORY_REGION_STATUS     Status;
2108 } EFI_ACPI_6_1_PCCT_GENERIC_SHARED_MEMORY_REGION_HEADER;
2109 
2110 #define EFI_ACPI_6_1_PCCT_SUBSPACE_DOORBELL_INTERRUPT_FLAGS_POLARITY  BIT0
2111 #define EFI_ACPI_6_1_PCCT_SUBSPACE_DOORBELL_INTERRUPT_FLAGS_MODE      BIT1
2112 
2113 ///
2114 /// Type 1 HW-Reduced Communications Subspace Structure
2115 ///
2116 typedef struct {
2117   UINT8                                     Type;
2118   UINT8                                     Length;
2119   UINT32                                    DoorbellInterrupt;
2120   UINT8                                     DoorbellInterruptFlags;
2121   UINT8                                     Reserved;
2122   UINT64                                    BaseAddress;
2123   UINT64                                    AddressLength;
2124   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    DoorbellRegister;
2125   UINT64                                    DoorbellPreserve;
2126   UINT64                                    DoorbellWrite;
2127   UINT32                                    NominalLatency;
2128   UINT32                                    MaximumPeriodicAccessRate;
2129   UINT16                                    MinimumRequestTurnaroundTime;
2130 } EFI_ACPI_6_1_PCCT_SUBSPACE_1_HW_REDUCED_COMMUNICATIONS;
2131 
2132 ///
2133 /// Type 2 HW-Reduced Communications Subspace Structure
2134 ///
2135 typedef struct {
2136   UINT8                                     Type;
2137   UINT8                                     Length;
2138   UINT32                                    DoorbellInterrupt;
2139   UINT8                                     DoorbellInterruptFlags;
2140   UINT8                                     Reserved;
2141   UINT64                                    BaseAddress;
2142   UINT64                                    AddressLength;
2143   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    DoorbellRegister;
2144   UINT64                                    DoorbellPreserve;
2145   UINT64                                    DoorbellWrite;
2146   UINT32                                    NominalLatency;
2147   UINT32                                    MaximumPeriodicAccessRate;
2148   UINT16                                    MinimumRequestTurnaroundTime;
2149   EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE    DoorbellAckRegister;
2150   UINT64                                    DoorbellAckPreserve;
2151   UINT64                                    DoorbellAckWrite;
2152 } EFI_ACPI_6_1_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS;
2153 
2154 //
2155 // Known table signatures
2156 //
2157 
2158 ///
2159 /// "RSD PTR " Root System Description Pointer
2160 ///
2161 #define EFI_ACPI_6_1_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE  SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ')
2162 
2163 ///
2164 /// "APIC" Multiple APIC Description Table
2165 ///
2166 #define EFI_ACPI_6_1_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('A', 'P', 'I', 'C')
2167 
2168 ///
2169 /// "BERT" Boot Error Record Table
2170 ///
2171 #define EFI_ACPI_6_1_BOOT_ERROR_RECORD_TABLE_SIGNATURE  SIGNATURE_32('B', 'E', 'R', 'T')
2172 
2173 ///
2174 /// "BGRT" Boot Graphics Resource Table
2175 ///
2176 #define EFI_ACPI_6_1_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE  SIGNATURE_32('B', 'G', 'R', 'T')
2177 
2178 ///
2179 /// "CPEP" Corrected Platform Error Polling Table
2180 ///
2181 #define EFI_ACPI_6_1_CORRECTED_PLATFORM_ERROR_POLLING_TABLE_SIGNATURE  SIGNATURE_32('C', 'P', 'E', 'P')
2182 
2183 ///
2184 /// "DSDT" Differentiated System Description Table
2185 ///
2186 #define EFI_ACPI_6_1_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('D', 'S', 'D', 'T')
2187 
2188 ///
2189 /// "ECDT" Embedded Controller Boot Resources Table
2190 ///
2191 #define EFI_ACPI_6_1_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE  SIGNATURE_32('E', 'C', 'D', 'T')
2192 
2193 ///
2194 /// "EINJ" Error Injection Table
2195 ///
2196 #define EFI_ACPI_6_1_ERROR_INJECTION_TABLE_SIGNATURE  SIGNATURE_32('E', 'I', 'N', 'J')
2197 
2198 ///
2199 /// "ERST" Error Record Serialization Table
2200 ///
2201 #define EFI_ACPI_6_1_ERROR_RECORD_SERIALIZATION_TABLE_SIGNATURE  SIGNATURE_32('E', 'R', 'S', 'T')
2202 
2203 ///
2204 /// "FACP" Fixed ACPI Description Table
2205 ///
2206 #define EFI_ACPI_6_1_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('F', 'A', 'C', 'P')
2207 
2208 ///
2209 /// "FACS" Firmware ACPI Control Structure
2210 ///
2211 #define EFI_ACPI_6_1_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE  SIGNATURE_32('F', 'A', 'C', 'S')
2212 
2213 ///
2214 /// "FPDT" Firmware Performance Data Table
2215 ///
2216 #define EFI_ACPI_6_1_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE  SIGNATURE_32('F', 'P', 'D', 'T')
2217 
2218 ///
2219 /// "GTDT" Generic Timer Description Table
2220 ///
2221 #define EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('G', 'T', 'D', 'T')
2222 
2223 ///
2224 /// "HEST" Hardware Error Source Table
2225 ///
2226 #define EFI_ACPI_6_1_HARDWARE_ERROR_SOURCE_TABLE_SIGNATURE  SIGNATURE_32('H', 'E', 'S', 'T')
2227 
2228 ///
2229 /// "MPST" Memory Power State Table
2230 ///
2231 #define EFI_ACPI_6_1_MEMORY_POWER_STATE_TABLE_SIGNATURE  SIGNATURE_32('M', 'P', 'S', 'T')
2232 
2233 ///
2234 /// "MSCT" Maximum System Characteristics Table
2235 ///
2236 #define EFI_ACPI_6_1_MAXIMUM_SYSTEM_CHARACTERISTICS_TABLE_SIGNATURE  SIGNATURE_32('M', 'S', 'C', 'T')
2237 
2238 ///
2239 /// "NFIT" NVDIMM Firmware Interface Table
2240 ///
2241 #define EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE_STRUCTURE_SIGNATURE  SIGNATURE_32('N', 'F', 'I', 'T')
2242 
2243 ///
2244 /// "PMTT" Platform Memory Topology Table
2245 ///
2246 #define EFI_ACPI_6_1_PLATFORM_MEMORY_TOPOLOGY_TABLE_SIGNATURE  SIGNATURE_32('P', 'M', 'T', 'T')
2247 
2248 ///
2249 /// "PSDT" Persistent System Description Table
2250 ///
2251 #define EFI_ACPI_6_1_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('P', 'S', 'D', 'T')
2252 
2253 ///
2254 /// "RASF" ACPI RAS Feature Table
2255 ///
2256 #define EFI_ACPI_6_1_ACPI_RAS_FEATURE_TABLE_SIGNATURE  SIGNATURE_32('R', 'A', 'S', 'F')
2257 
2258 ///
2259 /// "RSDT" Root System Description Table
2260 ///
2261 #define EFI_ACPI_6_1_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('R', 'S', 'D', 'T')
2262 
2263 ///
2264 /// "SBST" Smart Battery Specification Table
2265 ///
2266 #define EFI_ACPI_6_1_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE  SIGNATURE_32('S', 'B', 'S', 'T')
2267 
2268 ///
2269 /// "SLIT" System Locality Information Table
2270 ///
2271 #define EFI_ACPI_6_1_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE  SIGNATURE_32('S', 'L', 'I', 'T')
2272 
2273 ///
2274 /// "SRAT" System Resource Affinity Table
2275 ///
2276 #define EFI_ACPI_6_1_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE  SIGNATURE_32('S', 'R', 'A', 'T')
2277 
2278 ///
2279 /// "SSDT" Secondary System Description Table
2280 ///
2281 #define EFI_ACPI_6_1_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('S', 'S', 'D', 'T')
2282 
2283 ///
2284 /// "XSDT" Extended System Description Table
2285 ///
2286 #define EFI_ACPI_6_1_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('X', 'S', 'D', 'T')
2287 
2288 ///
2289 /// "BOOT" MS Simple Boot Spec
2290 ///
2291 #define EFI_ACPI_6_1_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE  SIGNATURE_32('B', 'O', 'O', 'T')
2292 
2293 ///
2294 /// "CSRT" MS Core System Resource Table
2295 ///
2296 #define EFI_ACPI_6_1_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE  SIGNATURE_32('C', 'S', 'R', 'T')
2297 
2298 ///
2299 /// "DBG2" MS Debug Port 2 Spec
2300 ///
2301 #define EFI_ACPI_6_1_DEBUG_PORT_2_TABLE_SIGNATURE  SIGNATURE_32('D', 'B', 'G', '2')
2302 
2303 ///
2304 /// "DBGP" MS Debug Port Spec
2305 ///
2306 #define EFI_ACPI_6_1_DEBUG_PORT_TABLE_SIGNATURE  SIGNATURE_32('D', 'B', 'G', 'P')
2307 
2308 ///
2309 /// "DMAR" DMA Remapping Table
2310 ///
2311 #define EFI_ACPI_6_1_DMA_REMAPPING_TABLE_SIGNATURE  SIGNATURE_32('D', 'M', 'A', 'R')
2312 
2313 ///
2314 /// "DRTM" Dynamic Root of Trust for Measurement Table
2315 ///
2316 #define EFI_ACPI_6_1_DYNAMIC_ROOT_OF_TRUST_FOR_MEASUREMENT_TABLE_SIGNATURE  SIGNATURE_32('D', 'R', 'T', 'M')
2317 
2318 ///
2319 /// "ETDT" Event Timer Description Table
2320 ///
2321 #define EFI_ACPI_6_1_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('E', 'T', 'D', 'T')
2322 
2323 ///
2324 /// "HPET" IA-PC High Precision Event Timer Table
2325 ///
2326 #define EFI_ACPI_6_1_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE  SIGNATURE_32('H', 'P', 'E', 'T')
2327 
2328 ///
2329 /// "iBFT" iSCSI Boot Firmware Table
2330 ///
2331 #define EFI_ACPI_6_1_ISCSI_BOOT_FIRMWARE_TABLE_SIGNATURE  SIGNATURE_32('i', 'B', 'F', 'T')
2332 
2333 ///
2334 /// "IORT" I/O Remapping Table
2335 ///
2336 #define EFI_ACPI_6_1_IO_REMAPPING_TABLE_SIGNATURE  SIGNATURE_32('I', 'O', 'R', 'T')
2337 
2338 ///
2339 /// "IVRS" I/O Virtualization Reporting Structure
2340 ///
2341 #define EFI_ACPI_6_1_IO_VIRTUALIZATION_REPORTING_STRUCTURE_SIGNATURE  SIGNATURE_32('I', 'V', 'R', 'S')
2342 
2343 ///
2344 /// "LPIT" Low Power Idle Table
2345 ///
2346 #define EFI_ACPI_6_1_LOW_POWER_IDLE_TABLE_STRUCTURE_SIGNATURE  SIGNATURE_32('L', 'P', 'I', 'T')
2347 
2348 ///
2349 /// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
2350 ///
2351 #define EFI_ACPI_6_1_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('M', 'C', 'F', 'G')
2352 
2353 ///
2354 /// "MCHI" Management Controller Host Interface Table
2355 ///
2356 #define EFI_ACPI_6_1_MANAGEMENT_CONTROLLER_HOST_INTERFACE_TABLE_SIGNATURE  SIGNATURE_32('M', 'C', 'H', 'I')
2357 
2358 ///
2359 /// "MSDM" MS Data Management Table
2360 ///
2361 #define EFI_ACPI_6_1_DATA_MANAGEMENT_TABLE_SIGNATURE  SIGNATURE_32('M', 'S', 'D', 'M')
2362 
2363 ///
2364 /// "PCCT" Platform Communications Channel Table
2365 ///
2366 #define EFI_ACPI_6_1_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE  SIGNATURE_32('P', 'C', 'C', 'T')
2367 
2368 ///
2369 /// "SLIC" MS Software Licensing Table Specification
2370 ///
2371 #define EFI_ACPI_6_1_SOFTWARE_LICENSING_TABLE_SIGNATURE  SIGNATURE_32('S', 'L', 'I', 'C')
2372 
2373 ///
2374 /// "SPCR" Serial Port Console Redirection Table
2375 ///
2376 #define EFI_ACPI_6_1_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE  SIGNATURE_32('S', 'P', 'C', 'R')
2377 
2378 ///
2379 /// "SPMI" Server Platform Management Interface Table
2380 ///
2381 #define EFI_ACPI_6_1_SERVER_PLATFORM_MANAGEMENT_INTERFACE_TABLE_SIGNATURE  SIGNATURE_32('S', 'P', 'M', 'I')
2382 
2383 ///
2384 /// "STAO" _STA Override Table
2385 ///
2386 #define EFI_ACPI_6_1_STA_OVERRIDE_TABLE_SIGNATURE  SIGNATURE_32('S', 'T', 'A', 'O')
2387 
2388 ///
2389 /// "TCPA" Trusted Computing Platform Alliance Capabilities Table
2390 ///
2391 #define EFI_ACPI_6_1_TRUSTED_COMPUTING_PLATFORM_ALLIANCE_CAPABILITIES_TABLE_SIGNATURE  SIGNATURE_32('T', 'C', 'P', 'A')
2392 
2393 ///
2394 /// "TPM2" Trusted Computing Platform 1 Table
2395 ///
2396 #define EFI_ACPI_6_1_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE  SIGNATURE_32('T', 'P', 'M', '2')
2397 
2398 ///
2399 /// "UEFI" UEFI ACPI Data Table
2400 ///
2401 #define EFI_ACPI_6_1_UEFI_ACPI_DATA_TABLE_SIGNATURE  SIGNATURE_32('U', 'E', 'F', 'I')
2402 
2403 ///
2404 /// "WAET" Windows ACPI Emulated Devices Table
2405 ///
2406 #define EFI_ACPI_6_1_WINDOWS_ACPI_EMULATED_DEVICES_TABLE_SIGNATURE  SIGNATURE_32('W', 'A', 'E', 'T')
2407 
2408 ///
2409 /// "WDAT" Watchdog Action Table
2410 ///
2411 #define EFI_ACPI_6_1_WATCHDOG_ACTION_TABLE_SIGNATURE  SIGNATURE_32('W', 'D', 'A', 'T')
2412 
2413 ///
2414 /// "WDRT" Watchdog Resource Table
2415 ///
2416 #define EFI_ACPI_6_1_WATCHDOG_RESOURCE_TABLE_SIGNATURE  SIGNATURE_32('W', 'D', 'R', 'T')
2417 
2418 ///
2419 /// "WPBT" MS Platform Binary Table
2420 ///
2421 #define EFI_ACPI_6_1_PLATFORM_BINARY_TABLE_SIGNATURE  SIGNATURE_32('W', 'P', 'B', 'T')
2422 
2423 ///
2424 /// "XENV" Xen Project Table
2425 ///
2426 #define EFI_ACPI_6_1_XEN_PROJECT_TABLE_SIGNATURE  SIGNATURE_32('X', 'E', 'N', 'V')
2427 
2428 #pragma pack()
2429 
2430 #endif
2431