1 /** @file
2   ACPI 2.0 definitions from the ACPI Specification, revision 2.0
3 
4   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 **/
7 
8 #ifndef _ACPI_2_0_H_
9 #define _ACPI_2_0_H_
10 
11 #include <IndustryStandard/Acpi10.h>
12 
13 //
14 // Define for Descriptor
15 //
16 #define ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME  0x02
17 
18 #define ACPI_GENERIC_REGISTER_DESCRIPTOR  0x82
19 
20 //
21 // Ensure proper structure formats
22 //
23 #pragma pack(1)
24 
25 ///
26 /// Generic Register Descriptor
27 ///
28 typedef PACKED struct {
29   ACPI_LARGE_RESOURCE_HEADER    Header;
30   UINT8                         AddressSpaceId;
31   UINT8                         RegisterBitWidth;
32   UINT8                         RegisterBitOffset;
33   UINT8                         AddressSize;
34   UINT64                        RegisterAddress;
35 } EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR;
36 
37 #pragma pack()
38 
39 //
40 // Ensure proper structure formats
41 //
42 #pragma pack(1)
43 
44 ///
45 /// ACPI 2.0 Generic Address Space definition
46 ///
47 typedef struct {
48   UINT8     AddressSpaceId;
49   UINT8     RegisterBitWidth;
50   UINT8     RegisterBitOffset;
51   UINT8     Reserved;
52   UINT64    Address;
53 } EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE;
54 
55 //
56 // Generic Address Space Address IDs
57 //
58 #define EFI_ACPI_2_0_SYSTEM_MEMORY              0
59 #define EFI_ACPI_2_0_SYSTEM_IO                  1
60 #define EFI_ACPI_2_0_PCI_CONFIGURATION_SPACE    2
61 #define EFI_ACPI_2_0_EMBEDDED_CONTROLLER        3
62 #define EFI_ACPI_2_0_SMBUS                      4
63 #define EFI_ACPI_2_0_FUNCTIONAL_FIXED_HARDWARE  0x7F
64 
65 //
66 // ACPI 2.0 table structures
67 //
68 
69 ///
70 /// Root System Description Pointer Structure
71 ///
72 typedef struct {
73   UINT64    Signature;
74   UINT8     Checksum;
75   UINT8     OemId[6];
76   UINT8     Revision;
77   UINT32    RsdtAddress;
78   UINT32    Length;
79   UINT64    XsdtAddress;
80   UINT8     ExtendedChecksum;
81   UINT8     Reserved[3];
82 } EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
83 
84 ///
85 /// RSD_PTR Revision (as defined in ACPI 2.0 spec.)
86 ///
87 #define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION  0x02
88 
89 ///
90 /// Common table header, this prefaces all ACPI tables, including FACS, but
91 /// excluding the RSD PTR structure
92 ///
93 typedef struct {
94   UINT32    Signature;
95   UINT32    Length;
96 } EFI_ACPI_2_0_COMMON_HEADER;
97 
98 //
99 // Root System Description Table
100 // No definition needed as it is a common description table header, the same with
101 // EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT32 table pointers.
102 //
103 
104 ///
105 /// RSDT Revision (as defined in ACPI 2.0 spec.)
106 ///
107 #define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION  0x01
108 
109 //
110 // Extended System Description Table
111 // No definition needed as it is a common description table header, the same with
112 // EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT64 table pointers.
113 //
114 
115 ///
116 /// XSDT Revision (as defined in ACPI 2.0 spec.)
117 ///
118 #define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION  0x01
119 
120 ///
121 /// Fixed ACPI Description Table Structure (FADT)
122 ///
123 typedef struct {
124   EFI_ACPI_DESCRIPTION_HEADER               Header;
125   UINT32                                    FirmwareCtrl;
126   UINT32                                    Dsdt;
127   UINT8                                     Reserved0;
128   UINT8                                     PreferredPmProfile;
129   UINT16                                    SciInt;
130   UINT32                                    SmiCmd;
131   UINT8                                     AcpiEnable;
132   UINT8                                     AcpiDisable;
133   UINT8                                     S4BiosReq;
134   UINT8                                     PstateCnt;
135   UINT32                                    Pm1aEvtBlk;
136   UINT32                                    Pm1bEvtBlk;
137   UINT32                                    Pm1aCntBlk;
138   UINT32                                    Pm1bCntBlk;
139   UINT32                                    Pm2CntBlk;
140   UINT32                                    PmTmrBlk;
141   UINT32                                    Gpe0Blk;
142   UINT32                                    Gpe1Blk;
143   UINT8                                     Pm1EvtLen;
144   UINT8                                     Pm1CntLen;
145   UINT8                                     Pm2CntLen;
146   UINT8                                     PmTmrLen;
147   UINT8                                     Gpe0BlkLen;
148   UINT8                                     Gpe1BlkLen;
149   UINT8                                     Gpe1Base;
150   UINT8                                     CstCnt;
151   UINT16                                    PLvl2Lat;
152   UINT16                                    PLvl3Lat;
153   UINT16                                    FlushSize;
154   UINT16                                    FlushStride;
155   UINT8                                     DutyOffset;
156   UINT8                                     DutyWidth;
157   UINT8                                     DayAlrm;
158   UINT8                                     MonAlrm;
159   UINT8                                     Century;
160   UINT16                                    IaPcBootArch;
161   UINT8                                     Reserved1;
162   UINT32                                    Flags;
163   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    ResetReg;
164   UINT8                                     ResetValue;
165   UINT8                                     Reserved2[3];
166   UINT64                                    XFirmwareCtrl;
167   UINT64                                    XDsdt;
168   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XPm1aEvtBlk;
169   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XPm1bEvtBlk;
170   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XPm1aCntBlk;
171   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XPm1bCntBlk;
172   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XPm2CntBlk;
173   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XPmTmrBlk;
174   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XGpe0Blk;
175   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    XGpe1Blk;
176 } EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE;
177 
178 ///
179 /// FADT Version (as defined in ACPI 2.0 spec.)
180 ///
181 #define EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION  0x03
182 
183 //
184 // Fixed ACPI Description Table Preferred Power Management Profile
185 //
186 #define EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED        0
187 #define EFI_ACPI_2_0_PM_PROFILE_DESKTOP            1
188 #define EFI_ACPI_2_0_PM_PROFILE_MOBILE             2
189 #define EFI_ACPI_2_0_PM_PROFILE_WORKSTATION        3
190 #define EFI_ACPI_2_0_PM_PROFILE_ENTERPRISE_SERVER  4
191 #define EFI_ACPI_2_0_PM_PROFILE_SOHO_SERVER        5
192 #define EFI_ACPI_2_0_PM_PROFILE_APPLIANCE_PC       6
193 
194 //
195 // Fixed ACPI Description Table Boot Architecture Flags
196 // All other bits are reserved and must be set to 0.
197 //
198 #define EFI_ACPI_2_0_LEGACY_DEVICES  BIT0
199 #define EFI_ACPI_2_0_8042            BIT1
200 
201 //
202 // Fixed ACPI Description Table Fixed Feature Flags
203 // All other bits are reserved and must be set to 0.
204 //
205 #define EFI_ACPI_2_0_WBINVD         BIT0
206 #define EFI_ACPI_2_0_WBINVD_FLUSH   BIT1
207 #define EFI_ACPI_2_0_PROC_C1        BIT2
208 #define EFI_ACPI_2_0_P_LVL2_UP      BIT3
209 #define EFI_ACPI_2_0_PWR_BUTTON     BIT4
210 #define EFI_ACPI_2_0_SLP_BUTTON     BIT5
211 #define EFI_ACPI_2_0_FIX_RTC        BIT6
212 #define EFI_ACPI_2_0_RTC_S4         BIT7
213 #define EFI_ACPI_2_0_TMR_VAL_EXT    BIT8
214 #define EFI_ACPI_2_0_DCK_CAP        BIT9
215 #define EFI_ACPI_2_0_RESET_REG_SUP  BIT10
216 #define EFI_ACPI_2_0_SEALED_CASE    BIT11
217 #define EFI_ACPI_2_0_HEADLESS       BIT12
218 #define EFI_ACPI_2_0_CPU_SW_SLP     BIT13
219 
220 ///
221 /// Firmware ACPI Control Structure
222 ///
223 typedef struct {
224   UINT32    Signature;
225   UINT32    Length;
226   UINT32    HardwareSignature;
227   UINT32    FirmwareWakingVector;
228   UINT32    GlobalLock;
229   UINT32    Flags;
230   UINT64    XFirmwareWakingVector;
231   UINT8     Version;
232   UINT8     Reserved[31];
233 } EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
234 
235 ///
236 /// FACS Version (as defined in ACPI 2.0 spec.)
237 ///
238 #define EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION  0x01
239 
240 ///
241 /// Firmware Control Structure Feature Flags
242 /// All other bits are reserved and must be set to 0.
243 ///
244 #define EFI_ACPI_2_0_S4BIOS_F  BIT0
245 
246 ///
247 /// Multiple APIC Description Table header definition.  The rest of the table
248 /// must be defined in a platform specific manner.
249 ///
250 typedef struct {
251   EFI_ACPI_DESCRIPTION_HEADER    Header;
252   UINT32                         LocalApicAddress;
253   UINT32                         Flags;
254 } EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
255 
256 ///
257 /// MADT Revision (as defined in ACPI 2.0 spec.)
258 ///
259 #define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION  0x01
260 
261 ///
262 /// Multiple APIC Flags
263 /// All other bits are reserved and must be set to 0.
264 ///
265 #define EFI_ACPI_2_0_PCAT_COMPAT  BIT0
266 
267 //
268 // Multiple APIC Description Table APIC structure types
269 // All other values between 0x09 an 0xFF are reserved and
270 // will be ignored by OSPM.
271 //
272 #define EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC           0x00
273 #define EFI_ACPI_2_0_IO_APIC                        0x01
274 #define EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE      0x02
275 #define EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE  0x03
276 #define EFI_ACPI_2_0_LOCAL_APIC_NMI                 0x04
277 #define EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE    0x05
278 #define EFI_ACPI_2_0_IO_SAPIC                       0x06
279 #define EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC          0x07
280 #define EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES     0x08
281 
282 //
283 // APIC Structure Definitions
284 //
285 
286 ///
287 /// Processor Local APIC Structure Definition
288 ///
289 typedef struct {
290   UINT8     Type;
291   UINT8     Length;
292   UINT8     AcpiProcessorId;
293   UINT8     ApicId;
294   UINT32    Flags;
295 } EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
296 
297 ///
298 /// Local APIC Flags.  All other bits are reserved and must be 0.
299 ///
300 #define EFI_ACPI_2_0_LOCAL_APIC_ENABLED  BIT0
301 
302 ///
303 /// IO APIC Structure
304 ///
305 typedef struct {
306   UINT8     Type;
307   UINT8     Length;
308   UINT8     IoApicId;
309   UINT8     Reserved;
310   UINT32    IoApicAddress;
311   UINT32    GlobalSystemInterruptBase;
312 } EFI_ACPI_2_0_IO_APIC_STRUCTURE;
313 
314 ///
315 /// Interrupt Source Override Structure
316 ///
317 typedef struct {
318   UINT8     Type;
319   UINT8     Length;
320   UINT8     Bus;
321   UINT8     Source;
322   UINT32    GlobalSystemInterrupt;
323   UINT16    Flags;
324 } EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
325 
326 ///
327 /// Non-Maskable Interrupt Source Structure
328 ///
329 typedef struct {
330   UINT8     Type;
331   UINT8     Length;
332   UINT16    Flags;
333   UINT32    GlobalSystemInterrupt;
334 } EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
335 
336 ///
337 /// Local APIC NMI Structure
338 ///
339 typedef struct {
340   UINT8     Type;
341   UINT8     Length;
342   UINT8     AcpiProcessorId;
343   UINT16    Flags;
344   UINT8     LocalApicLint;
345 } EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE;
346 
347 ///
348 /// Local APIC Address Override Structure
349 ///
350 typedef struct {
351   UINT8     Type;
352   UINT8     Length;
353   UINT16    Reserved;
354   UINT64    LocalApicAddress;
355 } EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
356 
357 ///
358 /// IO SAPIC Structure
359 ///
360 typedef struct {
361   UINT8     Type;
362   UINT8     Length;
363   UINT8     IoApicId;
364   UINT8     Reserved;
365   UINT32    GlobalSystemInterruptBase;
366   UINT64    IoSapicAddress;
367 } EFI_ACPI_2_0_IO_SAPIC_STRUCTURE;
368 
369 ///
370 /// Local SAPIC Structure
371 ///
372 typedef struct {
373   UINT8     Type;
374   UINT8     Length;
375   UINT8     AcpiProcessorId;
376   UINT8     LocalSapicId;
377   UINT8     LocalSapicEid;
378   UINT8     Reserved[3];
379   UINT32    Flags;
380 } EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
381 
382 ///
383 /// Platform Interrupt Sources Structure
384 ///
385 typedef struct {
386   UINT8     Type;
387   UINT8     Length;
388   UINT16    Flags;
389   UINT8     InterruptType;
390   UINT8     ProcessorId;
391   UINT8     ProcessorEid;
392   UINT8     IoSapicVector;
393   UINT32    GlobalSystemInterrupt;
394   UINT32    Reserved;
395 } EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
396 
397 ///
398 /// Smart Battery Description Table (SBST)
399 ///
400 typedef struct {
401   EFI_ACPI_DESCRIPTION_HEADER    Header;
402   UINT32                         WarningEnergyLevel;
403   UINT32                         LowEnergyLevel;
404   UINT32                         CriticalEnergyLevel;
405 } EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE;
406 
407 ///
408 /// SBST Version (as defined in ACPI 2.0 spec.)
409 ///
410 #define EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION  0x01
411 
412 ///
413 /// Embedded Controller Boot Resources Table (ECDT)
414 /// The table is followed by a null terminated ASCII string that contains
415 /// a fully qualified reference to the name space object.
416 ///
417 typedef struct {
418   EFI_ACPI_DESCRIPTION_HEADER               Header;
419   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    EcControl;
420   EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE    EcData;
421   UINT32                                    Uid;
422   UINT8                                     GpeBit;
423 } EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
424 
425 ///
426 /// ECDT Version (as defined in ACPI 2.0 spec.)
427 ///
428 #define EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION  0x01
429 
430 //
431 // Known table signatures
432 //
433 
434 ///
435 /// "RSD PTR " Root System Description Pointer
436 ///
437 #define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE  SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ')
438 
439 ///
440 /// "SPIC" Multiple SAPIC Description Table
441 ///
442 /// BUGBUG: Don't know where this came from except SR870BN4 uses it.
443 /// #define EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE 0x43495053
444 ///
445 #define EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('A', 'P', 'I', 'C')
446 
447 ///
448 /// "BOOT" MS Simple Boot Spec
449 ///
450 #define EFI_ACPI_2_0_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE  SIGNATURE_32('B', 'O', 'O', 'T')
451 
452 ///
453 /// "DBGP" MS Bebug Port Spec
454 ///
455 #define EFI_ACPI_2_0_DEBUG_PORT_TABLE_SIGNATURE  SIGNATURE_32('D', 'B', 'G', 'P')
456 
457 ///
458 /// "DSDT" Differentiated System Description Table
459 ///
460 #define EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('D', 'S', 'D', 'T')
461 
462 ///
463 /// "ECDT" Embedded Controller Boot Resources Table
464 ///
465 #define EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE  SIGNATURE_32('E', 'C', 'D', 'T')
466 
467 ///
468 /// "ETDT" Event Timer Description Table
469 ///
470 #define EFI_ACPI_2_0_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('E', 'T', 'D', 'T')
471 
472 ///
473 /// "FACS" Firmware ACPI Control Structure
474 ///
475 #define EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE  SIGNATURE_32('F', 'A', 'C', 'S')
476 
477 ///
478 /// "FACP" Fixed ACPI Description Table
479 ///
480 #define EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('F', 'A', 'C', 'P')
481 
482 ///
483 /// "APIC" Multiple APIC Description Table
484 ///
485 #define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('A', 'P', 'I', 'C')
486 
487 ///
488 /// "PSDT" Persistent System Description Table
489 ///
490 #define EFI_ACPI_2_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('P', 'S', 'D', 'T')
491 
492 ///
493 /// "RSDT" Root System Description Table
494 ///
495 #define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('R', 'S', 'D', 'T')
496 
497 ///
498 /// "SBST" Smart Battery Specification Table
499 ///
500 #define EFI_ACPI_2_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE  SIGNATURE_32('S', 'B', 'S', 'T')
501 
502 ///
503 /// "SLIT" System Locality Information Table
504 ///
505 #define EFI_ACPI_2_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE  SIGNATURE_32('S', 'L', 'I', 'T')
506 
507 ///
508 /// "SPCR" Serial Port Console Redirection Table
509 ///
510 #define EFI_ACPI_2_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE  SIGNATURE_32('S', 'P', 'C', 'R')
511 
512 ///
513 /// "SRAT" Static Resource Affinity Table
514 ///
515 #define EFI_ACPI_2_0_STATIC_RESOURCE_AFFINITY_TABLE_SIGNATURE  SIGNATURE_32('S', 'R', 'A', 'T')
516 
517 ///
518 /// "SSDT" Secondary System Description Table
519 ///
520 #define EFI_ACPI_2_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('S', 'S', 'D', 'T')
521 
522 ///
523 /// "SPMI" Server Platform Management Interface Table
524 ///
525 #define EFI_ACPI_2_0_SERVER_PLATFORM_MANAGEMENT_INTERFACE_SIGNATURE  SIGNATURE_32('S', 'P', 'M', 'I')
526 
527 ///
528 /// "XSDT" Extended System Description Table
529 ///
530 #define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('X', 'S', 'D', 'T')
531 
532 ///
533 /// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
534 ///
535 #define EFI_ACPI_2_0_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_SIGNATURE  SIGNATURE_32('M', 'C', 'F', 'G')
536 
537 #pragma pack()
538 
539 #endif
540