xref: /openbmc/qemu/include/hw/acpi/acpi-defs.h (revision 5334bf57)
1395e5fb4SShannon Zhao /*
2395e5fb4SShannon Zhao  * This program is free software; you can redistribute it and/or modify
3395e5fb4SShannon Zhao  * it under the terms of the GNU General Public License as published by
4395e5fb4SShannon Zhao  * the Free Software Foundation; either version 2 of the License, or
5395e5fb4SShannon Zhao  * (at your option) any later version.
6395e5fb4SShannon Zhao 
7395e5fb4SShannon Zhao  * This program is distributed in the hope that it will be useful,
8395e5fb4SShannon Zhao  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9395e5fb4SShannon Zhao  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10395e5fb4SShannon Zhao  * GNU General Public License for more details.
11395e5fb4SShannon Zhao 
12395e5fb4SShannon Zhao  * You should have received a copy of the GNU General Public License along
13395e5fb4SShannon Zhao  * with this program; if not, see <http://www.gnu.org/licenses/>.
14395e5fb4SShannon Zhao  */
15395e5fb4SShannon Zhao #ifndef QEMU_ACPI_DEFS_H
16395e5fb4SShannon Zhao #define QEMU_ACPI_DEFS_H
17395e5fb4SShannon Zhao 
18395e5fb4SShannon Zhao enum {
19395e5fb4SShannon Zhao     ACPI_FADT_F_WBINVD,
20395e5fb4SShannon Zhao     ACPI_FADT_F_WBINVD_FLUSH,
21395e5fb4SShannon Zhao     ACPI_FADT_F_PROC_C1,
22395e5fb4SShannon Zhao     ACPI_FADT_F_P_LVL2_UP,
23395e5fb4SShannon Zhao     ACPI_FADT_F_PWR_BUTTON,
24395e5fb4SShannon Zhao     ACPI_FADT_F_SLP_BUTTON,
25395e5fb4SShannon Zhao     ACPI_FADT_F_FIX_RTC,
26395e5fb4SShannon Zhao     ACPI_FADT_F_RTC_S4,
27395e5fb4SShannon Zhao     ACPI_FADT_F_TMR_VAL_EXT,
28395e5fb4SShannon Zhao     ACPI_FADT_F_DCK_CAP,
29395e5fb4SShannon Zhao     ACPI_FADT_F_RESET_REG_SUP,
30395e5fb4SShannon Zhao     ACPI_FADT_F_SEALED_CASE,
31395e5fb4SShannon Zhao     ACPI_FADT_F_HEADLESS,
32395e5fb4SShannon Zhao     ACPI_FADT_F_CPU_SW_SLP,
33395e5fb4SShannon Zhao     ACPI_FADT_F_PCI_EXP_WAK,
34395e5fb4SShannon Zhao     ACPI_FADT_F_USE_PLATFORM_CLOCK,
35395e5fb4SShannon Zhao     ACPI_FADT_F_S4_RTC_STS_VALID,
36395e5fb4SShannon Zhao     ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE,
37395e5fb4SShannon Zhao     ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL,
38395e5fb4SShannon Zhao     ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE,
39395e5fb4SShannon Zhao     ACPI_FADT_F_HW_REDUCED_ACPI,
40395e5fb4SShannon Zhao     ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE,
41395e5fb4SShannon Zhao };
42395e5fb4SShannon Zhao 
435c5fce1aSSamuel Ortiz typedef struct AcpiRsdpData {
44602b4582SMarian Postevca     char *oem_id;                     /* OEM identification */
455c5fce1aSSamuel Ortiz     uint8_t revision;                 /* Must be 0 for 1.0, 2 for 2.0 */
465c5fce1aSSamuel Ortiz 
475c5fce1aSSamuel Ortiz     unsigned *rsdt_tbl_offset;
485c5fce1aSSamuel Ortiz     unsigned *xsdt_tbl_offset;
495c5fce1aSSamuel Ortiz } AcpiRsdpData;
505c5fce1aSSamuel Ortiz 
51c2f7c0c3SShannon Zhao struct AcpiGenericAddress {
52c2f7c0c3SShannon Zhao     uint8_t space_id;        /* Address space where struct or register exists */
53c2f7c0c3SShannon Zhao     uint8_t bit_width;       /* Size in bits of given register */
54c2f7c0c3SShannon Zhao     uint8_t bit_offset;      /* Bit offset within the register */
55b8e0f589SIgor Mammedov     uint8_t access_width;    /* ACPI 3.0: Minimum Access size (ACPI 3.0),
56b8e0f589SIgor Mammedov                                 ACPI 2.0: Reserved, Table 5-1 */
57c2f7c0c3SShannon Zhao     uint64_t address;        /* 64-bit address of struct or register */
58a8a57687SIgor Mammedov };
59c2f7c0c3SShannon Zhao 
60937d1b58SIgor Mammedov typedef struct AcpiFadtData {
61937d1b58SIgor Mammedov     struct AcpiGenericAddress pm1a_cnt;   /* PM1a_CNT_BLK */
62937d1b58SIgor Mammedov     struct AcpiGenericAddress pm1a_evt;   /* PM1a_EVT_BLK */
63937d1b58SIgor Mammedov     struct AcpiGenericAddress pm_tmr;    /* PM_TMR_BLK */
64937d1b58SIgor Mammedov     struct AcpiGenericAddress gpe0_blk;  /* GPE0_BLK */
65937d1b58SIgor Mammedov     struct AcpiGenericAddress reset_reg; /* RESET_REG */
66c8ed8f57SGerd Hoffmann     struct AcpiGenericAddress sleep_ctl; /* SLEEP_CONTROL_REG */
67c8ed8f57SGerd Hoffmann     struct AcpiGenericAddress sleep_sts; /* SLEEP_STATUS_REG */
68937d1b58SIgor Mammedov     uint8_t reset_val;         /* RESET_VALUE */
69937d1b58SIgor Mammedov     uint8_t  rev;              /* Revision */
70937d1b58SIgor Mammedov     uint32_t flags;            /* Flags */
71937d1b58SIgor Mammedov     uint32_t smi_cmd;          /* SMI_CMD */
72937d1b58SIgor Mammedov     uint16_t sci_int;          /* SCI_INT */
73937d1b58SIgor Mammedov     uint8_t  int_model;        /* INT_MODEL */
74937d1b58SIgor Mammedov     uint8_t  acpi_enable_cmd;  /* ACPI_ENABLE */
75937d1b58SIgor Mammedov     uint8_t  acpi_disable_cmd; /* ACPI_DISABLE */
76937d1b58SIgor Mammedov     uint8_t  rtc_century;      /* CENTURY */
77937d1b58SIgor Mammedov     uint16_t plvl2_lat;        /* P_LVL2_LAT */
78937d1b58SIgor Mammedov     uint16_t plvl3_lat;        /* P_LVL3_LAT */
79dd1b2037SIgor Mammedov     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
80*5334bf57SLiav Albani     uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
81dd1b2037SIgor Mammedov     uint8_t minor_ver;         /* FADT Minor Version */
82937d1b58SIgor Mammedov 
83937d1b58SIgor Mammedov     /*
84937d1b58SIgor Mammedov      * respective tables offsets within ACPI_BUILD_TABLE_FILE,
85937d1b58SIgor Mammedov      * NULL if table doesn't exist (in that case field's value
86937d1b58SIgor Mammedov      * won't be patched by linker and will be kept set to 0)
87937d1b58SIgor Mammedov      */
88937d1b58SIgor Mammedov     unsigned *facs_tbl_offset; /* FACS offset in */
89937d1b58SIgor Mammedov     unsigned *dsdt_tbl_offset;
90937d1b58SIgor Mammedov     unsigned *xdsdt_tbl_offset;
91937d1b58SIgor Mammedov } AcpiFadtData;
92937d1b58SIgor Mammedov 
938c92c6a4SAndrew Jones #define ACPI_FADT_ARM_PSCI_COMPLIANT  (1 << 0)
948c92c6a4SAndrew Jones #define ACPI_FADT_ARM_PSCI_USE_HVC    (1 << 1)
95c2f7c0c3SShannon Zhao 
96395e5fb4SShannon Zhao #endif
97