xref: /openbmc/qemu/include/hw/acpi/acpi-defs.h (revision 354908ce)
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] QEMU_NONSTRING; /* 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] \
61                  QEMU_NONSTRING;     /* OEM identification */ \
62     uint8_t  oem_table_id[8] \
63                  QEMU_NONSTRING;     /* OEM table identification */ \
64     uint32_t oem_revision;           /* OEM revision number */ \
65     uint8_t  asl_compiler_id[4] \
66                  QEMU_NONSTRING;     /* ASL compiler vendor ID */ \
67     uint32_t asl_compiler_revision;  /* ASL compiler revision number */
68 
69 
70 /* ACPI common table header */
71 struct AcpiTableHeader {
72     ACPI_TABLE_HEADER_DEF
73 } QEMU_PACKED;
74 typedef struct AcpiTableHeader AcpiTableHeader;
75 
76 struct AcpiGenericAddress {
77     uint8_t space_id;        /* Address space where struct or register exists */
78     uint8_t bit_width;       /* Size in bits of given register */
79     uint8_t bit_offset;      /* Bit offset within the register */
80     uint8_t access_width;    /* ACPI 3.0: Minimum Access size (ACPI 3.0),
81                                 ACPI 2.0: Reserved, Table 5-1 */
82     uint64_t address;        /* 64-bit address of struct or register */
83 } QEMU_PACKED;
84 
85 typedef struct AcpiFadtData {
86     struct AcpiGenericAddress pm1a_cnt;   /* PM1a_CNT_BLK */
87     struct AcpiGenericAddress pm1a_evt;   /* PM1a_EVT_BLK */
88     struct AcpiGenericAddress pm_tmr;    /* PM_TMR_BLK */
89     struct AcpiGenericAddress gpe0_blk;  /* GPE0_BLK */
90     struct AcpiGenericAddress reset_reg; /* RESET_REG */
91     struct AcpiGenericAddress sleep_ctl; /* SLEEP_CONTROL_REG */
92     struct AcpiGenericAddress sleep_sts; /* SLEEP_STATUS_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[];  /* 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[];  /* 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 /*
455  * TCPA Description Table
456  *
457  * Following Level 00, Rev 00.37 of specs:
458  * http://www.trustedcomputinggroup.org/resources/tcg_acpi_specification
459  */
460 struct Acpi20Tcpa {
461     ACPI_TABLE_HEADER_DEF                    /* ACPI common table header */
462     uint16_t platform_class;
463     uint32_t log_area_minimum_length;
464     uint64_t log_area_start_address;
465 } QEMU_PACKED;
466 typedef struct Acpi20Tcpa Acpi20Tcpa;
467 
468 /*
469  * TPM2
470  *
471  * Following Version 1.2, Revision 8 of specs:
472  * https://trustedcomputinggroup.org/tcg-acpi-specification/
473  */
474 struct Acpi20TPM2 {
475     ACPI_TABLE_HEADER_DEF
476     uint16_t platform_class;
477     uint16_t reserved;
478     uint64_t control_area_address;
479     uint32_t start_method;
480     uint8_t start_method_params[12];
481     uint32_t log_area_minimum_length;
482     uint64_t log_area_start_address;
483 } QEMU_PACKED;
484 typedef struct Acpi20TPM2 Acpi20TPM2;
485 
486 /* DMAR - DMA Remapping table r2.2 */
487 struct AcpiTableDmar {
488     ACPI_TABLE_HEADER_DEF
489     uint8_t host_address_width; /* Maximum DMA physical addressability */
490     uint8_t flags;
491     uint8_t reserved[10];
492 } QEMU_PACKED;
493 typedef struct AcpiTableDmar AcpiTableDmar;
494 
495 /* Masks for Flags field above */
496 #define ACPI_DMAR_INTR_REMAP        1
497 #define ACPI_DMAR_X2APIC_OPT_OUT    (1 << 1)
498 
499 /* Values for sub-structure type for DMAR */
500 enum {
501     ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,       /* DRHD */
502     ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,     /* RMRR */
503     ACPI_DMAR_TYPE_ATSR = 2,                /* ATSR */
504     ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3,   /* RHSR */
505     ACPI_DMAR_TYPE_ANDD = 4,                /* ANDD */
506     ACPI_DMAR_TYPE_RESERVED = 5             /* Reserved for furture use */
507 };
508 
509 /*
510  * Sub-structures for DMAR
511  */
512 
513 /* Device scope structure for DRHD. */
514 struct AcpiDmarDeviceScope {
515     uint8_t entry_type;
516     uint8_t length;
517     uint16_t reserved;
518     uint8_t enumeration_id;
519     uint8_t bus;
520     struct {
521         uint8_t device;
522         uint8_t function;
523     } path[];
524 } QEMU_PACKED;
525 typedef struct AcpiDmarDeviceScope AcpiDmarDeviceScope;
526 
527 /* Type 0: Hardware Unit Definition */
528 struct AcpiDmarHardwareUnit {
529     uint16_t type;
530     uint16_t length;
531     uint8_t flags;
532     uint8_t reserved;
533     uint16_t pci_segment;   /* The PCI Segment associated with this unit */
534     uint64_t address;   /* Base address of remapping hardware register-set */
535     AcpiDmarDeviceScope scope[];
536 } QEMU_PACKED;
537 typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit;
538 
539 /* Type 2: Root Port ATS Capability Reporting Structure */
540 struct AcpiDmarRootPortATS {
541     uint16_t type;
542     uint16_t length;
543     uint8_t flags;
544     uint8_t reserved;
545     uint16_t pci_segment;
546     AcpiDmarDeviceScope scope[];
547 } QEMU_PACKED;
548 typedef struct AcpiDmarRootPortATS AcpiDmarRootPortATS;
549 
550 /* Masks for Flags field above */
551 #define ACPI_DMAR_INCLUDE_PCI_ALL   1
552 #define ACPI_DMAR_ATSR_ALL_PORTS    1
553 
554 /*
555  * Input Output Remapping Table (IORT)
556  * Conforms to "IO Remapping Table System Software on ARM Platforms",
557  * Document number: ARM DEN 0049B, October 2015
558  */
559 
560 struct AcpiIortTable {
561     ACPI_TABLE_HEADER_DEF     /* ACPI common table header */
562     uint32_t node_count;
563     uint32_t node_offset;
564     uint32_t reserved;
565 } QEMU_PACKED;
566 typedef struct AcpiIortTable AcpiIortTable;
567 
568 /*
569  * IORT node types
570  */
571 
572 #define ACPI_IORT_NODE_HEADER_DEF   /* Node format common fields */ \
573     uint8_t  type;          \
574     uint16_t length;        \
575     uint8_t  revision;      \
576     uint32_t reserved;      \
577     uint32_t mapping_count; \
578     uint32_t mapping_offset;
579 
580 /* Values for node Type above */
581 enum {
582         ACPI_IORT_NODE_ITS_GROUP = 0x00,
583         ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
584         ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
585         ACPI_IORT_NODE_SMMU = 0x03,
586         ACPI_IORT_NODE_SMMU_V3 = 0x04
587 };
588 
589 struct AcpiIortIdMapping {
590     uint32_t input_base;
591     uint32_t id_count;
592     uint32_t output_base;
593     uint32_t output_reference;
594     uint32_t flags;
595 } QEMU_PACKED;
596 typedef struct AcpiIortIdMapping AcpiIortIdMapping;
597 
598 struct AcpiIortMemoryAccess {
599     uint32_t cache_coherency;
600     uint8_t  hints;
601     uint16_t reserved;
602     uint8_t  memory_flags;
603 } QEMU_PACKED;
604 typedef struct AcpiIortMemoryAccess AcpiIortMemoryAccess;
605 
606 struct AcpiIortItsGroup {
607     ACPI_IORT_NODE_HEADER_DEF
608     uint32_t its_count;
609     uint32_t identifiers[];
610 } QEMU_PACKED;
611 typedef struct AcpiIortItsGroup AcpiIortItsGroup;
612 
613 #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE 1
614 
615 struct AcpiIortSmmu3 {
616     ACPI_IORT_NODE_HEADER_DEF
617     uint64_t base_address;
618     uint32_t flags;
619     uint32_t reserved2;
620     uint64_t vatos_address;
621     uint32_t model;
622     uint32_t event_gsiv;
623     uint32_t pri_gsiv;
624     uint32_t gerr_gsiv;
625     uint32_t sync_gsiv;
626     AcpiIortIdMapping id_mapping_array[];
627 } QEMU_PACKED;
628 typedef struct AcpiIortSmmu3 AcpiIortSmmu3;
629 
630 struct AcpiIortRC {
631     ACPI_IORT_NODE_HEADER_DEF
632     AcpiIortMemoryAccess memory_properties;
633     uint32_t ats_attribute;
634     uint32_t pci_segment_number;
635     AcpiIortIdMapping id_mapping_array[];
636 } QEMU_PACKED;
637 typedef struct AcpiIortRC AcpiIortRC;
638 
639 #endif
640