1 | #pragma once |
2 | |
3 | #include <uacpi/platform/compiler.h> |
4 | #include <uacpi/helpers.h> |
5 | #include <uacpi/types.h> |
6 | |
7 | /* |
8 | * ----------------------------------------------------- |
9 | * Common structures provided by the ACPI specification |
10 | * ----------------------------------------------------- |
11 | */ |
12 | |
13 | #define ACPI_RSDP_SIGNATURE "RSD PTR " |
14 | #define ACPI_RSDT_SIGNATURE "RSDT" |
15 | #define ACPI_XSDT_SIGNATURE "XSDT" |
16 | #define ACPI_MADT_SIGNATURE "APIC" |
17 | #define ACPI_FADT_SIGNATURE "FACP" |
18 | #define ACPI_FACS_SIGNATURE "FACS" |
19 | #define ACPI_MCFG_SIGNATURE "MCFG" |
20 | #define ACPI_HPET_SIGNATURE "HPET" |
21 | #define ACPI_SRAT_SIGNATURE "SRAT" |
22 | #define ACPI_SLIT_SIGNATURE "SLIT" |
23 | #define ACPI_DSDT_SIGNATURE "DSDT" |
24 | #define ACPI_SSDT_SIGNATURE "SSDT" |
25 | #define ACPI_PSDT_SIGNATURE "PSDT" |
26 | #define ACPI_ECDT_SIGNATURE "ECDT" |
27 | |
28 | #define ACPI_AS_ID_SYS_MEM 0x00 |
29 | #define ACPI_AS_ID_SYS_IO 0x01 |
30 | #define ACPI_AS_ID_PCI_CFG_SPACE 0x02 |
31 | #define ACPI_AS_ID_EC 0x03 |
32 | #define ACPI_AS_ID_SMBUS 0x04 |
33 | #define ACPI_AS_ID_SYS_CMOS 0x05 |
34 | #define ACPI_AS_ID_PCI_BAR_TGT 0x06 |
35 | #define ACPI_AS_ID_IPMI 0x07 |
36 | #define ACPI_AS_ID_GP_IO 0x08 |
37 | #define ACPI_AS_ID_GENERIC_SBUS 0x09 |
38 | #define ACPI_AS_ID_PCC 0x0A |
39 | #define ACPI_AS_ID_FFH 0x7F |
40 | #define ACPI_AS_ID_OEM_BASE 0xC0 |
41 | #define ACPI_AS_ID_OEM_END 0xFF |
42 | |
43 | #define ACPI_ACCESS_UD 0 |
44 | #define ACPI_ACCESS_BYTE 1 |
45 | #define ACPI_ACCESS_WORD 2 |
46 | #define ACPI_ACCESS_DWORD 3 |
47 | #define ACPI_ACCESS_QWORD 4 |
48 | |
49 | UACPI_PACKED(struct acpi_gas { |
50 | uacpi_u8 address_space_id; |
51 | uacpi_u8 register_bit_width; |
52 | uacpi_u8 register_bit_offset; |
53 | uacpi_u8 access_size; |
54 | uacpi_u64 address; |
55 | }) |
56 | UACPI_EXPECT_SIZEOF(struct acpi_gas, 12); |
57 | |
58 | UACPI_PACKED(struct acpi_rsdp { |
59 | uacpi_char signature[8]; |
60 | uacpi_u8 checksum; |
61 | uacpi_char oemid[6]; |
62 | uacpi_u8 revision; |
63 | uacpi_u32 rsdt_addr; |
64 | |
65 | // vvvv available if .revision >= 2.0 only |
66 | uacpi_u32 length; |
67 | uacpi_u64 xsdt_addr; |
68 | uacpi_u8 extended_checksum; |
69 | uacpi_u8 rsvd[3]; |
70 | }) |
71 | UACPI_EXPECT_SIZEOF(struct acpi_rsdp, 36); |
72 | |
73 | UACPI_PACKED(struct acpi_sdt_hdr { |
74 | uacpi_char signature[4]; |
75 | uacpi_u32 length; |
76 | uacpi_u8 revision; |
77 | uacpi_u8 checksum; |
78 | uacpi_char oemid[6]; |
79 | uacpi_char oem_table_id[8]; |
80 | uacpi_u32 oem_revision; |
81 | uacpi_u32 creator_id; |
82 | uacpi_u32 creator_revision; |
83 | }) |
84 | UACPI_EXPECT_SIZEOF(struct acpi_sdt_hdr, 36); |
85 | |
86 | UACPI_PACKED(struct acpi_rsdt { |
87 | struct acpi_sdt_hdr hdr; |
88 | uacpi_u32 entries[]; |
89 | }) |
90 | |
91 | UACPI_PACKED(struct acpi_xsdt { |
92 | struct acpi_sdt_hdr hdr; |
93 | uacpi_u64 entries[]; |
94 | }) |
95 | |
96 | UACPI_PACKED(struct acpi_entry_hdr { |
97 | /* |
98 | * - acpi_madt_entry_type for the APIC table |
99 | * - acpi_srat_entry_type for the SRAT table |
100 | */ |
101 | uacpi_u8 type; |
102 | uacpi_u8 length; |
103 | }) |
104 | |
105 | // acpi_madt->flags |
106 | #define ACPI_PCAT_COMPAT (1 << 0) |
107 | |
108 | enum acpi_madt_entry_type { |
109 | ACPI_MADT_ENTRY_TYPE_LAPIC = 0, |
110 | ACPI_MADT_ENTRY_TYPE_IOAPIC = 1, |
111 | ACPI_MADT_ENTRY_TYPE_INTERRUPT_SOURCE_OVERRIDE = 2, |
112 | ACPI_MADT_ENTRY_TYPE_NMI_SOURCE = 3, |
113 | ACPI_MADT_ENTRY_TYPE_LAPIC_NMI = 4, |
114 | ACPI_MADT_ENTRY_TYPE_LAPIC_ADDRESS_OVERRIDE = 5, |
115 | ACPI_MADT_ENTRY_TYPE_IOSAPIC = 6, |
116 | ACPI_MADT_ENTRY_TYPE_LSAPIC = 7, |
117 | ACPI_MADT_ENTRY_TYPE_PLATFORM_INTERRUPT_SOURCES = 8, |
118 | ACPI_MADT_ENTRY_TYPE_LOCAL_X2APIC = 9, |
119 | ACPI_MADT_ENTRY_TYPE_LOCAL_X2APIC_NMI = 0xA, |
120 | ACPI_MADT_ENTRY_TYPE_GICC = 0xB, |
121 | ACPI_MADT_ENTRY_TYPE_GICD = 0xC, |
122 | ACPI_MADT_ENTRY_TYPE_GIC_MSI_FRAME = 0xD, |
123 | ACPI_MADT_ENTRY_TYPE_GICR = 0xE, |
124 | ACPI_MADT_ENTRY_TYPE_GIC_ITS = 0xF, |
125 | ACPI_MADT_ENTRY_TYPE_MULTIPROCESSOR_WAKEUP = 0x10, |
126 | ACPI_MADT_ENTRY_TYPE_CORE_PIC = 0x11, |
127 | ACPI_MADT_ENTRY_TYPE_LIO_PIC = 0x12, |
128 | ACPI_MADT_ENTRY_TYPE_HT_PIC = 0x13, |
129 | ACPI_MADT_ENTRY_TYPE_EIO_PIC = 0x14, |
130 | ACPI_MADT_ENTRY_TYPE_MSI_PIC = 0x15, |
131 | ACPI_MADT_ENTRY_TYPE_BIO_PIC = 0x16, |
132 | ACPI_MADT_ENTRY_TYPE_LPC_PIC = 0x17, |
133 | ACPI_MADT_ENTRY_TYPE_RESERVED = 0x18, // 0x18..0x7F |
134 | ACPI_MADT_ENTRY_TYPE_OEM = 0x80, // 0x80..0xFF |
135 | }; |
136 | |
137 | UACPI_PACKED(struct acpi_madt { |
138 | struct acpi_sdt_hdr hdr; |
139 | uacpi_u32 local_interrupt_controller_address; |
140 | uacpi_u32 flags; |
141 | struct acpi_entry_hdr entries[]; |
142 | }) |
143 | UACPI_EXPECT_SIZEOF(struct acpi_madt, 44); |
144 | |
145 | /* |
146 | * - acpi_madt_lapic->flags |
147 | * - acpi_madt_lsapic->flags |
148 | * - acpi_madt_x2apic->flags |
149 | */ |
150 | #define ACPI_PIC_ENABLED (1 << 0) |
151 | #define ACPI_PIC_ONLINE_CAPABLE (1 << 1) |
152 | |
153 | UACPI_PACKED(struct acpi_madt_lapic { |
154 | struct acpi_entry_hdr hdr; |
155 | uacpi_u8 uid; |
156 | uacpi_u8 id; |
157 | uacpi_u32 flags; |
158 | }) |
159 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lapic, 8); |
160 | |
161 | UACPI_PACKED(struct acpi_madt_ioapic { |
162 | struct acpi_entry_hdr hdr; |
163 | uacpi_u8 id; |
164 | uacpi_u8 rsvd; |
165 | uacpi_u32 address; |
166 | uacpi_u32 gsi_base; |
167 | }) |
168 | UACPI_EXPECT_SIZEOF(struct acpi_madt_ioapic, 12); |
169 | |
170 | /* |
171 | * - acpi_madt_interrupt_source_override->flags |
172 | * - acpi_madt_nmi_source->flags |
173 | * - acpi_madt_lapic_nmi->flags |
174 | * - acpi_madt_platform_interrupt_source->flags |
175 | * - acpi_madt_x2apic_nmi->flags |
176 | */ |
177 | #define ACPI_MADT_POLARITY_MASK 0b11 |
178 | #define ACPI_MADT_POLARITY_CONFORMING 0b00 |
179 | #define ACPI_MADT_POLARITY_ACTIVE_HIGH 0b01 |
180 | #define ACPI_MADT_POLARITY_ACTIVE_LOW 0b11 |
181 | |
182 | #define ACPI_MADT_TRIGGERING_MASK 0b1100 |
183 | #define ACPI_MADT_TRIGGERING_CONFORMING 0b0000 |
184 | #define ACPI_MADT_TRIGGERING_EDGE 0b0100 |
185 | #define ACPI_MADT_TRIGGERING_LEVEL 0b1100 |
186 | |
187 | UACPI_PACKED(struct acpi_madt_interrupt_source_override { |
188 | struct acpi_entry_hdr hdr; |
189 | uacpi_u8 bus; |
190 | uacpi_u8 source; |
191 | uacpi_u32 gsi; |
192 | uacpi_u16 flags; |
193 | }) |
194 | UACPI_EXPECT_SIZEOF(struct acpi_madt_interrupt_source_override, 10); |
195 | |
196 | UACPI_PACKED(struct acpi_madt_nmi_source { |
197 | struct acpi_entry_hdr hdr; |
198 | uacpi_u16 flags; |
199 | uacpi_u32 gsi; |
200 | }) |
201 | UACPI_EXPECT_SIZEOF(struct acpi_madt_nmi_source, 8); |
202 | |
203 | UACPI_PACKED(struct acpi_madt_lapic_nmi { |
204 | struct acpi_entry_hdr hdr; |
205 | uacpi_u8 uid; |
206 | uacpi_u16 flags; |
207 | uacpi_u8 lint; |
208 | }) |
209 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lapic_nmi, 6); |
210 | |
211 | UACPI_PACKED(struct acpi_madt_lapic_address_override { |
212 | struct acpi_entry_hdr hdr; |
213 | uacpi_u16 rsvd; |
214 | uacpi_u64 address; |
215 | }) |
216 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lapic_address_override, 12); |
217 | |
218 | UACPI_PACKED(struct acpi_madt_iosapic { |
219 | struct acpi_entry_hdr hdr; |
220 | uacpi_u8 id; |
221 | uacpi_u8 rsvd; |
222 | uacpi_u32 gsi_base; |
223 | uacpi_u64 address; |
224 | }) |
225 | UACPI_EXPECT_SIZEOF(struct acpi_madt_iosapic, 16); |
226 | |
227 | UACPI_PACKED(struct acpi_madt_lsapic { |
228 | struct acpi_entry_hdr hdr; |
229 | uacpi_u8 acpi_id; |
230 | uacpi_u8 id; |
231 | uacpi_u8 eid; |
232 | uacpi_u8 reserved[3]; |
233 | uacpi_u32 flags; |
234 | uacpi_u32 uid; |
235 | uacpi_char uid_string[]; |
236 | }) |
237 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lsapic, 16); |
238 | |
239 | // acpi_madt_platform_interrupt_source->platform_flags |
240 | #define ACPI_CPEI_PROCESSOR_OVERRIDE (1 << 0) |
241 | |
242 | UACPI_PACKED(struct acpi_madt_platform_interrupt_source { |
243 | struct acpi_entry_hdr hdr; |
244 | uacpi_u16 flags; |
245 | uacpi_u8 type; |
246 | uacpi_u8 processor_id; |
247 | uacpi_u8 processor_eid; |
248 | uacpi_u8 iosapic_vector; |
249 | uacpi_u32 gsi; |
250 | uacpi_u32 platform_flags; |
251 | }) |
252 | UACPI_EXPECT_SIZEOF(struct acpi_madt_platform_interrupt_source, 16); |
253 | |
254 | UACPI_PACKED(struct acpi_madt_x2apic { |
255 | struct acpi_entry_hdr hdr; |
256 | uacpi_u16 rsvd; |
257 | uacpi_u32 id; |
258 | uacpi_u32 flags; |
259 | uacpi_u32 uid; |
260 | }) |
261 | UACPI_EXPECT_SIZEOF(struct acpi_madt_x2apic, 16); |
262 | |
263 | UACPI_PACKED(struct acpi_madt_x2apic_nmi { |
264 | struct acpi_entry_hdr hdr; |
265 | uacpi_u16 flags; |
266 | uacpi_u32 uid; |
267 | uacpi_u8 lint; |
268 | uacpi_u8 reserved[3]; |
269 | }) |
270 | UACPI_EXPECT_SIZEOF(struct acpi_madt_x2apic_nmi, 12); |
271 | |
272 | // acpi_madt_gicc->flags |
273 | #define ACPI_GICC_ENABLED (1 << 0) |
274 | #define ACPI_GICC_PERF_INTERRUPT_MODE (1 << 1) |
275 | #define ACPI_GICC_VGIC_MAINTENANCE_INTERRUPT_MODE (1 << 2) |
276 | #define ACPI_GICC_ONLINE_CAPABLE (1 << 3) |
277 | |
278 | // ACPI_GICC_*_INTERRUPT_MODE |
279 | #define ACPI_GICC_TRIGGERING_EDGE 1 |
280 | #define ACPI_GICC_TRIGGERING_LEVEL 0 |
281 | |
282 | UACPI_PACKED(struct acpi_madt_gicc { |
283 | struct acpi_entry_hdr hdr; |
284 | uacpi_u16 rsvd0; |
285 | uacpi_u32 interface_number; |
286 | uacpi_u32 acpi_id; |
287 | uacpi_u32 flags; |
288 | uacpi_u32 parking_protocol_version; |
289 | uacpi_u32 perf_interrupt_gsiv; |
290 | uacpi_u64 parked_address; |
291 | uacpi_u64 address; |
292 | uacpi_u64 gicv; |
293 | uacpi_u64 gich; |
294 | uacpi_u32 vgic_maitenante_interrupt; |
295 | uacpi_u64 gicr_base_address; |
296 | uacpi_u64 mpidr; |
297 | uacpi_u8 power_efficiency_class; |
298 | uacpi_u8 rsvd1; |
299 | uacpi_u16 spe_overflow_interrupt; |
300 | uacpi_u16 trbe_interrupt; |
301 | }) |
302 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gicc, 82); |
303 | |
304 | UACPI_PACKED(struct acpi_madt_gicd { |
305 | struct acpi_entry_hdr hdr; |
306 | uacpi_u16 rsvd0; |
307 | uacpi_u32 id; |
308 | uacpi_u64 address; |
309 | uacpi_u32 system_vector_base; |
310 | uacpi_u8 gic_version; |
311 | uacpi_u8 reserved1[3]; |
312 | }) |
313 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gicd, 24); |
314 | |
315 | // acpi_madt_gic_msi_frame->flags |
316 | #define ACPI_SPI_SELECT (1 << 0) |
317 | |
318 | UACPI_PACKED(struct acpi_madt_gic_msi_frame { |
319 | struct acpi_entry_hdr hdr; |
320 | uacpi_u16 rsvd; |
321 | uacpi_u32 id; |
322 | uacpi_u64 address; |
323 | uacpi_u32 flags; |
324 | uacpi_u16 spi_count; |
325 | uacpi_u16 spi_base; |
326 | }) |
327 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gic_msi_frame, 24); |
328 | |
329 | UACPI_PACKED(struct acpi_madt_gicr { |
330 | struct acpi_entry_hdr hdr; |
331 | uacpi_u16 rsvd; |
332 | uacpi_u64 address; |
333 | uacpi_u32 length; |
334 | }) |
335 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gicr, 16); |
336 | |
337 | UACPI_PACKED(struct acpi_madt_gic_its { |
338 | struct acpi_entry_hdr hdr; |
339 | uacpi_u16 rsvd0; |
340 | uacpi_u32 id; |
341 | uacpi_u64 address; |
342 | uacpi_u32 rsvd1; |
343 | }) |
344 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gic_its, 20); |
345 | |
346 | UACPI_PACKED(struct acpi_madt_multiprocessor_wakeup { |
347 | struct acpi_entry_hdr hdr; |
348 | uacpi_u16 mailbox_version; |
349 | uacpi_u32 rsvd; |
350 | uacpi_u64 mailbox_address; |
351 | }) |
352 | UACPI_EXPECT_SIZEOF(struct acpi_madt_multiprocessor_wakeup, 16); |
353 | |
354 | #define ACPI_CORE_PIC_ENABLED (1 << 0) |
355 | |
356 | UACPI_PACKED(struct acpi_madt_core_pic { |
357 | struct acpi_entry_hdr hdr; |
358 | uacpi_u8 version; |
359 | uacpi_u32 acpi_id; |
360 | uacpi_u32 id; |
361 | uacpi_u32 flags; |
362 | }) |
363 | UACPI_EXPECT_SIZEOF(struct acpi_madt_core_pic, 15); |
364 | |
365 | UACPI_PACKED(struct acpi_madt_lio_pic { |
366 | struct acpi_entry_hdr hdr; |
367 | uacpi_u8 version; |
368 | uacpi_u64 address; |
369 | uacpi_u16 size; |
370 | uacpi_u16 cascade_vector; |
371 | uacpi_u64 cascade_vector_mapping; |
372 | }) |
373 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lio_pic, 23); |
374 | |
375 | UACPI_PACKED(struct acpi_madt_ht_pic { |
376 | struct acpi_entry_hdr hdr; |
377 | uacpi_u8 version; |
378 | uacpi_u64 address; |
379 | uacpi_u16 size; |
380 | uacpi_u64 cascade_vector; |
381 | }) |
382 | UACPI_EXPECT_SIZEOF(struct acpi_madt_ht_pic, 21); |
383 | |
384 | UACPI_PACKED(struct acpi_madt_eio_pic { |
385 | struct acpi_entry_hdr hdr; |
386 | uacpi_u8 version; |
387 | uacpi_u8 cascade_vector; |
388 | uacpi_u8 node; |
389 | uacpi_u64 node_map; |
390 | }) |
391 | UACPI_EXPECT_SIZEOF(struct acpi_madt_eio_pic, 13); |
392 | |
393 | UACPI_PACKED(struct acpi_madt_msi_pic { |
394 | struct acpi_entry_hdr hdr; |
395 | uacpi_u8 version; |
396 | uacpi_u64 address; |
397 | uacpi_u32 start; |
398 | uacpi_u32 count; |
399 | }) |
400 | UACPI_EXPECT_SIZEOF(struct acpi_madt_msi_pic, 19); |
401 | |
402 | UACPI_PACKED(struct acpi_madt_bio_pic { |
403 | struct acpi_entry_hdr hdr; |
404 | uacpi_u8 version; |
405 | uacpi_u64 address; |
406 | uacpi_u16 size; |
407 | uacpi_u16 hardware_id; |
408 | uacpi_u16 gsi_base; |
409 | }) |
410 | UACPI_EXPECT_SIZEOF(struct acpi_madt_bio_pic, 17); |
411 | |
412 | UACPI_PACKED(struct acpi_madt_lpc_pic { |
413 | struct acpi_entry_hdr hdr; |
414 | uacpi_u8 version; |
415 | uacpi_u64 address; |
416 | uacpi_u16 size; |
417 | uacpi_u16 cascade_vector; |
418 | }) |
419 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lpc_pic, 15); |
420 | |
421 | enum acpi_srat_entry_type { |
422 | ACPI_SRAT_ENTRY_TYPE_PROCESSOR_AFFINITY = 0, |
423 | ACPI_SRAT_ENTRY_TYPE_MEMORY_AFFINITY = 1, |
424 | ACPI_SRAT_ENTRY_TYPE_X2APIC_AFFINITY = 2, |
425 | ACPI_SRAT_ENTRY_TYPE_GICC_AFFINITY = 3, |
426 | ACPI_SRAT_ENTRY_TYPE_GIC_ITS_AFFINITY = 4, |
427 | ACPI_SRAT_ENTRY_TYPE_GENERIC_INITIATOR_AFFINITY = 5, |
428 | ACPI_SRAT_ENTRY_TYPE_GENERIC_PORT_AFFINITY = 6, |
429 | ACPI_SRAT_ENTRY_TYPE_RINTC_AFFINITY = 7, |
430 | }; |
431 | |
432 | UACPI_PACKED(struct acpi_srat { |
433 | struct acpi_sdt_hdr hdr; |
434 | uacpi_u32 rsvd0; |
435 | uacpi_u64 rsvd1; |
436 | struct acpi_entry_hdr entries[]; |
437 | }) |
438 | UACPI_EXPECT_SIZEOF(struct acpi_srat, 48); |
439 | |
440 | /* |
441 | * acpi_srat_processor_affinity->flags |
442 | * acpi_srat_x2apic_affinity->flags |
443 | */ |
444 | #define ACPI_SRAT_PROCESSOR_ENABLED (1 << 0) |
445 | |
446 | UACPI_PACKED(struct acpi_srat_processor_affinity { |
447 | struct acpi_entry_hdr hdr; |
448 | uacpi_u8 proximity_domain_low; |
449 | uacpi_u8 id; |
450 | uacpi_u32 flags; |
451 | uacpi_u8 eid; |
452 | uacpi_u8 proximity_domain_high[3]; |
453 | uacpi_u32 clock_domain; |
454 | }) |
455 | UACPI_EXPECT_SIZEOF(struct acpi_srat_processor_affinity, 16); |
456 | |
457 | // acpi_srat_memory_affinity->flags |
458 | #define ACPI_SRAT_MEMORY_ENABLED (1 << 0) |
459 | #define ACPI_SRAT_MEMORY_HOTPLUGGABLE (1 << 1) |
460 | #define ACPI_SRAT_MEMORY_NON_VOLATILE (1 << 2) |
461 | |
462 | UACPI_PACKED(struct acpi_srat_memory_affinity { |
463 | struct acpi_entry_hdr hdr; |
464 | uacpi_u32 proximity_domain; |
465 | uacpi_u16 rsvd0; |
466 | uacpi_u64 address; |
467 | uacpi_u64 length; |
468 | uacpi_u32 rsvd1; |
469 | uacpi_u32 flags; |
470 | uacpi_u64 rsdv2; |
471 | }) |
472 | UACPI_EXPECT_SIZEOF(struct acpi_srat_memory_affinity, 40); |
473 | |
474 | UACPI_PACKED(struct acpi_srat_x2apic_affinity { |
475 | struct acpi_entry_hdr hdr; |
476 | uacpi_u16 rsvd0; |
477 | uacpi_u32 proximity_domain; |
478 | uacpi_u32 id; |
479 | uacpi_u32 flags; |
480 | uacpi_u32 clock_domain; |
481 | uacpi_u32 rsvd1; |
482 | }) |
483 | UACPI_EXPECT_SIZEOF(struct acpi_srat_x2apic_affinity, 24); |
484 | |
485 | // acpi_srat_gicc_affinity->flags |
486 | #define ACPI_SRAT_GICC_ENABLED (1 << 0) |
487 | |
488 | UACPI_PACKED(struct acpi_srat_gicc_affinity { |
489 | struct acpi_entry_hdr hdr; |
490 | uacpi_u32 proximity_domain; |
491 | uacpi_u32 uid; |
492 | uacpi_u32 flags; |
493 | uacpi_u32 clock_domain; |
494 | }) |
495 | UACPI_EXPECT_SIZEOF(struct acpi_srat_gicc_affinity, 18); |
496 | |
497 | UACPI_PACKED(struct acpi_srat_gic_its_affinity { |
498 | struct acpi_entry_hdr hdr; |
499 | uacpi_u32 proximity_domain; |
500 | uacpi_u16 rsvd; |
501 | uacpi_u32 id; |
502 | }) |
503 | UACPI_EXPECT_SIZEOF(struct acpi_srat_gic_its_affinity, 12); |
504 | |
505 | // acpi_srat_generic_affinity->flags |
506 | #define ACPI_GENERIC_AFFINITY_ENABLED (1 << 0) |
507 | #define ACPI_GENERIC_AFFINITY_ARCH_TRANSACTIONS (1 << 1) |
508 | |
509 | UACPI_PACKED(struct acpi_srat_generic_affinity { |
510 | struct acpi_entry_hdr hdr; |
511 | uacpi_u8 rsvd0; |
512 | uacpi_u8 handle_type; |
513 | uacpi_u32 proximity_domain; |
514 | uacpi_u8 handle[16]; |
515 | uacpi_u32 flags; |
516 | uacpi_u32 rsvd1; |
517 | }) |
518 | UACPI_EXPECT_SIZEOF(struct acpi_srat_generic_affinity, 32); |
519 | |
520 | // acpi_srat_rintc_affinity->flags |
521 | #define ACPI_SRAT_RINTC_AFFINITY_ENABLED (1 << 0) |
522 | |
523 | UACPI_PACKED(struct acpi_srat_rintc_affinity { |
524 | struct acpi_entry_hdr hdr; |
525 | uacpi_u16 rsvd; |
526 | uacpi_u32 proximity_domain; |
527 | uacpi_u32 uid; |
528 | uacpi_u32 flags; |
529 | uacpi_u32 clock_domain; |
530 | }) |
531 | UACPI_EXPECT_SIZEOF(struct acpi_srat_rintc_affinity, 20); |
532 | |
533 | UACPI_PACKED(struct acpi_slit { |
534 | struct acpi_sdt_hdr hdr; |
535 | uacpi_u64 num_localities; |
536 | uacpi_u8 matrix[]; |
537 | }) |
538 | UACPI_EXPECT_SIZEOF(struct acpi_slit, 44); |
539 | |
540 | // acpi_fdt->iapc_flags |
541 | #define ACPI_IA_PC_LEGACY_DEVS (1 << 0) |
542 | #define ACPI_IA_PC_8042 (1 << 1) |
543 | #define ACPI_IA_PC_NO_VGA (1 << 2) |
544 | #define ACPI_IA_PC_NO_MSI (1 << 3) |
545 | #define ACPI_IA_PC_NO_PCIE_ASPM (1 << 4) |
546 | #define ACPI_IA_PC_NO_CMOS_RTC (1 << 5) |
547 | |
548 | // acpi_fdt->flags |
549 | #define ACPI_WBINVD (1 << 0) |
550 | #define ACPI_WBINVD_FLUSH (1 << 1) |
551 | #define ACPI_PROC_C1 (1 << 2) |
552 | #define ACPI_P_LVL2_UP (1 << 3) |
553 | #define ACPI_PWR_BUTTON (1 << 4) |
554 | #define ACPI_SLP_BUTTON (1 << 5) |
555 | #define ACPI_FIX_RTC (1 << 6) |
556 | #define ACPI_RTC_S4 (1 << 7) |
557 | #define ACPI_TMR_VAL_EXT (1 << 8) |
558 | #define ACPI_DCK_CAP (1 << 9) |
559 | #define ACPI_RESET_REG_SUP (1 << 10) |
560 | #define ACPI_SEALED_CASE (1 << 11) |
561 | #define ACPI_HEADLESS (1 << 12) |
562 | #define ACPI_CPU_SW_SLP (1 << 13) |
563 | #define ACPI_PCI_EXP_WAK (1 << 14) |
564 | #define ACPI_USE_PLATFORM_CLOCK (1 << 15) |
565 | #define ACPI_S4_RTC_STS_VALID (1 << 16) |
566 | #define ACPI_REMOTE_POWER_ON_CAPABLE (1 << 17) |
567 | #define ACPI_FORCE_APIC_CLUSTER_MODEL (1 << 18) |
568 | #define ACPI_FORCE_APIC_PHYS_DEST_MODE (1 << 19) |
569 | #define ACPI_HW_REDUCED_ACPI (1 << 20) |
570 | #define ACPI_LOW_POWER_S0_IDLE_CAPABLE (1 << 21) |
571 | |
572 | // acpi_fdt->arm_flags |
573 | #define ACPI_ARM_PSCI_COMPLIANT (1 << 0) |
574 | #define ACPI_ARM_PSCI_USE_HVC (1 << 1) |
575 | |
576 | UACPI_PACKED(struct acpi_fadt { |
577 | struct acpi_sdt_hdr hdr; |
578 | uacpi_u32 firmware_ctrl; |
579 | uacpi_u32 dsdt; |
580 | uacpi_u8 int_model; |
581 | uacpi_u8 preferred_pm_profile; |
582 | uacpi_u16 sci_int; |
583 | uacpi_u32 smi_cmd; |
584 | uacpi_u8 acpi_enable; |
585 | uacpi_u8 acpi_disable; |
586 | uacpi_u8 s4bios_req; |
587 | uacpi_u8 pstate_cnt; |
588 | uacpi_u32 pm1a_evt_blk; |
589 | uacpi_u32 pm1b_evt_blk; |
590 | uacpi_u32 pm1a_cnt_blk; |
591 | uacpi_u32 pm1b_cnt_blk; |
592 | uacpi_u32 pm2_cnt_blk; |
593 | uacpi_u32 pm_tmr_blk; |
594 | uacpi_u32 gpe0_blk; |
595 | uacpi_u32 gpe1_blk; |
596 | uacpi_u8 pm1_evt_len; |
597 | uacpi_u8 pm1_cnt_len; |
598 | uacpi_u8 pm2_cnt_len; |
599 | uacpi_u8 pm_tmr_len; |
600 | uacpi_u8 gpe0_blk_len; |
601 | uacpi_u8 gpe1_blk_len; |
602 | uacpi_u8 gpe1_base; |
603 | uacpi_u8 cst_cnt; |
604 | uacpi_u16 p_lvl2_lat; |
605 | uacpi_u16 p_lvl3_lat; |
606 | uacpi_u16 flush_size; |
607 | uacpi_u16 flush_stride; |
608 | uacpi_u8 duty_offset; |
609 | uacpi_u8 duty_width; |
610 | uacpi_u8 day_alrm; |
611 | uacpi_u8 mon_alrm; |
612 | uacpi_u8 century; |
613 | uacpi_u16 iapc_boot_arch; |
614 | uacpi_u8 rsvd; |
615 | uacpi_u32 flags; |
616 | struct acpi_gas reset_reg; |
617 | uacpi_u8 reset_value; |
618 | uacpi_u16 arm_boot_arch; |
619 | uacpi_u8 fadt_minor_verison; |
620 | uacpi_u64 x_firmware_ctrl; |
621 | uacpi_u64 x_dsdt; |
622 | struct acpi_gas x_pm1a_evt_blk; |
623 | struct acpi_gas x_pm1b_evt_blk; |
624 | struct acpi_gas x_pm1a_cnt_blk; |
625 | struct acpi_gas x_pm1b_cnt_blk; |
626 | struct acpi_gas x_pm2_cnt_blk; |
627 | struct acpi_gas x_pm_tmr_blk; |
628 | struct acpi_gas x_gpe0_blk; |
629 | struct acpi_gas x_gpe1_blk; |
630 | struct acpi_gas sleep_control_reg; |
631 | struct acpi_gas sleep_status_reg; |
632 | uacpi_u64 hypervisor_vendor_identity; |
633 | }) |
634 | UACPI_EXPECT_SIZEOF(struct acpi_fadt, 276); |
635 | |
636 | // acpi_facs->flags |
637 | #define ACPI_S4BIOS_F (1 << 0) |
638 | #define ACPI_64BIT_WAKE_SUPPORTED_F (1 << 1) |
639 | |
640 | // acpi_facs->ospm_flags |
641 | #define ACPI_64BIT_WAKE_F (1 << 0) |
642 | |
643 | struct acpi_facs { |
644 | uacpi_char signature[4]; |
645 | uacpi_u32 length; |
646 | uacpi_u32 hardware_signature; |
647 | uacpi_u32 firmware_waking_vector; |
648 | uacpi_u32 global_lock; |
649 | uacpi_u32 flags; |
650 | uacpi_u64 x_firmware_waking_vector; |
651 | uacpi_u8 version; |
652 | uacpi_char rsvd0[3]; |
653 | uacpi_u32 ospm_flags; |
654 | uacpi_char rsvd1[24]; |
655 | }; |
656 | UACPI_EXPECT_SIZEOF(struct acpi_facs, 64); |
657 | |
658 | UACPI_PACKED(struct acpi_mcfg_allocation { |
659 | uacpi_u64 address; |
660 | uacpi_u16 segment; |
661 | uacpi_u8 start_bus; |
662 | uacpi_u8 end_bus; |
663 | uacpi_u32 rsvd; |
664 | }) |
665 | UACPI_EXPECT_SIZEOF(struct acpi_mcfg_allocation, 16); |
666 | |
667 | UACPI_PACKED(struct acpi_mcfg { |
668 | struct acpi_sdt_hdr hdr; |
669 | uacpi_u64 rsvd; |
670 | struct acpi_mcfg_allocation entries[]; |
671 | }) |
672 | UACPI_EXPECT_SIZEOF(struct acpi_mcfg, 44); |
673 | |
674 | // acpi_hpet->block_id |
675 | #define ACPI_HPET_PCI_VENDOR_ID_SHIFT 16 |
676 | #define ACPI_HPET_LEGACY_REPLACEMENT_IRQ_ROUTING_CAPABLE (1 << 15) |
677 | #define ACPI_HPET_COUNT_SIZE_CAP_COUNTER_SIZE (1 << 13) |
678 | #define ACPI_HPET_NUMBER_OF_COMPARATORS_SHIFT 8 |
679 | #define ACPI_HPET_NUMBER_OF_COMPARATORS_MASK 0b11111 |
680 | #define ACPI_HPET_HARDWARE_REV_ID_MASK 0b11111111 |
681 | |
682 | // acpi_hpet->flags |
683 | #define ACPI_HPET_PAGE_PROTECTION_MASK 0b11 |
684 | #define ACPI_HPET_PAGE_NO_PROTECTION 0 |
685 | #define ACPI_HPET_PAGE_4K_PROTECTED 1 |
686 | #define ACPI_HPET_PAGE_64K_PROTECTED 2 |
687 | |
688 | UACPI_PACKED(struct acpi_hpet { |
689 | struct acpi_sdt_hdr hdr; |
690 | uacpi_u32 block_id; |
691 | struct acpi_gas address; |
692 | uacpi_u8 number; |
693 | uacpi_u16 min_clock_tick; |
694 | uacpi_u8 flags; |
695 | }) |
696 | UACPI_EXPECT_SIZEOF(struct acpi_hpet, 56); |
697 | |
698 | // PM1{a,b}_STS |
699 | #define ACPI_PM1_STS_TMR_STS_IDX 0 |
700 | #define ACPI_PM1_STS_BM_STS_IDX 4 |
701 | #define ACPI_PM1_STS_GBL_STS_IDX 5 |
702 | #define ACPI_PM1_STS_PWRBTN_STS_IDX 8 |
703 | #define ACPI_PM1_STS_SLPBTN_STS_IDX 9 |
704 | #define ACPI_PM1_STS_RTC_STS_IDX 10 |
705 | #define ACPI_PM1_STS_IGN0_IDX 11 |
706 | #define ACPI_PM1_STS_PCIEXP_WAKE_STS_IDX 14 |
707 | #define ACPI_PM1_STS_WAKE_STS_IDX 15 |
708 | |
709 | #define ACPI_PM1_STS_TMR_STS_MASK (1 << ACPI_PM1_STS_TMR_STS_IDX) |
710 | #define ACPI_PM1_STS_BM_STS_MASK (1 << ACPI_PM1_STS_BM_STS_IDX) |
711 | #define ACPI_PM1_STS_GBL_STS_MASK (1 << ACPI_PM1_STS_GBL_STS_IDX) |
712 | #define ACPI_PM1_STS_PWRBTN_STS_MASK (1 << ACPI_PM1_STS_PWRBTN_STS_IDX) |
713 | #define ACPI_PM1_STS_SLPBTN_STS_MASK (1 << ACPI_PM1_STS_SLPBTN_STS_IDX) |
714 | #define ACPI_PM1_STS_RTC_STS_MASK (1 << ACPI_PM1_STS_RTC_STS_IDX) |
715 | #define ACPI_PM1_STS_IGN0_MASK (1 << ACPI_PM1_STS_IGN0_IDX) |
716 | #define ACPI_PM1_STS_PCIEXP_WAKE_STS_MASK (1 << ACPI_PM1_STS_PCIEXP_WAKE_STS_IDX) |
717 | #define ACPI_PM1_STS_WAKE_STS_MASK (1 << ACPI_PM1_STS_WAKE_STS_IDX) |
718 | |
719 | #define ACPI_PM1_STS_CLEAR 1 |
720 | |
721 | // PM1{a,b}_EN |
722 | #define ACPI_PM1_EN_TMR_EN_IDX 0 |
723 | #define ACPI_PM1_EN_GBL_EN_IDX 5 |
724 | #define ACPI_PM1_EN_PWRBTN_EN_IDX 8 |
725 | #define ACPI_PM1_EN_SLPBTN_EN_IDX 9 |
726 | #define ACPI_PM1_EN_RTC_EN_IDX 10 |
727 | #define ACPI_PM1_EN_PCIEXP_WAKE_DIS_IDX 14 |
728 | |
729 | #define ACPI_PM1_EN_TMR_EN_MASK (1 << ACPI_PM1_EN_TMR_EN_IDX) |
730 | #define ACPI_PM1_EN_GBL_EN_MASK (1 << ACPI_PM1_EN_GBL_EN_IDX) |
731 | #define ACPI_PM1_EN_PWRBTN_EN_MASK (1 << ACPI_PM1_EN_PWRBTN_EN_IDX) |
732 | #define ACPI_PM1_EN_SLPBTN_EN_MASK (1 << ACPI_PM1_EN_SLPBTN_EN_IDX) |
733 | #define ACPI_PM1_EN_RTC_EN_MASK (1 << ACPI_PM1_EN_RTC_EN_IDX) |
734 | #define ACPI_PM1_EN_PCIEXP_WAKE_DIS_MASK (1 << ACPI_PM1_EN_PCIEXP_WAKE_DIS_IDX) |
735 | |
736 | // PM1{a,b}_CNT_BLK |
737 | #define ACPI_PM1_CNT_SCI_EN_IDX 0 |
738 | #define ACPI_PM1_CNT_BM_RLD_IDX 1 |
739 | #define ACPI_PM1_CNT_GBL_RLS_IDX 2 |
740 | #define ACPI_PM1_CNT_RSVD0_IDX 3 |
741 | #define ACPI_PM1_CNT_RSVD1_IDX 4 |
742 | #define ACPI_PM1_CNT_RSVD2_IDX 5 |
743 | #define ACPI_PM1_CNT_RSVD3_IDX 6 |
744 | #define ACPI_PM1_CNT_RSVD4_IDX 7 |
745 | #define ACPI_PM1_CNT_RSVD5_IDX 8 |
746 | #define ACPI_PM1_CNT_IGN0_IDX 9 |
747 | #define ACPI_PM1_CNT_SLP_TYP_IDX 10 |
748 | #define ACPI_PM1_CNT_SLP_EN_IDX 13 |
749 | #define ACPI_PM1_CNT_RSVD6_IDX 14 |
750 | #define ACPI_PM1_CNT_RSVD7_IDX 15 |
751 | |
752 | #define ACPI_SLP_TYP_MAX 0b111 |
753 | |
754 | #define ACPI_PM1_CNT_SCI_EN_MASK (1 << ACPI_PM1_CNT_SCI_EN_IDX) |
755 | #define ACPI_PM1_CNT_BM_RLD_MASK (1 << ACPI_PM1_CNT_BM_RLD_IDX) |
756 | #define ACPI_PM1_CNT_GBL_RLS_MASK (1 << ACPI_PM1_CNT_GBL_RLS_IDX) |
757 | #define ACPI_PM1_CNT_SLP_TYP_MASK (ACPI_SLP_TYP_MAX << ACPI_PM1_CNT_SLP_TYP_IDX) |
758 | #define ACPI_PM1_CNT_SLP_EN_MASK (1 << ACPI_PM1_CNT_SLP_EN_IDX) |
759 | |
760 | /* |
761 | * SCI_EN is not in this mask even though the spec says it must be preserved. |
762 | * This is because it's known to be bugged on some hardware that relies on |
763 | * software writing 1 to it after resume (as indicated by a similar comment in |
764 | * ACPICA) |
765 | */ |
766 | #define ACPI_PM1_CNT_PRESERVE_MASK ( \ |
767 | (1 << ACPI_PM1_CNT_RSVD0_IDX) | \ |
768 | (1 << ACPI_PM1_CNT_RSVD1_IDX) | \ |
769 | (1 << ACPI_PM1_CNT_RSVD2_IDX) | \ |
770 | (1 << ACPI_PM1_CNT_RSVD3_IDX) | \ |
771 | (1 << ACPI_PM1_CNT_RSVD4_IDX) | \ |
772 | (1 << ACPI_PM1_CNT_RSVD5_IDX) | \ |
773 | (1 << ACPI_PM1_CNT_IGN0_IDX ) | \ |
774 | (1 << ACPI_PM1_CNT_RSVD6_IDX) | \ |
775 | (1 << ACPI_PM1_CNT_RSVD7_IDX) \ |
776 | ) |
777 | |
778 | // PM2_CNT |
779 | #define ACPI_PM2_CNT_ARB_DIS_IDX 0 |
780 | #define ACPI_PM2_CNT_ARB_DIS_MASK (1 << ACPI_PM2_CNT_ARB_DIS_IDX) |
781 | |
782 | // All bits are reserved but this first one |
783 | #define ACPI_PM2_CNT_PRESERVE_MASK (~((uacpi_u64)ACPI_PM2_CNT_ARB_DIS_MASK)) |
784 | |
785 | // SLEEP_CONTROL_REG |
786 | #define ACPI_SLP_CNT_RSVD0_IDX 0 |
787 | #define ACPI_SLP_CNT_IGN0_IDX 1 |
788 | #define ACPI_SLP_CNT_SLP_TYP_IDX 2 |
789 | #define ACPI_SLP_CNT_SLP_EN_IDX 5 |
790 | #define ACPI_SLP_CNT_RSVD1_IDX 6 |
791 | #define ACPI_SLP_CNT_RSVD2_IDX 7 |
792 | |
793 | #define ACPI_SLP_CNT_SLP_TYP_MASK (ACPI_SLP_TYP_MAX << ACPI_SLP_CNT_SLP_TYP_IDX) |
794 | #define ACPI_SLP_CNT_SLP_EN_MASK (1 << ACPI_SLP_CNT_SLP_EN_IDX) |
795 | |
796 | #define ACPI_SLP_CNT_PRESERVE_MASK ( \ |
797 | (1 << ACPI_SLP_CNT_RSVD0_IDX) | \ |
798 | (1 << ACPI_SLP_CNT_IGN0_IDX) | \ |
799 | (1 << ACPI_SLP_CNT_RSVD1_IDX) | \ |
800 | (1 << ACPI_SLP_CNT_RSVD2_IDX) \ |
801 | ) |
802 | |
803 | // SLEEP_STATUS_REG |
804 | #define ACPI_SLP_STS_WAK_STS_IDX 7 |
805 | |
806 | #define ACPI_SLP_STS_WAK_STS_MASK (1 << ACPI_SLP_STS_WAK_STS_IDX) |
807 | |
808 | // All bits are reserved but this last one |
809 | #define ACPI_SLP_STS_PRESERVE_MASK (~((uacpi_u64)ACPI_SLP_STS_WAK_STS_MASK)) |
810 | |
811 | #define ACPI_SLP_STS_CLEAR 1 |
812 | |
813 | UACPI_PACKED(struct acpi_dsdt { |
814 | struct acpi_sdt_hdr hdr; |
815 | uacpi_u8 definition_block[]; |
816 | }) |
817 | |
818 | UACPI_PACKED(struct acpi_ssdt { |
819 | struct acpi_sdt_hdr hdr; |
820 | uacpi_u8 definition_block[]; |
821 | }) |
822 | |
823 | /* |
824 | * ACPI 6.5 specification: |
825 | * Bit [0] - Set if the device is present. |
826 | * Bit [1] - Set if the device is enabled and decoding its resources. |
827 | * Bit [2] - Set if the device should be shown in the UI. |
828 | * Bit [3] - Set if the device is functioning properly (cleared if device |
829 | * failed its diagnostics). |
830 | * Bit [4] - Set if the battery is present. |
831 | */ |
832 | #define ACPI_STA_RESULT_DEVICE_PRESENT (1 << 0) |
833 | #define ACPI_STA_RESULT_DEVICE_ENABLED (1 << 1) |
834 | #define ACPI_STA_RESULT_DEVICE_SHOWN_IN_UI (1 << 2) |
835 | #define ACPI_STA_RESULT_DEVICE_FUNCTIONING (1 << 3) |
836 | #define ACPI_STA_RESULT_DEVICE_BATTERY_PRESENT (1 << 4) |
837 | |
838 | #define ACPI_REG_DISCONNECT 0 |
839 | #define ACPI_REG_CONNECT 1 |
840 | |
841 | UACPI_PACKED(struct acpi_ecdt { |
842 | struct acpi_sdt_hdr hdr; |
843 | struct acpi_gas ec_control; |
844 | struct acpi_gas ec_data; |
845 | uacpi_u32 uid; |
846 | uacpi_u8 gpe_bit; |
847 | uacpi_char ec_id[]; |
848 | }) |
849 | UACPI_EXPECT_SIZEOF(struct acpi_ecdt, 65); |
850 | |
851 | #define ACPI_LARGE_ITEM (1 << 7) |
852 | |
853 | #define ACPI_SMALL_ITEM_NAME_IDX 3 |
854 | #define ACPI_SMALL_ITEM_NAME_MASK 0b1111 |
855 | #define ACPI_SMALL_ITEM_LENGTH_MASK 0b111 |
856 | |
857 | #define ACPI_LARGE_ITEM_NAME_MASK 0b1111111 |
858 | |
859 | // Small items |
860 | #define ACPI_RESOURCE_IRQ 0x04 |
861 | #define ACPI_RESOURCE_DMA 0x05 |
862 | #define ACPI_RESOURCE_START_DEPENDENT 0x06 |
863 | #define ACPI_RESOURCE_END_DEPENDENT 0x07 |
864 | #define ACPI_RESOURCE_IO 0x08 |
865 | #define ACPI_RESOURCE_FIXED_IO 0x09 |
866 | #define ACPI_RESOURCE_FIXED_DMA 0x0A |
867 | #define ACPI_RESOURCE_VENDOR_TYPE0 0x0E |
868 | #define ACPI_RESOURCE_END_TAG 0x0F |
869 | |
870 | // Large items |
871 | #define ACPI_RESOURCE_MEMORY24 0x01 |
872 | #define ACPI_RESOURCE_GENERIC_REGISTER 0x02 |
873 | #define ACPI_RESOURCE_VENDOR_TYPE1 0x04 |
874 | #define ACPI_RESOURCE_MEMORY32 0x05 |
875 | #define ACPI_RESOURCE_FIXED_MEMORY32 0x06 |
876 | #define ACPI_RESOURCE_ADDRESS32 0x07 |
877 | #define ACPI_RESOURCE_ADDRESS16 0x08 |
878 | #define ACPI_RESOURCE_EXTENDED_IRQ 0x09 |
879 | #define ACPI_RESOURCE_ADDRESS64 0x0A |
880 | #define ACPI_RESOURCE_ADDRESS64_EXTENDED 0x0B |
881 | #define ACPI_RESOURCE_GPIO_CONNECTION 0x0C |
882 | #define ACPI_RESOURCE_PIN_FUNCTION 0x0D |
883 | #define ACPI_RESOURCE_SERIAL_CONNECTION 0x0E |
884 | #define ACPI_RESOURCE_PIN_CONFIGURATION 0x0F |
885 | #define ACPI_RESOURCE_PIN_GROUP 0x10 |
886 | #define ACPI_RESOURCE_PIN_GROUP_FUNCTION 0x11 |
887 | #define ACPI_RESOURCE_PIN_GROUP_CONFIGURATION 0x12 |
888 | #define ACPI_RESOURCE_CLOCK_INPUT 0x13 |
889 | |
890 | /* |
891 | * Resources as encoded by the raw AML byte stream. |
892 | * For decode API & human usable structures refer to uacpi/resources.h |
893 | */ |
894 | UACPI_PACKED(struct acpi_small_item { |
895 | uacpi_u8 type_and_length; |
896 | }) |
897 | UACPI_EXPECT_SIZEOF(struct acpi_small_item, 1); |
898 | |
899 | UACPI_PACKED(struct acpi_resource_irq { |
900 | struct acpi_small_item common; |
901 | uacpi_u16 irq_mask; |
902 | uacpi_u8 flags; |
903 | }) |
904 | UACPI_EXPECT_SIZEOF(struct acpi_resource_irq, 4); |
905 | |
906 | UACPI_PACKED(struct acpi_resource_dma { |
907 | struct acpi_small_item common; |
908 | uacpi_u8 channel_mask; |
909 | uacpi_u8 flags; |
910 | }) |
911 | UACPI_EXPECT_SIZEOF(struct acpi_resource_dma, 3); |
912 | |
913 | UACPI_PACKED(struct acpi_resource_start_dependent { |
914 | struct acpi_small_item common; |
915 | uacpi_u8 flags; |
916 | }) |
917 | UACPI_EXPECT_SIZEOF(struct acpi_resource_start_dependent, 2); |
918 | |
919 | UACPI_PACKED(struct acpi_resource_end_dependent { |
920 | struct acpi_small_item common; |
921 | }) |
922 | UACPI_EXPECT_SIZEOF(struct acpi_resource_end_dependent, 1); |
923 | |
924 | UACPI_PACKED(struct acpi_resource_io { |
925 | struct acpi_small_item common; |
926 | uacpi_u8 information; |
927 | uacpi_u16 minimum; |
928 | uacpi_u16 maximum; |
929 | uacpi_u8 alignment; |
930 | uacpi_u8 length; |
931 | }) |
932 | UACPI_EXPECT_SIZEOF(struct acpi_resource_io, 8); |
933 | |
934 | UACPI_PACKED(struct acpi_resource_fixed_io { |
935 | struct acpi_small_item common; |
936 | uacpi_u16 address; |
937 | uacpi_u8 length; |
938 | }) |
939 | UACPI_EXPECT_SIZEOF(struct acpi_resource_fixed_io, 4); |
940 | |
941 | UACPI_PACKED(struct acpi_resource_fixed_dma { |
942 | struct acpi_small_item common; |
943 | uacpi_u16 request_line; |
944 | uacpi_u16 channel; |
945 | uacpi_u8 transfer_width; |
946 | }) |
947 | UACPI_EXPECT_SIZEOF(struct acpi_resource_fixed_dma, 6); |
948 | |
949 | UACPI_PACKED(struct acpi_resource_vendor_defined_type0 { |
950 | struct acpi_small_item common; |
951 | uacpi_u8 byte_data[]; |
952 | }) |
953 | UACPI_EXPECT_SIZEOF(struct acpi_resource_vendor_defined_type0, 1); |
954 | |
955 | UACPI_PACKED(struct acpi_resource_end_tag { |
956 | struct acpi_small_item common; |
957 | uacpi_u8 checksum; |
958 | }) |
959 | UACPI_EXPECT_SIZEOF(struct acpi_resource_end_tag, 2); |
960 | |
961 | UACPI_PACKED(struct acpi_large_item { |
962 | uacpi_u8 type; |
963 | uacpi_u16 length; |
964 | }) |
965 | UACPI_EXPECT_SIZEOF(struct acpi_large_item, 3); |
966 | |
967 | UACPI_PACKED(struct acpi_resource_memory24 { |
968 | struct acpi_large_item common; |
969 | uacpi_u8 information; |
970 | uacpi_u16 minimum; |
971 | uacpi_u16 maximum; |
972 | uacpi_u16 alignment; |
973 | uacpi_u16 length; |
974 | }) |
975 | UACPI_EXPECT_SIZEOF(struct acpi_resource_memory24, 12); |
976 | |
977 | UACPI_PACKED(struct acpi_resource_vendor_defined_type1 { |
978 | struct acpi_large_item common; |
979 | uacpi_u8 byte_data[]; |
980 | }) |
981 | UACPI_EXPECT_SIZEOF(struct acpi_resource_vendor_defined_type1, 3); |
982 | |
983 | UACPI_PACKED(struct acpi_resource_memory32 { |
984 | struct acpi_large_item common; |
985 | uacpi_u8 information; |
986 | uacpi_u32 minimum; |
987 | uacpi_u32 maximum; |
988 | uacpi_u32 alignment; |
989 | uacpi_u32 length; |
990 | }) |
991 | UACPI_EXPECT_SIZEOF(struct acpi_resource_memory32, 20); |
992 | |
993 | UACPI_PACKED(struct acpi_resource_fixed_memory32 { |
994 | struct acpi_large_item common; |
995 | uacpi_u8 information; |
996 | uacpi_u32 address; |
997 | uacpi_u32 length; |
998 | }) |
999 | UACPI_EXPECT_SIZEOF(struct acpi_resource_fixed_memory32, 12); |
1000 | |
1001 | UACPI_PACKED(struct acpi_resource_address { |
1002 | struct acpi_large_item common; |
1003 | uacpi_u8 type; |
1004 | uacpi_u8 flags; |
1005 | uacpi_u8 type_flags; |
1006 | }) |
1007 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address, 6); |
1008 | |
1009 | UACPI_PACKED(struct acpi_resource_address64 { |
1010 | struct acpi_resource_address common; |
1011 | uacpi_u64 granularity; |
1012 | uacpi_u64 minimum; |
1013 | uacpi_u64 maximum; |
1014 | uacpi_u64 translation_offset; |
1015 | uacpi_u64 length; |
1016 | }) |
1017 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address64, 46); |
1018 | |
1019 | UACPI_PACKED(struct acpi_resource_address32 { |
1020 | struct acpi_resource_address common; |
1021 | uacpi_u32 granularity; |
1022 | uacpi_u32 minimum; |
1023 | uacpi_u32 maximum; |
1024 | uacpi_u32 translation_offset; |
1025 | uacpi_u32 length; |
1026 | }) |
1027 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address32, 26); |
1028 | |
1029 | UACPI_PACKED(struct acpi_resource_address16 { |
1030 | struct acpi_resource_address common; |
1031 | uacpi_u16 granularity; |
1032 | uacpi_u16 minimum; |
1033 | uacpi_u16 maximum; |
1034 | uacpi_u16 translation_offset; |
1035 | uacpi_u16 length; |
1036 | }) |
1037 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address16, 16); |
1038 | |
1039 | UACPI_PACKED(struct acpi_resource_address64_extended { |
1040 | struct acpi_resource_address common; |
1041 | uacpi_u8 revision_id; |
1042 | uacpi_u8 rsvd; |
1043 | uacpi_u64 granularity; |
1044 | uacpi_u64 minimum; |
1045 | uacpi_u64 maximum; |
1046 | uacpi_u64 translation_offset; |
1047 | uacpi_u64 length; |
1048 | uacpi_u64 attributes; |
1049 | }) |
1050 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address64_extended, 56); |
1051 | |
1052 | UACPI_PACKED(struct acpi_resource_extended_irq { |
1053 | struct acpi_large_item common; |
1054 | uacpi_u8 flags; |
1055 | uacpi_u8 num_irqs; |
1056 | uacpi_u32 irqs[]; |
1057 | }) |
1058 | UACPI_EXPECT_SIZEOF(struct acpi_resource_extended_irq, 5); |
1059 | |
1060 | UACPI_PACKED(struct acpi_resource_generic_register { |
1061 | struct acpi_large_item common; |
1062 | uacpi_u8 address_space_id; |
1063 | uacpi_u8 bit_width; |
1064 | uacpi_u8 bit_offset; |
1065 | uacpi_u8 access_size; |
1066 | uacpi_u64 address; |
1067 | }) |
1068 | UACPI_EXPECT_SIZEOF(struct acpi_resource_generic_register, 15); |
1069 | |
1070 | UACPI_PACKED(struct acpi_resource_gpio_connection { |
1071 | struct acpi_large_item common; |
1072 | uacpi_u8 revision_id; |
1073 | uacpi_u8 type; |
1074 | uacpi_u16 general_flags; |
1075 | uacpi_u16 connection_flags; |
1076 | uacpi_u8 pull_configuration; |
1077 | uacpi_u16 drive_strength; |
1078 | uacpi_u16 debounce_timeout; |
1079 | uacpi_u16 pin_table_offset; |
1080 | uacpi_u8 source_index; |
1081 | uacpi_u16 source_offset; |
1082 | uacpi_u16 vendor_data_offset; |
1083 | uacpi_u16 vendor_data_length; |
1084 | }) |
1085 | UACPI_EXPECT_SIZEOF(struct acpi_resource_gpio_connection, 23); |
1086 | |
1087 | #define ACPI_SERIAL_TYPE_I2C 1 |
1088 | #define ACPI_SERIAL_TYPE_SPI 2 |
1089 | #define ACPI_SERIAL_TYPE_UART 3 |
1090 | #define ACPI_SERIAL_TYPE_CSI2 4 |
1091 | #define ACPI_SERIAL_TYPE_MAX ACPI_SERIAL_TYPE_CSI2 |
1092 | |
1093 | UACPI_PACKED(struct acpi_resource_serial { |
1094 | struct acpi_large_item common; |
1095 | uacpi_u8 revision_id; |
1096 | uacpi_u8 source_index; |
1097 | uacpi_u8 type; |
1098 | uacpi_u8 flags; |
1099 | uacpi_u16 type_specific_flags; |
1100 | uacpi_u8 type_specific_revision_id; |
1101 | uacpi_u16 type_data_length; |
1102 | }) |
1103 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial, 12); |
1104 | |
1105 | UACPI_PACKED(struct acpi_resource_serial_i2c { |
1106 | struct acpi_resource_serial common; |
1107 | uacpi_u32 connection_speed; |
1108 | uacpi_u16 slave_address; |
1109 | }) |
1110 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_i2c, 18); |
1111 | |
1112 | UACPI_PACKED(struct acpi_resource_serial_spi { |
1113 | struct acpi_resource_serial common; |
1114 | uacpi_u32 connection_speed; |
1115 | uacpi_u8 data_bit_length; |
1116 | uacpi_u8 phase; |
1117 | uacpi_u8 polarity; |
1118 | uacpi_u16 device_selection; |
1119 | }) |
1120 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_spi, 21); |
1121 | |
1122 | UACPI_PACKED(struct acpi_resource_serial_uart { |
1123 | struct acpi_resource_serial common; |
1124 | uacpi_u32 baud_rate; |
1125 | uacpi_u16 rx_fifo; |
1126 | uacpi_u16 tx_fifo; |
1127 | uacpi_u8 parity; |
1128 | uacpi_u8 lines_enabled; |
1129 | }) |
1130 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_uart, 22); |
1131 | |
1132 | UACPI_PACKED(struct acpi_resource_serial_csi2 { |
1133 | struct acpi_resource_serial common; |
1134 | }) |
1135 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_csi2, 12); |
1136 | |
1137 | UACPI_PACKED(struct acpi_resource_pin_function { |
1138 | struct acpi_large_item common; |
1139 | uacpi_u8 revision_id; |
1140 | uacpi_u16 flags; |
1141 | uacpi_u8 pull_configuration; |
1142 | uacpi_u16 function_number; |
1143 | uacpi_u16 pin_table_offset; |
1144 | uacpi_u8 source_index; |
1145 | uacpi_u16 source_offset; |
1146 | uacpi_u16 vendor_data_offset; |
1147 | uacpi_u16 vendor_data_length; |
1148 | }) |
1149 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_function, 18); |
1150 | |
1151 | UACPI_PACKED(struct acpi_resource_pin_configuration { |
1152 | struct acpi_large_item common; |
1153 | uacpi_u8 revision_id; |
1154 | uacpi_u16 flags; |
1155 | uacpi_u8 type; |
1156 | uacpi_u32 value; |
1157 | uacpi_u16 pin_table_offset; |
1158 | uacpi_u8 source_index; |
1159 | uacpi_u16 source_offset; |
1160 | uacpi_u16 vendor_data_offset; |
1161 | uacpi_u16 vendor_data_length; |
1162 | }) |
1163 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_configuration, 20); |
1164 | |
1165 | UACPI_PACKED(struct acpi_resource_pin_group { |
1166 | struct acpi_large_item common; |
1167 | uacpi_u8 revision_id; |
1168 | uacpi_u16 flags; |
1169 | uacpi_u16 pin_table_offset; |
1170 | uacpi_u16 source_lable_offset; |
1171 | uacpi_u16 vendor_data_offset; |
1172 | uacpi_u16 vendor_data_length; |
1173 | }) |
1174 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_group, 14); |
1175 | |
1176 | UACPI_PACKED(struct acpi_resource_pin_group_function { |
1177 | struct acpi_large_item common; |
1178 | uacpi_u8 revision_id; |
1179 | uacpi_u16 flags; |
1180 | uacpi_u16 function; |
1181 | uacpi_u8 source_index; |
1182 | uacpi_u16 source_offset; |
1183 | uacpi_u16 source_lable_offset; |
1184 | uacpi_u16 vendor_data_offset; |
1185 | uacpi_u16 vendor_data_length; |
1186 | }) |
1187 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_group_function, 17); |
1188 | |
1189 | UACPI_PACKED(struct acpi_resource_pin_group_configuration { |
1190 | struct acpi_large_item common; |
1191 | uacpi_u8 revision_id; |
1192 | uacpi_u16 flags; |
1193 | uacpi_u8 type; |
1194 | uacpi_u32 value; |
1195 | uacpi_u8 source_index; |
1196 | uacpi_u16 source_offset; |
1197 | uacpi_u16 source_lable_offset; |
1198 | uacpi_u16 vendor_data_offset; |
1199 | uacpi_u16 vendor_data_length; |
1200 | }) |
1201 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_group_configuration, 20); |
1202 | |
1203 | UACPI_PACKED(struct acpi_resource_clock_input { |
1204 | struct acpi_large_item common; |
1205 | uacpi_u8 revision_id; |
1206 | uacpi_u16 flags; |
1207 | uacpi_u16 divisor; |
1208 | uacpi_u32 numerator; |
1209 | uacpi_u8 source_index; |
1210 | }) |
1211 | UACPI_EXPECT_SIZEOF(struct acpi_resource_clock_input, 13); |
1212 | |