linux/include/acpi/actbl.h

/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
/******************************************************************************
 *
 * Name: actbl.h - Basic ACPI Table Definitions
 *
 * Copyright (C) 2000 - 2023, Intel Corp.
 *
 *****************************************************************************/

#ifndef __ACTBL_H__
#define __ACTBL_H__

/*******************************************************************************
 *
 * Fundamental ACPI tables
 *
 * This file contains definitions for the ACPI tables that are directly consumed
 * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related
 * device drivers and other OS support code.
 *
 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
 * tables use the header.
 *
 ******************************************************************************/

/*
 * Values for description table header signatures for tables defined in this
 * file. Useful because they make it more difficult to inadvertently type in
 * the wrong signature.
 */
#define ACPI_SIG_DSDT
#define ACPI_SIG_FADT
#define ACPI_SIG_FACS
#define ACPI_SIG_OSDT
#define ACPI_SIG_PSDT
#define ACPI_SIG_RSDP
#define ACPI_SIG_RSDT
#define ACPI_SIG_XSDT
#define ACPI_SIG_SSDT
#define ACPI_RSDP_NAME
#define ACPI_OEM_NAME

/*
 * All tables and structures must be byte-packed to match the ACPI
 * specification, since the tables are provided by the system BIOS
 */
#pragma pack(1)

/*
 * Note: C bitfields are not used for this reason:
 *
 * "Bitfields are great and easy to read, but unfortunately the C language
 * does not specify the layout of bitfields in memory, which means they are
 * essentially useless for dealing with packed data in on-disk formats or
 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
 * this decision was a design error in C. Ritchie could have picked an order
 * and stuck with it." Norman Ramsey.
 * See http://stackoverflow.com/a/1053662/41661
 */

/*******************************************************************************
 *
 * Master ACPI Table Header. This common header is used by all ACPI tables
 * except the RSDP and FACS.
 *
 ******************************************************************************/

struct acpi_table_header {};

/*******************************************************************************
 *
 * GAS - Generic Address Structure (ACPI 2.0+)
 *
 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
 * If misaligned access is not supported by the hardware, accesses to the
 * 64-bit Address field must be performed with care.
 *
 ******************************************************************************/

struct acpi_generic_address {};

/*******************************************************************************
 *
 * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
 *        Version 2
 *
 ******************************************************************************/

struct acpi_table_rsdp {};

/* Standalone struct for the ACPI 1.0 RSDP */

struct acpi_rsdp_common {};

/* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */

struct acpi_rsdp_extension {};

/*******************************************************************************
 *
 * RSDT/XSDT - Root System Description Tables
 *             Version 1 (both)
 *
 ******************************************************************************/

struct acpi_table_rsdt {};

struct acpi_table_xsdt {};

#define ACPI_RSDT_ENTRY_SIZE
#define ACPI_XSDT_ENTRY_SIZE

/*******************************************************************************
 *
 * FACS - Firmware ACPI Control Structure (FACS)
 *
 ******************************************************************************/

struct acpi_table_facs {};

/* Masks for global_lock flag field above */

#define ACPI_GLOCK_PENDING
#define ACPI_GLOCK_OWNED

/* Masks for Flags field above  */

#define ACPI_FACS_S4_BIOS_PRESENT
#define ACPI_FACS_64BIT_WAKE

/* Masks for ospm_flags field above */

#define ACPI_FACS_64BIT_ENVIRONMENT

/*******************************************************************************
 *
 * FADT - Fixed ACPI Description Table (Signature "FACP")
 *        Version 6
 *
 ******************************************************************************/

/* Fields common to all versions of the FADT */

struct acpi_table_fadt {};

/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */

#define ACPI_FADT_LEGACY_DEVICES
#define ACPI_FADT_8042
#define ACPI_FADT_NO_VGA
#define ACPI_FADT_NO_MSI
#define ACPI_FADT_NO_ASPM
#define ACPI_FADT_NO_CMOS_RTC

