]>
Commit | Line | Data |
---|---|---|
72c194f7 MT |
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 | ||
5c5fce1a | 43 | typedef struct AcpiRsdpData { |
602b4582 | 44 | char *oem_id; /* OEM identification */ |
9cbb8eca | 45 | uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ |
5c5fce1a SO |
46 | |
47 | unsigned *rsdt_tbl_offset; | |
48 | unsigned *xsdt_tbl_offset; | |
49 | } AcpiRsdpData; | |
50 | ||
72c194f7 MT |
51 | /* Table structure from Linux kernel (the ACPI tables are under the |
52 | BSD license) */ | |
53 | ||
54 | ||
55 | #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ | |
56 | uint32_t signature; /* ACPI signature (4 ASCII characters) */ \ | |
57 | uint32_t length; /* Length of table, in bytes, including header */ \ | |
58 | uint8_t revision; /* ACPI Specification minor version # */ \ | |
59 | uint8_t checksum; /* To make sum of entire table == 0 */ \ | |
9cbb8eca PMD |
60 | uint8_t oem_id[6] \ |
61 | QEMU_NONSTRING; /* OEM identification */ \ | |
62 | uint8_t oem_table_id[8] \ | |
63 | QEMU_NONSTRING; /* OEM table identification */ \ | |
72c194f7 | 64 | uint32_t oem_revision; /* OEM revision number */ \ |
9cbb8eca PMD |
65 | uint8_t asl_compiler_id[4] \ |
66 | QEMU_NONSTRING; /* ASL compiler vendor ID */ \ | |
72c194f7 MT |
67 | uint32_t asl_compiler_revision; /* ASL compiler revision number */ |
68 | ||
69 | ||
8b12e489 MT |
70 | /* ACPI common table header */ |
71 | struct AcpiTableHeader { | |
72c194f7 MT |
72 | ACPI_TABLE_HEADER_DEF |
73 | } QEMU_PACKED; | |
74 | typedef struct AcpiTableHeader AcpiTableHeader; | |
75 | ||
c2f7c0c3 SZ |
76 | struct AcpiGenericAddress { |
77 | uint8_t space_id; /* Address space where struct or register exists */ | |
78 | uint8_t bit_width; /* Size in bits of given register */ | |
79 | uint8_t bit_offset; /* Bit offset within the register */ | |
b8e0f589 IM |
80 | uint8_t access_width; /* ACPI 3.0: Minimum Access size (ACPI 3.0), |
81 | ACPI 2.0: Reserved, Table 5-1 */ | |
c2f7c0c3 SZ |
82 | uint64_t address; /* 64-bit address of struct or register */ |
83 | } QEMU_PACKED; | |
84 | ||
937d1b58 IM |
85 | typedef struct AcpiFadtData { |
86 | struct AcpiGenericAddress pm1a_cnt; /* PM1a_CNT_BLK */ | |
87 | struct AcpiGenericAddress pm1a_evt; /* PM1a_EVT_BLK */ | |
88 | struct AcpiGenericAddress pm_tmr; /* PM_TMR_BLK */ | |
89 | struct AcpiGenericAddress gpe0_blk; /* GPE0_BLK */ | |
90 | struct AcpiGenericAddress reset_reg; /* RESET_REG */ | |
c8ed8f57 GH |
91 | struct AcpiGenericAddress sleep_ctl; /* SLEEP_CONTROL_REG */ |
92 | struct AcpiGenericAddress sleep_sts; /* SLEEP_STATUS_REG */ | |
937d1b58 IM |
93 | uint8_t reset_val; /* RESET_VALUE */ |
94 | uint8_t rev; /* Revision */ | |
95 | uint32_t flags; /* Flags */ | |
96 | uint32_t smi_cmd; /* SMI_CMD */ | |
97 | uint16_t sci_int; /* SCI_INT */ | |
98 | uint8_t int_model; /* INT_MODEL */ | |
99 | uint8_t acpi_enable_cmd; /* ACPI_ENABLE */ | |
100 | uint8_t acpi_disable_cmd; /* ACPI_DISABLE */ | |
101 | uint8_t rtc_century; /* CENTURY */ | |
102 | uint16_t plvl2_lat; /* P_LVL2_LAT */ | |
103 | uint16_t plvl3_lat; /* P_LVL3_LAT */ | |
dd1b2037 IM |
104 | uint16_t arm_boot_arch; /* ARM_BOOT_ARCH */ |
105 | uint8_t minor_ver; /* FADT Minor Version */ | |
937d1b58 IM |
106 | |
107 | /* | |
108 | * respective tables offsets within ACPI_BUILD_TABLE_FILE, | |
109 | * NULL if table doesn't exist (in that case field's value | |
110 | * won't be patched by linker and will be kept set to 0) | |
111 | */ | |
112 | unsigned *facs_tbl_offset; /* FACS offset in */ | |
113 | unsigned *dsdt_tbl_offset; | |
114 | unsigned *xdsdt_tbl_offset; | |
115 | } AcpiFadtData; | |
116 | ||
8c92c6a4 AJ |
117 | #define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0) |
118 | #define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1) | |
c2f7c0c3 | 119 | |
b8a0d75e AJ |
120 | /* |
121 | * Serial Port Console Redirection Table (SPCR), Rev. 1.02 | |
122 | * | |
123 | * For .interface_type see Debug Port Table 2 (DBG2) serial port | |
124 | * subtypes in Table 3, Rev. May 22, 2012 | |
125 | */ | |
126 | struct AcpiSerialPortConsoleRedirection { | |
127 | ACPI_TABLE_HEADER_DEF | |
128 | uint8_t interface_type; | |
129 | uint8_t reserved1[3]; | |
130 | struct AcpiGenericAddress base_address; | |
131 | uint8_t interrupt_types; | |
132 | uint8_t irq; | |
133 | uint32_t gsi; | |
134 | uint8_t baud; | |
135 | uint8_t parity; | |
136 | uint8_t stopbits; | |
137 | uint8_t flowctrl; | |
138 | uint8_t term_type; | |
139 | uint8_t reserved2; | |
140 | uint16_t pci_device_id; | |
141 | uint16_t pci_vendor_id; | |
142 | uint8_t pci_bus; | |
143 | uint8_t pci_slot; | |
144 | uint8_t pci_func; | |
145 | uint32_t pci_flags; | |
146 | uint8_t pci_seg; | |
147 | uint32_t reserved3; | |
148 | } QEMU_PACKED; | |
149 | typedef struct AcpiSerialPortConsoleRedirection | |
150 | AcpiSerialPortConsoleRedirection; | |
151 | ||
72c194f7 MT |
152 | /* |
153 | * ACPI 1.0 Firmware ACPI Control Structure (FACS) | |
154 | */ | |
8b12e489 | 155 | struct AcpiFacsDescriptorRev1 { |
72c194f7 MT |
156 | uint32_t signature; /* ACPI Signature */ |
157 | uint32_t length; /* Length of structure, in bytes */ | |
158 | uint32_t hardware_signature; /* Hardware configuration signature */ | |
159 | uint32_t firmware_waking_vector; /* ACPI OS waking vector */ | |
160 | uint32_t global_lock; /* Global Lock */ | |
161 | uint32_t flags; | |
162 | uint8_t resverved3 [40]; /* Reserved - must be zero */ | |
163 | } QEMU_PACKED; | |
164 | typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1; | |
165 | ||
ee246400 SZ |
166 | /* |
167 | * Generic Timer Description Table (GTDT) | |
168 | */ | |
8dd845d3 | 169 | #define ACPI_GTDT_INTERRUPT_MODE_LEVEL (0 << 0) |
aca4bbf4 AJ |
170 | #define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0) |
171 | #define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2) | |
ee246400 SZ |
172 | |
173 | struct AcpiGenericTimerTable { | |
174 | ACPI_TABLE_HEADER_DEF | |
175 | uint64_t counter_block_addresss; | |
176 | uint32_t reserved; | |
177 | uint32_t secure_el1_interrupt; | |
178 | uint32_t secure_el1_flags; | |
179 | uint32_t non_secure_el1_interrupt; | |
180 | uint32_t non_secure_el1_flags; | |
181 | uint32_t virtual_timer_interrupt; | |
182 | uint32_t virtual_timer_flags; | |
183 | uint32_t non_secure_el2_interrupt; | |
184 | uint32_t non_secure_el2_flags; | |
185 | uint64_t counter_read_block_address; | |
186 | uint32_t platform_timer_count; | |
187 | uint32_t platform_timer_offset; | |
188 | } QEMU_PACKED; | |
189 | typedef struct AcpiGenericTimerTable AcpiGenericTimerTable; | |
190 | ||
16fc326a PM |
191 | /* |
192 | * Input Output Remapping Table (IORT) | |
193 | * Conforms to "IO Remapping Table System Software on ARM Platforms", | |
194 | * Document number: ARM DEN 0049B, October 2015 | |
195 | */ | |
196 | ||
197 | struct AcpiIortTable { | |
198 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | |
199 | uint32_t node_count; | |
200 | uint32_t node_offset; | |
201 | uint32_t reserved; | |
202 | } QEMU_PACKED; | |
203 | typedef struct AcpiIortTable AcpiIortTable; | |
204 | ||
205 | /* | |
206 | * IORT node types | |
207 | */ | |
208 | ||
209 | #define ACPI_IORT_NODE_HEADER_DEF /* Node format common fields */ \ | |
210 | uint8_t type; \ | |
211 | uint16_t length; \ | |
212 | uint8_t revision; \ | |
213 | uint32_t reserved; \ | |
214 | uint32_t mapping_count; \ | |
215 | uint32_t mapping_offset; | |
216 | ||
217 | /* Values for node Type above */ | |
218 | enum { | |
219 | ACPI_IORT_NODE_ITS_GROUP = 0x00, | |
220 | ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, | |
221 | ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, | |
222 | ACPI_IORT_NODE_SMMU = 0x03, | |
223 | ACPI_IORT_NODE_SMMU_V3 = 0x04 | |
224 | }; | |
225 | ||
226 | struct AcpiIortIdMapping { | |
227 | uint32_t input_base; | |
228 | uint32_t id_count; | |
229 | uint32_t output_base; | |
230 | uint32_t output_reference; | |
231 | uint32_t flags; | |
232 | } QEMU_PACKED; | |
233 | typedef struct AcpiIortIdMapping AcpiIortIdMapping; | |
234 | ||
235 | struct AcpiIortMemoryAccess { | |
236 | uint32_t cache_coherency; | |
237 | uint8_t hints; | |
238 | uint16_t reserved; | |
239 | uint8_t memory_flags; | |
240 | } QEMU_PACKED; | |
241 | typedef struct AcpiIortMemoryAccess AcpiIortMemoryAccess; | |
242 | ||
243 | struct AcpiIortItsGroup { | |
244 | ACPI_IORT_NODE_HEADER_DEF | |
245 | uint32_t its_count; | |
f7795e40 | 246 | uint32_t identifiers[]; |
16fc326a PM |
247 | } QEMU_PACKED; |
248 | typedef struct AcpiIortItsGroup AcpiIortItsGroup; | |
249 | ||
29bbccc2 EA |
250 | #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE 1 |
251 | ||
a703b4f6 PM |
252 | struct AcpiIortSmmu3 { |
253 | ACPI_IORT_NODE_HEADER_DEF | |
254 | uint64_t base_address; | |
255 | uint32_t flags; | |
256 | uint32_t reserved2; | |
257 | uint64_t vatos_address; | |
258 | uint32_t model; | |
259 | uint32_t event_gsiv; | |
260 | uint32_t pri_gsiv; | |
261 | uint32_t gerr_gsiv; | |
262 | uint32_t sync_gsiv; | |
f7795e40 | 263 | AcpiIortIdMapping id_mapping_array[]; |
a703b4f6 PM |
264 | } QEMU_PACKED; |
265 | typedef struct AcpiIortSmmu3 AcpiIortSmmu3; | |
266 | ||
16fc326a PM |
267 | struct AcpiIortRC { |
268 | ACPI_IORT_NODE_HEADER_DEF | |
269 | AcpiIortMemoryAccess memory_properties; | |
270 | uint32_t ats_attribute; | |
271 | uint32_t pci_segment_number; | |
f7795e40 | 272 | AcpiIortIdMapping id_mapping_array[]; |
16fc326a PM |
273 | } QEMU_PACKED; |
274 | typedef struct AcpiIortRC AcpiIortRC; | |
275 | ||
72c194f7 | 276 | #endif |