| 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 | #define ACPI_RHCT_SIGNATURE "RHCT" |
| 28 | #define ACPI_DMAR_SIGNATURE "DMAR" |
| 29 | |
| 30 | #define ACPI_AS_ID_SYS_MEM 0x00 |
| 31 | #define ACPI_AS_ID_SYS_IO 0x01 |
| 32 | #define ACPI_AS_ID_PCI_CFG_SPACE 0x02 |
| 33 | #define ACPI_AS_ID_EC 0x03 |
| 34 | #define ACPI_AS_ID_SMBUS 0x04 |
| 35 | #define ACPI_AS_ID_SYS_CMOS 0x05 |
| 36 | #define ACPI_AS_ID_PCI_BAR_TGT 0x06 |
| 37 | #define ACPI_AS_ID_IPMI 0x07 |
| 38 | #define ACPI_AS_ID_GP_IO 0x08 |
| 39 | #define ACPI_AS_ID_GENERIC_SBUS 0x09 |
| 40 | #define ACPI_AS_ID_PCC 0x0A |
| 41 | #define ACPI_AS_ID_FFH 0x7F |
| 42 | #define ACPI_AS_ID_OEM_BASE 0xC0 |
| 43 | #define ACPI_AS_ID_OEM_END 0xFF |
| 44 | |
| 45 | #define ACPI_ACCESS_UD 0 |
| 46 | #define ACPI_ACCESS_BYTE 1 |
| 47 | #define ACPI_ACCESS_WORD 2 |
| 48 | #define ACPI_ACCESS_DWORD 3 |
| 49 | #define ACPI_ACCESS_QWORD 4 |
| 50 | |
| 51 | UACPI_PACKED(struct acpi_gas { |
| 52 | uacpi_u8 address_space_id; |
| 53 | uacpi_u8 register_bit_width; |
| 54 | uacpi_u8 register_bit_offset; |
| 55 | uacpi_u8 access_size; |
| 56 | uacpi_u64 address; |
| 57 | }) |
| 58 | UACPI_EXPECT_SIZEOF(struct acpi_gas, 12); |
| 59 | |
| 60 | UACPI_PACKED(struct acpi_rsdp { |
| 61 | uacpi_char signature[8]; |
| 62 | uacpi_u8 checksum; |
| 63 | uacpi_char oemid[6]; |
| 64 | uacpi_u8 revision; |
| 65 | uacpi_u32 rsdt_addr; |
| 66 | |
| 67 | // vvvv available if .revision >= 2.0 only |
| 68 | uacpi_u32 length; |
| 69 | uacpi_u64 xsdt_addr; |
| 70 | uacpi_u8 extended_checksum; |
| 71 | uacpi_u8 rsvd[3]; |
| 72 | }) |
| 73 | UACPI_EXPECT_SIZEOF(struct acpi_rsdp, 36); |
| 74 | |
| 75 | UACPI_PACKED(struct acpi_sdt_hdr { |
| 76 | uacpi_char signature[4]; |
| 77 | uacpi_u32 length; |
| 78 | uacpi_u8 revision; |
| 79 | uacpi_u8 checksum; |
| 80 | uacpi_char oemid[6]; |
| 81 | uacpi_char oem_table_id[8]; |
| 82 | uacpi_u32 oem_revision; |
| 83 | uacpi_u32 creator_id; |
| 84 | uacpi_u32 creator_revision; |
| 85 | }) |
| 86 | UACPI_EXPECT_SIZEOF(struct acpi_sdt_hdr, 36); |
| 87 | |
| 88 | UACPI_PACKED(struct acpi_rsdt { |
| 89 | struct acpi_sdt_hdr hdr; |
| 90 | uacpi_u32 entries[]; |
| 91 | }) |
| 92 | |
| 93 | UACPI_PACKED(struct acpi_xsdt { |
| 94 | struct acpi_sdt_hdr hdr; |
| 95 | uacpi_u64 entries[]; |
| 96 | }) |
| 97 | |
| 98 | UACPI_PACKED(struct acpi_entry_hdr { |
| 99 | /** |
| 100 | * - acpi_madt_entry_type for the APIC table |
| 101 | * - acpi_srat_entry_type for the SRAT table |
| 102 | */ |
| 103 | uacpi_u8 type; |
| 104 | uacpi_u8 length; |
| 105 | }) |
| 106 | |
| 107 | // acpi_madt->flags |
| 108 | #define ACPI_PCAT_COMPAT (1 << 0) |
| 109 | |
| 110 | enum acpi_madt_entry_type { |
| 111 | ACPI_MADT_ENTRY_TYPE_LAPIC = 0, |
| 112 | ACPI_MADT_ENTRY_TYPE_IOAPIC = 1, |
| 113 | ACPI_MADT_ENTRY_TYPE_INTERRUPT_SOURCE_OVERRIDE = 2, |
| 114 | ACPI_MADT_ENTRY_TYPE_NMI_SOURCE = 3, |
| 115 | ACPI_MADT_ENTRY_TYPE_LAPIC_NMI = 4, |
| 116 | ACPI_MADT_ENTRY_TYPE_LAPIC_ADDRESS_OVERRIDE = 5, |
| 117 | ACPI_MADT_ENTRY_TYPE_IOSAPIC = 6, |
| 118 | ACPI_MADT_ENTRY_TYPE_LSAPIC = 7, |
| 119 | ACPI_MADT_ENTRY_TYPE_PLATFORM_INTERRUPT_SOURCES = 8, |
| 120 | ACPI_MADT_ENTRY_TYPE_LOCAL_X2APIC = 9, |
| 121 | ACPI_MADT_ENTRY_TYPE_LOCAL_X2APIC_NMI = 0xA, |
| 122 | ACPI_MADT_ENTRY_TYPE_GICC = 0xB, |
| 123 | ACPI_MADT_ENTRY_TYPE_GICD = 0xC, |
| 124 | ACPI_MADT_ENTRY_TYPE_GIC_MSI_FRAME = 0xD, |
| 125 | ACPI_MADT_ENTRY_TYPE_GICR = 0xE, |
| 126 | ACPI_MADT_ENTRY_TYPE_GIC_ITS = 0xF, |
| 127 | ACPI_MADT_ENTRY_TYPE_MULTIPROCESSOR_WAKEUP = 0x10, |
| 128 | ACPI_MADT_ENTRY_TYPE_CORE_PIC = 0x11, |
| 129 | ACPI_MADT_ENTRY_TYPE_LIO_PIC = 0x12, |
| 130 | ACPI_MADT_ENTRY_TYPE_HT_PIC = 0x13, |
| 131 | ACPI_MADT_ENTRY_TYPE_EIO_PIC = 0x14, |
| 132 | ACPI_MADT_ENTRY_TYPE_MSI_PIC = 0x15, |
| 133 | ACPI_MADT_ENTRY_TYPE_BIO_PIC = 0x16, |
| 134 | ACPI_MADT_ENTRY_TYPE_LPC_PIC = 0x17, |
| 135 | ACPI_MADT_ENTRY_TYPE_RINTC = 0x18, |
| 136 | ACPI_MADT_ENTRY_TYPE_IMSIC = 0x19, |
| 137 | ACPI_MADT_ENTRY_TYPE_APLIC = 0x1A, |
| 138 | ACPI_MADT_ENTRY_TYPE_PLIC = 0x1B, |
| 139 | ACPI_MADT_ENTRY_TYPE_RESERVED = 0x1C, // 0x1C..0x7F |
| 140 | ACPI_MADT_ENTRY_TYPE_OEM = 0x80, // 0x80..0xFF |
| 141 | }; |
| 142 | |
| 143 | UACPI_PACKED(struct acpi_madt { |
| 144 | struct acpi_sdt_hdr hdr; |
| 145 | uacpi_u32 local_interrupt_controller_address; |
| 146 | uacpi_u32 flags; |
| 147 | struct acpi_entry_hdr entries[]; |
| 148 | }) |
| 149 | UACPI_EXPECT_SIZEOF(struct acpi_madt, 44); |
| 150 | |
| 151 | /** |
| 152 | * - acpi_madt_lapic->flags |
| 153 | * - acpi_madt_lsapic->flags |
| 154 | * - acpi_madt_x2apic->flags |
| 155 | */ |
| 156 | #define ACPI_PIC_ENABLED (1 << 0) |
| 157 | #define ACPI_PIC_ONLINE_CAPABLE (1 << 1) |
| 158 | |
| 159 | UACPI_PACKED(struct acpi_madt_lapic { |
| 160 | struct acpi_entry_hdr hdr; |
| 161 | uacpi_u8 uid; |
| 162 | uacpi_u8 id; |
| 163 | uacpi_u32 flags; |
| 164 | }) |
| 165 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lapic, 8); |
| 166 | |
| 167 | UACPI_PACKED(struct acpi_madt_ioapic { |
| 168 | struct acpi_entry_hdr hdr; |
| 169 | uacpi_u8 id; |
| 170 | uacpi_u8 rsvd; |
| 171 | uacpi_u32 address; |
| 172 | uacpi_u32 gsi_base; |
| 173 | }) |
| 174 | UACPI_EXPECT_SIZEOF(struct acpi_madt_ioapic, 12); |
| 175 | |
| 176 | /** |
| 177 | * - acpi_madt_interrupt_source_override->flags |
| 178 | * - acpi_madt_nmi_source->flags |
| 179 | * - acpi_madt_lapic_nmi->flags |
| 180 | * - acpi_madt_platform_interrupt_source->flags |
| 181 | * - acpi_madt_x2apic_nmi->flags |
| 182 | */ |
| 183 | #define ACPI_MADT_POLARITY_MASK 0b11 |
| 184 | #define ACPI_MADT_POLARITY_CONFORMING 0b00 |
| 185 | #define ACPI_MADT_POLARITY_ACTIVE_HIGH 0b01 |
| 186 | #define ACPI_MADT_POLARITY_ACTIVE_LOW 0b11 |
| 187 | |
| 188 | #define ACPI_MADT_TRIGGERING_MASK 0b1100 |
| 189 | #define ACPI_MADT_TRIGGERING_CONFORMING 0b0000 |
| 190 | #define ACPI_MADT_TRIGGERING_EDGE 0b0100 |
| 191 | #define ACPI_MADT_TRIGGERING_LEVEL 0b1100 |
| 192 | |
| 193 | UACPI_PACKED(struct acpi_madt_interrupt_source_override { |
| 194 | struct acpi_entry_hdr hdr; |
| 195 | uacpi_u8 bus; |
| 196 | uacpi_u8 source; |
| 197 | uacpi_u32 gsi; |
| 198 | uacpi_u16 flags; |
| 199 | }) |
| 200 | UACPI_EXPECT_SIZEOF(struct acpi_madt_interrupt_source_override, 10); |
| 201 | |
| 202 | UACPI_PACKED(struct acpi_madt_nmi_source { |
| 203 | struct acpi_entry_hdr hdr; |
| 204 | uacpi_u16 flags; |
| 205 | uacpi_u32 gsi; |
| 206 | }) |
| 207 | UACPI_EXPECT_SIZEOF(struct acpi_madt_nmi_source, 8); |
| 208 | |
| 209 | UACPI_PACKED(struct acpi_madt_lapic_nmi { |
| 210 | struct acpi_entry_hdr hdr; |
| 211 | uacpi_u8 uid; |
| 212 | uacpi_u16 flags; |
| 213 | uacpi_u8 lint; |
| 214 | }) |
| 215 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lapic_nmi, 6); |
| 216 | |
| 217 | UACPI_PACKED(struct acpi_madt_lapic_address_override { |
| 218 | struct acpi_entry_hdr hdr; |
| 219 | uacpi_u16 rsvd; |
| 220 | uacpi_u64 address; |
| 221 | }) |
| 222 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lapic_address_override, 12); |
| 223 | |
| 224 | UACPI_PACKED(struct acpi_madt_iosapic { |
| 225 | struct acpi_entry_hdr hdr; |
| 226 | uacpi_u8 id; |
| 227 | uacpi_u8 rsvd; |
| 228 | uacpi_u32 gsi_base; |
| 229 | uacpi_u64 address; |
| 230 | }) |
| 231 | UACPI_EXPECT_SIZEOF(struct acpi_madt_iosapic, 16); |
| 232 | |
| 233 | UACPI_PACKED(struct acpi_madt_lsapic { |
| 234 | struct acpi_entry_hdr hdr; |
| 235 | uacpi_u8 acpi_id; |
| 236 | uacpi_u8 id; |
| 237 | uacpi_u8 eid; |
| 238 | uacpi_u8 reserved[3]; |
| 239 | uacpi_u32 flags; |
| 240 | uacpi_u32 uid; |
| 241 | uacpi_char uid_string[]; |
| 242 | }) |
| 243 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lsapic, 16); |
| 244 | |
| 245 | // acpi_madt_platform_interrupt_source->platform_flags |
| 246 | #define ACPI_CPEI_PROCESSOR_OVERRIDE (1 << 0) |
| 247 | |
| 248 | UACPI_PACKED(struct acpi_madt_platform_interrupt_source { |
| 249 | struct acpi_entry_hdr hdr; |
| 250 | uacpi_u16 flags; |
| 251 | uacpi_u8 type; |
| 252 | uacpi_u8 processor_id; |
| 253 | uacpi_u8 processor_eid; |
| 254 | uacpi_u8 iosapic_vector; |
| 255 | uacpi_u32 gsi; |
| 256 | uacpi_u32 platform_flags; |
| 257 | }) |
| 258 | UACPI_EXPECT_SIZEOF(struct acpi_madt_platform_interrupt_source, 16); |
| 259 | |
| 260 | UACPI_PACKED(struct acpi_madt_x2apic { |
| 261 | struct acpi_entry_hdr hdr; |
| 262 | uacpi_u16 rsvd; |
| 263 | uacpi_u32 id; |
| 264 | uacpi_u32 flags; |
| 265 | uacpi_u32 uid; |
| 266 | }) |
| 267 | UACPI_EXPECT_SIZEOF(struct acpi_madt_x2apic, 16); |
| 268 | |
| 269 | UACPI_PACKED(struct acpi_madt_x2apic_nmi { |
| 270 | struct acpi_entry_hdr hdr; |
| 271 | uacpi_u16 flags; |
| 272 | uacpi_u32 uid; |
| 273 | uacpi_u8 lint; |
| 274 | uacpi_u8 reserved[3]; |
| 275 | }) |
| 276 | UACPI_EXPECT_SIZEOF(struct acpi_madt_x2apic_nmi, 12); |
| 277 | |
| 278 | // acpi_madt_gicc->flags |
| 279 | #define ACPI_GICC_ENABLED (1 << 0) |
| 280 | #define ACPI_GICC_PERF_INTERRUPT_MODE (1 << 1) |
| 281 | #define ACPI_GICC_VGIC_MAINTENANCE_INTERRUPT_MODE (1 << 2) |
| 282 | #define ACPI_GICC_ONLINE_CAPABLE (1 << 3) |
| 283 | |
| 284 | // ACPI_GICC_*_INTERRUPT_MODE |
| 285 | #define ACPI_GICC_TRIGGERING_EDGE 1 |
| 286 | #define ACPI_GICC_TRIGGERING_LEVEL 0 |
| 287 | |
| 288 | UACPI_PACKED(struct acpi_madt_gicc { |
| 289 | struct acpi_entry_hdr hdr; |
| 290 | uacpi_u16 rsvd0; |
| 291 | uacpi_u32 interface_number; |
| 292 | uacpi_u32 acpi_id; |
| 293 | uacpi_u32 flags; |
| 294 | uacpi_u32 parking_protocol_version; |
| 295 | uacpi_u32 perf_interrupt_gsiv; |
| 296 | uacpi_u64 parked_address; |
| 297 | uacpi_u64 address; |
| 298 | uacpi_u64 gicv; |
| 299 | uacpi_u64 gich; |
| 300 | uacpi_u32 vgic_maitenante_interrupt; |
| 301 | uacpi_u64 gicr_base_address; |
| 302 | uacpi_u64 mpidr; |
| 303 | uacpi_u8 power_efficiency_class; |
| 304 | uacpi_u8 rsvd1; |
| 305 | uacpi_u16 spe_overflow_interrupt; |
| 306 | uacpi_u16 trbe_interrupt; |
| 307 | }) |
| 308 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gicc, 82); |
| 309 | |
| 310 | UACPI_PACKED(struct acpi_madt_gicd { |
| 311 | struct acpi_entry_hdr hdr; |
| 312 | uacpi_u16 rsvd0; |
| 313 | uacpi_u32 id; |
| 314 | uacpi_u64 address; |
| 315 | uacpi_u32 system_vector_base; |
| 316 | uacpi_u8 gic_version; |
| 317 | uacpi_u8 reserved1[3]; |
| 318 | }) |
| 319 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gicd, 24); |
| 320 | |
| 321 | // acpi_madt_gic_msi_frame->flags |
| 322 | #define ACPI_SPI_SELECT (1 << 0) |
| 323 | |
| 324 | UACPI_PACKED(struct acpi_madt_gic_msi_frame { |
| 325 | struct acpi_entry_hdr hdr; |
| 326 | uacpi_u16 rsvd; |
| 327 | uacpi_u32 id; |
| 328 | uacpi_u64 address; |
| 329 | uacpi_u32 flags; |
| 330 | uacpi_u16 spi_count; |
| 331 | uacpi_u16 spi_base; |
| 332 | }) |
| 333 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gic_msi_frame, 24); |
| 334 | |
| 335 | UACPI_PACKED(struct acpi_madt_gicr { |
| 336 | struct acpi_entry_hdr hdr; |
| 337 | uacpi_u16 rsvd; |
| 338 | uacpi_u64 address; |
| 339 | uacpi_u32 length; |
| 340 | }) |
| 341 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gicr, 16); |
| 342 | |
| 343 | UACPI_PACKED(struct acpi_madt_gic_its { |
| 344 | struct acpi_entry_hdr hdr; |
| 345 | uacpi_u16 rsvd0; |
| 346 | uacpi_u32 id; |
| 347 | uacpi_u64 address; |
| 348 | uacpi_u32 rsvd1; |
| 349 | }) |
| 350 | UACPI_EXPECT_SIZEOF(struct acpi_madt_gic_its, 20); |
| 351 | |
| 352 | UACPI_PACKED(struct acpi_madt_multiprocessor_wakeup { |
| 353 | struct acpi_entry_hdr hdr; |
| 354 | uacpi_u16 mailbox_version; |
| 355 | uacpi_u32 rsvd; |
| 356 | uacpi_u64 mailbox_address; |
| 357 | }) |
| 358 | UACPI_EXPECT_SIZEOF(struct acpi_madt_multiprocessor_wakeup, 16); |
| 359 | |
| 360 | #define ACPI_CORE_PIC_ENABLED (1 << 0) |
| 361 | |
| 362 | UACPI_PACKED(struct acpi_madt_core_pic { |
| 363 | struct acpi_entry_hdr hdr; |
| 364 | uacpi_u8 version; |
| 365 | uacpi_u32 acpi_id; |
| 366 | uacpi_u32 id; |
| 367 | uacpi_u32 flags; |
| 368 | }) |
| 369 | UACPI_EXPECT_SIZEOF(struct acpi_madt_core_pic, 15); |
| 370 | |
| 371 | UACPI_PACKED(struct acpi_madt_lio_pic { |
| 372 | struct acpi_entry_hdr hdr; |
| 373 | uacpi_u8 version; |
| 374 | uacpi_u64 address; |
| 375 | uacpi_u16 size; |
| 376 | uacpi_u16 cascade_vector; |
| 377 | uacpi_u64 cascade_vector_mapping; |
| 378 | }) |
| 379 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lio_pic, 23); |
| 380 | |
| 381 | UACPI_PACKED(struct acpi_madt_ht_pic { |
| 382 | struct acpi_entry_hdr hdr; |
| 383 | uacpi_u8 version; |
| 384 | uacpi_u64 address; |
| 385 | uacpi_u16 size; |
| 386 | uacpi_u64 cascade_vector; |
| 387 | }) |
| 388 | UACPI_EXPECT_SIZEOF(struct acpi_madt_ht_pic, 21); |
| 389 | |
| 390 | UACPI_PACKED(struct acpi_madt_eio_pic { |
| 391 | struct acpi_entry_hdr hdr; |
| 392 | uacpi_u8 version; |
| 393 | uacpi_u8 cascade_vector; |
| 394 | uacpi_u8 node; |
| 395 | uacpi_u64 node_map; |
| 396 | }) |
| 397 | UACPI_EXPECT_SIZEOF(struct acpi_madt_eio_pic, 13); |
| 398 | |
| 399 | UACPI_PACKED(struct acpi_madt_msi_pic { |
| 400 | struct acpi_entry_hdr hdr; |
| 401 | uacpi_u8 version; |
| 402 | uacpi_u64 address; |
| 403 | uacpi_u32 start; |
| 404 | uacpi_u32 count; |
| 405 | }) |
| 406 | UACPI_EXPECT_SIZEOF(struct acpi_madt_msi_pic, 19); |
| 407 | |
| 408 | UACPI_PACKED(struct acpi_madt_bio_pic { |
| 409 | struct acpi_entry_hdr hdr; |
| 410 | uacpi_u8 version; |
| 411 | uacpi_u64 address; |
| 412 | uacpi_u16 size; |
| 413 | uacpi_u16 hardware_id; |
| 414 | uacpi_u16 gsi_base; |
| 415 | }) |
| 416 | UACPI_EXPECT_SIZEOF(struct acpi_madt_bio_pic, 17); |
| 417 | |
| 418 | UACPI_PACKED(struct acpi_madt_lpc_pic { |
| 419 | struct acpi_entry_hdr hdr; |
| 420 | uacpi_u8 version; |
| 421 | uacpi_u64 address; |
| 422 | uacpi_u16 size; |
| 423 | uacpi_u16 cascade_vector; |
| 424 | }) |
| 425 | UACPI_EXPECT_SIZEOF(struct acpi_madt_lpc_pic, 15); |
| 426 | |
| 427 | UACPI_PACKED(struct acpi_madt_rintc { |
| 428 | struct acpi_entry_hdr hdr; |
| 429 | uacpi_u8 version; |
| 430 | uacpi_u8 rsvd; |
| 431 | uacpi_u32 flags; |
| 432 | uacpi_u64 hart_id; |
| 433 | uacpi_u32 uid; |
| 434 | uacpi_u32 ext_intc_id; |
| 435 | uacpi_u64 address; |
| 436 | uacpi_u32 size; |
| 437 | }) |
| 438 | UACPI_EXPECT_SIZEOF(struct acpi_madt_rintc, 36); |
| 439 | |
| 440 | UACPI_PACKED(struct acpi_madt_imsic { |
| 441 | struct acpi_entry_hdr hdr; |
| 442 | uacpi_u8 version; |
| 443 | uacpi_u8 rsvd; |
| 444 | uacpi_u32 flags; |
| 445 | uacpi_u16 num_ids; |
| 446 | uacpi_u16 num_guest_ids; |
| 447 | uacpi_u8 guest_index_bits; |
| 448 | uacpi_u8 hart_index_bits; |
| 449 | uacpi_u8 group_index_bits; |
| 450 | uacpi_u8 group_index_shift; |
| 451 | }) |
| 452 | UACPI_EXPECT_SIZEOF(struct acpi_madt_imsic, 16); |
| 453 | |
| 454 | UACPI_PACKED(struct acpi_madt_aplic { |
| 455 | struct acpi_entry_hdr hdr; |
| 456 | uacpi_u8 version; |
| 457 | uacpi_u8 id; |
| 458 | uacpi_u32 flags; |
| 459 | uacpi_u64 hardware_id; |
| 460 | uacpi_u16 idc_count; |
| 461 | uacpi_u16 sources_count; |
| 462 | uacpi_u32 gsi_base; |
| 463 | uacpi_u64 address; |
| 464 | uacpi_u32 size; |
| 465 | }) |
| 466 | UACPI_EXPECT_SIZEOF(struct acpi_madt_aplic, 36); |
| 467 | |
| 468 | UACPI_PACKED(struct acpi_madt_plic { |
| 469 | struct acpi_entry_hdr hdr; |
| 470 | uacpi_u8 version; |
| 471 | uacpi_u8 id; |
| 472 | uacpi_u64 hardware_id; |
| 473 | uacpi_u16 sources_count; |
| 474 | uacpi_u16 max_priority; |
| 475 | uacpi_u32 flags; |
| 476 | uacpi_u32 size; |
| 477 | uacpi_u64 address; |
| 478 | uacpi_u32 gsi_base; |
| 479 | |
| 480 | }) |
| 481 | UACPI_EXPECT_SIZEOF(struct acpi_madt_plic, 36); |
| 482 | |
| 483 | enum acpi_srat_entry_type { |
| 484 | ACPI_SRAT_ENTRY_TYPE_PROCESSOR_AFFINITY = 0, |
| 485 | ACPI_SRAT_ENTRY_TYPE_MEMORY_AFFINITY = 1, |
| 486 | ACPI_SRAT_ENTRY_TYPE_X2APIC_AFFINITY = 2, |
| 487 | ACPI_SRAT_ENTRY_TYPE_GICC_AFFINITY = 3, |
| 488 | ACPI_SRAT_ENTRY_TYPE_GIC_ITS_AFFINITY = 4, |
| 489 | ACPI_SRAT_ENTRY_TYPE_GENERIC_INITIATOR_AFFINITY = 5, |
| 490 | ACPI_SRAT_ENTRY_TYPE_GENERIC_PORT_AFFINITY = 6, |
| 491 | ACPI_SRAT_ENTRY_TYPE_RINTC_AFFINITY = 7, |
| 492 | }; |
| 493 | |
| 494 | UACPI_PACKED(struct acpi_srat { |
| 495 | struct acpi_sdt_hdr hdr; |
| 496 | uacpi_u32 rsvd0; |
| 497 | uacpi_u64 rsvd1; |
| 498 | struct acpi_entry_hdr entries[]; |
| 499 | }) |
| 500 | UACPI_EXPECT_SIZEOF(struct acpi_srat, 48); |
| 501 | |
| 502 | /** |
| 503 | * acpi_srat_processor_affinity->flags |
| 504 | * acpi_srat_x2apic_affinity->flags |
| 505 | */ |
| 506 | #define ACPI_SRAT_PROCESSOR_ENABLED (1 << 0) |
| 507 | |
| 508 | UACPI_PACKED(struct acpi_srat_processor_affinity { |
| 509 | struct acpi_entry_hdr hdr; |
| 510 | uacpi_u8 proximity_domain_low; |
| 511 | uacpi_u8 id; |
| 512 | uacpi_u32 flags; |
| 513 | uacpi_u8 eid; |
| 514 | uacpi_u8 proximity_domain_high[3]; |
| 515 | uacpi_u32 clock_domain; |
| 516 | }) |
| 517 | UACPI_EXPECT_SIZEOF(struct acpi_srat_processor_affinity, 16); |
| 518 | |
| 519 | // acpi_srat_memory_affinity->flags |
| 520 | #define ACPI_SRAT_MEMORY_ENABLED (1 << 0) |
| 521 | #define ACPI_SRAT_MEMORY_HOTPLUGGABLE (1 << 1) |
| 522 | #define ACPI_SRAT_MEMORY_NON_VOLATILE (1 << 2) |
| 523 | |
| 524 | UACPI_PACKED(struct acpi_srat_memory_affinity { |
| 525 | struct acpi_entry_hdr hdr; |
| 526 | uacpi_u32 proximity_domain; |
| 527 | uacpi_u16 rsvd0; |
| 528 | uacpi_u64 address; |
| 529 | uacpi_u64 length; |
| 530 | uacpi_u32 rsvd1; |
| 531 | uacpi_u32 flags; |
| 532 | uacpi_u64 rsdv2; |
| 533 | }) |
| 534 | UACPI_EXPECT_SIZEOF(struct acpi_srat_memory_affinity, 40); |
| 535 | |
| 536 | UACPI_PACKED(struct acpi_srat_x2apic_affinity { |
| 537 | struct acpi_entry_hdr hdr; |
| 538 | uacpi_u16 rsvd0; |
| 539 | uacpi_u32 proximity_domain; |
| 540 | uacpi_u32 id; |
| 541 | uacpi_u32 flags; |
| 542 | uacpi_u32 clock_domain; |
| 543 | uacpi_u32 rsvd1; |
| 544 | }) |
| 545 | UACPI_EXPECT_SIZEOF(struct acpi_srat_x2apic_affinity, 24); |
| 546 | |
| 547 | // acpi_srat_gicc_affinity->flags |
| 548 | #define ACPI_SRAT_GICC_ENABLED (1 << 0) |
| 549 | |
| 550 | UACPI_PACKED(struct acpi_srat_gicc_affinity { |
| 551 | struct acpi_entry_hdr hdr; |
| 552 | uacpi_u32 proximity_domain; |
| 553 | uacpi_u32 uid; |
| 554 | uacpi_u32 flags; |
| 555 | uacpi_u32 clock_domain; |
| 556 | }) |
| 557 | UACPI_EXPECT_SIZEOF(struct acpi_srat_gicc_affinity, 18); |
| 558 | |
| 559 | UACPI_PACKED(struct acpi_srat_gic_its_affinity { |
| 560 | struct acpi_entry_hdr hdr; |
| 561 | uacpi_u32 proximity_domain; |
| 562 | uacpi_u16 rsvd; |
| 563 | uacpi_u32 id; |
| 564 | }) |
| 565 | UACPI_EXPECT_SIZEOF(struct acpi_srat_gic_its_affinity, 12); |
| 566 | |
| 567 | // acpi_srat_generic_affinity->flags |
| 568 | #define ACPI_GENERIC_AFFINITY_ENABLED (1 << 0) |
| 569 | #define ACPI_GENERIC_AFFINITY_ARCH_TRANSACTIONS (1 << 1) |
| 570 | |
| 571 | UACPI_PACKED(struct acpi_srat_generic_affinity { |
| 572 | struct acpi_entry_hdr hdr; |
| 573 | uacpi_u8 rsvd0; |
| 574 | uacpi_u8 handle_type; |
| 575 | uacpi_u32 proximity_domain; |
| 576 | uacpi_u8 handle[16]; |
| 577 | uacpi_u32 flags; |
| 578 | uacpi_u32 rsvd1; |
| 579 | }) |
| 580 | UACPI_EXPECT_SIZEOF(struct acpi_srat_generic_affinity, 32); |
| 581 | |
| 582 | // acpi_srat_rintc_affinity->flags |
| 583 | #define ACPI_SRAT_RINTC_AFFINITY_ENABLED (1 << 0) |
| 584 | |
| 585 | UACPI_PACKED(struct acpi_srat_rintc_affinity { |
| 586 | struct acpi_entry_hdr hdr; |
| 587 | uacpi_u16 rsvd; |
| 588 | uacpi_u32 proximity_domain; |
| 589 | uacpi_u32 uid; |
| 590 | uacpi_u32 flags; |
| 591 | uacpi_u32 clock_domain; |
| 592 | }) |
| 593 | UACPI_EXPECT_SIZEOF(struct acpi_srat_rintc_affinity, 20); |
| 594 | |
| 595 | UACPI_PACKED(struct acpi_slit { |
| 596 | struct acpi_sdt_hdr hdr; |
| 597 | uacpi_u64 num_localities; |
| 598 | uacpi_u8 matrix[]; |
| 599 | }) |
| 600 | UACPI_EXPECT_SIZEOF(struct acpi_slit, 44); |
| 601 | |
| 602 | /** |
| 603 | * acpi_gtdt->el*_flags |
| 604 | * acpi_gtdt_timer_entry->physical_flags |
| 605 | * acpi_gtdt_timer_entry->virtual_flags |
| 606 | * acpi_gtdt_watchdog->flags |
| 607 | */ |
| 608 | #define ACPI_GTDT_TRIGGERING (1 << 0) |
| 609 | #define ACPI_GTDT_TRIGGERING_EDGE 1 |
| 610 | #define ACPI_GTDT_TRIGGERING_LEVEL 0 |
| 611 | |
| 612 | /** |
| 613 | * acpi_gtdt->el*_flags |
| 614 | * acpi_gtdt_timer_entry->physical_flags |
| 615 | * acpi_gtdt_timer_entry->virtual_flags |
| 616 | * acpi_gtdt_watchdog->flags |
| 617 | */ |
| 618 | #define ACPI_GTDT_POLARITY (1 << 1) |
| 619 | #define ACPI_GTDT_POLARITY_ACTIVE_LOW 1 |
| 620 | #define ACPI_GTDT_POLARITY_ACTIVE_HIGH 0 |
| 621 | |
| 622 | // acpi_gtdt->el*_flags |
| 623 | #define ACPI_GTDT_ALWAYS_ON_CAPABLE (1 << 2) |
| 624 | |
| 625 | UACPI_PACKED(struct acpi_gtdt { |
| 626 | struct acpi_sdt_hdr hdr; |
| 627 | uacpi_u64 cnt_control_base; |
| 628 | uacpi_u32 rsvd; |
| 629 | uacpi_u32 el1_secure_gsiv; |
| 630 | uacpi_u32 el1_secure_flags; |
| 631 | uacpi_u32 el1_non_secure_gsiv; |
| 632 | uacpi_u32 el1_non_secure_flags; |
| 633 | uacpi_u32 el1_virtual_gsiv; |
| 634 | uacpi_u32 el1_virtual_flags; |
| 635 | uacpi_u32 el2_gsiv; |
| 636 | uacpi_u32 el2_flags; |
| 637 | uacpi_u64 cnt_read_base; |
| 638 | uacpi_u32 platform_timer_count; |
| 639 | uacpi_u32 platform_timer_offset; |
| 640 | |
| 641 | // revision >= 3 |
| 642 | uacpi_u32 el2_virtual_gsiv; |
| 643 | uacpi_u32 el2_virtual_flags; |
| 644 | }) |
| 645 | UACPI_EXPECT_SIZEOF(struct acpi_gtdt, 104); |
| 646 | |
| 647 | enum acpi_gtdt_entry_type { |
| 648 | ACPI_GTDT_ENTRY_TYPE_TIMER = 0, |
| 649 | ACPI_GTDT_ENTRY_TYPE_WATCHDOG = 1, |
| 650 | }; |
| 651 | |
| 652 | UACPI_PACKED(struct acpi_gtdt_entry_hdr { |
| 653 | uacpi_u8 type; |
| 654 | uacpi_u16 length; |
| 655 | }) |
| 656 | |
| 657 | UACPI_PACKED(struct acpi_gtdt_timer { |
| 658 | struct acpi_gtdt_entry_hdr hdr; |
| 659 | uacpi_u8 rsvd; |
| 660 | uacpi_u64 cnt_ctl_base; |
| 661 | uacpi_u32 timer_count; |
| 662 | uacpi_u32 timer_offset; |
| 663 | }) |
| 664 | UACPI_EXPECT_SIZEOF(struct acpi_gtdt_timer, 20); |
| 665 | |
| 666 | // acpi_gtdt_timer_entry->common_flags |
| 667 | #define ACPI_GTDT_TIMER_ENTRY_SECURE (1 << 0) |
| 668 | #define ACPI_GTDT_TIMER_ENTRY_ALWAYS_ON_CAPABLE (1 << 1) |
| 669 | |
| 670 | UACPI_PACKED(struct acpi_gtdt_timer_entry { |
| 671 | uacpi_u8 frame_number; |
| 672 | uacpi_u8 rsvd[3]; |
| 673 | uacpi_u64 cnt_base; |
| 674 | uacpi_u64 el0_cnt_base; |
| 675 | uacpi_u32 physical_gsiv; |
| 676 | uacpi_u32 physical_flags; |
| 677 | uacpi_u32 virtual_gsiv; |
| 678 | uacpi_u32 virtual_flags; |
| 679 | uacpi_u32 common_flags; |
| 680 | }) |
| 681 | UACPI_EXPECT_SIZEOF(struct acpi_gtdt_timer_entry, 40); |
| 682 | |
| 683 | // acpi_gtdt_watchdog->flags |
| 684 | #define ACPI_GTDT_WATCHDOG_SECURE (1 << 2) |
| 685 | |
| 686 | UACPI_PACKED(struct acpi_gtdt_watchdog { |
| 687 | struct acpi_gtdt_entry_hdr hdr; |
| 688 | uacpi_u8 rsvd; |
| 689 | uacpi_u64 refresh_frame; |
| 690 | uacpi_u64 control_frame; |
| 691 | uacpi_u32 gsiv; |
| 692 | uacpi_u32 flags; |
| 693 | }) |
| 694 | UACPI_EXPECT_SIZEOF(struct acpi_gtdt_watchdog, 28); |
| 695 | |
| 696 | // acpi_fdt->iapc_flags |
| 697 | #define ACPI_IA_PC_LEGACY_DEVS (1 << 0) |
| 698 | #define ACPI_IA_PC_8042 (1 << 1) |
| 699 | #define ACPI_IA_PC_NO_VGA (1 << 2) |
| 700 | #define ACPI_IA_PC_NO_MSI (1 << 3) |
| 701 | #define ACPI_IA_PC_NO_PCIE_ASPM (1 << 4) |
| 702 | #define ACPI_IA_PC_NO_CMOS_RTC (1 << 5) |
| 703 | |
| 704 | // acpi_fdt->flags |
| 705 | #define ACPI_WBINVD (1 << 0) |
| 706 | #define ACPI_WBINVD_FLUSH (1 << 1) |
| 707 | #define ACPI_PROC_C1 (1 << 2) |
| 708 | #define ACPI_P_LVL2_UP (1 << 3) |
| 709 | #define ACPI_PWR_BUTTON (1 << 4) |
| 710 | #define ACPI_SLP_BUTTON (1 << 5) |
| 711 | #define ACPI_FIX_RTC (1 << 6) |
| 712 | #define ACPI_RTC_S4 (1 << 7) |
| 713 | #define ACPI_TMR_VAL_EXT (1 << 8) |
| 714 | #define ACPI_DCK_CAP (1 << 9) |
| 715 | #define ACPI_RESET_REG_SUP (1 << 10) |
| 716 | #define ACPI_SEALED_CASE (1 << 11) |
| 717 | #define ACPI_HEADLESS (1 << 12) |
| 718 | #define ACPI_CPU_SW_SLP (1 << 13) |
| 719 | #define ACPI_PCI_EXP_WAK (1 << 14) |
| 720 | #define ACPI_USE_PLATFORM_CLOCK (1 << 15) |
| 721 | #define ACPI_S4_RTC_STS_VALID (1 << 16) |
| 722 | #define ACPI_REMOTE_POWER_ON_CAPABLE (1 << 17) |
| 723 | #define ACPI_FORCE_APIC_CLUSTER_MODEL (1 << 18) |
| 724 | #define ACPI_FORCE_APIC_PHYS_DEST_MODE (1 << 19) |
| 725 | #define ACPI_HW_REDUCED_ACPI (1 << 20) |
| 726 | #define ACPI_LOW_POWER_S0_IDLE_CAPABLE (1 << 21) |
| 727 | |
| 728 | // acpi_fdt->arm_flags |
| 729 | #define ACPI_ARM_PSCI_COMPLIANT (1 << 0) |
| 730 | #define ACPI_ARM_PSCI_USE_HVC (1 << 1) |
| 731 | |
| 732 | UACPI_PACKED(struct acpi_fadt { |
| 733 | struct acpi_sdt_hdr hdr; |
| 734 | uacpi_u32 firmware_ctrl; |
| 735 | uacpi_u32 dsdt; |
| 736 | uacpi_u8 int_model; |
| 737 | uacpi_u8 preferred_pm_profile; |
| 738 | uacpi_u16 sci_int; |
| 739 | uacpi_u32 smi_cmd; |
| 740 | uacpi_u8 acpi_enable; |
| 741 | uacpi_u8 acpi_disable; |
| 742 | uacpi_u8 s4bios_req; |
| 743 | uacpi_u8 pstate_cnt; |
| 744 | uacpi_u32 pm1a_evt_blk; |
| 745 | uacpi_u32 pm1b_evt_blk; |
| 746 | uacpi_u32 pm1a_cnt_blk; |
| 747 | uacpi_u32 pm1b_cnt_blk; |
| 748 | uacpi_u32 pm2_cnt_blk; |
| 749 | uacpi_u32 pm_tmr_blk; |
| 750 | uacpi_u32 gpe0_blk; |
| 751 | uacpi_u32 gpe1_blk; |
| 752 | uacpi_u8 pm1_evt_len; |
| 753 | uacpi_u8 pm1_cnt_len; |
| 754 | uacpi_u8 pm2_cnt_len; |
| 755 | uacpi_u8 pm_tmr_len; |
| 756 | uacpi_u8 gpe0_blk_len; |
| 757 | uacpi_u8 gpe1_blk_len; |
| 758 | uacpi_u8 gpe1_base; |
| 759 | uacpi_u8 cst_cnt; |
| 760 | uacpi_u16 p_lvl2_lat; |
| 761 | uacpi_u16 p_lvl3_lat; |
| 762 | uacpi_u16 flush_size; |
| 763 | uacpi_u16 flush_stride; |
| 764 | uacpi_u8 duty_offset; |
| 765 | uacpi_u8 duty_width; |
| 766 | uacpi_u8 day_alrm; |
| 767 | uacpi_u8 mon_alrm; |
| 768 | uacpi_u8 century; |
| 769 | uacpi_u16 iapc_boot_arch; |
| 770 | uacpi_u8 rsvd; |
| 771 | uacpi_u32 flags; |
| 772 | struct acpi_gas reset_reg; |
| 773 | uacpi_u8 reset_value; |
| 774 | uacpi_u16 arm_boot_arch; |
| 775 | uacpi_u8 fadt_minor_verison; |
| 776 | uacpi_u64 x_firmware_ctrl; |
| 777 | uacpi_u64 x_dsdt; |
| 778 | struct acpi_gas x_pm1a_evt_blk; |
| 779 | struct acpi_gas x_pm1b_evt_blk; |
| 780 | struct acpi_gas x_pm1a_cnt_blk; |
| 781 | struct acpi_gas x_pm1b_cnt_blk; |
| 782 | struct acpi_gas x_pm2_cnt_blk; |
| 783 | struct acpi_gas x_pm_tmr_blk; |
| 784 | struct acpi_gas x_gpe0_blk; |
| 785 | struct acpi_gas x_gpe1_blk; |
| 786 | struct acpi_gas sleep_control_reg; |
| 787 | struct acpi_gas sleep_status_reg; |
| 788 | uacpi_u64 hypervisor_vendor_identity; |
| 789 | }) |
| 790 | UACPI_EXPECT_SIZEOF(struct acpi_fadt, 276); |
| 791 | |
| 792 | // acpi_facs->flags |
| 793 | #define ACPI_S4BIOS_F (1 << 0) |
| 794 | #define ACPI_64BIT_WAKE_SUPPORTED_F (1 << 1) |
| 795 | |
| 796 | // acpi_facs->ospm_flags |
| 797 | #define ACPI_64BIT_WAKE_F (1 << 0) |
| 798 | |
| 799 | struct acpi_facs { |
| 800 | uacpi_char signature[4]; |
| 801 | uacpi_u32 length; |
| 802 | uacpi_u32 hardware_signature; |
| 803 | uacpi_u32 firmware_waking_vector; |
| 804 | uacpi_u32 global_lock; |
| 805 | uacpi_u32 flags; |
| 806 | uacpi_u64 x_firmware_waking_vector; |
| 807 | uacpi_u8 version; |
| 808 | uacpi_char rsvd0[3]; |
| 809 | uacpi_u32 ospm_flags; |
| 810 | uacpi_char rsvd1[24]; |
| 811 | }; |
| 812 | UACPI_EXPECT_SIZEOF(struct acpi_facs, 64); |
| 813 | |
| 814 | UACPI_PACKED(struct acpi_mcfg_allocation { |
| 815 | uacpi_u64 address; |
| 816 | uacpi_u16 segment; |
| 817 | uacpi_u8 start_bus; |
| 818 | uacpi_u8 end_bus; |
| 819 | uacpi_u32 rsvd; |
| 820 | }) |
| 821 | UACPI_EXPECT_SIZEOF(struct acpi_mcfg_allocation, 16); |
| 822 | |
| 823 | UACPI_PACKED(struct acpi_mcfg { |
| 824 | struct acpi_sdt_hdr hdr; |
| 825 | uacpi_u64 rsvd; |
| 826 | struct acpi_mcfg_allocation entries[]; |
| 827 | }) |
| 828 | UACPI_EXPECT_SIZEOF(struct acpi_mcfg, 44); |
| 829 | |
| 830 | // acpi_hpet->block_id |
| 831 | #define ACPI_HPET_PCI_VENDOR_ID_SHIFT 16 |
| 832 | #define ACPI_HPET_LEGACY_REPLACEMENT_IRQ_ROUTING_CAPABLE (1 << 15) |
| 833 | #define ACPI_HPET_COUNT_SIZE_CAP (1 << 13) |
| 834 | #define ACPI_HPET_NUMBER_OF_COMPARATORS_SHIFT 8 |
| 835 | #define ACPI_HPET_NUMBER_OF_COMPARATORS_MASK 0b11111 |
| 836 | #define ACPI_HPET_HARDWARE_REV_ID_MASK 0b11111111 |
| 837 | |
| 838 | // acpi_hpet->flags |
| 839 | #define ACPI_HPET_PAGE_PROTECTION_MASK 0b11 |
| 840 | #define ACPI_HPET_PAGE_NO_PROTECTION 0 |
| 841 | #define ACPI_HPET_PAGE_4K_PROTECTED 1 |
| 842 | #define ACPI_HPET_PAGE_64K_PROTECTED 2 |
| 843 | |
| 844 | UACPI_PACKED(struct acpi_hpet { |
| 845 | struct acpi_sdt_hdr hdr; |
| 846 | uacpi_u32 block_id; |
| 847 | struct acpi_gas address; |
| 848 | uacpi_u8 number; |
| 849 | uacpi_u16 min_clock_tick; |
| 850 | uacpi_u8 flags; |
| 851 | }) |
| 852 | UACPI_EXPECT_SIZEOF(struct acpi_hpet, 56); |
| 853 | |
| 854 | // PM1{a,b}_STS |
| 855 | #define ACPI_PM1_STS_TMR_STS_IDX 0 |
| 856 | #define ACPI_PM1_STS_BM_STS_IDX 4 |
| 857 | #define ACPI_PM1_STS_GBL_STS_IDX 5 |
| 858 | #define ACPI_PM1_STS_PWRBTN_STS_IDX 8 |
| 859 | #define ACPI_PM1_STS_SLPBTN_STS_IDX 9 |
| 860 | #define ACPI_PM1_STS_RTC_STS_IDX 10 |
| 861 | #define ACPI_PM1_STS_IGN0_IDX 11 |
| 862 | #define ACPI_PM1_STS_PCIEXP_WAKE_STS_IDX 14 |
| 863 | #define ACPI_PM1_STS_WAKE_STS_IDX 15 |
| 864 | |
| 865 | #define ACPI_PM1_STS_TMR_STS_MASK (1 << ACPI_PM1_STS_TMR_STS_IDX) |
| 866 | #define ACPI_PM1_STS_BM_STS_MASK (1 << ACPI_PM1_STS_BM_STS_IDX) |
| 867 | #define ACPI_PM1_STS_GBL_STS_MASK (1 << ACPI_PM1_STS_GBL_STS_IDX) |
| 868 | #define ACPI_PM1_STS_PWRBTN_STS_MASK (1 << ACPI_PM1_STS_PWRBTN_STS_IDX) |
| 869 | #define ACPI_PM1_STS_SLPBTN_STS_MASK (1 << ACPI_PM1_STS_SLPBTN_STS_IDX) |
| 870 | #define ACPI_PM1_STS_RTC_STS_MASK (1 << ACPI_PM1_STS_RTC_STS_IDX) |
| 871 | #define ACPI_PM1_STS_IGN0_MASK (1 << ACPI_PM1_STS_IGN0_IDX) |
| 872 | #define ACPI_PM1_STS_PCIEXP_WAKE_STS_MASK (1 << ACPI_PM1_STS_PCIEXP_WAKE_STS_IDX) |
| 873 | #define ACPI_PM1_STS_WAKE_STS_MASK (1 << ACPI_PM1_STS_WAKE_STS_IDX) |
| 874 | |
| 875 | #define ACPI_PM1_STS_CLEAR 1 |
| 876 | |
| 877 | // PM1{a,b}_EN |
| 878 | #define ACPI_PM1_EN_TMR_EN_IDX 0 |
| 879 | #define ACPI_PM1_EN_GBL_EN_IDX 5 |
| 880 | #define ACPI_PM1_EN_PWRBTN_EN_IDX 8 |
| 881 | #define ACPI_PM1_EN_SLPBTN_EN_IDX 9 |
| 882 | #define ACPI_PM1_EN_RTC_EN_IDX 10 |
| 883 | #define ACPI_PM1_EN_PCIEXP_WAKE_DIS_IDX 14 |
| 884 | |
| 885 | #define ACPI_PM1_EN_TMR_EN_MASK (1 << ACPI_PM1_EN_TMR_EN_IDX) |
| 886 | #define ACPI_PM1_EN_GBL_EN_MASK (1 << ACPI_PM1_EN_GBL_EN_IDX) |
| 887 | #define ACPI_PM1_EN_PWRBTN_EN_MASK (1 << ACPI_PM1_EN_PWRBTN_EN_IDX) |
| 888 | #define ACPI_PM1_EN_SLPBTN_EN_MASK (1 << ACPI_PM1_EN_SLPBTN_EN_IDX) |
| 889 | #define ACPI_PM1_EN_RTC_EN_MASK (1 << ACPI_PM1_EN_RTC_EN_IDX) |
| 890 | #define ACPI_PM1_EN_PCIEXP_WAKE_DIS_MASK (1 << ACPI_PM1_EN_PCIEXP_WAKE_DIS_IDX) |
| 891 | |
| 892 | // PM1{a,b}_CNT_BLK |
| 893 | #define ACPI_PM1_CNT_SCI_EN_IDX 0 |
| 894 | #define ACPI_PM1_CNT_BM_RLD_IDX 1 |
| 895 | #define ACPI_PM1_CNT_GBL_RLS_IDX 2 |
| 896 | #define ACPI_PM1_CNT_RSVD0_IDX 3 |
| 897 | #define ACPI_PM1_CNT_RSVD1_IDX 4 |
| 898 | #define ACPI_PM1_CNT_RSVD2_IDX 5 |
| 899 | #define ACPI_PM1_CNT_RSVD3_IDX 6 |
| 900 | #define ACPI_PM1_CNT_RSVD4_IDX 7 |
| 901 | #define ACPI_PM1_CNT_RSVD5_IDX 8 |
| 902 | #define ACPI_PM1_CNT_IGN0_IDX 9 |
| 903 | #define ACPI_PM1_CNT_SLP_TYP_IDX 10 |
| 904 | #define ACPI_PM1_CNT_SLP_EN_IDX 13 |
| 905 | #define ACPI_PM1_CNT_RSVD6_IDX 14 |
| 906 | #define ACPI_PM1_CNT_RSVD7_IDX 15 |
| 907 | |
| 908 | #define ACPI_SLP_TYP_MAX 0x7 |
| 909 | |
| 910 | #define ACPI_PM1_CNT_SCI_EN_MASK (1 << ACPI_PM1_CNT_SCI_EN_IDX) |
| 911 | #define ACPI_PM1_CNT_BM_RLD_MASK (1 << ACPI_PM1_CNT_BM_RLD_IDX) |
| 912 | #define ACPI_PM1_CNT_GBL_RLS_MASK (1 << ACPI_PM1_CNT_GBL_RLS_IDX) |
| 913 | #define ACPI_PM1_CNT_SLP_TYP_MASK (ACPI_SLP_TYP_MAX << ACPI_PM1_CNT_SLP_TYP_IDX) |
| 914 | #define ACPI_PM1_CNT_SLP_EN_MASK (1 << ACPI_PM1_CNT_SLP_EN_IDX) |
| 915 | |
| 916 | /** |
| 917 | * SCI_EN is not in this mask even though the spec says it must be preserved. |
| 918 | * This is because it's known to be bugged on some hardware that relies on |
| 919 | * software writing 1 to it after resume (as indicated by a similar comment in |
| 920 | * ACPICA) |
| 921 | */ |
| 922 | #define ACPI_PM1_CNT_PRESERVE_MASK ( \ |
| 923 | (1 << ACPI_PM1_CNT_RSVD0_IDX) | \ |
| 924 | (1 << ACPI_PM1_CNT_RSVD1_IDX) | \ |
| 925 | (1 << ACPI_PM1_CNT_RSVD2_IDX) | \ |
| 926 | (1 << ACPI_PM1_CNT_RSVD3_IDX) | \ |
| 927 | (1 << ACPI_PM1_CNT_RSVD4_IDX) | \ |
| 928 | (1 << ACPI_PM1_CNT_RSVD5_IDX) | \ |
| 929 | (1 << ACPI_PM1_CNT_IGN0_IDX ) | \ |
| 930 | (1 << ACPI_PM1_CNT_RSVD6_IDX) | \ |
| 931 | (1 << ACPI_PM1_CNT_RSVD7_IDX) \ |
| 932 | ) |
| 933 | |
| 934 | // PM2_CNT |
| 935 | #define ACPI_PM2_CNT_ARB_DIS_IDX 0 |
| 936 | #define ACPI_PM2_CNT_ARB_DIS_MASK (1 << ACPI_PM2_CNT_ARB_DIS_IDX) |
| 937 | |
| 938 | // All bits are reserved but this first one |
| 939 | #define ACPI_PM2_CNT_PRESERVE_MASK (~((uacpi_u64)ACPI_PM2_CNT_ARB_DIS_MASK)) |
| 940 | |
| 941 | // SLEEP_CONTROL_REG |
| 942 | #define ACPI_SLP_CNT_RSVD0_IDX 0 |
| 943 | #define ACPI_SLP_CNT_IGN0_IDX 1 |
| 944 | #define ACPI_SLP_CNT_SLP_TYP_IDX 2 |
| 945 | #define ACPI_SLP_CNT_SLP_EN_IDX 5 |
| 946 | #define ACPI_SLP_CNT_RSVD1_IDX 6 |
| 947 | #define ACPI_SLP_CNT_RSVD2_IDX 7 |
| 948 | |
| 949 | #define ACPI_SLP_CNT_SLP_TYP_MASK (ACPI_SLP_TYP_MAX << ACPI_SLP_CNT_SLP_TYP_IDX) |
| 950 | #define ACPI_SLP_CNT_SLP_EN_MASK (1 << ACPI_SLP_CNT_SLP_EN_IDX) |
| 951 | |
| 952 | #define ACPI_SLP_CNT_PRESERVE_MASK ( \ |
| 953 | (1 << ACPI_SLP_CNT_RSVD0_IDX) | \ |
| 954 | (1 << ACPI_SLP_CNT_IGN0_IDX) | \ |
| 955 | (1 << ACPI_SLP_CNT_RSVD1_IDX) | \ |
| 956 | (1 << ACPI_SLP_CNT_RSVD2_IDX) \ |
| 957 | ) |
| 958 | |
| 959 | // SLEEP_STATUS_REG |
| 960 | #define ACPI_SLP_STS_WAK_STS_IDX 7 |
| 961 | |
| 962 | #define ACPI_SLP_STS_WAK_STS_MASK (1 << ACPI_SLP_STS_WAK_STS_IDX) |
| 963 | |
| 964 | // All bits are reserved but this last one |
| 965 | #define ACPI_SLP_STS_PRESERVE_MASK (~((uacpi_u64)ACPI_SLP_STS_WAK_STS_MASK)) |
| 966 | |
| 967 | #define ACPI_SLP_STS_CLEAR 1 |
| 968 | |
| 969 | UACPI_PACKED(struct acpi_dsdt { |
| 970 | struct acpi_sdt_hdr hdr; |
| 971 | uacpi_u8 definition_block[]; |
| 972 | }) |
| 973 | |
| 974 | UACPI_PACKED(struct acpi_ssdt { |
| 975 | struct acpi_sdt_hdr hdr; |
| 976 | uacpi_u8 definition_block[]; |
| 977 | }) |
| 978 | |
| 979 | /** |
| 980 | * ACPI 6.5 specification: |
| 981 | * Bit [0] - Set if the device is present. |
| 982 | * Bit [1] - Set if the device is enabled and decoding its resources. |
| 983 | * Bit [2] - Set if the device should be shown in the UI. |
| 984 | * Bit [3] - Set if the device is functioning properly (cleared if device |
| 985 | * failed its diagnostics). |
| 986 | * Bit [4] - Set if the battery is present. |
| 987 | */ |
| 988 | #define ACPI_STA_RESULT_DEVICE_PRESENT (1 << 0) |
| 989 | #define ACPI_STA_RESULT_DEVICE_ENABLED (1 << 1) |
| 990 | #define ACPI_STA_RESULT_DEVICE_SHOWN_IN_UI (1 << 2) |
| 991 | #define ACPI_STA_RESULT_DEVICE_FUNCTIONING (1 << 3) |
| 992 | #define ACPI_STA_RESULT_DEVICE_BATTERY_PRESENT (1 << 4) |
| 993 | |
| 994 | #define ACPI_REG_DISCONNECT 0 |
| 995 | #define ACPI_REG_CONNECT 1 |
| 996 | |
| 997 | UACPI_PACKED(struct acpi_ecdt { |
| 998 | struct acpi_sdt_hdr hdr; |
| 999 | struct acpi_gas ec_control; |
| 1000 | struct acpi_gas ec_data; |
| 1001 | uacpi_u32 uid; |
| 1002 | uacpi_u8 gpe_bit; |
| 1003 | uacpi_char ec_id[]; |
| 1004 | }) |
| 1005 | UACPI_EXPECT_SIZEOF(struct acpi_ecdt, 65); |
| 1006 | |
| 1007 | // acpi_dbg2_device_info->port_type |
| 1008 | enum acpi_dbg2_type { |
| 1009 | ACPI_DBG2_TYPE_SERIAL = 0x8000, |
| 1010 | ACPI_DBG2_TYPE_1394 = 0x8001, |
| 1011 | ACPI_DBG2_TYPE_USB = 0x8002, |
| 1012 | ACPI_DBG2_TYPE_NET = 0x8003, |
| 1013 | }; |
| 1014 | |
| 1015 | /** |
| 1016 | * Constants for: |
| 1017 | * - acpi_dbg2_device_info->port_subtype |
| 1018 | * if acpi_dbg2_device_info->port_type == ACPI_DBG2_TYPE_SERIAL. |
| 1019 | * - acpi_spcr->interface_type (there is no type/subtype distinction in SPCR). |
| 1020 | */ |
| 1021 | enum acpi_dbg2_serial_subtype { |
| 1022 | ACPI_DBG2_SUBTYPE_SERIAL_NS16550 = 0x0, |
| 1023 | ACPI_DBG2_SUBTYPE_SERIAL_NS16550_DBGP1 = 0x1, |
| 1024 | ACPI_DBG2_SUBTYPE_SERIAL_MAX311XE_SPI = 0x2, |
| 1025 | ACPI_DBG2_SUBTYPE_SERIAL_PL011 = 0x3, |
| 1026 | ACPI_DBG2_SUBTYPE_SERIAL_MSM8X60 = 0x4, |
| 1027 | ACPI_DBG2_SUBTYPE_SERIAL_NS16550_NVIDIA = 0x5, |
| 1028 | ACPI_DBG2_SUBTYPE_SERIAL_TI_OMAP = 0x6, |
| 1029 | ACPI_DBG2_SUBTYPE_SERIAL_APM88XXXX = 0x8, |
| 1030 | ACPI_DBG2_SUBTYPE_SERIAL_MSM8974 = 0x9, |
| 1031 | ACPI_DBG2_SUBTYPE_SERIAL_SAM5250 = 0xA, |
| 1032 | ACPI_DBG2_SUBTYPE_SERIAL_INTEL_USIF = 0xB, |
| 1033 | ACPI_DBG2_SUBTYPE_SERIAL_IMX6 = 0xC, |
| 1034 | ACPI_DBG2_SUBTYPE_SERIAL_ARM_SBSA_32BIT = 0xD, |
| 1035 | ACPI_DBG2_SUBTYPE_SERIAL_ARM_SBSA_GENERIC = 0xE, |
| 1036 | ACPI_DBG2_SUBTYPE_SERIAL_ARM_DCC = 0xF, |
| 1037 | ACPI_DBG2_SUBTYPE_SERIAL_BCM2835 = 0x10, |
| 1038 | ACPI_DBG2_SUBTYPE_SERIAL_SDM845_1_8432MHZ = 0x11, |
| 1039 | ACPI_DBG2_SUBTYPE_SERIAL_NS16550_GAS = 0x12, |
| 1040 | ACPI_DBG2_SUBTYPE_SERIAL_SDM845_7_372MHZ = 0x13, |
| 1041 | ACPI_DBG2_SUBTYPE_SERIAL_INTEL_LPSS = 0x14, |
| 1042 | ACPI_DBG2_SUBTYPE_SERIAL_RISCV_SBI = 0x15, |
| 1043 | }; |
| 1044 | |
| 1045 | /** |
| 1046 | * Constants for acpi_dbg2_device_info->port_subtype |
| 1047 | * if acpi_dbg2_device_info->port_type == ACPI_DBG2_TYPE_1394. |
| 1048 | */ |
| 1049 | enum acpi_dbg2_1394_subtype { |
| 1050 | ACPI_DBG2_SUBTYPE_1394_STANDARD = 0x0, |
| 1051 | }; |
| 1052 | |
| 1053 | /** |
| 1054 | * Constants for acpi_dbg2_device_info->port_subtype |
| 1055 | * if acpi_dbg2_device_info->port_type == ACPI_DBG2_TYPE_USB. |
| 1056 | */ |
| 1057 | enum acpi_dbg2_usb_subtype { |
| 1058 | ACPI_DBG2_SUBTYPE_USB_XHCI_DEBUG = 0x0, |
| 1059 | ACPI_DBG2_SUBTYPE_USB_EHCI_DEBUG = 0x1, |
| 1060 | }; |
| 1061 | |
| 1062 | UACPI_PACKED(struct acpi_dbg2 { |
| 1063 | struct acpi_sdt_hdr hdr; |
| 1064 | uacpi_u32 offset_dbg_device_info; |
| 1065 | uacpi_u32 number_dbg_device_info; |
| 1066 | /** |
| 1067 | * Variable length fields below: |
| 1068 | * At ->offset_dbg_device_info: |
| 1069 | * struct acpi_dbg2_dbg_device_info dbg_devices[number_dbg_device_info]; |
| 1070 | */ |
| 1071 | }) |
| 1072 | UACPI_EXPECT_SIZEOF(struct acpi_dbg2, 44); |
| 1073 | |
| 1074 | UACPI_PACKED(struct acpi_dbg2_dbg_device_info { |
| 1075 | uacpi_u8 revision; |
| 1076 | uacpi_u16 length; |
| 1077 | uacpi_u8 number_generic_address_registers; |
| 1078 | uacpi_u16 namespace_string_length; |
| 1079 | uacpi_u16 namespace_string_offset; |
| 1080 | uacpi_u16 oem_data_length; |
| 1081 | uacpi_u16 oem_data_offset; |
| 1082 | uacpi_u16 port_type; |
| 1083 | uacpi_u16 port_subtype; |
| 1084 | uacpi_u16 rsvd; |
| 1085 | uacpi_u16 base_address_register_offset; |
| 1086 | uacpi_u16 address_size_offset; |
| 1087 | /** |
| 1088 | * Variable length fields below: |
| 1089 | * At ->base_address_register_offset: |
| 1090 | * struct acpi_gas base_address_register[number_generic_address_registers]; |
| 1091 | * At ->address_size_offset |
| 1092 | * u32 address_size[number_generic_address_registers]; |
| 1093 | * At ->namespace_string_offset: |
| 1094 | * char namespace_string[namespace_string_length]; |
| 1095 | * At ->oem_data_offset: |
| 1096 | * char oem_data[oem_data_length]; |
| 1097 | */ |
| 1098 | }) |
| 1099 | UACPI_EXPECT_SIZEOF(struct acpi_dbg2_dbg_device_info, 22); |
| 1100 | |
| 1101 | // acpi_scpr->interrupt_type |
| 1102 | #define ACPI_SPCR_INTERRUPT_TYPE_8259 0x1 |
| 1103 | #define ACPI_SPCR_INTERRUPT_TYPE_IOAPIC 0x2 |
| 1104 | #define ACPI_SPCR_INTERRUPT_TYPE_IOSAPIC 0x4 |
| 1105 | #define ACPI_SPCR_INTERRUPT_TYPE_GIC 0x8 |
| 1106 | #define ACPI_SPCR_INTERRUPT_TYPE_PLIC_APLIC 0x10 |
| 1107 | |
| 1108 | // acpi_spcr->pci_flags |
| 1109 | #define ACPI_SPCR_PCI_FLAGS_DO_NOT_DISABLE 0x1 |
| 1110 | |
| 1111 | // acpi_spcr->terminal_type |
| 1112 | enum acpi_spcr_terminal_type { |
| 1113 | ACPI_SPCR_TERMINAL_TYPE_VT100 = 0, |
| 1114 | ACPI_SPCR_TERMINAL_TYPE_EXTENDED_VT100 = 1, |
| 1115 | ACPI_SPCR_TERMINAL_TYPE_VT_UTF8 = 2, |
| 1116 | ACPI_SPCR_TERMINAL_TYPE_ANSI = 3, |
| 1117 | }; |
| 1118 | |
| 1119 | UACPI_PACKED(struct acpi_spcr { |
| 1120 | struct acpi_sdt_hdr hdr; |
| 1121 | uacpi_u8 interface_type; |
| 1122 | uacpi_u8 rsvd[3]; |
| 1123 | struct acpi_gas base_address; |
| 1124 | uacpi_u8 interrupt_type; |
| 1125 | uacpi_u8 irq; |
| 1126 | uacpi_u32 gsi; |
| 1127 | uacpi_u8 configured_baud_rate; |
| 1128 | uacpi_u8 parity; |
| 1129 | uacpi_u8 stop_bits; |
| 1130 | uacpi_u8 flow_control; |
| 1131 | uacpi_u8 terminal_type; |
| 1132 | uacpi_u8 language; |
| 1133 | uacpi_u16 pci_device_id; |
| 1134 | uacpi_u16 pci_vendor_id; |
| 1135 | uacpi_u8 pci_bus_number; |
| 1136 | uacpi_u8 pci_device_number; |
| 1137 | uacpi_u8 pci_function_number; |
| 1138 | uacpi_u32 pci_flags; |
| 1139 | uacpi_u8 pci_segment; |
| 1140 | uacpi_u32 uart_clock_frequency; |
| 1141 | uacpi_u32 precise_baud_rate; |
| 1142 | uacpi_u16 namespace_string_length; |
| 1143 | uacpi_u16 namespace_string_offset; |
| 1144 | /** |
| 1145 | * At ->namespace_string_offset: |
| 1146 | * char namespace_string[namespace_string_length]; |
| 1147 | */ |
| 1148 | }) |
| 1149 | UACPI_EXPECT_SIZEOF(struct acpi_spcr, 88); |
| 1150 | |
| 1151 | UACPI_PACKED(struct acpi_rhct_hdr { |
| 1152 | uacpi_u16 type; |
| 1153 | uacpi_u16 length; |
| 1154 | uacpi_u16 revision; |
| 1155 | }) |
| 1156 | UACPI_EXPECT_SIZEOF(struct acpi_rhct_hdr, 6); |
| 1157 | |
| 1158 | // acpi_rhct->flags |
| 1159 | #define ACPI_TIMER_CANNOT_WAKE_CPU (1 << 0) |
| 1160 | |
| 1161 | UACPI_PACKED(struct acpi_rhct { |
| 1162 | struct acpi_sdt_hdr hdr; |
| 1163 | uacpi_u32 flags; |
| 1164 | uacpi_u64 timebase_frequency; |
| 1165 | uacpi_u32 node_count; |
| 1166 | uacpi_u32 nodes_offset; |
| 1167 | struct acpi_rhct_hdr entries[]; |
| 1168 | }) |
| 1169 | UACPI_EXPECT_SIZEOF(struct acpi_rhct, 56); |
| 1170 | |
| 1171 | enum acpi_rhct_entry_type { |
| 1172 | ACPI_RHCT_ENTRY_TYPE_ISA_STRING = 0, |
| 1173 | ACPI_RHCT_ENTRY_TYPE_CMO = 1, |
| 1174 | ACPI_RHCT_ENTRY_TYPE_MMU = 2, |
| 1175 | ACPI_RHCT_ENTRY_TYPE_HART_INFO = 65535, |
| 1176 | }; |
| 1177 | |
| 1178 | UACPI_PACKED(struct acpi_rhct_isa_string { |
| 1179 | struct acpi_rhct_hdr hdr; |
| 1180 | uacpi_u16 length; |
| 1181 | uacpi_u8 isa[]; |
| 1182 | }) |
| 1183 | UACPI_EXPECT_SIZEOF(struct acpi_rhct_isa_string, 8); |
| 1184 | |
| 1185 | UACPI_PACKED(struct acpi_rhct_cmo { |
| 1186 | struct acpi_rhct_hdr hdr; |
| 1187 | uacpi_u8 rsvd; |
| 1188 | uacpi_u8 cbom_size; |
| 1189 | uacpi_u8 cbop_size; |
| 1190 | uacpi_u8 cboz_size; |
| 1191 | }) |
| 1192 | UACPI_EXPECT_SIZEOF(struct acpi_rhct_cmo, 10); |
| 1193 | |
| 1194 | enum acpi_rhct_mmu_type { |
| 1195 | ACPI_RHCT_MMU_TYPE_SV39 = 0, |
| 1196 | ACPI_RHCT_MMU_TYPE_SV48 = 1, |
| 1197 | ACPI_RHCT_MMU_TYPE_SV57 = 2, |
| 1198 | }; |
| 1199 | |
| 1200 | UACPI_PACKED(struct acpi_rhct_mmu { |
| 1201 | struct acpi_rhct_hdr hdr; |
| 1202 | uacpi_u8 rsvd; |
| 1203 | uacpi_u8 type; |
| 1204 | }) |
| 1205 | UACPI_EXPECT_SIZEOF(struct acpi_rhct_mmu, 8); |
| 1206 | |
| 1207 | UACPI_PACKED(struct acpi_rhct_hart_info { |
| 1208 | struct acpi_rhct_hdr hdr; |
| 1209 | uacpi_u16 offset_count; |
| 1210 | uacpi_u32 uid; |
| 1211 | uacpi_u32 offsets[]; |
| 1212 | }) |
| 1213 | UACPI_EXPECT_SIZEOF(struct acpi_rhct_hart_info, 12); |
| 1214 | |
| 1215 | #define ACPI_LARGE_ITEM (1 << 7) |
| 1216 | |
| 1217 | #define ACPI_SMALL_ITEM_NAME_IDX 3 |
| 1218 | #define ACPI_SMALL_ITEM_NAME_MASK 0xF |
| 1219 | #define ACPI_SMALL_ITEM_LENGTH_MASK 0x7 |
| 1220 | |
| 1221 | #define ACPI_LARGE_ITEM_NAME_MASK 0x7F |
| 1222 | |
| 1223 | // Small items |
| 1224 | #define ACPI_RESOURCE_IRQ 0x04 |
| 1225 | #define ACPI_RESOURCE_DMA 0x05 |
| 1226 | #define ACPI_RESOURCE_START_DEPENDENT 0x06 |
| 1227 | #define ACPI_RESOURCE_END_DEPENDENT 0x07 |
| 1228 | #define ACPI_RESOURCE_IO 0x08 |
| 1229 | #define ACPI_RESOURCE_FIXED_IO 0x09 |
| 1230 | #define ACPI_RESOURCE_FIXED_DMA 0x0A |
| 1231 | #define ACPI_RESOURCE_VENDOR_TYPE0 0x0E |
| 1232 | #define ACPI_RESOURCE_END_TAG 0x0F |
| 1233 | |
| 1234 | // Large items |
| 1235 | #define ACPI_RESOURCE_MEMORY24 0x01 |
| 1236 | #define ACPI_RESOURCE_GENERIC_REGISTER 0x02 |
| 1237 | #define ACPI_RESOURCE_VENDOR_TYPE1 0x04 |
| 1238 | #define ACPI_RESOURCE_MEMORY32 0x05 |
| 1239 | #define ACPI_RESOURCE_FIXED_MEMORY32 0x06 |
| 1240 | #define ACPI_RESOURCE_ADDRESS32 0x07 |
| 1241 | #define ACPI_RESOURCE_ADDRESS16 0x08 |
| 1242 | #define ACPI_RESOURCE_EXTENDED_IRQ 0x09 |
| 1243 | #define ACPI_RESOURCE_ADDRESS64 0x0A |
| 1244 | #define ACPI_RESOURCE_ADDRESS64_EXTENDED 0x0B |
| 1245 | #define ACPI_RESOURCE_GPIO_CONNECTION 0x0C |
| 1246 | #define ACPI_RESOURCE_PIN_FUNCTION 0x0D |
| 1247 | #define ACPI_RESOURCE_SERIAL_CONNECTION 0x0E |
| 1248 | #define ACPI_RESOURCE_PIN_CONFIGURATION 0x0F |
| 1249 | #define ACPI_RESOURCE_PIN_GROUP 0x10 |
| 1250 | #define ACPI_RESOURCE_PIN_GROUP_FUNCTION 0x11 |
| 1251 | #define ACPI_RESOURCE_PIN_GROUP_CONFIGURATION 0x12 |
| 1252 | #define ACPI_RESOURCE_CLOCK_INPUT 0x13 |
| 1253 | |
| 1254 | /** |
| 1255 | * Resources as encoded by the raw AML byte stream. |
| 1256 | * For decode API & human usable structures refer to uacpi/resources.h |
| 1257 | */ |
| 1258 | UACPI_PACKED(struct acpi_small_item { |
| 1259 | uacpi_u8 type_and_length; |
| 1260 | }) |
| 1261 | UACPI_EXPECT_SIZEOF(struct acpi_small_item, 1); |
| 1262 | |
| 1263 | UACPI_PACKED(struct acpi_resource_irq { |
| 1264 | struct acpi_small_item common; |
| 1265 | uacpi_u16 irq_mask; |
| 1266 | uacpi_u8 flags; |
| 1267 | }) |
| 1268 | UACPI_EXPECT_SIZEOF(struct acpi_resource_irq, 4); |
| 1269 | |
| 1270 | UACPI_PACKED(struct acpi_resource_dma { |
| 1271 | struct acpi_small_item common; |
| 1272 | uacpi_u8 channel_mask; |
| 1273 | uacpi_u8 flags; |
| 1274 | }) |
| 1275 | UACPI_EXPECT_SIZEOF(struct acpi_resource_dma, 3); |
| 1276 | |
| 1277 | UACPI_PACKED(struct acpi_resource_start_dependent { |
| 1278 | struct acpi_small_item common; |
| 1279 | uacpi_u8 flags; |
| 1280 | }) |
| 1281 | UACPI_EXPECT_SIZEOF(struct acpi_resource_start_dependent, 2); |
| 1282 | |
| 1283 | UACPI_PACKED(struct acpi_resource_end_dependent { |
| 1284 | struct acpi_small_item common; |
| 1285 | }) |
| 1286 | UACPI_EXPECT_SIZEOF(struct acpi_resource_end_dependent, 1); |
| 1287 | |
| 1288 | UACPI_PACKED(struct acpi_resource_io { |
| 1289 | struct acpi_small_item common; |
| 1290 | uacpi_u8 information; |
| 1291 | uacpi_u16 minimum; |
| 1292 | uacpi_u16 maximum; |
| 1293 | uacpi_u8 alignment; |
| 1294 | uacpi_u8 length; |
| 1295 | }) |
| 1296 | UACPI_EXPECT_SIZEOF(struct acpi_resource_io, 8); |
| 1297 | |
| 1298 | UACPI_PACKED(struct acpi_resource_fixed_io { |
| 1299 | struct acpi_small_item common; |
| 1300 | uacpi_u16 address; |
| 1301 | uacpi_u8 length; |
| 1302 | }) |
| 1303 | UACPI_EXPECT_SIZEOF(struct acpi_resource_fixed_io, 4); |
| 1304 | |
| 1305 | UACPI_PACKED(struct acpi_resource_fixed_dma { |
| 1306 | struct acpi_small_item common; |
| 1307 | uacpi_u16 request_line; |
| 1308 | uacpi_u16 channel; |
| 1309 | uacpi_u8 transfer_width; |
| 1310 | }) |
| 1311 | UACPI_EXPECT_SIZEOF(struct acpi_resource_fixed_dma, 6); |
| 1312 | |
| 1313 | UACPI_PACKED(struct acpi_resource_vendor_defined_type0 { |
| 1314 | struct acpi_small_item common; |
| 1315 | uacpi_u8 byte_data[]; |
| 1316 | }) |
| 1317 | UACPI_EXPECT_SIZEOF(struct acpi_resource_vendor_defined_type0, 1); |
| 1318 | |
| 1319 | UACPI_PACKED(struct acpi_resource_end_tag { |
| 1320 | struct acpi_small_item common; |
| 1321 | uacpi_u8 checksum; |
| 1322 | }) |
| 1323 | UACPI_EXPECT_SIZEOF(struct acpi_resource_end_tag, 2); |
| 1324 | |
| 1325 | UACPI_PACKED(struct acpi_large_item { |
| 1326 | uacpi_u8 type; |
| 1327 | uacpi_u16 length; |
| 1328 | }) |
| 1329 | UACPI_EXPECT_SIZEOF(struct acpi_large_item, 3); |
| 1330 | |
| 1331 | UACPI_PACKED(struct acpi_resource_memory24 { |
| 1332 | struct acpi_large_item common; |
| 1333 | uacpi_u8 information; |
| 1334 | uacpi_u16 minimum; |
| 1335 | uacpi_u16 maximum; |
| 1336 | uacpi_u16 alignment; |
| 1337 | uacpi_u16 length; |
| 1338 | }) |
| 1339 | UACPI_EXPECT_SIZEOF(struct acpi_resource_memory24, 12); |
| 1340 | |
| 1341 | UACPI_PACKED(struct acpi_resource_vendor_defined_type1 { |
| 1342 | struct acpi_large_item common; |
| 1343 | uacpi_u8 byte_data[]; |
| 1344 | }) |
| 1345 | UACPI_EXPECT_SIZEOF(struct acpi_resource_vendor_defined_type1, 3); |
| 1346 | |
| 1347 | UACPI_PACKED(struct acpi_resource_memory32 { |
| 1348 | struct acpi_large_item common; |
| 1349 | uacpi_u8 information; |
| 1350 | uacpi_u32 minimum; |
| 1351 | uacpi_u32 maximum; |
| 1352 | uacpi_u32 alignment; |
| 1353 | uacpi_u32 length; |
| 1354 | }) |
| 1355 | UACPI_EXPECT_SIZEOF(struct acpi_resource_memory32, 20); |
| 1356 | |
| 1357 | UACPI_PACKED(struct acpi_resource_fixed_memory32 { |
| 1358 | struct acpi_large_item common; |
| 1359 | uacpi_u8 information; |
| 1360 | uacpi_u32 address; |
| 1361 | uacpi_u32 length; |
| 1362 | }) |
| 1363 | UACPI_EXPECT_SIZEOF(struct acpi_resource_fixed_memory32, 12); |
| 1364 | |
| 1365 | UACPI_PACKED(struct acpi_resource_address { |
| 1366 | struct acpi_large_item common; |
| 1367 | uacpi_u8 type; |
| 1368 | uacpi_u8 flags; |
| 1369 | uacpi_u8 type_flags; |
| 1370 | }) |
| 1371 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address, 6); |
| 1372 | |
| 1373 | UACPI_PACKED(struct acpi_resource_address64 { |
| 1374 | struct acpi_resource_address common; |
| 1375 | uacpi_u64 granularity; |
| 1376 | uacpi_u64 minimum; |
| 1377 | uacpi_u64 maximum; |
| 1378 | uacpi_u64 translation_offset; |
| 1379 | uacpi_u64 length; |
| 1380 | }) |
| 1381 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address64, 46); |
| 1382 | |
| 1383 | UACPI_PACKED(struct acpi_resource_address32 { |
| 1384 | struct acpi_resource_address common; |
| 1385 | uacpi_u32 granularity; |
| 1386 | uacpi_u32 minimum; |
| 1387 | uacpi_u32 maximum; |
| 1388 | uacpi_u32 translation_offset; |
| 1389 | uacpi_u32 length; |
| 1390 | }) |
| 1391 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address32, 26); |
| 1392 | |
| 1393 | UACPI_PACKED(struct acpi_resource_address16 { |
| 1394 | struct acpi_resource_address common; |
| 1395 | uacpi_u16 granularity; |
| 1396 | uacpi_u16 minimum; |
| 1397 | uacpi_u16 maximum; |
| 1398 | uacpi_u16 translation_offset; |
| 1399 | uacpi_u16 length; |
| 1400 | }) |
| 1401 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address16, 16); |
| 1402 | |
| 1403 | UACPI_PACKED(struct acpi_resource_address64_extended { |
| 1404 | struct acpi_resource_address common; |
| 1405 | uacpi_u8 revision_id; |
| 1406 | uacpi_u8 rsvd; |
| 1407 | uacpi_u64 granularity; |
| 1408 | uacpi_u64 minimum; |
| 1409 | uacpi_u64 maximum; |
| 1410 | uacpi_u64 translation_offset; |
| 1411 | uacpi_u64 length; |
| 1412 | uacpi_u64 attributes; |
| 1413 | }) |
| 1414 | UACPI_EXPECT_SIZEOF(struct acpi_resource_address64_extended, 56); |
| 1415 | |
| 1416 | UACPI_PACKED(struct acpi_resource_extended_irq { |
| 1417 | struct acpi_large_item common; |
| 1418 | uacpi_u8 flags; |
| 1419 | uacpi_u8 num_irqs; |
| 1420 | uacpi_u32 irqs[]; |
| 1421 | }) |
| 1422 | UACPI_EXPECT_SIZEOF(struct acpi_resource_extended_irq, 5); |
| 1423 | |
| 1424 | UACPI_PACKED(struct acpi_resource_generic_register { |
| 1425 | struct acpi_large_item common; |
| 1426 | uacpi_u8 address_space_id; |
| 1427 | uacpi_u8 bit_width; |
| 1428 | uacpi_u8 bit_offset; |
| 1429 | uacpi_u8 access_size; |
| 1430 | uacpi_u64 address; |
| 1431 | }) |
| 1432 | UACPI_EXPECT_SIZEOF(struct acpi_resource_generic_register, 15); |
| 1433 | |
| 1434 | UACPI_PACKED(struct acpi_resource_gpio_connection { |
| 1435 | struct acpi_large_item common; |
| 1436 | uacpi_u8 revision_id; |
| 1437 | uacpi_u8 type; |
| 1438 | uacpi_u16 general_flags; |
| 1439 | uacpi_u16 connection_flags; |
| 1440 | uacpi_u8 pull_configuration; |
| 1441 | uacpi_u16 drive_strength; |
| 1442 | uacpi_u16 debounce_timeout; |
| 1443 | uacpi_u16 pin_table_offset; |
| 1444 | uacpi_u8 source_index; |
| 1445 | uacpi_u16 source_offset; |
| 1446 | uacpi_u16 vendor_data_offset; |
| 1447 | uacpi_u16 vendor_data_length; |
| 1448 | }) |
| 1449 | UACPI_EXPECT_SIZEOF(struct acpi_resource_gpio_connection, 23); |
| 1450 | |
| 1451 | #define ACPI_SERIAL_TYPE_I2C 1 |
| 1452 | #define ACPI_SERIAL_TYPE_SPI 2 |
| 1453 | #define ACPI_SERIAL_TYPE_UART 3 |
| 1454 | #define ACPI_SERIAL_TYPE_CSI2 4 |
| 1455 | #define ACPI_SERIAL_TYPE_MAX ACPI_SERIAL_TYPE_CSI2 |
| 1456 | |
| 1457 | UACPI_PACKED(struct acpi_resource_serial { |
| 1458 | struct acpi_large_item common; |
| 1459 | uacpi_u8 revision_id; |
| 1460 | uacpi_u8 source_index; |
| 1461 | uacpi_u8 type; |
| 1462 | uacpi_u8 flags; |
| 1463 | uacpi_u16 type_specific_flags; |
| 1464 | uacpi_u8 type_specific_revision_id; |
| 1465 | uacpi_u16 type_data_length; |
| 1466 | }) |
| 1467 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial, 12); |
| 1468 | |
| 1469 | UACPI_PACKED(struct acpi_resource_serial_i2c { |
| 1470 | struct acpi_resource_serial common; |
| 1471 | uacpi_u32 connection_speed; |
| 1472 | uacpi_u16 slave_address; |
| 1473 | }) |
| 1474 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_i2c, 18); |
| 1475 | |
| 1476 | UACPI_PACKED(struct acpi_resource_serial_spi { |
| 1477 | struct acpi_resource_serial common; |
| 1478 | uacpi_u32 connection_speed; |
| 1479 | uacpi_u8 data_bit_length; |
| 1480 | uacpi_u8 phase; |
| 1481 | uacpi_u8 polarity; |
| 1482 | uacpi_u16 device_selection; |
| 1483 | }) |
| 1484 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_spi, 21); |
| 1485 | |
| 1486 | UACPI_PACKED(struct acpi_resource_serial_uart { |
| 1487 | struct acpi_resource_serial common; |
| 1488 | uacpi_u32 baud_rate; |
| 1489 | uacpi_u16 rx_fifo; |
| 1490 | uacpi_u16 tx_fifo; |
| 1491 | uacpi_u8 parity; |
| 1492 | uacpi_u8 lines_enabled; |
| 1493 | }) |
| 1494 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_uart, 22); |
| 1495 | |
| 1496 | UACPI_PACKED(struct acpi_resource_serial_csi2 { |
| 1497 | struct acpi_resource_serial common; |
| 1498 | }) |
| 1499 | UACPI_EXPECT_SIZEOF(struct acpi_resource_serial_csi2, 12); |
| 1500 | |
| 1501 | UACPI_PACKED(struct acpi_resource_pin_function { |
| 1502 | struct acpi_large_item common; |
| 1503 | uacpi_u8 revision_id; |
| 1504 | uacpi_u16 flags; |
| 1505 | uacpi_u8 pull_configuration; |
| 1506 | uacpi_u16 function_number; |
| 1507 | uacpi_u16 pin_table_offset; |
| 1508 | uacpi_u8 source_index; |
| 1509 | uacpi_u16 source_offset; |
| 1510 | uacpi_u16 vendor_data_offset; |
| 1511 | uacpi_u16 vendor_data_length; |
| 1512 | }) |
| 1513 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_function, 18); |
| 1514 | |
| 1515 | UACPI_PACKED(struct acpi_resource_pin_configuration { |
| 1516 | struct acpi_large_item common; |
| 1517 | uacpi_u8 revision_id; |
| 1518 | uacpi_u16 flags; |
| 1519 | uacpi_u8 type; |
| 1520 | uacpi_u32 value; |
| 1521 | uacpi_u16 pin_table_offset; |
| 1522 | uacpi_u8 source_index; |
| 1523 | uacpi_u16 source_offset; |
| 1524 | uacpi_u16 vendor_data_offset; |
| 1525 | uacpi_u16 vendor_data_length; |
| 1526 | }) |
| 1527 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_configuration, 20); |
| 1528 | |
| 1529 | UACPI_PACKED(struct acpi_resource_pin_group { |
| 1530 | struct acpi_large_item common; |
| 1531 | uacpi_u8 revision_id; |
| 1532 | uacpi_u16 flags; |
| 1533 | uacpi_u16 pin_table_offset; |
| 1534 | uacpi_u16 source_lable_offset; |
| 1535 | uacpi_u16 vendor_data_offset; |
| 1536 | uacpi_u16 vendor_data_length; |
| 1537 | }) |
| 1538 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_group, 14); |
| 1539 | |
| 1540 | UACPI_PACKED(struct acpi_resource_pin_group_function { |
| 1541 | struct acpi_large_item common; |
| 1542 | uacpi_u8 revision_id; |
| 1543 | uacpi_u16 flags; |
| 1544 | uacpi_u16 function; |
| 1545 | uacpi_u8 source_index; |
| 1546 | uacpi_u16 source_offset; |
| 1547 | uacpi_u16 source_lable_offset; |
| 1548 | uacpi_u16 vendor_data_offset; |
| 1549 | uacpi_u16 vendor_data_length; |
| 1550 | }) |
| 1551 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_group_function, 17); |
| 1552 | |
| 1553 | UACPI_PACKED(struct acpi_resource_pin_group_configuration { |
| 1554 | struct acpi_large_item common; |
| 1555 | uacpi_u8 revision_id; |
| 1556 | uacpi_u16 flags; |
| 1557 | uacpi_u8 type; |
| 1558 | uacpi_u32 value; |
| 1559 | uacpi_u8 source_index; |
| 1560 | uacpi_u16 source_offset; |
| 1561 | uacpi_u16 source_lable_offset; |
| 1562 | uacpi_u16 vendor_data_offset; |
| 1563 | uacpi_u16 vendor_data_length; |
| 1564 | }) |
| 1565 | UACPI_EXPECT_SIZEOF(struct acpi_resource_pin_group_configuration, 20); |
| 1566 | |
| 1567 | UACPI_PACKED(struct acpi_resource_clock_input { |
| 1568 | struct acpi_large_item common; |
| 1569 | uacpi_u8 revision_id; |
| 1570 | uacpi_u16 flags; |
| 1571 | uacpi_u16 divisor; |
| 1572 | uacpi_u32 numerator; |
| 1573 | uacpi_u8 source_index; |
| 1574 | }) |
| 1575 | UACPI_EXPECT_SIZEOF(struct acpi_resource_clock_input, 13); |
| 1576 | |
| 1577 | // acpi_dmar->flags |
| 1578 | #define ACPI_DMAR_INTR_REMAP (1 << 0) |
| 1579 | #define ACPI_DMAR_X2APIC_OPT_OUT (1 << 1) |
| 1580 | #define ACPI_DMAR_DMA_CTRL_PLATFORM_OPT_IN_FLAG (1 << 2) |
| 1581 | |
| 1582 | UACPI_PACKED(struct acpi_dmar_entry_hdr { |
| 1583 | uacpi_u16 type; |
| 1584 | uacpi_u16 length; |
| 1585 | }) |
| 1586 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_entry_hdr, 4); |
| 1587 | |
| 1588 | // acpi_dmar_entry_hdr->type |
| 1589 | enum acpi_dmar_entry_type { |
| 1590 | ACPI_DMAR_ENTRY_TYPE_DRHD = 0, |
| 1591 | ACPI_DMAR_ENTRY_TYPE_RMRR = 1, |
| 1592 | ACPI_DMAR_ENTRY_TYPE_ATSR = 2, |
| 1593 | ACPI_DMAR_ENTRY_TYPE_RHSA = 3, |
| 1594 | ACPI_DMAR_ENTRY_TYPE_ANDD = 4, |
| 1595 | ACPI_DMAR_ENTRY_TYPE_SATC = 5, |
| 1596 | ACPI_DMAR_ENTRY_TYPE_SIDP = 6, |
| 1597 | }; |
| 1598 | |
| 1599 | UACPI_PACKED(struct acpi_dmar { |
| 1600 | struct acpi_sdt_hdr hdr; |
| 1601 | uacpi_u8 haw; |
| 1602 | uacpi_u8 flags; |
| 1603 | uacpi_u8 rsvd[10]; |
| 1604 | struct acpi_dmar_entry_hdr entries[]; |
| 1605 | }) |
| 1606 | UACPI_EXPECT_SIZEOF(struct acpi_dmar, 48); |
| 1607 | |
| 1608 | // acpi_dmar_dss->type |
| 1609 | #define ACPI_DSS_PCI_ENDPOINT 0x01 |
| 1610 | #define ACPI_DSS_PCI_BRIDGE 0x02 |
| 1611 | #define ACPI_DSS_IOAPIC 0x03 |
| 1612 | #define ACPI_DSS_MSI_CAPABLE_HPET 0x04 |
| 1613 | #define ACPI_DSS_ACPI_NAMESPACE_DEVICE 0x05 |
| 1614 | |
| 1615 | // acpi_dmar_dss->flags |
| 1616 | #define ACPI_DSS_REQ_WO_PASID_NESTED_NOTALLOWED (1 << 0) |
| 1617 | #define ACPI_DSS_REQ_WO_PASID_PWSNP_NOTALLOWED (1 << 1) |
| 1618 | #define ACPI_DSS_REQ_WO_PASID_PGSNP_NOTALLOWED (1 << 2) |
| 1619 | #define ACPI_DSS_ATC_HARDENED (1 << 3) |
| 1620 | #define ACPI_DSS_ATC_REQUIRED (1 << 4) |
| 1621 | |
| 1622 | UACPI_PACKED(struct acpi_dmar_dss { |
| 1623 | uacpi_u8 type; |
| 1624 | uacpi_u8 length; |
| 1625 | uacpi_u8 flags; |
| 1626 | uacpi_u8 rsvd; |
| 1627 | uacpi_u8 enumeration_id; |
| 1628 | uacpi_u8 start_bus; |
| 1629 | |
| 1630 | // The actual number of bytes here depends on the type |
| 1631 | uacpi_u16 path[1]; |
| 1632 | }) |
| 1633 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_dss, 8); |
| 1634 | |
| 1635 | // acpi_dmar_drhd->flags |
| 1636 | #define ACPI_INCLUDE_PCI_ALL (1 << 0) |
| 1637 | |
| 1638 | UACPI_PACKED(struct acpi_dmar_drhd { |
| 1639 | struct acpi_dmar_entry_hdr hdr; |
| 1640 | uacpi_u8 flags; |
| 1641 | uacpi_u8 size; |
| 1642 | uacpi_u16 segment; |
| 1643 | uacpi_u64 address; |
| 1644 | struct acpi_dmar_dss entries[]; |
| 1645 | }) |
| 1646 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_drhd, 16); |
| 1647 | |
| 1648 | UACPI_PACKED(struct acpi_dmar_rmrr { |
| 1649 | struct acpi_dmar_entry_hdr hdr; |
| 1650 | uacpi_u16 rsvd; |
| 1651 | uacpi_u16 segment; |
| 1652 | uacpi_u64 base; |
| 1653 | uacpi_u64 limit; |
| 1654 | struct acpi_dmar_dss entries[]; |
| 1655 | }) |
| 1656 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_rmrr, 24); |
| 1657 | |
| 1658 | // acpi_dmar_atsr->flags |
| 1659 | #define ACPI_ATSR_ALL_PORTS (1 << 0) |
| 1660 | |
| 1661 | UACPI_PACKED(struct acpi_dmar_atsr { |
| 1662 | struct acpi_dmar_entry_hdr hdr; |
| 1663 | uacpi_u8 flags; |
| 1664 | uacpi_u8 rsvd; |
| 1665 | uacpi_u16 segment; |
| 1666 | struct acpi_dmar_dss entries[]; |
| 1667 | }) |
| 1668 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_atsr, 8); |
| 1669 | |
| 1670 | UACPI_PACKED(struct acpi_dmar_rhsa { |
| 1671 | struct acpi_dmar_entry_hdr hdr; |
| 1672 | uacpi_u32 rsvd; |
| 1673 | uacpi_u64 base; |
| 1674 | uacpi_u32 proximity_domain; |
| 1675 | }) |
| 1676 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_rhsa, 20); |
| 1677 | |
| 1678 | UACPI_PACKED(struct acpi_dmar_andd { |
| 1679 | struct acpi_dmar_entry_hdr hdr; |
| 1680 | uacpi_u8 rsvd[3]; |
| 1681 | uacpi_u8 device_id; |
| 1682 | uacpi_char name[]; |
| 1683 | }) |
| 1684 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_andd, 8); |
| 1685 | |
| 1686 | // acpi_dmar_satc->flags |
| 1687 | #define ACPI_SATC_ATC_REQUIRED 0x01 |
| 1688 | |
| 1689 | UACPI_PACKED(struct acpi_dmar_satc { |
| 1690 | struct acpi_dmar_entry_hdr hdr; |
| 1691 | uacpi_u8 flags; |
| 1692 | uacpi_u8 rsvd; |
| 1693 | uacpi_u16 segment; |
| 1694 | struct acpi_dmar_dss entries[]; |
| 1695 | }) |
| 1696 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_satc, 8); |
| 1697 | |
| 1698 | UACPI_PACKED(struct acpi_dmar_sidp { |
| 1699 | struct acpi_dmar_entry_hdr hdr; |
| 1700 | uacpi_u16 rsvd; |
| 1701 | uacpi_u16 segment; |
| 1702 | struct acpi_dmar_dss entries[]; |
| 1703 | }) |
| 1704 | UACPI_EXPECT_SIZEOF(struct acpi_dmar_sidp, 8); |
| 1705 | |