#define FADT2_REVISION_ID

/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */

#define ACPI_FADT_PSCI_COMPLIANT
#define ACPI_FADT_PSCI_USE_HVC

/* Masks for FADT flags */

#define ACPI_FADT_WBINVD
#define ACPI_FADT_WBINVD_FLUSH
#define ACPI_FADT_C1_SUPPORTED
#define ACPI_FADT_C2_MP_SUPPORTED
#define ACPI_FADT_POWER_BUTTON
#define ACPI_FADT_SLEEP_BUTTON
#define ACPI_FADT_FIXED_RTC
#define ACPI_FADT_S4_RTC_WAKE
#define ACPI_FADT_32BIT_TIMER
#define ACPI_FADT_DOCKING_SUPPORTED
#define ACPI_FADT_RESET_REGISTER
#define ACPI_FADT_SEALED_CASE
#define ACPI_FADT_HEADLESS
#define ACPI_FADT_SLEEP_TYPE
#define ACPI_FADT_PCI_EXPRESS_WAKE
#define ACPI_FADT_PLATFORM_CLOCK
#define ACPI_FADT_S4_RTC_VALID
#define ACPI_FADT_REMOTE_POWER_ON
#define ACPI_FADT_APIC_CLUSTER
#define ACPI_FADT_APIC_PHYSICAL
#define ACPI_FADT_HW_REDUCED
#define ACPI_FADT_LOW_POWER_S0

/* Values for preferred_profile (Preferred Power Management Profiles) */

enum acpi_preferred_pm_profiles {};

/* Values for sleep_status and sleep_control registers (V5+ FADT) */

#define ACPI_X_WAKE_STATUS
#define ACPI_X_SLEEP_TYPE_MASK
#define ACPI_X_SLEEP_TYPE_POSITION
#define ACPI_X_SLEEP_ENABLE

/* Reset to default packing */

#pragma pack()

/*
 * Internal table-related structures
 */
acpi_name_union;

/* Internal ACPI Table Descriptor. One per ACPI table. */

struct acpi_table_desc {};

/*
 * Maximum value of the validation_count field in struct acpi_table_desc.
 * When reached, validation_count cannot be changed any more and the table will
 * be permanently regarded as validated.
 *
 * This is to prevent situations in which unbalanced table get/put operations
 * may cause premature table unmapping in the OS to happen.
 *
 * The maximum validation count can be defined to any value, but should be
 * greater than the maximum number of OS early stage mapping slots to avoid
 * leaking early stage table mappings to the late stage.
 */
#define ACPI_MAX_TABLE_VALIDATIONS

/* Masks for Flags field above */

#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL
#define ACPI_TABLE_ORIGIN_MASK
#define ACPI_TABLE_IS_VERIFIED
#define ACPI_TABLE_IS_LOADED

/*
 * Get the remaining ACPI tables
 */
#include <acpi/actbl1.h>
#include <acpi/actbl2.h>
#include <acpi/actbl3.h>

/* Macros used to generate offsets to specific table fields */

#define ACPI_FADT_OFFSET(f)

/*
 * Sizes of the various flavors of FADT. We need to look closely
 * at the FADT length because the version number essentially tells
 * us nothing because of many BIOS bugs where the version does not
 * match the expected length. In other words, the length of the
 * FADT is the bottom line as to what the version really is.
 *
 * For reference, the values below are as follows:
 *     FADT V1 size: 0x074
 *     FADT V2 size: 0x084
 *     FADT V3 size: 0x0F4
 *     FADT V4 size: 0x0F4
 *     FADT V5 size: 0x10C
 *     FADT V6 size: 0x114
 */
#define ACPI_FADT_V1_SIZE
#define ACPI_FADT_V2_SIZE
#define ACPI_FADT_V3_SIZE
#define ACPI_FADT_V5_SIZE
#define ACPI_FADT_V6_SIZE

#define ACPI_FADT_CONFORMANCE

#endif				/* __ACTBL_H__ */