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