2 ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <IndustryStandard/AcpiAml.h>
15 /// Common table header, this prefaces all ACPI tables, including FACS, but
16 /// excluding the RSD PTR structure.
21 } EFI_ACPI_COMMON_HEADER
;
25 /// The common ACPI description table header. This structure prefaces most ACPI tables.
36 UINT32 CreatorRevision
;
37 } EFI_ACPI_DESCRIPTION_HEADER
;
41 // Define for Descriptor
43 #define ACPI_SMALL_ITEM_FLAG 0x00
44 #define ACPI_LARGE_ITEM_FLAG 0x01
47 // Small Item Descriptor Name
49 #define ACPI_SMALL_IRQ_DESCRIPTOR_NAME 0x04
50 #define ACPI_SMALL_DMA_DESCRIPTOR_NAME 0x05
51 #define ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME 0x06
52 #define ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME 0x07
53 #define ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME 0x08
54 #define ACPI_SMALL_FIXED_IO_PORT_DESCRIPTOR_NAME 0x09
55 #define ACPI_SMALL_VENDOR_DEFINED_DESCRIPTOR_NAME 0x0E
56 #define ACPI_SMALL_END_TAG_DESCRIPTOR_NAME 0x0F
59 // Large Item Descriptor Name
61 #define ACPI_LARGE_24_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x01
62 #define ACPI_LARGE_VENDOR_DEFINED_DESCRIPTOR_NAME 0x04
63 #define ACPI_LARGE_32_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x05
64 #define ACPI_LARGE_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR_NAME 0x06
65 #define ACPI_LARGE_DWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x07
66 #define ACPI_LARGE_WORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x08
67 #define ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME 0x09
68 #define ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x0A
71 // Small Item Descriptor Value
73 #define ACPI_IRQ_NOFLAG_DESCRIPTOR 0x22
74 #define ACPI_IRQ_DESCRIPTOR 0x23
75 #define ACPI_DMA_DESCRIPTOR 0x2A
76 #define ACPI_START_DEPENDENT_DESCRIPTOR 0x30
77 #define ACPI_START_DEPENDENT_EX_DESCRIPTOR 0x31
78 #define ACPI_END_DEPENDENT_DESCRIPTOR 0x38
79 #define ACPI_IO_PORT_DESCRIPTOR 0x47
80 #define ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR 0x4B
81 #define ACPI_END_TAG_DESCRIPTOR 0x79
84 // Large Item Descriptor Value
86 #define ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR 0x81
87 #define ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR 0x85
88 #define ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR 0x86
89 #define ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR 0x87
90 #define ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR 0x88
91 #define ACPI_EXTENDED_INTERRUPT_DESCRIPTOR 0x89
92 #define ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR 0x8A
93 #define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A
98 #define ACPI_ADDRESS_SPACE_TYPE_MEM 0x00
99 #define ACPI_ADDRESS_SPACE_TYPE_IO 0x01
100 #define ACPI_ADDRESS_SPACE_TYPE_BUS 0x02
103 /// Power Management Timer frequency is fixed at 3.579545MHz.
105 #define ACPI_TIMER_FREQUENCY 3579545
108 // Ensure proper structure formats
113 /// The common definition of QWORD, DWORD, and WORD
114 /// Address Space Descriptors.
116 typedef PACKED
struct {
122 UINT64 AddrSpaceGranularity
;
125 UINT64 AddrTranslationOffset
;
127 } EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
;
129 typedef PACKED
union {
136 } ACPI_SMALL_RESOURCE_HEADER
;
138 typedef PACKED
struct {
147 } ACPI_LARGE_RESOURCE_HEADER
;
152 typedef PACKED
struct {
153 ACPI_SMALL_RESOURCE_HEADER Header
;
155 } EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR
;
160 typedef PACKED
struct {
161 ACPI_SMALL_RESOURCE_HEADER Header
;
164 } EFI_ACPI_IRQ_DESCRIPTOR
;
169 typedef PACKED
struct {
170 ACPI_SMALL_RESOURCE_HEADER Header
;
173 } EFI_ACPI_DMA_DESCRIPTOR
;
176 /// I/O Port Descriptor
178 typedef PACKED
struct {
179 ACPI_SMALL_RESOURCE_HEADER Header
;
181 UINT16 BaseAddressMin
;
182 UINT16 BaseAddressMax
;
185 } EFI_ACPI_IO_PORT_DESCRIPTOR
;
188 /// Fixed Location I/O Port Descriptor.
190 typedef PACKED
struct {
191 ACPI_SMALL_RESOURCE_HEADER Header
;
194 } EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR
;
197 /// 24-Bit Memory Range Descriptor
199 typedef PACKED
struct {
200 ACPI_LARGE_RESOURCE_HEADER Header
;
202 UINT16 BaseAddressMin
;
203 UINT16 BaseAddressMax
;
206 } EFI_ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR
;
209 /// 32-Bit Memory Range Descriptor
211 typedef PACKED
struct {
212 ACPI_LARGE_RESOURCE_HEADER Header
;
214 UINT32 BaseAddressMin
;
215 UINT32 BaseAddressMax
;
218 } EFI_ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR
;
221 /// Fixed 32-Bit Fixed Memory Range Descriptor
223 typedef PACKED
struct {
224 ACPI_LARGE_RESOURCE_HEADER Header
;
228 } EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR
;
231 /// QWORD Address Space Descriptor
233 typedef PACKED
struct {
234 ACPI_LARGE_RESOURCE_HEADER Header
;
238 UINT64 AddrSpaceGranularity
;
241 UINT64 AddrTranslationOffset
;
243 } EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR
;
246 /// DWORD Address Space Descriptor
248 typedef PACKED
struct {
249 ACPI_LARGE_RESOURCE_HEADER Header
;
253 UINT32 AddrSpaceGranularity
;
256 UINT32 AddrTranslationOffset
;
258 } EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR
;
261 /// WORD Address Space Descriptor
263 typedef PACKED
struct {
264 ACPI_LARGE_RESOURCE_HEADER Header
;
268 UINT16 AddrSpaceGranularity
;
271 UINT16 AddrTranslationOffset
;
273 } EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR
;
276 /// Extended Interrupt Descriptor
278 typedef PACKED
struct {
279 ACPI_LARGE_RESOURCE_HEADER Header
;
280 UINT8 InterruptVectorFlags
;
281 UINT8 InterruptTableLength
;
282 UINT32 InterruptNumber
[1];
283 } EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR
;
288 /// The End tag identifies an end of resource data.
293 } EFI_ACPI_END_TAG_DESCRIPTOR
;
296 // General use definitions
298 #define EFI_ACPI_RESERVED_BYTE 0x00
299 #define EFI_ACPI_RESERVED_WORD 0x0000
300 #define EFI_ACPI_RESERVED_DWORD 0x00000000
301 #define EFI_ACPI_RESERVED_QWORD 0x0000000000000000
304 // Resource Type Specific Flags
305 // Ref ACPI specification 6.4.3.5.5
307 // Bit [0] : Write Status, _RW
309 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE (1 << 0)
310 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY (0 << 0)
312 // Bit [2:1] : Memory Attributes, _MEM
314 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE (0 << 1)
315 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE (1 << 1)
316 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 1)
317 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE (3 << 1)
319 // Bit [4:3] : Memory Attributes, _MTP
321 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY (0 << 3)
322 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED (1 << 3)
323 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI (2 << 3)
324 #define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS (3 << 3)
326 // Bit [5] : Memory to I/O Translation, _TTP
328 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION (1 << 5)
329 #define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC (0 << 5)
333 // Ref ACPI specification 6.4.2.1
335 #define EFI_ACPI_IRQ_SHARABLE_MASK 0x10
336 #define EFI_ACPI_IRQ_SHARABLE 0x10
338 #define EFI_ACPI_IRQ_POLARITY_MASK 0x08
339 #define EFI_ACPI_IRQ_HIGH_TRUE 0x00
340 #define EFI_ACPI_IRQ_LOW_FALSE 0x08
342 #define EFI_ACPI_IRQ_MODE 0x01
343 #define EFI_ACPI_IRQ_LEVEL_TRIGGERED 0x00
344 #define EFI_ACPI_IRQ_EDGE_TRIGGERED 0x01
348 // Ref ACPI specification 6.4.2.2
350 #define EFI_ACPI_DMA_SPEED_TYPE_MASK 0x60
351 #define EFI_ACPI_DMA_SPEED_TYPE_COMPATIBILITY 0x00
352 #define EFI_ACPI_DMA_SPEED_TYPE_A 0x20
353 #define EFI_ACPI_DMA_SPEED_TYPE_B 0x40
354 #define EFI_ACPI_DMA_SPEED_TYPE_F 0x60
356 #define EFI_ACPI_DMA_BUS_MASTER_MASK 0x04
357 #define EFI_ACPI_DMA_BUS_MASTER 0x04
359 #define EFI_ACPI_DMA_TRANSFER_TYPE_MASK 0x03
360 #define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x00
361 #define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT 0x01
362 #define EFI_ACPI_DMA_TRANSFER_TYPE_16_BIT 0x02
366 // Ref ACPI specification 6.4.2.5
368 #define EFI_ACPI_IO_DECODE_MASK 0x01
369 #define EFI_ACPI_IO_DECODE_16_BIT 0x01
370 #define EFI_ACPI_IO_DECODE_10_BIT 0x00
373 // Memory Information
374 // Ref ACPI specification 6.4.3.4
376 #define EFI_ACPI_MEMORY_WRITE_STATUS_MASK 0x01
377 #define EFI_ACPI_MEMORY_WRITABLE 0x01
378 #define EFI_ACPI_MEMORY_NON_WRITABLE 0x00
381 // Interrupt Vector Flags definitions for Extended Interrupt Descriptor
382 // Ref ACPI specification 6.4.3.6
384 #define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK BIT0
385 #define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_MODE_MASK BIT1
386 #define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_POLARITY_MASK BIT2
387 #define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK BIT3
388 #define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_WAKE_CAPABLITY_MASK BIT4
391 // Ensure proper structure formats
395 // ACPI 1.0b table structures
399 /// Root System Description Pointer Structure.
407 } EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER
;
410 // Root System Description Table
411 // No definition needed as it is a common description table header, the same with
412 // EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT32 table pointers.
416 /// RSDT Revision (as defined in ACPI 1.0b specification).
418 #define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
421 /// Fixed ACPI Description Table Structure (FADT).
424 EFI_ACPI_DESCRIPTION_HEADER Header
;
464 } EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE
;
467 /// FADT Version (as defined in ACPI 1.0b specification).
469 #define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x01
471 #define EFI_ACPI_1_0_INT_MODE_DUAL_PIC 0
472 #define EFI_ACPI_1_0_INT_MODE_MULTIPLE_APIC 1
475 // Fixed ACPI Description Table Fixed Feature Flags
476 // All other bits are reserved and must be set to 0.
478 #define EFI_ACPI_1_0_WBINVD BIT0
479 #define EFI_ACPI_1_0_WBINVD_FLUSH BIT1
480 #define EFI_ACPI_1_0_PROC_C1 BIT2
481 #define EFI_ACPI_1_0_P_LVL2_UP BIT3
482 #define EFI_ACPI_1_0_PWR_BUTTON BIT4
483 #define EFI_ACPI_1_0_SLP_BUTTON BIT5
484 #define EFI_ACPI_1_0_FIX_RTC BIT6
485 #define EFI_ACPI_1_0_RTC_S4 BIT7
486 #define EFI_ACPI_1_0_TMR_VAL_EXT BIT8
487 #define EFI_ACPI_1_0_DCK_CAP BIT9
490 /// Firmware ACPI Control Structure.
495 UINT32 HardwareSignature
;
496 UINT32 FirmwareWakingVector
;
500 } EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE
;
503 /// Firmware Control Structure Feature Flags.
504 /// All other bits are reserved and must be set to 0.
506 #define EFI_ACPI_1_0_S4BIOS_F BIT0
509 /// Multiple APIC Description Table header definition. The rest of the table
510 /// must be defined in a platform-specific manner.
513 EFI_ACPI_DESCRIPTION_HEADER Header
;
514 UINT32 LocalApicAddress
;
516 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER
;
519 /// MADT Revision (as defined in ACPI 1.0b specification).
521 #define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
524 /// Multiple APIC Flags
525 /// All other bits are reserved and must be set to 0.
527 #define EFI_ACPI_1_0_PCAT_COMPAT BIT0
530 // Multiple APIC Description Table APIC structure types
531 // All other values between 0x05 an 0xFF are reserved and
532 // will be ignored by OSPM.
534 #define EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC 0x00
535 #define EFI_ACPI_1_0_IO_APIC 0x01
536 #define EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE 0x02
537 #define EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
538 #define EFI_ACPI_1_0_LOCAL_APIC_NMI 0x04
541 // APIC Structure Definitions
545 /// Processor Local APIC Structure Definition.
550 UINT8 AcpiProcessorId
;
553 } EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE
;
556 /// Local APIC Flags. All other bits are reserved and must be 0.
558 #define EFI_ACPI_1_0_LOCAL_APIC_ENABLED BIT0
561 /// IO APIC Structure.
568 UINT32 IoApicAddress
;
569 UINT32 SystemVectorBase
;
570 } EFI_ACPI_1_0_IO_APIC_STRUCTURE
;
573 /// Interrupt Source Override Structure.
580 UINT32 GlobalSystemInterruptVector
;
582 } EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE
;
585 /// Non-Maskable Interrupt Source Structure.
591 UINT32 GlobalSystemInterruptVector
;
592 } EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE
;
595 /// Local APIC NMI Structure.
600 UINT8 AcpiProcessorId
;
603 } EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE
;
606 /// Smart Battery Description Table (SBST)
609 EFI_ACPI_DESCRIPTION_HEADER Header
;
610 UINT32 WarningEnergyLevel
;
611 UINT32 LowEnergyLevel
;
612 UINT32 CriticalEnergyLevel
;
613 } EFI_ACPI_1_0_SMART_BATTERY_DESCRIPTION_TABLE
;
616 // Known table signatures
620 /// "RSD PTR " Root System Description Pointer.
622 #define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ')
625 /// "APIC" Multiple APIC Description Table.
627 #define EFI_ACPI_1_0_APIC_SIGNATURE SIGNATURE_32('A', 'P', 'I', 'C')
630 /// "DSDT" Differentiated System Description Table.
632 #define EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('D', 'S', 'D', 'T')
635 /// "FACS" Firmware ACPI Control Structure.
637 #define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE SIGNATURE_32('F', 'A', 'C', 'S')
640 /// "FACP" Fixed ACPI Description Table.
642 #define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('F', 'A', 'C', 'P')
645 /// "PSDT" Persistent System Description Table.
647 #define EFI_ACPI_1_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('P', 'S', 'D', 'T')
650 /// "RSDT" Root System Description Table.
652 #define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('R', 'S', 'D', 'T')
655 /// "SBST" Smart Battery Specification Table.
657 #define EFI_ACPI_1_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE SIGNATURE_32('S', 'B', 'S', 'T')
660 /// "SSDT" Secondary System Description Table.
662 #define EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('S', 'S', 'D', 'T')