1 /* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 12 * You should have received a copy of the GNU General Public License along 13 * with this program; if not, see <http://www.gnu.org/licenses/>. 14 */ 15 #ifndef QEMU_ACPI_DEFS_H 16 #define QEMU_ACPI_DEFS_H 17 18 enum { 19 ACPI_FADT_F_WBINVD, 20 ACPI_FADT_F_WBINVD_FLUSH, 21 ACPI_FADT_F_PROC_C1, 22 ACPI_FADT_F_P_LVL2_UP, 23 ACPI_FADT_F_PWR_BUTTON, 24 ACPI_FADT_F_SLP_BUTTON, 25 ACPI_FADT_F_FIX_RTC, 26 ACPI_FADT_F_RTC_S4, 27 ACPI_FADT_F_TMR_VAL_EXT, 28 ACPI_FADT_F_DCK_CAP, 29 ACPI_FADT_F_RESET_REG_SUP, 30 ACPI_FADT_F_SEALED_CASE, 31 ACPI_FADT_F_HEADLESS, 32 ACPI_FADT_F_CPU_SW_SLP, 33 ACPI_FADT_F_PCI_EXP_WAK, 34 ACPI_FADT_F_USE_PLATFORM_CLOCK, 35 ACPI_FADT_F_S4_RTC_STS_VALID, 36 ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE, 37 ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL, 38 ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE, 39 ACPI_FADT_F_HW_REDUCED_ACPI, 40 ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE, 41 }; 42 43 typedef struct AcpiRsdpData { 44 uint8_t oem_id[6]; /* OEM identification */ 45 uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ 46 47 unsigned *rsdt_tbl_offset; 48 unsigned *xsdt_tbl_offset; 49 } AcpiRsdpData; 50 51 /* Table structure from Linux kernel (the ACPI tables are under the 52 BSD license) */ 53 54 55 #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ 56 uint32_t signature; /* ACPI signature (4 ASCII characters) */ \ 57 uint32_t length; /* Length of table, in bytes, including header */ \ 58 uint8_t revision; /* ACPI Specification minor version # */ \ 59 uint8_t checksum; /* To make sum of entire table == 0 */ \ 60 uint8_t oem_id [6]; /* OEM identification */ \ 61 uint8_t oem_table_id [8]; /* OEM table identification */ \ 62 uint32_t oem_revision; /* OEM revision number */ \ 63 uint8_t asl_compiler_id [4]; /* ASL compiler vendor ID */ \ 64 uint32_t asl_compiler_revision; /* ASL compiler revision number */ 65 66 67 /* ACPI common table header */ 68 struct AcpiTableHeader { 69 ACPI_TABLE_HEADER_DEF 70 } QEMU_PACKED; 71 typedef struct AcpiTableHeader AcpiTableHeader; 72 73 struct AcpiGenericAddress { 74 uint8_t space_id; /* Address space where struct or register exists */ 75 uint8_t bit_width; /* Size in bits of given register */ 76 uint8_t bit_offset; /* Bit offset within the register */ 77 uint8_t access_width; /* ACPI 3.0: Minimum Access size (ACPI 3.0), 78 ACPI 2.0: Reserved, Table 5-1 */ 79 uint64_t address; /* 64-bit address of struct or register */ 80 } QEMU_PACKED; 81 82 typedef struct AcpiFadtData { 83 struct AcpiGenericAddress pm1a_cnt; /* PM1a_CNT_BLK */ 84 struct AcpiGenericAddress pm1a_evt; /* PM1a_EVT_BLK */ 85 struct AcpiGenericAddress pm_tmr; /* PM_TMR_BLK */ 86 struct AcpiGenericAddress gpe0_blk; /* GPE0_BLK */ 87 struct AcpiGenericAddress reset_reg; /* RESET_REG */ 88 uint8_t reset_val; /* RESET_VALUE */ 89 uint8_t rev; /* Revision */ 90 uint32_t flags; /* Flags */ 91 uint32_t smi_cmd; /* SMI_CMD */ 92 uint16_t sci_int; /* SCI_INT */ 93 uint8_t int_model; /* INT_MODEL */ 94 uint8_t acpi_enable_cmd; /* ACPI_ENABLE */ 95 uint8_t acpi_disable_cmd; /* ACPI_DISABLE */ 96 uint8_t rtc_century; /* CENTURY */ 97 uint16_t plvl2_lat; /* P_LVL2_LAT */ 98 uint16_t plvl3_lat; /* P_LVL3_LAT */ 99 uint16_t arm_boot_arch; /* ARM_BOOT_ARCH */ 100 uint8_t minor_ver; /* FADT Minor Version */ 101 102 /* 103 * respective tables offsets within ACPI_BUILD_TABLE_FILE, 104 * NULL if table doesn't exist (in that case field's value 105 * won't be patched by linker and will be kept set to 0) 106 */ 107 unsigned *facs_tbl_offset; /* FACS offset in */ 108 unsigned *dsdt_tbl_offset; 109 unsigned *xdsdt_tbl_offset; 110 } AcpiFadtData; 111 112 #define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0) 113 #define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1) 114 115 /* 116 * Serial Port Console Redirection Table (SPCR), Rev. 1.02 117 * 118 * For .interface_type see Debug Port Table 2 (DBG2) serial port 119 * subtypes in Table 3, Rev. May 22, 2012 120 */ 121 struct AcpiSerialPortConsoleRedirection { 122 ACPI_TABLE_HEADER_DEF 123 uint8_t interface_type; 124 uint8_t reserved1[3]; 125 struct AcpiGenericAddress base_address; 126 uint8_t interrupt_types; 127 uint8_t irq; 128 uint32_t gsi; 129 uint8_t baud; 130 uint8_t parity; 131 uint8_t stopbits; 132 uint8_t flowctrl; 133 uint8_t term_type; 134 uint8_t reserved2; 135 uint16_t pci_device_id; 136 uint16_t pci_vendor_id; 137 uint8_t pci_bus; 138 uint8_t pci_slot; 139 uint8_t pci_func; 140 uint32_t pci_flags; 141 uint8_t pci_seg; 142 uint32_t reserved3; 143 } QEMU_PACKED; 144 typedef struct AcpiSerialPortConsoleRedirection 145 AcpiSerialPortConsoleRedirection; 146 147 /* 148 * ACPI 1.0 Root System Description Table (RSDT) 149 */ 150 struct AcpiRsdtDescriptorRev1 { 151 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 152 uint32_t table_offset_entry[0]; /* Array of pointers to other */ 153 /* ACPI tables */ 154 } QEMU_PACKED; 155 typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescriptorRev1; 156 157 /* 158 * ACPI 2.0 eXtended System Description Table (XSDT) 159 */ 160 struct AcpiXsdtDescriptorRev2 { 161 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 162 uint64_t table_offset_entry[0]; /* Array of pointers to other */ 163 /* ACPI tables */ 164 } QEMU_PACKED; 165 typedef struct AcpiXsdtDescriptorRev2 AcpiXsdtDescriptorRev2; 166 167 /* 168 * ACPI 1.0 Firmware ACPI Control Structure (FACS) 169 */ 170 struct AcpiFacsDescriptorRev1 { 171 uint32_t signature; /* ACPI Signature */ 172 uint32_t length; /* Length of structure, in bytes */ 173 uint32_t hardware_signature; /* Hardware configuration signature */ 174 uint32_t firmware_waking_vector; /* ACPI OS waking vector */ 175 uint32_t global_lock; /* Global Lock */ 176 uint32_t flags; 177 uint8_t resverved3 [40]; /* Reserved - must be zero */ 178 } QEMU_PACKED; 179 typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1; 180 181 /* 182 * Differentiated System Description Table (DSDT) 183 */ 184 185 /* 186 * MADT values and structures 187 */ 188 189 /* Values for MADT PCATCompat */ 190 191 #define ACPI_DUAL_PIC 0 192 #define ACPI_MULTIPLE_APIC 1 193 194 /* Master MADT */ 195 196 struct AcpiMultipleApicTable { 197 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 198 uint32_t local_apic_address; /* Physical address of local APIC */ 199 uint32_t flags; 200 } QEMU_PACKED; 201 typedef struct AcpiMultipleApicTable AcpiMultipleApicTable; 202 203 /* Values for Type in APIC sub-headers */ 204 205 #define ACPI_APIC_PROCESSOR 0 206 #define ACPI_APIC_IO 1 207 #define ACPI_APIC_XRUPT_OVERRIDE 2 208 #define ACPI_APIC_NMI 3 209 #define ACPI_APIC_LOCAL_NMI 4 210 #define ACPI_APIC_ADDRESS_OVERRIDE 5 211 #define ACPI_APIC_IO_SAPIC 6 212 #define ACPI_APIC_LOCAL_SAPIC 7 213 #define ACPI_APIC_XRUPT_SOURCE 8 214 #define ACPI_APIC_LOCAL_X2APIC 9 215 #define ACPI_APIC_LOCAL_X2APIC_NMI 10 216 #define ACPI_APIC_GENERIC_CPU_INTERFACE 11 217 #define ACPI_APIC_GENERIC_DISTRIBUTOR 12 218 #define ACPI_APIC_GENERIC_MSI_FRAME 13 219 #define ACPI_APIC_GENERIC_REDISTRIBUTOR 14 220 #define ACPI_APIC_GENERIC_TRANSLATOR 15 221 #define ACPI_APIC_RESERVED 16 /* 16 and greater are reserved */ 222 223 /* 224 * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) 225 */ 226 #define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\ 227 uint8_t type; \ 228 uint8_t length; 229 230 /* Sub-structures for MADT */ 231 232 struct AcpiMadtProcessorApic { 233 ACPI_SUB_HEADER_DEF 234 uint8_t processor_id; /* ACPI processor id */ 235 uint8_t local_apic_id; /* Processor's local APIC id */ 236 uint32_t flags; 237 } QEMU_PACKED; 238 typedef struct AcpiMadtProcessorApic AcpiMadtProcessorApic; 239 240 struct AcpiMadtIoApic { 241 ACPI_SUB_HEADER_DEF 242 uint8_t io_apic_id; /* I/O APIC ID */ 243 uint8_t reserved; /* Reserved - must be zero */ 244 uint32_t address; /* APIC physical address */ 245 uint32_t interrupt; /* Global system interrupt where INTI 246 * lines start */ 247 } QEMU_PACKED; 248 typedef struct AcpiMadtIoApic AcpiMadtIoApic; 249 250 struct AcpiMadtIntsrcovr { 251 ACPI_SUB_HEADER_DEF 252 uint8_t bus; 253 uint8_t source; 254 uint32_t gsi; 255 uint16_t flags; 256 } QEMU_PACKED; 257 typedef struct AcpiMadtIntsrcovr AcpiMadtIntsrcovr; 258 259 struct AcpiMadtLocalNmi { 260 ACPI_SUB_HEADER_DEF 261 uint8_t processor_id; /* ACPI processor id */ 262 uint16_t flags; /* MPS INTI flags */ 263 uint8_t lint; /* Local APIC LINT# */ 264 } QEMU_PACKED; 265 typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi; 266 267 struct AcpiMadtProcessorX2Apic { 268 ACPI_SUB_HEADER_DEF 269 uint16_t reserved; 270 uint32_t x2apic_id; /* Processor's local x2APIC ID */ 271 uint32_t flags; 272 uint32_t uid; /* Processor object _UID */ 273 } QEMU_PACKED; 274 typedef struct AcpiMadtProcessorX2Apic AcpiMadtProcessorX2Apic; 275 276 struct AcpiMadtLocalX2ApicNmi { 277 ACPI_SUB_HEADER_DEF 278 uint16_t flags; /* MPS INTI flags */ 279 uint32_t uid; /* Processor object _UID */ 280 uint8_t lint; /* Local APIC LINT# */ 281 uint8_t reserved[3]; /* Local APIC LINT# */ 282 } QEMU_PACKED; 283 typedef struct AcpiMadtLocalX2ApicNmi AcpiMadtLocalX2ApicNmi; 284 285 struct AcpiMadtGenericCpuInterface { 286 ACPI_SUB_HEADER_DEF 287 uint16_t reserved; 288 uint32_t cpu_interface_number; 289 uint32_t uid; 290 uint32_t flags; 291 uint32_t parking_version; 292 uint32_t performance_interrupt; 293 uint64_t parked_address; 294 uint64_t base_address; 295 uint64_t gicv_base_address; 296 uint64_t gich_base_address; 297 uint32_t vgic_interrupt; 298 uint64_t gicr_base_address; 299 uint64_t arm_mpidr; 300 } QEMU_PACKED; 301 302 typedef struct AcpiMadtGenericCpuInterface AcpiMadtGenericCpuInterface; 303 304 /* GICC CPU Interface Flags */ 305 #define ACPI_MADT_GICC_ENABLED 1 306 307 struct AcpiMadtGenericDistributor { 308 ACPI_SUB_HEADER_DEF 309 uint16_t reserved; 310 uint32_t gic_id; 311 uint64_t base_address; 312 uint32_t global_irq_base; 313 /* ACPI 5.1 Errata 1228 Present GIC version in MADT table */ 314 uint8_t version; 315 uint8_t reserved2[3]; 316 } QEMU_PACKED; 317 318 typedef struct AcpiMadtGenericDistributor AcpiMadtGenericDistributor; 319 320 struct AcpiMadtGenericMsiFrame { 321 ACPI_SUB_HEADER_DEF 322 uint16_t reserved; 323 uint32_t gic_msi_frame_id; 324 uint64_t base_address; 325 uint32_t flags; 326 uint16_t spi_count; 327 uint16_t spi_base; 328 } QEMU_PACKED; 329 330 typedef struct AcpiMadtGenericMsiFrame AcpiMadtGenericMsiFrame; 331 332 struct AcpiMadtGenericRedistributor { 333 ACPI_SUB_HEADER_DEF 334 uint16_t reserved; 335 uint64_t base_address; 336 uint32_t range_length; 337 } QEMU_PACKED; 338 339 typedef struct AcpiMadtGenericRedistributor AcpiMadtGenericRedistributor; 340 341 struct AcpiMadtGenericTranslator { 342 ACPI_SUB_HEADER_DEF 343 uint16_t reserved; 344 uint32_t translation_id; 345 uint64_t base_address; 346 uint32_t reserved2; 347 } QEMU_PACKED; 348 349 typedef struct AcpiMadtGenericTranslator AcpiMadtGenericTranslator; 350 351 /* 352 * Generic Timer Description Table (GTDT) 353 */ 354 #define ACPI_GTDT_INTERRUPT_MODE_LEVEL (0 << 0) 355 #define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0) 356 #define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2) 357 358 struct AcpiGenericTimerTable { 359 ACPI_TABLE_HEADER_DEF 360 uint64_t counter_block_addresss; 361 uint32_t reserved; 362 uint32_t secure_el1_interrupt; 363 uint32_t secure_el1_flags; 364 uint32_t non_secure_el1_interrupt; 365 uint32_t non_secure_el1_flags; 366 uint32_t virtual_timer_interrupt; 367 uint32_t virtual_timer_flags; 368 uint32_t non_secure_el2_interrupt; 369 uint32_t non_secure_el2_flags; 370 uint64_t counter_read_block_address; 371 uint32_t platform_timer_count; 372 uint32_t platform_timer_offset; 373 } QEMU_PACKED; 374 typedef struct AcpiGenericTimerTable AcpiGenericTimerTable; 375 376 /* 377 * HPET Description Table 378 */ 379 struct Acpi20Hpet { 380 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 381 uint32_t timer_block_id; 382 struct AcpiGenericAddress addr; 383 uint8_t hpet_number; 384 uint16_t min_tick; 385 uint8_t page_protect; 386 } QEMU_PACKED; 387 typedef struct Acpi20Hpet Acpi20Hpet; 388 389 /* 390 * SRAT (NUMA topology description) table 391 */ 392 393 struct AcpiSystemResourceAffinityTable { 394 ACPI_TABLE_HEADER_DEF 395 uint32_t reserved1; 396 uint32_t reserved2[2]; 397 } QEMU_PACKED; 398 typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable; 399 400 #define ACPI_SRAT_PROCESSOR_APIC 0 401 #define ACPI_SRAT_MEMORY 1 402 #define ACPI_SRAT_PROCESSOR_x2APIC 2 403 #define ACPI_SRAT_PROCESSOR_GICC 3 404 405 struct AcpiSratProcessorAffinity { 406 ACPI_SUB_HEADER_DEF 407 uint8_t proximity_lo; 408 uint8_t local_apic_id; 409 uint32_t flags; 410 uint8_t local_sapic_eid; 411 uint8_t proximity_hi[3]; 412 uint32_t reserved; 413 } QEMU_PACKED; 414 typedef struct AcpiSratProcessorAffinity AcpiSratProcessorAffinity; 415 416 struct AcpiSratProcessorX2ApicAffinity { 417 ACPI_SUB_HEADER_DEF 418 uint16_t reserved; 419 uint32_t proximity_domain; 420 uint32_t x2apic_id; 421 uint32_t flags; 422 uint32_t clk_domain; 423 uint32_t reserved2; 424 } QEMU_PACKED; 425 typedef struct AcpiSratProcessorX2ApicAffinity AcpiSratProcessorX2ApicAffinity; 426 427 struct AcpiSratMemoryAffinity { 428 ACPI_SUB_HEADER_DEF 429 uint32_t proximity; 430 uint16_t reserved1; 431 uint64_t base_addr; 432 uint64_t range_length; 433 uint32_t reserved2; 434 uint32_t flags; 435 uint32_t reserved3[2]; 436 } QEMU_PACKED; 437 typedef struct AcpiSratMemoryAffinity AcpiSratMemoryAffinity; 438 439 struct AcpiSratProcessorGiccAffinity { 440 ACPI_SUB_HEADER_DEF 441 uint32_t proximity; 442 uint32_t acpi_processor_uid; 443 uint32_t flags; 444 uint32_t clock_domain; 445 } QEMU_PACKED; 446 447 typedef struct AcpiSratProcessorGiccAffinity AcpiSratProcessorGiccAffinity; 448 449 /* PCI fw r3.0 MCFG table. */ 450 /* Subtable */ 451 struct AcpiMcfgAllocation { 452 uint64_t address; /* Base address, processor-relative */ 453 uint16_t pci_segment; /* PCI segment group number */ 454 uint8_t start_bus_number; /* Starting PCI Bus number */ 455 uint8_t end_bus_number; /* Final PCI Bus number */ 456 uint32_t reserved; 457 } QEMU_PACKED; 458 typedef struct AcpiMcfgAllocation AcpiMcfgAllocation; 459 460 struct AcpiTableMcfg { 461 ACPI_TABLE_HEADER_DEF; 462 uint8_t reserved[8]; 463 AcpiMcfgAllocation allocation[0]; 464 } QEMU_PACKED; 465 typedef struct AcpiTableMcfg AcpiTableMcfg; 466 467 /* 468 * TCPA Description Table 469 * 470 * Following Level 00, Rev 00.37 of specs: 471 * http://www.trustedcomputinggroup.org/resources/tcg_acpi_specification 472 */ 473 struct Acpi20Tcpa { 474 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 475 uint16_t platform_class; 476 uint32_t log_area_minimum_length; 477 uint64_t log_area_start_address; 478 } QEMU_PACKED; 479 typedef struct Acpi20Tcpa Acpi20Tcpa; 480 481 /* 482 * TPM2 483 * 484 * Following Version 1.2, Revision 8 of specs: 485 * https://trustedcomputinggroup.org/tcg-acpi-specification/ 486 */ 487 struct Acpi20TPM2 { 488 ACPI_TABLE_HEADER_DEF 489 uint16_t platform_class; 490 uint16_t reserved; 491 uint64_t control_area_address; 492 uint32_t start_method; 493 uint8_t start_method_params[12]; 494 uint32_t log_area_minimum_length; 495 uint64_t log_area_start_address; 496 } QEMU_PACKED; 497 typedef struct Acpi20TPM2 Acpi20TPM2; 498 499 /* DMAR - DMA Remapping table r2.2 */ 500 struct AcpiTableDmar { 501 ACPI_TABLE_HEADER_DEF 502 uint8_t host_address_width; /* Maximum DMA physical addressability */ 503 uint8_t flags; 504 uint8_t reserved[10]; 505 } QEMU_PACKED; 506 typedef struct AcpiTableDmar AcpiTableDmar; 507 508 /* Masks for Flags field above */ 509 #define ACPI_DMAR_INTR_REMAP 1 510 #define ACPI_DMAR_X2APIC_OPT_OUT (1 << 1) 511 512 /* Values for sub-structure type for DMAR */ 513 enum { 514 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, /* DRHD */ 515 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, /* RMRR */ 516 ACPI_DMAR_TYPE_ATSR = 2, /* ATSR */ 517 ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, /* RHSR */ 518 ACPI_DMAR_TYPE_ANDD = 4, /* ANDD */ 519 ACPI_DMAR_TYPE_RESERVED = 5 /* Reserved for furture use */ 520 }; 521 522 /* 523 * Sub-structures for DMAR 524 */ 525 526 /* Device scope structure for DRHD. */ 527 struct AcpiDmarDeviceScope { 528 uint8_t entry_type; 529 uint8_t length; 530 uint16_t reserved; 531 uint8_t enumeration_id; 532 uint8_t bus; 533 struct { 534 uint8_t device; 535 uint8_t function; 536 } path[0]; 537 } QEMU_PACKED; 538 typedef struct AcpiDmarDeviceScope AcpiDmarDeviceScope; 539 540 /* Type 0: Hardware Unit Definition */ 541 struct AcpiDmarHardwareUnit { 542 uint16_t type; 543 uint16_t length; 544 uint8_t flags; 545 uint8_t reserved; 546 uint16_t pci_segment; /* The PCI Segment associated with this unit */ 547 uint64_t address; /* Base address of remapping hardware register-set */ 548 AcpiDmarDeviceScope scope[0]; 549 } QEMU_PACKED; 550 typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit; 551 552 /* Type 2: Root Port ATS Capability Reporting Structure */ 553 struct AcpiDmarRootPortATS { 554 uint16_t type; 555 uint16_t length; 556 uint8_t flags; 557 uint8_t reserved; 558 uint16_t pci_segment; 559 AcpiDmarDeviceScope scope[0]; 560 } QEMU_PACKED; 561 typedef struct AcpiDmarRootPortATS AcpiDmarRootPortATS; 562 563 /* Masks for Flags field above */ 564 #define ACPI_DMAR_INCLUDE_PCI_ALL 1 565 #define ACPI_DMAR_ATSR_ALL_PORTS 1 566 567 /* 568 * Input Output Remapping Table (IORT) 569 * Conforms to "IO Remapping Table System Software on ARM Platforms", 570 * Document number: ARM DEN 0049B, October 2015 571 */ 572 573 struct AcpiIortTable { 574 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 575 uint32_t node_count; 576 uint32_t node_offset; 577 uint32_t reserved; 578 } QEMU_PACKED; 579 typedef struct AcpiIortTable AcpiIortTable; 580 581 /* 582 * IORT node types 583 */ 584 585 #define ACPI_IORT_NODE_HEADER_DEF /* Node format common fields */ \ 586 uint8_t type; \ 587 uint16_t length; \ 588 uint8_t revision; \ 589 uint32_t reserved; \ 590 uint32_t mapping_count; \ 591 uint32_t mapping_offset; 592 593 /* Values for node Type above */ 594 enum { 595 ACPI_IORT_NODE_ITS_GROUP = 0x00, 596 ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, 597 ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, 598 ACPI_IORT_NODE_SMMU = 0x03, 599 ACPI_IORT_NODE_SMMU_V3 = 0x04 600 }; 601 602 struct AcpiIortIdMapping { 603 uint32_t input_base; 604 uint32_t id_count; 605 uint32_t output_base; 606 uint32_t output_reference; 607 uint32_t flags; 608 } QEMU_PACKED; 609 typedef struct AcpiIortIdMapping AcpiIortIdMapping; 610 611 struct AcpiIortMemoryAccess { 612 uint32_t cache_coherency; 613 uint8_t hints; 614 uint16_t reserved; 615 uint8_t memory_flags; 616 } QEMU_PACKED; 617 typedef struct AcpiIortMemoryAccess AcpiIortMemoryAccess; 618 619 struct AcpiIortItsGroup { 620 ACPI_IORT_NODE_HEADER_DEF 621 uint32_t its_count; 622 uint32_t identifiers[0]; 623 } QEMU_PACKED; 624 typedef struct AcpiIortItsGroup AcpiIortItsGroup; 625 626 struct AcpiIortSmmu3 { 627 ACPI_IORT_NODE_HEADER_DEF 628 uint64_t base_address; 629 uint32_t flags; 630 uint32_t reserved2; 631 uint64_t vatos_address; 632 uint32_t model; 633 uint32_t event_gsiv; 634 uint32_t pri_gsiv; 635 uint32_t gerr_gsiv; 636 uint32_t sync_gsiv; 637 AcpiIortIdMapping id_mapping_array[0]; 638 } QEMU_PACKED; 639 typedef struct AcpiIortSmmu3 AcpiIortSmmu3; 640 641 struct AcpiIortRC { 642 ACPI_IORT_NODE_HEADER_DEF 643 AcpiIortMemoryAccess memory_properties; 644 uint32_t ats_attribute; 645 uint32_t pci_segment_number; 646 AcpiIortIdMapping id_mapping_array[0]; 647 } QEMU_PACKED; 648 typedef struct AcpiIortRC AcpiIortRC; 649 650 #endif 651