2 ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 FILE_LICENCE ( BSD3 );
19 #include <ipxe/efi/IndustryStandard/AcpiAml.h>
22 /// Common table header, this prefaces all ACPI tables, including FACS, but
23 /// excluding the RSD PTR structure.
28 } EFI_ACPI_COMMON_HEADER;
32 /// The common ACPI description table header. This structure prefaces most ACPI tables.
43 UINT32 CreatorRevision;
44 } EFI_ACPI_DESCRIPTION_HEADER;
48 // Define for Desriptor
50 #define ACPI_SMALL_ITEM_FLAG 0x00
51 #define ACPI_LARGE_ITEM_FLAG 0x01
54 // Small Item Descriptor Name
56 #define ACPI_SMALL_IRQ_DESCRIPTOR_NAME 0x04
57 #define ACPI_SMALL_DMA_DESCRIPTOR_NAME 0x05
58 #define ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME 0x06
59 #define ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME 0x07
60 #define ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME 0x08
61 #define ACPI_SMALL_FIXED_IO_PORT_DESCRIPTOR_NAME 0x09
62 #define ACPI_SMALL_VENDOR_DEFINED_DESCRIPTOR_NAME 0x0E
63 #define ACPI_SMALL_END_TAG_DESCRIPTOR_NAME 0x0F
66 // Large Item Descriptor Name
68 #define ACPI_LARGE_24_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x01
69 #define ACPI_LARGE_VENDOR_DEFINED_DESCRIPTOR_NAME 0x04
70 #define ACPI_LARGE_32_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x05
71 #define ACPI_LARGE_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR_NAME 0x06
72 #define ACPI_LARGE_DWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x07
73 #define ACPI_LARGE_WORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x08
74 #define ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME 0x09
75 #define ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x0A
78 // Small Item Descriptor Value
80 #define ACPI_IRQ_NOFLAG_DESCRIPTOR 0x22
81 #define ACPI_IRQ_DESCRIPTOR 0x23
82 #define ACPI_DMA_DESCRIPTOR 0x2A
83 #define ACPI_START_DEPENDENT_DESCRIPTOR 0x30
84 #define ACPI_START_DEPENDENT_EX_DESCRIPTOR 0x31
85 #define ACPI_END_DEPENDENT_DESCRIPTOR 0x38
86 #define ACPI_IO_PORT_DESCRIPTOR 0x47
87 #define ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR 0x4B
88 #define ACPI_END_TAG_DESCRIPTOR 0x79
91 // Large Item Descriptor Value
93 #define ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR 0x81
94 #define ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR 0x85
95 #define ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR 0x86
96 #define ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR 0x87
97 #define ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR 0x88
98 #define ACPI_EXTENDED_INTERRUPT_DESCRIPTOR 0x89
99 #define ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR 0x8A
100 #define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A
105 #define ACPI_ADDRESS_SPACE_TYPE_MEM 0x00
106 #define ACPI_ADDRESS_SPACE_TYPE_IO 0x01
107 #define ACPI_ADDRESS_SPACE_TYPE_BUS 0x02
110 /// Power Management Timer frequency is fixed at 3.579545MHz.
112 #define ACPI_TIMER_FREQUENCY 3579545
115 // Ensure proper structure formats
120 /// The commond definition of QWORD, DWORD, and WORD
121 /// Address Space Descriptors.
123 typedef PACKED struct {
129 UINT64 AddrSpaceGranularity;
132 UINT64 AddrTranslationOffset;
134 } EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
136 typedef PACKED union {
143 } ACPI_SMALL_RESOURCE_HEADER;
145 typedef PACKED struct {
154 } ACPI_LARGE_RESOURCE_HEADER;
159 typedef PACKED struct {
160 ACPI_SMALL_RESOURCE_HEADER Header;
162 } EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR;
167 typedef PACKED struct {
168 ACPI_SMALL_RESOURCE_HEADER Header;
171 } EFI_ACPI_IRQ_DESCRIPTOR;
176 typedef PACKED struct {
177 ACPI_SMALL_RESOURCE_HEADER Header;
180 } EFI_ACPI_DMA_DESCRIPTOR;
183 /// I/O Port Descriptor
185 typedef PACKED struct {
186 ACPI_SMALL_RESOURCE_HEADER Header;
188 UINT16 BaseAddressMin;
189 UINT16 BaseAddressMax;
192 } EFI_ACPI_IO_PORT_DESCRIPTOR;
195 /// Fixed Location I/O Port Descriptor.
197 typedef PACKED struct {
198 ACPI_SMALL_RESOURCE_HEADER Header;
201 } EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR;
204 /// 24-Bit Memory Range Descriptor
206 typedef PACKED struct {
207 ACPI_LARGE_RESOURCE_HEADER Header;
209 UINT16 BaseAddressMin;
210 UINT16 BaseAddressMax;
213 } EFI_ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR;
216 /// 32-Bit Memory Range Descriptor
218 typedef PACKED struct {
219 ACPI_LARGE_RESOURCE_HEADER Header;
221 UINT32 BaseAddressMin;
222 UINT32 BaseAddressMax;
225 } EFI_ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR;
228 /// Fixed 32-Bit Fixed Memory Range Descriptor
230 typedef PACKED struct {
231 ACPI_LARGE_RESOURCE_HEADER Header;
235 } EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR;
238 /// QWORD Address Space Descriptor
240 typedef PACKED struct {
241 ACPI_LARGE_RESOURCE_HEADER Header;
245 UINT64 AddrSpaceGranularity;
248 UINT64 AddrTranslationOffset;
250 } EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR;
253 /// DWORD Address Space Descriptor
255 typedef PACKED struct {
256 ACPI_LARGE_RESOURCE_HEADER Header;
260 UINT32 AddrSpaceGranularity;
263 UINT32 AddrTranslationOffset;
265 } EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR;
268 /// WORD Address Space Descriptor
270 typedef PACKED struct {
271 ACPI_LARGE_RESOURCE_HEADER Header;
275 UINT16 AddrSpaceGranularity;
278 UINT16 AddrTranslationOffset;
280 } EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR;
283 /// Extended Interrupt Descriptor
285 typedef PACKED struct {
286 ACPI_LARGE_RESOURCE_HEADER Header;
287 UINT8 InterruptVectorFlags;
288 UINT8 InterruptTableLength;
289 UINT32 InterruptNumber[1];
290 } EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR;
295 /// The End tag identifies an end of resource data.
300 } EFI_ACPI_END_TAG_DESCRIPTOR;
303 // General use definitions
305 #define EFI_ACPI_RESERVED_BYTE 0x00
306 #define EFI_ACPI_RESERVED_WORD 0x0000
307 #define EFI_ACPI_RESERVED_DWORD 0x00000000
308 #define EFI_ACPI_RESERVED_QWORD 0x0000000000000000
311 // Resource Type Specific Flags
312 // Ref ACPI specification 6.4.3.5.5
314 // Bit [0] : Write Status, _RW
316 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE (1 << 0)
317 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY (0 << 0)
319 // Bit [2:1] : Memory Attributes, _MEM
321 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE (0 << 1)
322 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE (1 << 1)
323 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 1)
324 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE (3 << 1)
326 // Bit [4:3] : Memory Attributes, _MTP
328 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY (0 << 3)
329 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED (1 << 3)
330 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI (2 << 3)
331 #define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS (3 << 3)
333 // Bit [5] : Memory to I/O Translation, _TTP
335 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION (1 << 5)
336 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC (0 << 5)
340 // Ref ACPI specification 6.4.2.1
342 #define EFI_ACPI_IRQ_SHARABLE_MASK 0x10
343 #define EFI_ACPI_IRQ_SHARABLE 0x10
345 #define EFI_ACPI_IRQ_POLARITY_MASK 0x08
346 #define EFI_ACPI_IRQ_HIGH_TRUE 0x00
347 #define EFI_ACPI_IRQ_LOW_FALSE 0x08
349 #define EFI_ACPI_IRQ_MODE 0x01
350 #define EFI_ACPI_IRQ_LEVEL_TRIGGERED 0x00
351 #define EFI_ACPI_IRQ_EDGE_TRIGGERED 0x01
355 // Ref ACPI specification 6.4.2.2
357 #define EFI_ACPI_DMA_SPEED_TYPE_MASK 0x60
358 #define EFI_ACPI_DMA_SPEED_TYPE_COMPATIBILITY 0x00
359 #define EFI_ACPI_DMA_SPEED_TYPE_A 0x20
360 #define EFI_ACPI_DMA_SPEED_TYPE_B 0x40
361 #define EFI_ACPI_DMA_SPEED_TYPE_F 0x60
363 #define EFI_ACPI_DMA_BUS_MASTER_MASK 0x04
364 #define EFI_ACPI_DMA_BUS_MASTER 0x04
366 #define EFI_ACPI_DMA_TRANSFER_TYPE_MASK 0x03
367 #define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x00
368 #define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT 0x01
369 #define EFI_ACPI_DMA_TRANSFER_TYPE_16_BIT 0x10
373 // Ref ACPI specification 6.4.2.5
375 #define EFI_ACPI_IO_DECODE_MASK 0x01
376 #define EFI_ACPI_IO_DECODE_16_BIT 0x01
377 #define EFI_ACPI_IO_DECODE_10_BIT 0x00
380 // Memory Information
381 // Ref ACPI specification 6.4.3.4
383 #define EFI_ACPI_MEMORY_WRITE_STATUS_MASK 0x01
384 #define EFI_ACPI_MEMORY_WRITABLE 0x01
385 #define EFI_ACPI_MEMORY_NON_WRITABLE 0x00
388 // Ensure proper structure formats
392 // ACPI 1.0b table structures
396 /// Root System Description Pointer Structure.
404 } EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
407 // Root System Description Table
408 // No definition needed as it is a common description table header, the same with
409 // EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT32 table pointers.
413 /// RSDT Revision (as defined in ACPI 1.0b specification).
415 #define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
418 /// Fixed ACPI Description Table Structure (FADT).
421 EFI_ACPI_DESCRIPTION_HEADER Header;
461 } EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE;
464 /// FADT Version (as defined in ACPI 1.0b specification).
466 #define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x01
468 #define EFI_ACPI_1_0_INT_MODE_DUAL_PIC 0
469 #define EFI_ACPI_1_0_INT_MODE_MULTIPLE_APIC 1
472 // Fixed ACPI Description Table Fixed Feature Flags
473 // All other bits are reserved and must be set to 0.
475 #define EFI_ACPI_1_0_WBINVD BIT0
476 #define EFI_ACPI_1_0_WBINVD_FLUSH BIT1
477 #define EFI_ACPI_1_0_PROC_C1 BIT2
478 #define EFI_ACPI_1_0_P_LVL2_UP BIT3
479 #define EFI_ACPI_1_0_PWR_BUTTON BIT4
480 #define EFI_ACPI_1_0_SLP_BUTTON BIT5
481 #define EFI_ACPI_1_0_FIX_RTC BIT6
482 #define EFI_ACPI_1_0_RTC_S4 BIT7
483 #define EFI_ACPI_1_0_TMR_VAL_EXT BIT8
484 #define EFI_ACPI_1_0_DCK_CAP BIT9
487 /// Firmware ACPI Control Structure.
492 UINT32 HardwareSignature;
493 UINT32 FirmwareWakingVector;
497 } EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
500 /// Firmware Control Structure Feature Flags.
501 /// All other bits are reserved and must be set to 0.
503 #define EFI_ACPI_1_0_S4BIOS_F BIT0
506 /// Multiple APIC Description Table header definition. The rest of the table
507 /// must be defined in a platform-specific manner.
510 EFI_ACPI_DESCRIPTION_HEADER Header;
511 UINT32 LocalApicAddress;
513 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
516 /// MADT Revision (as defined in ACPI 1.0b specification).
518 #define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
521 /// Multiple APIC Flags
522 /// All other bits are reserved and must be set to 0.
524 #define EFI_ACPI_1_0_PCAT_COMPAT BIT0
527 // Multiple APIC Description Table APIC structure types
528 // All other values between 0x05 an 0xFF are reserved and
529 // will be ignored by OSPM.
531 #define EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC 0x00
532 #define EFI_ACPI_1_0_IO_APIC 0x01
533 #define EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE 0x02
534 #define EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
535 #define EFI_ACPI_1_0_LOCAL_APIC_NMI 0x04
538 // APIC Structure Definitions
542 /// Processor Local APIC Structure Definition.
547 UINT8 AcpiProcessorId;
550 } EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
553 /// Local APIC Flags. All other bits are reserved and must be 0.
555 #define EFI_ACPI_1_0_LOCAL_APIC_ENABLED BIT0
558 /// IO APIC Structure.
565 UINT32 IoApicAddress;
566 UINT32 SystemVectorBase;
567 } EFI_ACPI_1_0_IO_APIC_STRUCTURE;
570 /// Interrupt Source Override Structure.
577 UINT32 GlobalSystemInterruptVector;
579 } EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
582 /// Non-Maskable Interrupt Source Structure.
588 UINT32 GlobalSystemInterruptVector;
589 } EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
592 /// Local APIC NMI Structure.
597 UINT8 AcpiProcessorId;
600 } EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE;
603 /// Smart Battery Description Table (SBST)
606 EFI_ACPI_DESCRIPTION_HEADER Header;
607 UINT32 WarningEnergyLevel;
608 UINT32 LowEnergyLevel;
609 UINT32 CriticalEnergyLevel;
610 } EFI_ACPI_1_0_SMART_BATTERY_DESCRIPTION_TABLE;
613 // Known table signatures
617 /// "RSD PTR " Root System Description Pointer.
619 #define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ')
622 /// "APIC" Multiple APIC Description Table.
624 #define EFI_ACPI_1_0_APIC_SIGNATURE SIGNATURE_32('A', 'P', 'I', 'C')
627 /// "DSDT" Differentiated System Description Table.
629 #define EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('D', 'S', 'D', 'T')
632 /// "FACS" Firmware ACPI Control Structure.
634 #define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE SIGNATURE_32('F', 'A', 'C', 'S')
637 /// "FACP" Fixed ACPI Description Table.
639 #define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('F', 'A', 'C', 'P')
642 /// "PSDT" Persistent System Description Table.
644 #define EFI_ACPI_1_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('P', 'S', 'D', 'T')
647 /// "RSDT" Root System Description Table.
649 #define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('R', 'S', 'D', 'T')
652 /// "SBST" Smart Battery Specification Table.
654 #define EFI_ACPI_1_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE SIGNATURE_32('S', 'B', 'S', 'T')
657 /// "SSDT" Secondary System Description Table.
659 #define EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('S', 'S', 'D', 'T')