| 1 |
|
| 2 | |
| 3 | *
|
| 4 | * Name: actbl.h - Basic ACPI Table Definitions
|
| 5 | *
|
| 6 | * Copyright (C) 2000 - 2026, Intel Corp.
|
| 7 | *
|
| 8 | ****************************************************************************
|
| 9 |
|
| 10 | #ifndef __ACTBL_H__
|
| 11 | #define __ACTBL_H__
|
| 12 |
|
| 13 | |
| 14 | *
|
| 15 | * Fundamental ACPI tables
|
| 16 | *
|
| 17 | * This file contains definitions for the ACPI tables that are directly consumed
|
| 18 | * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related
|
| 19 | * device drivers and other OS support code.
|
| 20 | *
|
| 21 | * The RSDP and FACS do not use the common ACPI table header. All other ACPI
|
| 22 | * tables use the header.
|
| 23 | *
|
| 24 | *****************************************************************************
|
| 25 |
|
| 26 | |
| 27 | * Values for description table header signatures for tables defined in this
|
| 28 | * file. Useful because they make it more difficult to inadvertently type in
|
| 29 | * the wrong signature.
|
| 30 |
|
| 31 | #define ACPI_SIG_DSDT "DSDT"
|
| 32 | #define ACPI_SIG_FADT "FACP"
|
| 33 | #define ACPI_SIG_FACS "FACS"
|
| 34 | #define ACPI_SIG_OSDT "OSDT"
|
| 35 | #define ACPI_SIG_PSDT "PSDT"
|
| 36 | #define ACPI_SIG_RSDP "RSD PTR "
|
| 37 | #define ACPI_SIG_RSDT "RSDT"
|
| 38 | #define ACPI_SIG_XSDT "XSDT"
|
| 39 | #define ACPI_SIG_SSDT "SSDT"
|
| 40 | #define ACPI_RSDP_NAME "RSDP"
|
| 41 | #define ACPI_OEM_NAME "OEM"
|
| 42 |
|
| 43 | |
| 44 | * All tables and structures must be byte-packed to match the ACPI
|
| 45 | * specification, since the tables are provided by the system BIOS
|
| 46 |
|
| 47 | #pragma pack(1)
|
| 48 |
|
| 49 | |
| 50 | * Note: C bitfields are not used for this reason:
|
| 51 | *
|
| 52 | * "Bitfields are great and easy to read, but unfortunately the C language
|
| 53 | * does not specify the layout of bitfields in memory, which means they are
|
| 54 | * essentially useless for dealing with packed data in on-disk formats or
|
| 55 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
|
| 56 | * this decision was a design error in C. Ritchie could have picked an order
|
| 57 | * and stuck with it." Norman Ramsey.
|
| 58 | * See http://stackoverflow.com/a/1053662/41661
|
| 59 |
|
| 60 |
|
| 61 | |
| 62 | *
|
| 63 | * Master ACPI Table Header. This common header is used by all ACPI tables
|
| 64 | * except the RSDP and FACS.
|
| 65 | *
|
| 66 | *****************************************************************************
|
| 67 |
|
| 68 | struct acpi_table_header {
|
| 69 | char signature[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
|
| 70 | u32 length;
|
| 71 | u8 revision;
|
| 72 | u8 checksum;
|
| 73 | char oem_id[ACPI_OEM_ID_SIZE] ACPI_NONSTRING;
|
| 74 | char oem_table_id[ACPI_OEM_TABLE_ID_SIZE] ACPI_NONSTRING;
|
| 75 | u32 oem_revision;
|
| 76 | char asl_compiler_id[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
|
| 77 | u32 asl_compiler_revision;
|
| 78 | };
|
| 79 |
|
| 80 | |
| 81 | *
|
| 82 | * GAS - Generic Address Structure (ACPI 2.0+)
|
| 83 | *
|
| 84 | * Note: Since this structure is used in the ACPI tables, it is byte aligned.
|
| 85 | * If misaligned access is not supported by the hardware, accesses to the
|
| 86 | * 64-bit Address field must be performed with care.
|
| 87 | *
|
| 88 | *****************************************************************************
|
| 89 |
|
| 90 | struct acpi_generic_address {
|
| 91 | u8 space_id;
|
| 92 | u8 bit_width;
|
| 93 | u8 bit_offset;
|
| 94 | u8 access_width;
|
| 95 | u64 address;
|
| 96 | };
|
| 97 |
|
| 98 | |
| 99 | *
|
| 100 | * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
|
| 101 | * Version 2
|
| 102 | *
|
| 103 | *****************************************************************************
|
| 104 |
|
| 105 | struct acpi_table_rsdp {
|
| 106 | char signature[8];
|
| 107 | u8 checksum;
|
| 108 | char oem_id[ACPI_OEM_ID_SIZE];
|
| 109 | u8 revision;
|
| 110 | u32 rsdt_physical_address;
|
| 111 | u32 length;
|
| 112 | u64 xsdt_physical_address;
|
| 113 | u8 extended_checksum;
|
| 114 | u8 reserved[3];
|
| 115 | };
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 | struct acpi_rsdp_common {
|
| 120 | char signature[8];
|
| 121 | u8 checksum;
|
| 122 | char oem_id[ACPI_OEM_ID_SIZE];
|
| 123 | u8 revision;
|
| 124 | u32 rsdt_physical_address;
|
| 125 | };
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 | struct acpi_rsdp_extension {
|
| 130 | u32 length;
|
| 131 | u64 xsdt_physical_address;
|
| 132 | u8 extended_checksum;
|
| 133 | u8 reserved[3];
|
| 134 | };
|
| 135 |
|
| 136 | |
| 137 | *
|
| 138 | * RSDT/XSDT - Root System Description Tables
|
| 139 | * Version 1 (both)
|
| 140 | *
|
| 141 | *****************************************************************************
|
| 142 |
|
| 143 | struct acpi_table_rsdt {
|
| 144 | struct acpi_table_header header;
|
| 145 | u32 table_offset_entry[1];
|
| 146 | };
|
| 147 |
|
| 148 | struct acpi_table_xsdt {
|
| 149 | struct acpi_table_header header;
|
| 150 | u64 table_offset_entry[1];
|
| 151 | };
|
| 152 |
|
| 153 | #define ACPI_RSDT_ENTRY_SIZE (sizeof (u32))
|
| 154 | #define ACPI_XSDT_ENTRY_SIZE (sizeof (u64))
|
| 155 |
|
| 156 | |
| 157 | *
|
| 158 | * FACS - Firmware ACPI Control Structure (FACS)
|
| 159 | *
|
| 160 | *****************************************************************************
|
| 161 |
|
| 162 | struct acpi_table_facs {
|
| 163 | char signature[4];
|
| 164 | u32 length;
|
| 165 | u32 hardware_signature;
|
| 166 | u32 firmware_waking_vector;
|
| 167 | u32 global_lock;
|
| 168 | u32 flags;
|
| 169 | u64 xfirmware_waking_vector;
|
| 170 | u8 version;
|
| 171 | u8 reserved[3];
|
| 172 | u32 ospm_flags;
|
| 173 | u8 reserved1[24];
|
| 174 | };
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 | #define ACPI_GLOCK_PENDING (1)
|
| 179 | #define ACPI_GLOCK_OWNED (1<<1)
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 | #define ACPI_FACS_S4_BIOS_PRESENT (1)
|
| 184 | #define ACPI_FACS_64BIT_WAKE (1<<1)
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 | #define ACPI_FACS_64BIT_ENVIRONMENT (1)
|
| 189 |
|
| 190 | |
| 191 | *
|
| 192 | * FADT - Fixed ACPI Description Table (Signature "FACP")
|
| 193 | * Version 6
|
| 194 | *
|
| 195 | *****************************************************************************
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 | struct acpi_table_fadt {
|
| 200 | struct acpi_table_header header;
|
| 201 | u32 facs;
|
| 202 | u32 dsdt;
|
| 203 | u8 model;
|
| 204 | u8 preferred_profile;
|
| 205 | u16 sci_interrupt;
|
| 206 | u32 smi_command;
|
| 207 | u8 acpi_enable;
|
| 208 | u8 acpi_disable;
|
| 209 | u8 s4_bios_request;
|
| 210 | u8 pstate_control;
|
| 211 | u32 pm1a_event_block;
|
| 212 | u32 pm1b_event_block;
|
| 213 | u32 pm1a_control_block;
|
| 214 | u32 pm1b_control_block;
|
| 215 | u32 pm2_control_block;
|
| 216 | u32 pm_timer_block;
|
| 217 | u32 gpe0_block;
|
| 218 | u32 gpe1_block;
|
| 219 | u8 pm1_event_length;
|
| 220 | u8 pm1_control_length;
|
| 221 | u8 pm2_control_length;
|
| 222 | u8 pm_timer_length;
|
| 223 | u8 gpe0_block_length;
|
| 224 | u8 gpe1_block_length;
|
| 225 | u8 gpe1_base;
|
| 226 | u8 cst_control;
|
| 227 | u16 c2_latency;
|
| 228 | u16 c3_latency;
|
| 229 | u16 flush_size;
|
| 230 | u16 flush_stride;
|
| 231 | u8 duty_offset;
|
| 232 | u8 duty_width;
|
| 233 | u8 day_alarm;
|
| 234 | u8 month_alarm;
|
| 235 | u8 century;
|
| 236 | u16 boot_flags;
|
| 237 | u8 reserved;
|
| 238 | u32 flags;
|
| 239 | struct acpi_generic_address reset_register;
|
| 240 | u8 reset_value;
|
| 241 | u16 arm_boot_flags;
|
| 242 | u8 minor_revision;
|
| 243 | u64 Xfacs;
|
| 244 | u64 Xdsdt;
|
| 245 | struct acpi_generic_address xpm1a_event_block;
|
| 246 | struct acpi_generic_address xpm1b_event_block;
|
| 247 | struct acpi_generic_address xpm1a_control_block;
|
| 248 | struct acpi_generic_address xpm1b_control_block;
|
| 249 | struct acpi_generic_address xpm2_control_block;
|
| 250 | struct acpi_generic_address xpm_timer_block;
|
| 251 | struct acpi_generic_address xgpe0_block;
|
| 252 | struct acpi_generic_address xgpe1_block;
|
| 253 | struct acpi_generic_address sleep_control;
|
| 254 | struct acpi_generic_address sleep_status;
|
| 255 | u64 hypervisor_id;
|
| 256 | };
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 | #define ACPI_FADT_LEGACY_DEVICES (1)
|
| 261 | #define ACPI_FADT_8042 (1<<1)
|
| 262 | #define ACPI_FADT_NO_VGA (1<<2)
|
| 263 | #define ACPI_FADT_NO_MSI (1<<3)
|
| 264 | #define ACPI_FADT_NO_ASPM (1<<4)
|
| 265 | #define ACPI_FADT_NO_CMOS_RTC (1<<5)
|
| 266 |
|
| 267 | #define FADT2_REVISION_ID 3
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 | #define ACPI_FADT_PSCI_COMPLIANT (1)
|
| 272 | #define ACPI_FADT_PSCI_USE_HVC (1<<1)
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 | #define ACPI_FADT_WBINVD (1)
|
| 277 | #define ACPI_FADT_WBINVD_FLUSH (1<<1)
|
| 278 | #define ACPI_FADT_C1_SUPPORTED (1<<2)
|
| 279 | #define ACPI_FADT_C2_MP_SUPPORTED (1<<3)
|
| 280 | #define ACPI_FADT_POWER_BUTTON (1<<4)
|
| 281 | #define ACPI_FADT_SLEEP_BUTTON (1<<5)
|
| 282 | #define ACPI_FADT_FIXED_RTC (1<<6)
|
| 283 | #define ACPI_FADT_S4_RTC_WAKE (1<<7)
|
| 284 | #define ACPI_FADT_32BIT_TIMER (1<<8)
|
| 285 | #define ACPI_FADT_DOCKING_SUPPORTED (1<<9)
|
| 286 | #define ACPI_FADT_RESET_REGISTER (1<<10)
|
| 287 | #define ACPI_FADT_SEALED_CASE (1<<11)
|
| 288 | #define ACPI_FADT_HEADLESS (1<<12)
|
| 289 | #define ACPI_FADT_SLEEP_TYPE (1<<13)
|
| 290 | #define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14)
|
| 291 | #define ACPI_FADT_PLATFORM_CLOCK (1<<15)
|
| 292 | #define ACPI_FADT_S4_RTC_VALID (1<<16)
|
| 293 | #define ACPI_FADT_REMOTE_POWER_ON (1<<17)
|
| 294 | #define ACPI_FADT_APIC_CLUSTER (1<<18)
|
| 295 | #define ACPI_FADT_APIC_PHYSICAL (1<<19)
|
| 296 | #define ACPI_FADT_HW_REDUCED (1<<20)
|
| 297 | #define ACPI_FADT_LOW_POWER_S0 (1<<21)
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 | enum acpi_preferred_pm_profiles {
|
| 302 | PM_UNSPECIFIED = 0,
|
| 303 | PM_DESKTOP = 1,
|
| 304 | PM_MOBILE = 2,
|
| 305 | PM_WORKSTATION = 3,
|
| 306 | PM_ENTERPRISE_SERVER = 4,
|
| 307 | PM_SOHO_SERVER = 5,
|
| 308 | PM_APPLIANCE_PC = 6,
|
| 309 | PM_PERFORMANCE_SERVER = 7,
|
| 310 | PM_TABLET = 8,
|
| 311 | NR_PM_PROFILES = 9
|
| 312 | };
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 | #define ACPI_X_WAKE_STATUS 0x80
|
| 317 | #define ACPI_X_SLEEP_TYPE_MASK 0x1C
|
| 318 | #define ACPI_X_SLEEP_TYPE_POSITION 0x02
|
| 319 | #define ACPI_X_SLEEP_ENABLE 0x20
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 | #pragma pack()
|
| 324 |
|
| 325 | |
| 326 | * Internal table-related structures
|
| 327 |
|
| 328 | union acpi_name_union {
|
| 329 | u32 integer;
|
| 330 | char ascii[4];
|
| 331 | };
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 | struct acpi_table_desc {
|
| 336 | acpi_physical_address address;
|
| 337 | struct acpi_table_header *pointer;
|
| 338 | u32 length;
|
| 339 | union acpi_name_union signature;
|
| 340 | acpi_owner_id owner_id;
|
| 341 | u8 flags;
|
| 342 | u16 validation_count;
|
| 343 | };
|
| 344 |
|
| 345 | |
| 346 | * Maximum value of the validation_count field in struct acpi_table_desc.
|
| 347 | * When reached, validation_count cannot be changed any more and the table will
|
| 348 | * be permanently regarded as validated.
|
| 349 | *
|
| 350 | * This is to prevent situations in which unbalanced table get/put operations
|
| 351 | * may cause premature table unmapping in the OS to happen.
|
| 352 | *
|
| 353 | * The maximum validation count can be defined to any value, but should be
|
| 354 | * greater than the maximum number of OS early stage mapping slots to avoid
|
| 355 | * leaking early stage table mappings to the late stage.
|
| 356 |
|
| 357 | #define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 | #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0)
|
| 362 | #define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1)
|
| 363 | #define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2)
|
| 364 | #define ACPI_TABLE_ORIGIN_MASK (3)
|
| 365 | #define ACPI_TABLE_IS_VERIFIED (4)
|
| 366 | #define ACPI_TABLE_IS_LOADED (8)
|
| 367 |
|
| 368 | |
| 369 | * Get the remaining ACPI tables
|
| 370 |
|
| 371 | #include <acpi/actbl1.h>
|
| 372 | #include <acpi/actbl2.h>
|
| 373 | #include <acpi/actbl3.h>
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 | #define ACPI_FADT_OFFSET(f) (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
|
| 378 |
|
| 379 | |
| 380 | * Sizes of the various flavors of FADT. We need to look closely
|
| 381 | * at the FADT length because the version number essentially tells
|
| 382 | * us nothing because of many BIOS bugs where the version does not
|
| 383 | * match the expected length. In other words, the length of the
|
| 384 | * FADT is the bottom line as to what the version really is.
|
| 385 | *
|
| 386 | * For reference, the values below are as follows:
|
| 387 | * FADT V1 size: 0x074
|
| 388 | * FADT V2 size: 0x084
|
| 389 | * FADT V3 size: 0x0F4
|
| 390 | * FADT V4 size: 0x0F4
|
| 391 | * FADT V5 size: 0x10C
|
| 392 | * FADT V6 size: 0x114
|
| 393 |
|
| 394 | #define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
|
| 395 | #define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (minor_revision) + 1)
|
| 396 | #define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control))
|
| 397 | #define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id))
|
| 398 | #define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt))
|
| 399 |
|
| 400 | #define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)"
|
| 401 |
|
| 402 | #endif
|