xref: /openbmc/qemu/include/hw/acpi/acpi-defs.h (revision ed75658a)
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     uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
81     uint8_t minor_ver;         /* FADT Minor Version */
82 
83     /*
84      * respective tables offsets within ACPI_BUILD_TABLE_FILE,
85      * NULL if table doesn't exist (in that case field's value
86      * won't be patched by linker and will be kept set to 0)
87      */
88     unsigned *facs_tbl_offset; /* FACS offset in */
89     unsigned *dsdt_tbl_offset;
90     unsigned *xdsdt_tbl_offset;
91 } AcpiFadtData;
92 
93 typedef struct AcpiGas {
94     uint8_t id;                /* Address space ID */
95     uint8_t width;             /* Register bit width */
96     uint8_t offset;            /* Register bit offset */
97     uint8_t size;              /* Access size */
98     uint64_t addr;             /* Address */
99 } AcpiGas;
100 
101 /* SPCR (Serial Port Console Redirection table) */
102 typedef struct AcpiSpcrData {
103     uint8_t interface_type;
104     uint8_t reserved[3];
105     struct AcpiGas base_addr;
106     uint8_t interrupt_type;
107     uint8_t pc_interrupt;
108     uint32_t interrupt;        /* Global system interrupt */
109     uint8_t baud_rate;
110     uint8_t parity;
111     uint8_t stop_bits;
112     uint8_t flow_control;
113     uint8_t terminal_type;
114     uint8_t language;
115     uint8_t reserved1;
116     uint16_t pci_device_id;    /* Must be 0xffff if not PCI device */
117     uint16_t pci_vendor_id;    /* Must be 0xffff if not PCI device */
118     uint8_t pci_bus;
119     uint8_t pci_device;
120     uint8_t pci_function;
121     uint32_t pci_flags;
122     uint8_t pci_segment;
123     uint32_t reserved2;
124 } AcpiSpcrData;
125 
126 #define ACPI_FADT_ARM_PSCI_COMPLIANT  (1 << 0)
127 #define ACPI_FADT_ARM_PSCI_USE_HVC    (1 << 1)
128 
129 #endif
130