xref: /openbmc/qemu/include/hw/acpi/acpi-defs.h (revision 6016b7b4)
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6 
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11 
12  * You should have received a copy of the GNU General Public License along
13  * with this program; if not, see <http://www.gnu.org/licenses/>.
14  */
15 #ifndef QEMU_ACPI_DEFS_H
16 #define QEMU_ACPI_DEFS_H
17 
18 enum {
19     ACPI_FADT_F_WBINVD,
20     ACPI_FADT_F_WBINVD_FLUSH,
21     ACPI_FADT_F_PROC_C1,
22     ACPI_FADT_F_P_LVL2_UP,
23     ACPI_FADT_F_PWR_BUTTON,
24     ACPI_FADT_F_SLP_BUTTON,
25     ACPI_FADT_F_FIX_RTC,
26     ACPI_FADT_F_RTC_S4,
27     ACPI_FADT_F_TMR_VAL_EXT,
28     ACPI_FADT_F_DCK_CAP,
29     ACPI_FADT_F_RESET_REG_SUP,
30     ACPI_FADT_F_SEALED_CASE,
31     ACPI_FADT_F_HEADLESS,
32     ACPI_FADT_F_CPU_SW_SLP,
33     ACPI_FADT_F_PCI_EXP_WAK,
34     ACPI_FADT_F_USE_PLATFORM_CLOCK,
35     ACPI_FADT_F_S4_RTC_STS_VALID,
36     ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE,
37     ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL,
38     ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE,
39     ACPI_FADT_F_HW_REDUCED_ACPI,
40     ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE,
41 };
42 
43 typedef struct AcpiRsdpData {
44     char *oem_id;                     /* OEM identification */
45     uint8_t revision;                 /* Must be 0 for 1.0, 2 for 2.0 */
46 
47     unsigned *rsdt_tbl_offset;
48     unsigned *xsdt_tbl_offset;
49 } AcpiRsdpData;
50 
51 struct AcpiGenericAddress {
52     uint8_t space_id;        /* Address space where struct or register exists */
53     uint8_t bit_width;       /* Size in bits of given register */
54     uint8_t bit_offset;      /* Bit offset within the register */
55     uint8_t access_width;    /* ACPI 3.0: Minimum Access size (ACPI 3.0),
56                                 ACPI 2.0: Reserved, Table 5-1 */
57     uint64_t address;        /* 64-bit address of struct or register */
58 };
59 
60 typedef struct AcpiFadtData {
61     struct AcpiGenericAddress pm1a_cnt;   /* PM1a_CNT_BLK */
62     struct AcpiGenericAddress pm1a_evt;   /* PM1a_EVT_BLK */
63     struct AcpiGenericAddress pm_tmr;    /* PM_TMR_BLK */
64     struct AcpiGenericAddress gpe0_blk;  /* GPE0_BLK */
65     struct AcpiGenericAddress reset_reg; /* RESET_REG */
66     struct AcpiGenericAddress sleep_ctl; /* SLEEP_CONTROL_REG */
67     struct AcpiGenericAddress sleep_sts; /* SLEEP_STATUS_REG */
68     uint8_t reset_val;         /* RESET_VALUE */
69     uint8_t  rev;              /* Revision */
70     uint32_t flags;            /* Flags */
71     uint32_t smi_cmd;          /* SMI_CMD */
72     uint16_t sci_int;          /* SCI_INT */
73     uint8_t  int_model;        /* INT_MODEL */
74     uint8_t  acpi_enable_cmd;  /* ACPI_ENABLE */
75     uint8_t  acpi_disable_cmd; /* ACPI_DISABLE */
76     uint8_t  rtc_century;      /* CENTURY */
77     uint16_t plvl2_lat;        /* P_LVL2_LAT */
78     uint16_t plvl3_lat;        /* P_LVL3_LAT */
79     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
80     uint8_t minor_ver;         /* FADT Minor Version */
81 
82     /*
83      * respective tables offsets within ACPI_BUILD_TABLE_FILE,
84      * NULL if table doesn't exist (in that case field's value
85      * won't be patched by linker and will be kept set to 0)
86      */
87     unsigned *facs_tbl_offset; /* FACS offset in */
88     unsigned *dsdt_tbl_offset;
89     unsigned *xdsdt_tbl_offset;
90 } AcpiFadtData;
91 
92 #define ACPI_FADT_ARM_PSCI_COMPLIANT  (1 << 0)
93 #define ACPI_FADT_ARM_PSCI_USE_HVC    (1 << 1)
94 
95 #endif
96