1 /******************************************************************************
2  *
3  * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #ifndef __ACTBL2_H__
153 #define __ACTBL2_H__
154 
155 
156 /*******************************************************************************
157  *
158  * Additional ACPI Tables (2)
159  *
160  * These tables are not consumed directly by the ACPICA subsystem, but are
161  * included here to support device drivers and the AML disassembler.
162  *
163  ******************************************************************************/
164 
165 
166 /*
167  * Values for description table header signatures for tables defined in this
168  * file. Useful because they make it more difficult to inadvertently type in
169  * the wrong signature.
170  */
171 #define ACPI_SIG_AGDI           "AGDI"      /* Arm Generic Diagnostic Dump and Reset Device Interface */
172 #define ACPI_SIG_BDAT           "BDAT"      /* BIOS Data ACPI Table */
173 #define ACPI_SIG_IORT           "IORT"      /* IO Remapping Table */
174 #define ACPI_SIG_IVRS           "IVRS"      /* I/O Virtualization Reporting Structure */
175 #define ACPI_SIG_LPIT           "LPIT"      /* Low Power Idle Table */
176 #define ACPI_SIG_MADT           "APIC"      /* Multiple APIC Description Table */
177 #define ACPI_SIG_MCFG           "MCFG"      /* PCI Memory Mapped Configuration table */
178 #define ACPI_SIG_MCHI           "MCHI"      /* Management Controller Host Interface table */
179 #define ACPI_SIG_MPST           "MPST"      /* Memory Power State Table */
180 #define ACPI_SIG_MSCT           "MSCT"      /* Maximum System Characteristics Table */
181 #define ACPI_SIG_MSDM           "MSDM"      /* Microsoft Data Management Table */
182 #define ACPI_SIG_NFIT           "NFIT"      /* NVDIMM Firmware Interface Table */
183 #define ACPI_SIG_NHLT           "NHLT"      /* Non HD Audio Link Table */
184 #define ACPI_SIG_PCCT           "PCCT"      /* Platform Communications Channel Table */
185 #define ACPI_SIG_PDTT           "PDTT"      /* Platform Debug Trigger Table */
186 #define ACPI_SIG_PHAT           "PHAT"      /* Platform Health Assessment Table */
187 #define ACPI_SIG_PMTT           "PMTT"      /* Platform Memory Topology Table */
188 #define ACPI_SIG_PPTT           "PPTT"      /* Processor Properties Topology Table */
189 #define ACPI_SIG_PRMT           "PRMT"      /* Platform Runtime Mechanism Table */
190 #define ACPI_SIG_RASF           "RASF"      /* RAS Feature table */
191 #define ACPI_SIG_RGRT           "RGRT"      /* Regulatory Graphics Resource Table */
192 #define ACPI_SIG_SBST           "SBST"      /* Smart Battery Specification Table */
193 #define ACPI_SIG_SDEI           "SDEI"      /* Software Delegated Exception Interface Table */
194 #define ACPI_SIG_SDEV           "SDEV"      /* Secure Devices table */
195 #define ACPI_SIG_SVKL           "SVKL"      /* Storage Volume Key Location Table */
196 #define ACPI_SIG_TDEL           "TDEL"      /* TD Event Log Table */
197 
198 
199 /*
200  * All tables must be byte-packed to match the ACPI specification, since
201  * the tables are provided by the system BIOS.
202  */
203 #pragma pack(1)
204 
205 /*
206  * Note: C bitfields are not used for this reason:
207  *
208  * "Bitfields are great and easy to read, but unfortunately the C language
209  * does not specify the layout of bitfields in memory, which means they are
210  * essentially useless for dealing with packed data in on-disk formats or
211  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
212  * this decision was a design error in C. Ritchie could have picked an order
213  * and stuck with it." Norman Ramsey.
214  * See http://stackoverflow.com/a/1053662/41661
215  */
216 
217 
218 /*******************************************************************************
219  *
220  * AEST - Arm Error Source Table
221  *
222  * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
223  * September 2020.
224  *
225  ******************************************************************************/
226 
227 typedef struct acpi_table_aest
228 {
229     ACPI_TABLE_HEADER       Header;
230     void                    *NodeArray[];
231 
232 } ACPI_TABLE_AEST;
233 
234 /* Common Subtable header - one per Node Structure (Subtable) */
235 
236 typedef struct              acpi_aest_hdr
237 {
238     UINT8                   Type;
239     UINT16                  Length;
240     UINT8                   Reserved;
241     UINT32                  NodeSpecificOffset;
242     UINT32                  NodeInterfaceOffset;
243     UINT32                  NodeInterruptOffset;
244     UINT32                  NodeInterruptCount;
245     UINT64                  TimestampRate;
246     UINT64                  Reserved1;
247     UINT64                  ErrorInjectionRate;
248 
249 } ACPI_AEST_HEADER;
250 
251 /* Values for Type above */
252 
253 #define ACPI_AEST_PROCESSOR_ERROR_NODE      0
254 #define ACPI_AEST_MEMORY_ERROR_NODE         1
255 #define ACPI_AEST_SMMU_ERROR_NODE           2
256 #define ACPI_AEST_VENDOR_ERROR_NODE         3
257 #define ACPI_AEST_GIC_ERROR_NODE            4
258 #define ACPI_AEST_NODE_TYPE_RESERVED        5 /* 5 and above are reserved */
259 
260 
261 /*
262  * AEST subtables (Error nodes)
263  */
264 
265 /* 0: Processor Error */
266 
267 typedef struct              acpi_aest_processor
268 {
269     UINT32                  ProcessorId;
270     UINT8                   ResourceType;
271     UINT8                   Reserved;
272     UINT8                   Flags;
273     UINT8                   Revision;
274     UINT64                  ProcessorAffinity;
275 
276 } ACPI_AEST_PROCESSOR;
277 
278 /* Values for ResourceType above, related structs below */
279 
280 #define ACPI_AEST_CACHE_RESOURCE            0
281 #define ACPI_AEST_TLB_RESOURCE              1
282 #define ACPI_AEST_GENERIC_RESOURCE          2
283 #define ACPI_AEST_RESOURCE_RESERVED         3   /* 3 and above are reserved */
284 
285 /* 0R: Processor Cache Resource Substructure */
286 
287 typedef struct              acpi_aest_processor_cache
288 {
289     UINT32                  CacheReference;
290     UINT32                  Reserved;
291 
292 } ACPI_AEST_PROCESSOR_CACHE;
293 
294 /* Values for CacheType above */
295 
296 #define ACPI_AEST_CACHE_DATA                0
297 #define ACPI_AEST_CACHE_INSTRUCTION         1
298 #define ACPI_AEST_CACHE_UNIFIED             2
299 #define ACPI_AEST_CACHE_RESERVED            3   /* 3 and above are reserved */
300 
301 /* 1R: Processor TLB Resource Substructure */
302 
303 typedef struct              acpi_aest_processor_tlb
304 {
305     UINT32                  TlbLevel;
306     UINT32                  Reserved;
307 
308 } ACPI_AEST_PROCESSOR_TLB;
309 
310 /* 2R: Processor Generic Resource Substructure */
311 
312 typedef struct              acpi_aest_processor_generic
313 {
314     UINT32                   Resource;
315 
316 } ACPI_AEST_PROCESSOR_GENERIC;
317 
318 /* 1: Memory Error */
319 
320 typedef struct              acpi_aest_memory
321 {
322     UINT32                  SratProximityDomain;
323 
324 } ACPI_AEST_MEMORY;
325 
326 /* 2: Smmu Error */
327 
328 typedef struct              acpi_aest_smmu
329 {
330     UINT32                  IortNodeReference;
331     UINT32                  SubcomponentReference;
332 
333 } ACPI_AEST_SMMU;
334 
335 /* 3: Vendor Defined */
336 
337 typedef struct              acpi_aest_vendor
338 {
339     UINT32                  AcpiHid;
340     UINT32                  AcpiUid;
341     UINT8                   VendorSpecificData[16];
342 
343 } ACPI_AEST_VENDOR;
344 
345 /* 4: Gic Error */
346 
347 typedef struct              acpi_aest_gic
348 {
349     UINT32                  InterfaceType;
350     UINT32                  InstanceId;
351 
352 } ACPI_AEST_GIC;
353 
354 /* Values for InterfaceType above */
355 
356 #define ACPI_AEST_GIC_CPU                   0
357 #define ACPI_AEST_GIC_DISTRIBUTOR           1
358 #define ACPI_AEST_GIC_REDISTRIBUTOR         2
359 #define ACPI_AEST_GIC_ITS                   3
360 #define ACPI_AEST_GIC_RESERVED              4   /* 4 and above are reserved */
361 
362 
363 /* Node Interface Structure */
364 
365 typedef struct              acpi_aest_node_interface
366 {
367     UINT8                   Type;
368     UINT8                   Reserved[3];
369     UINT32                  Flags;
370     UINT64                  Address;
371     UINT32                  ErrorRecordIndex;
372     UINT32                  ErrorRecordCount;
373     UINT64                  ErrorRecordImplemented;
374     UINT64                  ErrorStatusReporting;
375     UINT64                  AddressingMode;
376 
377 } ACPI_AEST_NODE_INTERFACE;
378 
379 /* Values for Type field above */
380 
381 #define ACPI_AEST_NODE_SYSTEM_REGISTER      0
382 #define ACPI_AEST_NODE_MEMORY_MAPPED        1
383 #define ACPI_AEST_XFACE_RESERVED            2   /* 2 and above are reserved */
384 
385 /* Node Interrupt Structure */
386 
387 typedef struct              acpi_aest_node_interrupt
388 {
389     UINT8                   Type;
390     UINT8                   Reserved[2];
391     UINT8                   Flags;
392     UINT32                  Gsiv;
393     UINT8                   IortId;
394     UINT8                   Reserved1[3];
395 
396 } ACPI_AEST_NODE_INTERRUPT;
397 
398 /* Values for Type field above */
399 
400 #define ACPI_AEST_NODE_FAULT_HANDLING       0
401 #define ACPI_AEST_NODE_ERROR_RECOVERY       1
402 #define ACPI_AEST_XRUPT_RESERVED            2   /* 2 and above are reserved */
403 
404 
405 /*******************************************************************************
406  * AGDI - Arm Generic Diagnostic Dump and Reset Device Interface
407  *
408  * Conforms to "ACPI for Arm Components 1.1, Platform Design Document"
409  * ARM DEN0093 v1.1
410  *
411  ******************************************************************************/
412 typedef struct acpi_table_agdi
413 {
414     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
415     UINT8                   Flags;
416     UINT8                   Reserved[3];
417     UINT32                  SdeiEvent;
418     UINT32                  Gsiv;
419 
420 } ACPI_TABLE_AGDI;
421 
422 /* Mask for Flags field above */
423 
424 #define ACPI_AGDI_SIGNALING_MODE (1)
425 
426 
427 /*******************************************************************************
428  *
429  * BDAT - BIOS Data ACPI Table
430  *
431  * Conforms to "BIOS Data ACPI Table", Interface Specification v4.0 Draft 5
432  * Nov 2020
433  *
434  ******************************************************************************/
435 
436 typedef struct acpi_table_bdat
437 {
438     ACPI_TABLE_HEADER       Header;
439     ACPI_GENERIC_ADDRESS    Gas;
440 
441 } ACPI_TABLE_BDAT;
442 
443 
444 /*******************************************************************************
445  *
446  * IORT - IO Remapping Table
447  *
448  * Conforms to "IO Remapping Table System Software on ARM Platforms",
449  * Document number: ARM DEN 0049E.b, Feb 2021
450  *
451  ******************************************************************************/
452 
453 typedef struct acpi_table_iort
454 {
455     ACPI_TABLE_HEADER       Header;
456     UINT32                  NodeCount;
457     UINT32                  NodeOffset;
458     UINT32                  Reserved;
459 
460 } ACPI_TABLE_IORT;
461 
462 
463 /*
464  * IORT subtables
465  */
466 typedef struct acpi_iort_node
467 {
468     UINT8                   Type;
469     UINT16                  Length;
470     UINT8                   Revision;
471     UINT32                  Identifier;
472     UINT32                  MappingCount;
473     UINT32                  MappingOffset;
474     char                    NodeData[1];
475 
476 } ACPI_IORT_NODE;
477 
478 /* Values for subtable Type above */
479 
480 enum AcpiIortNodeType
481 {
482     ACPI_IORT_NODE_ITS_GROUP            = 0x00,
483     ACPI_IORT_NODE_NAMED_COMPONENT      = 0x01,
484     ACPI_IORT_NODE_PCI_ROOT_COMPLEX     = 0x02,
485     ACPI_IORT_NODE_SMMU                 = 0x03,
486     ACPI_IORT_NODE_SMMU_V3              = 0x04,
487     ACPI_IORT_NODE_PMCG                 = 0x05,
488     ACPI_IORT_NODE_RMR                  = 0x06,
489 };
490 
491 
492 typedef struct acpi_iort_id_mapping
493 {
494     UINT32                  InputBase;          /* Lowest value in input range */
495     UINT32                  IdCount;            /* Number of IDs */
496     UINT32                  OutputBase;         /* Lowest value in output range */
497     UINT32                  OutputReference;    /* A reference to the output node */
498     UINT32                  Flags;
499 
500 } ACPI_IORT_ID_MAPPING;
501 
502 /* Masks for Flags field above for IORT subtable */
503 
504 #define ACPI_IORT_ID_SINGLE_MAPPING (1)
505 
506 
507 typedef struct acpi_iort_memory_access
508 {
509     UINT32                  CacheCoherency;
510     UINT8                   Hints;
511     UINT16                  Reserved;
512     UINT8                   MemoryFlags;
513 
514 } ACPI_IORT_MEMORY_ACCESS;
515 
516 /* Values for CacheCoherency field above */
517 
518 #define ACPI_IORT_NODE_COHERENT         0x00000001  /* The device node is fully coherent */
519 #define ACPI_IORT_NODE_NOT_COHERENT     0x00000000  /* The device node is not coherent */
520 
521 /* Masks for Hints field above */
522 
523 #define ACPI_IORT_HT_TRANSIENT          (1)
524 #define ACPI_IORT_HT_WRITE              (1<<1)
525 #define ACPI_IORT_HT_READ               (1<<2)
526 #define ACPI_IORT_HT_OVERRIDE           (1<<3)
527 
528 /* Masks for MemoryFlags field above */
529 
530 #define ACPI_IORT_MF_COHERENCY          (1)
531 #define ACPI_IORT_MF_ATTRIBUTES         (1<<1)
532 
533 
534 /*
535  * IORT node specific subtables
536  */
537 typedef struct acpi_iort_its_group
538 {
539     UINT32                  ItsCount;
540     UINT32                  Identifiers[1];         /* GIC ITS identifier array */
541 
542 } ACPI_IORT_ITS_GROUP;
543 
544 
545 typedef struct acpi_iort_named_component
546 {
547     UINT32                  NodeFlags;
548     UINT64                  MemoryProperties;       /* Memory access properties */
549     UINT8                   MemoryAddressLimit;     /* Memory address size limit */
550     char                    DeviceName[1];          /* Path of namespace object */
551 
552 } ACPI_IORT_NAMED_COMPONENT;
553 
554 /* Masks for Flags field above */
555 
556 #define ACPI_IORT_NC_STALL_SUPPORTED    (1)
557 #define ACPI_IORT_NC_PASID_BITS         (31<<1)
558 
559 typedef struct acpi_iort_root_complex
560 {
561     UINT64                  MemoryProperties;       /* Memory access properties */
562     UINT32                  AtsAttribute;
563     UINT32                  PciSegmentNumber;
564     UINT8                   MemoryAddressLimit;     /* Memory address size limit */
565     UINT8                   Reserved[3];            /* Reserved, must be zero */
566 
567 } ACPI_IORT_ROOT_COMPLEX;
568 
569 /* Masks for AtsAttribute field above */
570 
571 #define ACPI_IORT_ATS_SUPPORTED         (1)     /* The root complex ATS support */
572 #define ACPI_IORT_PRI_SUPPORTED         (1<<1)  /* The root complex PRI support */
573 #define ACPI_IORT_PASID_FWD_SUPPORTED   (1<<2)  /* The root complex PASID forward support */
574 
575 
576 typedef struct acpi_iort_smmu
577 {
578     UINT64                  BaseAddress;            /* SMMU base address */
579     UINT64                  Span;                   /* Length of memory range */
580     UINT32                  Model;
581     UINT32                  Flags;
582     UINT32                  GlobalInterruptOffset;
583     UINT32                  ContextInterruptCount;
584     UINT32                  ContextInterruptOffset;
585     UINT32                  PmuInterruptCount;
586     UINT32                  PmuInterruptOffset;
587     UINT64                  Interrupts[1];          /* Interrupt array */
588 
589 } ACPI_IORT_SMMU;
590 
591 /* Values for Model field above */
592 
593 #define ACPI_IORT_SMMU_V1               0x00000000  /* Generic SMMUv1 */
594 #define ACPI_IORT_SMMU_V2               0x00000001  /* Generic SMMUv2 */
595 #define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002  /* ARM Corelink MMU-400 */
596 #define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003  /* ARM Corelink MMU-500 */
597 #define ACPI_IORT_SMMU_CORELINK_MMU401  0x00000004  /* ARM Corelink MMU-401 */
598 #define ACPI_IORT_SMMU_CAVIUM_THUNDERX  0x00000005  /* Cavium ThunderX SMMUv2 */
599 
600 /* Masks for Flags field above */
601 
602 #define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
603 #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
604 
605 /* Global interrupt format */
606 
607 typedef struct acpi_iort_smmu_gsi
608 {
609     UINT32                  NSgIrpt;
610     UINT32                  NSgIrptFlags;
611     UINT32                  NSgCfgIrpt;
612     UINT32                  NSgCfgIrptFlags;
613 
614 } ACPI_IORT_SMMU_GSI;
615 
616 
617 typedef struct acpi_iort_smmu_v3
618 {
619     UINT64                  BaseAddress;            /* SMMUv3 base address */
620     UINT32                  Flags;
621     UINT32                  Reserved;
622     UINT64                  VatosAddress;
623     UINT32                  Model;
624     UINT32                  EventGsiv;
625     UINT32                  PriGsiv;
626     UINT32                  GerrGsiv;
627     UINT32                  SyncGsiv;
628     UINT32                  Pxm;
629     UINT32                  IdMappingIndex;
630 
631 } ACPI_IORT_SMMU_V3;
632 
633 /* Values for Model field above */
634 
635 #define ACPI_IORT_SMMU_V3_GENERIC           0x00000000  /* Generic SMMUv3 */
636 #define ACPI_IORT_SMMU_V3_HISILICON_HI161X  0x00000001  /* HiSilicon Hi161x SMMUv3 */
637 #define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX     0x00000002  /* Cavium CN99xx SMMUv3 */
638 
639 /* Masks for Flags field above */
640 
641 #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
642 #define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE     (3<<1)
643 #define ACPI_IORT_SMMU_V3_PXM_VALID         (1<<3)
644 
645 typedef struct acpi_iort_pmcg
646 {
647     UINT64                  Page0BaseAddress;
648     UINT32                  OverflowGsiv;
649     UINT32                  NodeReference;
650     UINT64                  Page1BaseAddress;
651 
652 } ACPI_IORT_PMCG;
653 
654 typedef struct acpi_iort_rmr {
655     UINT32 Flags;
656     UINT32 RmrCount;
657     UINT32 RmrOffset;
658 
659 } ACPI_IORT_RMR;
660 
661 typedef struct acpi_iort_rmr_desc {
662     UINT64 BaseAddress;
663     UINT64 Length;
664     UINT32 Reserved;
665 
666 } ACPI_IORT_RMR_DESC;
667 
668 /*******************************************************************************
669  *
670  * IVRS - I/O Virtualization Reporting Structure
671  *        Version 1
672  *
673  * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
674  * Revision 1.26, February 2009.
675  *
676  ******************************************************************************/
677 
678 typedef struct acpi_table_ivrs
679 {
680     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
681     UINT32                  Info;               /* Common virtualization info */
682     UINT64                  Reserved;
683 
684 } ACPI_TABLE_IVRS;
685 
686 /* Values for Info field above */
687 
688 #define ACPI_IVRS_PHYSICAL_SIZE     0x00007F00  /* 7 bits, physical address size */
689 #define ACPI_IVRS_VIRTUAL_SIZE      0x003F8000  /* 7 bits, virtual address size */
690 #define ACPI_IVRS_ATS_RESERVED      0x00400000  /* ATS address translation range reserved */
691 
692 
693 /* IVRS subtable header */
694 
695 typedef struct acpi_ivrs_header
696 {
697     UINT8                   Type;               /* Subtable type */
698     UINT8                   Flags;
699     UINT16                  Length;             /* Subtable length */
700     UINT16                  DeviceId;           /* ID of IOMMU */
701 
702 } ACPI_IVRS_HEADER;
703 
704 /* Values for subtable Type above */
705 
706 enum AcpiIvrsType
707 {
708     ACPI_IVRS_TYPE_HARDWARE1        = 0x10,
709     ACPI_IVRS_TYPE_HARDWARE2        = 0x11,
710     ACPI_IVRS_TYPE_HARDWARE3        = 0x40,
711     ACPI_IVRS_TYPE_MEMORY1          = 0x20,
712     ACPI_IVRS_TYPE_MEMORY2          = 0x21,
713     ACPI_IVRS_TYPE_MEMORY3          = 0x22
714 };
715 
716 /* Masks for Flags field above for IVHD subtable */
717 
718 #define ACPI_IVHD_TT_ENABLE         (1)
719 #define ACPI_IVHD_PASS_PW           (1<<1)
720 #define ACPI_IVHD_RES_PASS_PW       (1<<2)
721 #define ACPI_IVHD_ISOC              (1<<3)
722 #define ACPI_IVHD_IOTLB             (1<<4)
723 
724 /* Masks for Flags field above for IVMD subtable */
725 
726 #define ACPI_IVMD_UNITY             (1)
727 #define ACPI_IVMD_READ              (1<<1)
728 #define ACPI_IVMD_WRITE             (1<<2)
729 #define ACPI_IVMD_EXCLUSION_RANGE   (1<<3)
730 
731 
732 /*
733  * IVRS subtables, correspond to Type in ACPI_IVRS_HEADER
734  */
735 
736 /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
737 
738 typedef struct acpi_ivrs_hardware_10
739 {
740     ACPI_IVRS_HEADER        Header;
741     UINT16                  CapabilityOffset;   /* Offset for IOMMU control fields */
742     UINT64                  BaseAddress;        /* IOMMU control registers */
743     UINT16                  PciSegmentGroup;
744     UINT16                  Info;               /* MSI number and unit ID */
745     UINT32                  FeatureReporting;
746 
747 } ACPI_IVRS_HARDWARE1;
748 
749 /* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */
750 
751 typedef struct acpi_ivrs_hardware_11
752 {
753     ACPI_IVRS_HEADER        Header;
754     UINT16                  CapabilityOffset;   /* Offset for IOMMU control fields */
755     UINT64                  BaseAddress;        /* IOMMU control registers */
756     UINT16                  PciSegmentGroup;
757     UINT16                  Info;               /* MSI number and unit ID */
758     UINT32                  Attributes;
759     UINT64                  EfrRegisterImage;
760     UINT64                  Reserved;
761 } ACPI_IVRS_HARDWARE2;
762 
763 /* Masks for Info field above */
764 
765 #define ACPI_IVHD_MSI_NUMBER_MASK   0x001F      /* 5 bits, MSI message number */
766 #define ACPI_IVHD_UNIT_ID_MASK      0x1F00      /* 5 bits, UnitID */
767 
768 
769 /*
770  * Device Entries for IVHD subtable, appear after ACPI_IVRS_HARDWARE structure.
771  * Upper two bits of the Type field are the (encoded) length of the structure.
772  * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
773  * are reserved for future use but not defined.
774  */
775 typedef struct acpi_ivrs_de_header
776 {
777     UINT8                   Type;
778     UINT16                  Id;
779     UINT8                   DataSetting;
780 
781 } ACPI_IVRS_DE_HEADER;
782 
783 /* Length of device entry is in the top two bits of Type field above */
784 
785 #define ACPI_IVHD_ENTRY_LENGTH      0xC0
786 
787 /* Values for device entry Type field above */
788 
789 enum AcpiIvrsDeviceEntryType
790 {
791     /* 4-byte device entries, all use ACPI_IVRS_DEVICE4 */
792 
793     ACPI_IVRS_TYPE_PAD4             = 0,
794     ACPI_IVRS_TYPE_ALL              = 1,
795     ACPI_IVRS_TYPE_SELECT           = 2,
796     ACPI_IVRS_TYPE_START            = 3,
797     ACPI_IVRS_TYPE_END              = 4,
798 
799     /* 8-byte device entries */
800 
801     ACPI_IVRS_TYPE_PAD8             = 64,
802     ACPI_IVRS_TYPE_NOT_USED         = 65,
803     ACPI_IVRS_TYPE_ALIAS_SELECT     = 66, /* Uses ACPI_IVRS_DEVICE8A */
804     ACPI_IVRS_TYPE_ALIAS_START      = 67, /* Uses ACPI_IVRS_DEVICE8A */
805     ACPI_IVRS_TYPE_EXT_SELECT       = 70, /* Uses ACPI_IVRS_DEVICE8B */
806     ACPI_IVRS_TYPE_EXT_START        = 71, /* Uses ACPI_IVRS_DEVICE8B */
807     ACPI_IVRS_TYPE_SPECIAL          = 72, /* Uses ACPI_IVRS_DEVICE8C */
808 
809     /* Variable-length device entries */
810 
811     ACPI_IVRS_TYPE_HID              = 240 /* Uses ACPI_IVRS_DEVICE_HID */
812 };
813 
814 /* Values for Data field above */
815 
816 #define ACPI_IVHD_INIT_PASS         (1)
817 #define ACPI_IVHD_EINT_PASS         (1<<1)
818 #define ACPI_IVHD_NMI_PASS          (1<<2)
819 #define ACPI_IVHD_SYSTEM_MGMT       (3<<4)
820 #define ACPI_IVHD_LINT0_PASS        (1<<6)
821 #define ACPI_IVHD_LINT1_PASS        (1<<7)
822 
823 
824 /* Types 0-4: 4-byte device entry */
825 
826 typedef struct acpi_ivrs_device4
827 {
828     ACPI_IVRS_DE_HEADER     Header;
829 
830 } ACPI_IVRS_DEVICE4;
831 
832 /* Types 66-67: 8-byte device entry */
833 
834 typedef struct acpi_ivrs_device8a
835 {
836     ACPI_IVRS_DE_HEADER     Header;
837     UINT8                   Reserved1;
838     UINT16                  UsedId;
839     UINT8                   Reserved2;
840 
841 } ACPI_IVRS_DEVICE8A;
842 
843 /* Types 70-71: 8-byte device entry */
844 
845 typedef struct acpi_ivrs_device8b
846 {
847     ACPI_IVRS_DE_HEADER     Header;
848     UINT32                  ExtendedData;
849 
850 } ACPI_IVRS_DEVICE8B;
851 
852 /* Values for ExtendedData above */
853 
854 #define ACPI_IVHD_ATS_DISABLED      (1<<31)
855 
856 /* Type 72: 8-byte device entry */
857 
858 typedef struct acpi_ivrs_device8c
859 {
860     ACPI_IVRS_DE_HEADER     Header;
861     UINT8                   Handle;
862     UINT16                  UsedId;
863     UINT8                   Variety;
864 
865 } ACPI_IVRS_DEVICE8C;
866 
867 /* Values for Variety field above */
868 
869 #define ACPI_IVHD_IOAPIC            1
870 #define ACPI_IVHD_HPET              2
871 
872 /* Type 240: variable-length device entry */
873 
874 typedef struct acpi_ivrs_device_hid
875 {
876     ACPI_IVRS_DE_HEADER     Header;
877     UINT64                  AcpiHid;
878     UINT64                  AcpiCid;
879     UINT8                   UidType;
880     UINT8                   UidLength;
881 
882 } ACPI_IVRS_DEVICE_HID;
883 
884 /* Values for UidType above */
885 
886 #define ACPI_IVRS_UID_NOT_PRESENT   0
887 #define ACPI_IVRS_UID_IS_INTEGER    1
888 #define ACPI_IVRS_UID_IS_STRING     2
889 
890 /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
891 
892 typedef struct acpi_ivrs_memory
893 {
894     ACPI_IVRS_HEADER        Header;
895     UINT16                  AuxData;
896     UINT64                  Reserved;
897     UINT64                  StartAddress;
898     UINT64                  MemoryLength;
899 
900 } ACPI_IVRS_MEMORY;
901 
902 
903 /*******************************************************************************
904  *
905  * LPIT - Low Power Idle Table
906  *
907  * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
908  *
909  ******************************************************************************/
910 
911 typedef struct acpi_table_lpit
912 {
913     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
914 
915 } ACPI_TABLE_LPIT;
916 
917 
918 /* LPIT subtable header */
919 
920 typedef struct acpi_lpit_header
921 {
922     UINT32                  Type;               /* Subtable type */
923     UINT32                  Length;             /* Subtable length */
924     UINT16                  UniqueId;
925     UINT16                  Reserved;
926     UINT32                  Flags;
927 
928 } ACPI_LPIT_HEADER;
929 
930 /* Values for subtable Type above */
931 
932 enum AcpiLpitType
933 {
934     ACPI_LPIT_TYPE_NATIVE_CSTATE    = 0x00,
935     ACPI_LPIT_TYPE_RESERVED         = 0x01      /* 1 and above are reserved */
936 };
937 
938 /* Masks for Flags field above  */
939 
940 #define ACPI_LPIT_STATE_DISABLED    (1)
941 #define ACPI_LPIT_NO_COUNTER        (1<<1)
942 
943 /*
944  * LPIT subtables, correspond to Type in ACPI_LPIT_HEADER
945  */
946 
947 /* 0x00: Native C-state instruction based LPI structure */
948 
949 typedef struct acpi_lpit_native
950 {
951     ACPI_LPIT_HEADER        Header;
952     ACPI_GENERIC_ADDRESS    EntryTrigger;
953     UINT32                  Residency;
954     UINT32                  Latency;
955     ACPI_GENERIC_ADDRESS    ResidencyCounter;
956     UINT64                  CounterFrequency;
957 
958 } ACPI_LPIT_NATIVE;
959 
960 
961 /*******************************************************************************
962  *
963  * MADT - Multiple APIC Description Table
964  *        Version 3
965  *
966  ******************************************************************************/
967 
968 typedef struct acpi_table_madt
969 {
970     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
971     UINT32                  Address;            /* Physical address of local APIC */
972     UINT32                  Flags;
973 
974 } ACPI_TABLE_MADT;
975 
976 /* Masks for Flags field above */
977 
978 #define ACPI_MADT_PCAT_COMPAT       (1)         /* 00: System also has dual 8259s */
979 
980 /* Values for PCATCompat flag */
981 
982 #define ACPI_MADT_DUAL_PIC          1
983 #define ACPI_MADT_MULTIPLE_APIC     0
984 
985 
986 /* Values for MADT subtable type in ACPI_SUBTABLE_HEADER */
987 
988 enum AcpiMadtType
989 {
990     ACPI_MADT_TYPE_LOCAL_APIC               = 0,
991     ACPI_MADT_TYPE_IO_APIC                  = 1,
992     ACPI_MADT_TYPE_INTERRUPT_OVERRIDE       = 2,
993     ACPI_MADT_TYPE_NMI_SOURCE               = 3,
994     ACPI_MADT_TYPE_LOCAL_APIC_NMI           = 4,
995     ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE      = 5,
996     ACPI_MADT_TYPE_IO_SAPIC                 = 6,
997     ACPI_MADT_TYPE_LOCAL_SAPIC              = 7,
998     ACPI_MADT_TYPE_INTERRUPT_SOURCE         = 8,
999     ACPI_MADT_TYPE_LOCAL_X2APIC             = 9,
1000     ACPI_MADT_TYPE_LOCAL_X2APIC_NMI         = 10,
1001     ACPI_MADT_TYPE_GENERIC_INTERRUPT        = 11,
1002     ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR      = 12,
1003     ACPI_MADT_TYPE_GENERIC_MSI_FRAME        = 13,
1004     ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR    = 14,
1005     ACPI_MADT_TYPE_GENERIC_TRANSLATOR       = 15,
1006     ACPI_MADT_TYPE_MULTIPROC_WAKEUP         = 16,
1007     ACPI_MADT_TYPE_RESERVED                 = 17    /* 17 and greater are reserved */
1008 };
1009 
1010 
1011 /*
1012  * MADT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
1013  */
1014 
1015 /* 0: Processor Local APIC */
1016 
1017 typedef struct acpi_madt_local_apic
1018 {
1019     ACPI_SUBTABLE_HEADER    Header;
1020     UINT8                   ProcessorId;        /* ACPI processor id */
1021     UINT8                   Id;                 /* Processor's local APIC id */
1022     UINT32                  LapicFlags;
1023 
1024 } ACPI_MADT_LOCAL_APIC;
1025 
1026 
1027 /* 1: IO APIC */
1028 
1029 typedef struct acpi_madt_io_apic
1030 {
1031     ACPI_SUBTABLE_HEADER    Header;
1032     UINT8                   Id;                 /* I/O APIC ID */
1033     UINT8                   Reserved;           /* Reserved - must be zero */
1034     UINT32                  Address;            /* APIC physical address */
1035     UINT32                  GlobalIrqBase;      /* Global system interrupt where INTI lines start */
1036 
1037 } ACPI_MADT_IO_APIC;
1038 
1039 
1040 /* 2: Interrupt Override */
1041 
1042 typedef struct acpi_madt_interrupt_override
1043 {
1044     ACPI_SUBTABLE_HEADER    Header;
1045     UINT8                   Bus;                /* 0 - ISA */
1046     UINT8                   SourceIrq;          /* Interrupt source (IRQ) */
1047     UINT32                  GlobalIrq;          /* Global system interrupt */
1048     UINT16                  IntiFlags;
1049 
1050 } ACPI_MADT_INTERRUPT_OVERRIDE;
1051 
1052 
1053 /* 3: NMI Source */
1054 
1055 typedef struct acpi_madt_nmi_source
1056 {
1057     ACPI_SUBTABLE_HEADER    Header;
1058     UINT16                  IntiFlags;
1059     UINT32                  GlobalIrq;          /* Global system interrupt */
1060 
1061 } ACPI_MADT_NMI_SOURCE;
1062 
1063 
1064 /* 4: Local APIC NMI */
1065 
1066 typedef struct acpi_madt_local_apic_nmi
1067 {
1068     ACPI_SUBTABLE_HEADER    Header;
1069     UINT8                   ProcessorId;        /* ACPI processor id */
1070     UINT16                  IntiFlags;
1071     UINT8                   Lint;               /* LINTn to which NMI is connected */
1072 
1073 } ACPI_MADT_LOCAL_APIC_NMI;
1074 
1075 
1076 /* 5: Address Override */
1077 
1078 typedef struct acpi_madt_local_apic_override
1079 {
1080     ACPI_SUBTABLE_HEADER    Header;
1081     UINT16                  Reserved;           /* Reserved, must be zero */
1082     UINT64                  Address;            /* APIC physical address */
1083 
1084 } ACPI_MADT_LOCAL_APIC_OVERRIDE;
1085 
1086 
1087 /* 6: I/O Sapic */
1088 
1089 typedef struct acpi_madt_io_sapic
1090 {
1091     ACPI_SUBTABLE_HEADER    Header;
1092     UINT8                   Id;                 /* I/O SAPIC ID */
1093     UINT8                   Reserved;           /* Reserved, must be zero */
1094     UINT32                  GlobalIrqBase;      /* Global interrupt for SAPIC start */
1095     UINT64                  Address;            /* SAPIC physical address */
1096 
1097 } ACPI_MADT_IO_SAPIC;
1098 
1099 
1100 /* 7: Local Sapic */
1101 
1102 typedef struct acpi_madt_local_sapic
1103 {
1104     ACPI_SUBTABLE_HEADER    Header;
1105     UINT8                   ProcessorId;        /* ACPI processor id */
1106     UINT8                   Id;                 /* SAPIC ID */
1107     UINT8                   Eid;                /* SAPIC EID */
1108     UINT8                   Reserved[3];        /* Reserved, must be zero */
1109     UINT32                  LapicFlags;
1110     UINT32                  Uid;                /* Numeric UID - ACPI 3.0 */
1111     char                    UidString[1];       /* String UID  - ACPI 3.0 */
1112 
1113 } ACPI_MADT_LOCAL_SAPIC;
1114 
1115 
1116 /* 8: Platform Interrupt Source */
1117 
1118 typedef struct acpi_madt_interrupt_source
1119 {
1120     ACPI_SUBTABLE_HEADER    Header;
1121     UINT16                  IntiFlags;
1122     UINT8                   Type;               /* 1=PMI, 2=INIT, 3=corrected */
1123     UINT8                   Id;                 /* Processor ID */
1124     UINT8                   Eid;                /* Processor EID */
1125     UINT8                   IoSapicVector;      /* Vector value for PMI interrupts */
1126     UINT32                  GlobalIrq;          /* Global system interrupt */
1127     UINT32                  Flags;              /* Interrupt Source Flags */
1128 
1129 } ACPI_MADT_INTERRUPT_SOURCE;
1130 
1131 /* Masks for Flags field above */
1132 
1133 #define ACPI_MADT_CPEI_OVERRIDE     (1)
1134 
1135 
1136 /* 9: Processor Local X2APIC (ACPI 4.0) */
1137 
1138 typedef struct acpi_madt_local_x2apic
1139 {
1140     ACPI_SUBTABLE_HEADER    Header;
1141     UINT16                  Reserved;           /* Reserved - must be zero */
1142     UINT32                  LocalApicId;        /* Processor x2APIC ID  */
1143     UINT32                  LapicFlags;
1144     UINT32                  Uid;                /* ACPI processor UID */
1145 
1146 } ACPI_MADT_LOCAL_X2APIC;
1147 
1148 
1149 /* 10: Local X2APIC NMI (ACPI 4.0) */
1150 
1151 typedef struct acpi_madt_local_x2apic_nmi
1152 {
1153     ACPI_SUBTABLE_HEADER    Header;
1154     UINT16                  IntiFlags;
1155     UINT32                  Uid;                /* ACPI processor UID */
1156     UINT8                   Lint;               /* LINTn to which NMI is connected */
1157     UINT8                   Reserved[3];        /* Reserved - must be zero */
1158 
1159 } ACPI_MADT_LOCAL_X2APIC_NMI;
1160 
1161 
1162 /* 11: Generic Interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 changes) */
1163 
1164 typedef struct acpi_madt_generic_interrupt
1165 {
1166     ACPI_SUBTABLE_HEADER    Header;
1167     UINT16                  Reserved;           /* Reserved - must be zero */
1168     UINT32                  CpuInterfaceNumber;
1169     UINT32                  Uid;
1170     UINT32                  Flags;
1171     UINT32                  ParkingVersion;
1172     UINT32                  PerformanceInterrupt;
1173     UINT64                  ParkedAddress;
1174     UINT64                  BaseAddress;
1175     UINT64                  GicvBaseAddress;
1176     UINT64                  GichBaseAddress;
1177     UINT32                  VgicInterrupt;
1178     UINT64                  GicrBaseAddress;
1179     UINT64                  ArmMpidr;
1180     UINT8                   EfficiencyClass;
1181     UINT8                   Reserved2[1];
1182     UINT16                  SpeInterrupt;       /* ACPI 6.3 */
1183 
1184 } ACPI_MADT_GENERIC_INTERRUPT;
1185 
1186 /* Masks for Flags field above */
1187 
1188 /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
1189 #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)  /* 01: Performance Interrupt Mode */
1190 #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)  /* 02: VGIC Maintenance Interrupt mode */
1191 
1192 
1193 /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
1194 
1195 typedef struct acpi_madt_generic_distributor
1196 {
1197     ACPI_SUBTABLE_HEADER    Header;
1198     UINT16                  Reserved;           /* Reserved - must be zero */
1199     UINT32                  GicId;
1200     UINT64                  BaseAddress;
1201     UINT32                  GlobalIrqBase;
1202     UINT8                   Version;
1203     UINT8                   Reserved2[3];       /* Reserved - must be zero */
1204 
1205 } ACPI_MADT_GENERIC_DISTRIBUTOR;
1206 
1207 /* Values for Version field above */
1208 
1209 enum AcpiMadtGicVersion
1210 {
1211     ACPI_MADT_GIC_VERSION_NONE          = 0,
1212     ACPI_MADT_GIC_VERSION_V1            = 1,
1213     ACPI_MADT_GIC_VERSION_V2            = 2,
1214     ACPI_MADT_GIC_VERSION_V3            = 3,
1215     ACPI_MADT_GIC_VERSION_V4            = 4,
1216     ACPI_MADT_GIC_VERSION_RESERVED      = 5     /* 5 and greater are reserved */
1217 };
1218 
1219 
1220 /* 13: Generic MSI Frame (ACPI 5.1) */
1221 
1222 typedef struct acpi_madt_generic_msi_frame
1223 {
1224     ACPI_SUBTABLE_HEADER    Header;
1225     UINT16                  Reserved;           /* Reserved - must be zero */
1226     UINT32                  MsiFrameId;
1227     UINT64                  BaseAddress;
1228     UINT32                  Flags;
1229     UINT16                  SpiCount;
1230     UINT16                  SpiBase;
1231 
1232 } ACPI_MADT_GENERIC_MSI_FRAME;
1233 
1234 /* Masks for Flags field above */
1235 
1236 #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
1237 
1238 
1239 /* 14: Generic Redistributor (ACPI 5.1) */
1240 
1241 typedef struct acpi_madt_generic_redistributor
1242 {
1243     ACPI_SUBTABLE_HEADER    Header;
1244     UINT16                  Reserved;           /* reserved - must be zero */
1245     UINT64                  BaseAddress;
1246     UINT32                  Length;
1247 
1248 } ACPI_MADT_GENERIC_REDISTRIBUTOR;
1249 
1250 
1251 /* 15: Generic Translator (ACPI 6.0) */
1252 
1253 typedef struct acpi_madt_generic_translator
1254 {
1255     ACPI_SUBTABLE_HEADER    Header;
1256     UINT16                  Reserved;           /* reserved - must be zero */
1257     UINT32                  TranslationId;
1258     UINT64                  BaseAddress;
1259     UINT32                  Reserved2;
1260 
1261 } ACPI_MADT_GENERIC_TRANSLATOR;
1262 
1263 /* 16: Multiprocessor wakeup (ACPI 6.4) */
1264 
1265 typedef struct acpi_madt_multiproc_wakeup
1266 {
1267     ACPI_SUBTABLE_HEADER    Header;
1268     UINT16                  MailboxVersion;
1269     UINT32                  Reserved;           /* reserved - must be zero */
1270     UINT64                  BaseAddress;
1271 
1272 } ACPI_MADT_MULTIPROC_WAKEUP;
1273 
1274 #define ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE	2032
1275 #define ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE	2048
1276 
1277 typedef struct acpi_madt_multiproc_wakeup_mailbox
1278 {
1279     UINT16                  Command;
1280     UINT16                  Reserved; /* reserved - must be zero */
1281     UINT32                  ApicId;
1282     UINT64                  WakeupVector;
1283     UINT8                   ReservedOs[ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE]; /* reserved for OS use */
1284     UINT8                   ReservedFirmware[ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE]; /* reserved for firmware use */
1285 
1286 } ACPI_MADT_MULTIPROC_WAKEUP_MAILBOX;
1287 
1288 #define ACPI_MP_WAKE_COMMAND_WAKEUP    1
1289 
1290 
1291 /*
1292  * Common flags fields for MADT subtables
1293  */
1294 
1295 /* MADT Local APIC flags */
1296 
1297 #define ACPI_MADT_ENABLED           (1)         /* 00: Processor is usable if set */
1298 #define ACPI_MADT_ONLINE_CAPABLE    (2)         /* 01: System HW supports enabling processor at runtime */
1299 
1300 /* MADT MPS INTI flags (IntiFlags) */
1301 
1302 #define ACPI_MADT_POLARITY_MASK     (3)         /* 00-01: Polarity of APIC I/O input signals */
1303 #define ACPI_MADT_TRIGGER_MASK      (3<<2)      /* 02-03: Trigger mode of APIC input signals */
1304 
1305 /* Values for MPS INTI flags */
1306 
1307 #define ACPI_MADT_POLARITY_CONFORMS       0
1308 #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
1309 #define ACPI_MADT_POLARITY_RESERVED       2
1310 #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
1311 
1312 #define ACPI_MADT_TRIGGER_CONFORMS        (0)
1313 #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
1314 #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
1315 #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
1316 
1317 
1318 /*******************************************************************************
1319  *
1320  * MCFG - PCI Memory Mapped Configuration table and subtable
1321  *        Version 1
1322  *
1323  * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
1324  *
1325  ******************************************************************************/
1326 
1327 typedef struct acpi_table_mcfg
1328 {
1329     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1330     UINT8                   Reserved[8];
1331 
1332 } ACPI_TABLE_MCFG;
1333 
1334 
1335 /* Subtable */
1336 
1337 typedef struct acpi_mcfg_allocation
1338 {
1339     UINT64                  Address;            /* Base address, processor-relative */
1340     UINT16                  PciSegment;         /* PCI segment group number */
1341     UINT8                   StartBusNumber;     /* Starting PCI Bus number */
1342     UINT8                   EndBusNumber;       /* Final PCI Bus number */
1343     UINT32                  Reserved;
1344 
1345 } ACPI_MCFG_ALLOCATION;
1346 
1347 
1348 /*******************************************************************************
1349  *
1350  * MCHI - Management Controller Host Interface Table
1351  *        Version 1
1352  *
1353  * Conforms to "Management Component Transport Protocol (MCTP) Host
1354  * Interface Specification", Revision 1.0.0a, October 13, 2009
1355  *
1356  ******************************************************************************/
1357 
1358 typedef struct acpi_table_mchi
1359 {
1360     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1361     UINT8                   InterfaceType;
1362     UINT8                   Protocol;
1363     UINT64                  ProtocolData;
1364     UINT8                   InterruptType;
1365     UINT8                   Gpe;
1366     UINT8                   PciDeviceFlag;
1367     UINT32                  GlobalInterrupt;
1368     ACPI_GENERIC_ADDRESS    ControlRegister;
1369     UINT8                   PciSegment;
1370     UINT8                   PciBus;
1371     UINT8                   PciDevice;
1372     UINT8                   PciFunction;
1373 
1374 } ACPI_TABLE_MCHI;
1375 
1376 
1377 /*******************************************************************************
1378  *
1379  * MPST - Memory Power State Table (ACPI 5.0)
1380  *        Version 1
1381  *
1382  ******************************************************************************/
1383 
1384 #define ACPI_MPST_CHANNEL_INFO \
1385     UINT8                   ChannelId; \
1386     UINT8                   Reserved1[3]; \
1387     UINT16                  PowerNodeCount; \
1388     UINT16                  Reserved2;
1389 
1390 /* Main table */
1391 
1392 typedef struct acpi_table_mpst
1393 {
1394     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1395     ACPI_MPST_CHANNEL_INFO                      /* Platform Communication Channel */
1396 
1397 } ACPI_TABLE_MPST;
1398 
1399 
1400 /* Memory Platform Communication Channel Info */
1401 
1402 typedef struct acpi_mpst_channel
1403 {
1404     ACPI_MPST_CHANNEL_INFO                      /* Platform Communication Channel */
1405 
1406 } ACPI_MPST_CHANNEL;
1407 
1408 
1409 /* Memory Power Node Structure */
1410 
1411 typedef struct acpi_mpst_power_node
1412 {
1413     UINT8                   Flags;
1414     UINT8                   Reserved1;
1415     UINT16                  NodeId;
1416     UINT32                  Length;
1417     UINT64                  RangeAddress;
1418     UINT64                  RangeLength;
1419     UINT32                  NumPowerStates;
1420     UINT32                  NumPhysicalComponents;
1421 
1422 } ACPI_MPST_POWER_NODE;
1423 
1424 /* Values for Flags field above */
1425 
1426 #define ACPI_MPST_ENABLED               1
1427 #define ACPI_MPST_POWER_MANAGED         2
1428 #define ACPI_MPST_HOT_PLUG_CAPABLE      4
1429 
1430 
1431 /* Memory Power State Structure (follows POWER_NODE above) */
1432 
1433 typedef struct acpi_mpst_power_state
1434 {
1435     UINT8                   PowerState;
1436     UINT8                   InfoIndex;
1437 
1438 } ACPI_MPST_POWER_STATE;
1439 
1440 
1441 /* Physical Component ID Structure (follows POWER_STATE above) */
1442 
1443 typedef struct acpi_mpst_component
1444 {
1445     UINT16                  ComponentId;
1446 
1447 } ACPI_MPST_COMPONENT;
1448 
1449 
1450 /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
1451 
1452 typedef struct acpi_mpst_data_hdr
1453 {
1454     UINT16                  CharacteristicsCount;
1455     UINT16                  Reserved;
1456 
1457 } ACPI_MPST_DATA_HDR;
1458 
1459 typedef struct acpi_mpst_power_data
1460 {
1461     UINT8                   StructureId;
1462     UINT8                   Flags;
1463     UINT16                  Reserved1;
1464     UINT32                  AveragePower;
1465     UINT32                  PowerSaving;
1466     UINT64                  ExitLatency;
1467     UINT64                  Reserved2;
1468 
1469 } ACPI_MPST_POWER_DATA;
1470 
1471 /* Values for Flags field above */
1472 
1473 #define ACPI_MPST_PRESERVE              1
1474 #define ACPI_MPST_AUTOENTRY             2
1475 #define ACPI_MPST_AUTOEXIT              4
1476 
1477 
1478 /* Shared Memory Region (not part of an ACPI table) */
1479 
1480 typedef struct acpi_mpst_shared
1481 {
1482     UINT32                  Signature;
1483     UINT16                  PccCommand;
1484     UINT16                  PccStatus;
1485     UINT32                  CommandRegister;
1486     UINT32                  StatusRegister;
1487     UINT32                  PowerStateId;
1488     UINT32                  PowerNodeId;
1489     UINT64                  EnergyConsumed;
1490     UINT64                  AveragePower;
1491 
1492 } ACPI_MPST_SHARED;
1493 
1494 
1495 /*******************************************************************************
1496  *
1497  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
1498  *        Version 1
1499  *
1500  ******************************************************************************/
1501 
1502 typedef struct acpi_table_msct
1503 {
1504     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1505     UINT32                  ProximityOffset;    /* Location of proximity info struct(s) */
1506     UINT32                  MaxProximityDomains;/* Max number of proximity domains */
1507     UINT32                  MaxClockDomains;    /* Max number of clock domains */
1508     UINT64                  MaxAddress;         /* Max physical address in system */
1509 
1510 } ACPI_TABLE_MSCT;
1511 
1512 
1513 /* Subtable - Maximum Proximity Domain Information. Version 1 */
1514 
1515 typedef struct acpi_msct_proximity
1516 {
1517     UINT8                   Revision;
1518     UINT8                   Length;
1519     UINT32                  RangeStart;         /* Start of domain range */
1520     UINT32                  RangeEnd;           /* End of domain range */
1521     UINT32                  ProcessorCapacity;
1522     UINT64                  MemoryCapacity;     /* In bytes */
1523 
1524 } ACPI_MSCT_PROXIMITY;
1525 
1526 
1527 /*******************************************************************************
1528  *
1529  * MSDM - Microsoft Data Management table
1530  *
1531  * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
1532  * November 29, 2011. Copyright 2011 Microsoft
1533  *
1534  ******************************************************************************/
1535 
1536 /* Basic MSDM table is only the common ACPI header */
1537 
1538 typedef struct acpi_table_msdm
1539 {
1540     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1541 
1542 } ACPI_TABLE_MSDM;
1543 
1544 
1545 /*******************************************************************************
1546  *
1547  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
1548  *        Version 1
1549  *
1550  ******************************************************************************/
1551 
1552 typedef struct acpi_table_nfit
1553 {
1554     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1555     UINT32                  Reserved;           /* Reserved, must be zero */
1556 
1557 } ACPI_TABLE_NFIT;
1558 
1559 /* Subtable header for NFIT */
1560 
1561 typedef struct acpi_nfit_header
1562 {
1563     UINT16                   Type;
1564     UINT16                   Length;
1565 
1566 } ACPI_NFIT_HEADER;
1567 
1568 
1569 /* Values for subtable type in ACPI_NFIT_HEADER */
1570 
1571 enum AcpiNfitType
1572 {
1573     ACPI_NFIT_TYPE_SYSTEM_ADDRESS       = 0,
1574     ACPI_NFIT_TYPE_MEMORY_MAP           = 1,
1575     ACPI_NFIT_TYPE_INTERLEAVE           = 2,
1576     ACPI_NFIT_TYPE_SMBIOS               = 3,
1577     ACPI_NFIT_TYPE_CONTROL_REGION       = 4,
1578     ACPI_NFIT_TYPE_DATA_REGION          = 5,
1579     ACPI_NFIT_TYPE_FLUSH_ADDRESS        = 6,
1580     ACPI_NFIT_TYPE_CAPABILITIES         = 7,
1581     ACPI_NFIT_TYPE_RESERVED             = 8     /* 8 and greater are reserved */
1582 };
1583 
1584 /*
1585  * NFIT Subtables
1586  */
1587 
1588 /* 0: System Physical Address Range Structure */
1589 
1590 typedef struct acpi_nfit_system_address
1591 {
1592     ACPI_NFIT_HEADER        Header;
1593     UINT16                  RangeIndex;
1594     UINT16                  Flags;
1595     UINT32                  Reserved;           /* Reserved, must be zero */
1596     UINT32                  ProximityDomain;
1597     UINT8                   RangeGuid[16];
1598     UINT64                  Address;
1599     UINT64                  Length;
1600     UINT64                  MemoryMapping;
1601     UINT64                  LocationCookie;     /* ACPI 6.4 */
1602 
1603 } ACPI_NFIT_SYSTEM_ADDRESS;
1604 
1605 /* Flags */
1606 
1607 #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)     /* 00: Add/Online Operation Only */
1608 #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)  /* 01: Proximity Domain Valid */
1609 #define ACPI_NFIT_LOCATION_COOKIE_VALID (1<<2)  /* 02: SPA location cookie valid (ACPI 6.4) */
1610 
1611 /* Range Type GUIDs appear in the include/acuuid.h file */
1612 
1613 
1614 /* 1: Memory Device to System Address Range Map Structure */
1615 
1616 typedef struct acpi_nfit_memory_map
1617 {
1618     ACPI_NFIT_HEADER        Header;
1619     UINT32                  DeviceHandle;
1620     UINT16                  PhysicalId;
1621     UINT16                  RegionId;
1622     UINT16                  RangeIndex;
1623     UINT16                  RegionIndex;
1624     UINT64                  RegionSize;
1625     UINT64                  RegionOffset;
1626     UINT64                  Address;
1627     UINT16                  InterleaveIndex;
1628     UINT16                  InterleaveWays;
1629     UINT16                  Flags;
1630     UINT16                  Reserved;           /* Reserved, must be zero */
1631 
1632 } ACPI_NFIT_MEMORY_MAP;
1633 
1634 /* Flags */
1635 
1636 #define ACPI_NFIT_MEM_SAVE_FAILED       (1)     /* 00: Last SAVE to Memory Device failed */
1637 #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)  /* 01: Last RESTORE from Memory Device failed */
1638 #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)  /* 02: Platform flush failed */
1639 #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)  /* 03: Memory Device is not armed */
1640 #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)  /* 04: Memory Device observed SMART/health events */
1641 #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)  /* 05: SMART/health events enabled */
1642 #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)  /* 06: Mapping to SPA failed */
1643 
1644 
1645 /* 2: Interleave Structure */
1646 
1647 typedef struct acpi_nfit_interleave
1648 {
1649     ACPI_NFIT_HEADER        Header;
1650     UINT16                  InterleaveIndex;
1651     UINT16                  Reserved;           /* Reserved, must be zero */
1652     UINT32                  LineCount;
1653     UINT32                  LineSize;
1654     UINT32                  LineOffset[1];      /* Variable length */
1655 
1656 } ACPI_NFIT_INTERLEAVE;
1657 
1658 
1659 /* 3: SMBIOS Management Information Structure */
1660 
1661 typedef struct acpi_nfit_smbios
1662 {
1663     ACPI_NFIT_HEADER        Header;
1664     UINT32                  Reserved;           /* Reserved, must be zero */
1665     UINT8                   Data[1];            /* Variable length */
1666 
1667 } ACPI_NFIT_SMBIOS;
1668 
1669 
1670 /* 4: NVDIMM Control Region Structure */
1671 
1672 typedef struct acpi_nfit_control_region
1673 {
1674     ACPI_NFIT_HEADER        Header;
1675     UINT16                  RegionIndex;
1676     UINT16                  VendorId;
1677     UINT16                  DeviceId;
1678     UINT16                  RevisionId;
1679     UINT16                  SubsystemVendorId;
1680     UINT16                  SubsystemDeviceId;
1681     UINT16                  SubsystemRevisionId;
1682     UINT8                   ValidFields;
1683     UINT8                   ManufacturingLocation;
1684     UINT16                  ManufacturingDate;
1685     UINT8                   Reserved[2];        /* Reserved, must be zero */
1686     UINT32                  SerialNumber;
1687     UINT16                  Code;
1688     UINT16                  Windows;
1689     UINT64                  WindowSize;
1690     UINT64                  CommandOffset;
1691     UINT64                  CommandSize;
1692     UINT64                  StatusOffset;
1693     UINT64                  StatusSize;
1694     UINT16                  Flags;
1695     UINT8                   Reserved1[6];       /* Reserved, must be zero */
1696 
1697 } ACPI_NFIT_CONTROL_REGION;
1698 
1699 /* Flags */
1700 
1701 #define ACPI_NFIT_CONTROL_BUFFERED          (1)     /* Block Data Windows implementation is buffered */
1702 
1703 /* ValidFields bits */
1704 
1705 #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)     /* Manufacturing fields are valid */
1706 
1707 
1708 /* 5: NVDIMM Block Data Window Region Structure */
1709 
1710 typedef struct acpi_nfit_data_region
1711 {
1712     ACPI_NFIT_HEADER        Header;
1713     UINT16                  RegionIndex;
1714     UINT16                  Windows;
1715     UINT64                  Offset;
1716     UINT64                  Size;
1717     UINT64                  Capacity;
1718     UINT64                  StartAddress;
1719 
1720 } ACPI_NFIT_DATA_REGION;
1721 
1722 
1723 /* 6: Flush Hint Address Structure */
1724 
1725 typedef struct acpi_nfit_flush_address
1726 {
1727     ACPI_NFIT_HEADER        Header;
1728     UINT32                  DeviceHandle;
1729     UINT16                  HintCount;
1730     UINT8                   Reserved[6];        /* Reserved, must be zero */
1731     UINT64                  HintAddress[1];     /* Variable length */
1732 
1733 } ACPI_NFIT_FLUSH_ADDRESS;
1734 
1735 
1736 /* 7: Platform Capabilities Structure */
1737 
1738 typedef struct acpi_nfit_capabilities
1739 {
1740     ACPI_NFIT_HEADER        Header;
1741     UINT8                   HighestCapability;
1742     UINT8                   Reserved[3];       /* Reserved, must be zero */
1743     UINT32                  Capabilities;
1744     UINT32                  Reserved2;
1745 
1746 } ACPI_NFIT_CAPABILITIES;
1747 
1748 /* Capabilities Flags */
1749 
1750 #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)     /* 00: Cache Flush to NVDIMM capable */
1751 #define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)  /* 01: Memory Flush to NVDIMM capable */
1752 #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)  /* 02: Memory Mirroring capable */
1753 
1754 
1755 /*
1756  * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1757  */
1758 typedef struct nfit_device_handle
1759 {
1760     UINT32                  Handle;
1761 
1762 } NFIT_DEVICE_HANDLE;
1763 
1764 /* Device handle construction and extraction macros */
1765 
1766 #define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
1767 #define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
1768 #define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
1769 #define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
1770 #define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
1771 
1772 #define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
1773 #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
1774 #define ACPI_NFIT_MEMORY_ID_OFFSET              8
1775 #define ACPI_NFIT_SOCKET_ID_OFFSET              12
1776 #define ACPI_NFIT_NODE_ID_OFFSET                16
1777 
1778 /* Macro to construct a NFIT/NVDIMM device handle */
1779 
1780 #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1781     ((dimm)                                         | \
1782     ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
1783     ((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
1784     ((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
1785     ((node)    << ACPI_NFIT_NODE_ID_OFFSET))
1786 
1787 /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1788 
1789 #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1790     ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1791 
1792 #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1793     (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1794 
1795 #define ACPI_NFIT_GET_MEMORY_ID(handle) \
1796     (((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
1797 
1798 #define ACPI_NFIT_GET_SOCKET_ID(handle) \
1799     (((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
1800 
1801 #define ACPI_NFIT_GET_NODE_ID(handle) \
1802     (((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
1803 
1804 
1805 /*******************************************************************************
1806  *
1807  * NHLT - Non HD Audio Link Table
1808  *
1809  * Conforms to: Intel Smart Sound Technology NHLT Specification
1810  * Version 0.8.1, January 2020.
1811  *
1812  ******************************************************************************/
1813 
1814 /* Main table */
1815 
1816 typedef struct acpi_table_nhlt
1817 {
1818     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1819     UINT8                   EndpointCount;
1820 
1821 } ACPI_TABLE_NHLT;
1822 
1823 typedef struct acpi_table_nhlt_endpoint_count
1824 {
1825     UINT8                   EndpointCount;
1826 
1827 } ACPI_TABLE_NHLT_ENDPOINT_COUNT;
1828 
1829 typedef struct acpi_nhlt_endpoint
1830 {
1831     UINT32                  DescriptorLength;
1832     UINT8                   LinkType;
1833     UINT8                   InstanceId;
1834     UINT16                  VendorId;
1835     UINT16                  DeviceId;
1836     UINT16                  RevisionId;
1837     UINT32                  SubsystemId;
1838     UINT8                   DeviceType;
1839     UINT8                   Direction;
1840     UINT8                   VirtualBusId;
1841 
1842 } ACPI_NHLT_ENDPOINT;
1843 
1844 /* Types for LinkType field above */
1845 
1846 #define ACPI_NHLT_RESERVED_HD_AUDIO         0
1847 #define ACPI_NHLT_RESERVED_DSP              1
1848 #define ACPI_NHLT_PDM                       2
1849 #define ACPI_NHLT_SSP                       3
1850 #define ACPI_NHLT_RESERVED_SLIMBUS          4
1851 #define ACPI_NHLT_RESERVED_SOUNDWIRE        5
1852 #define ACPI_NHLT_TYPE_RESERVED             6 /* 6 and above are reserved */
1853 
1854 /* All other values above are reserved */
1855 
1856 /* Values for DeviceId field above */
1857 
1858 #define ACPI_NHLT_PDM_DMIC                  0xAE20
1859 #define ACPI_NHLT_BT_SIDEBAND               0xAE30
1860 #define ACPI_NHLT_I2S_TDM_CODECS            0xAE23
1861 
1862 /* Values for DeviceType field above */
1863 
1864 /* SSP Link */
1865 
1866 #define ACPI_NHLT_LINK_BT_SIDEBAND          0
1867 #define ACPI_NHLT_LINK_FM                   1
1868 #define ACPI_NHLT_LINK_MODEM                2
1869 /* 3 is reserved */
1870 #define ACPI_NHLT_LINK_SSP_ANALOG_CODEC     4
1871 
1872 /* PDM Link */
1873 
1874 #define ACPI_NHLT_PDM_ON_CAVS_1P8           0
1875 #define ACPI_NHLT_PDM_ON_CAVS_1P5           1
1876 
1877 /* Values for Direction field above */
1878 
1879 #define ACPI_NHLT_DIR_RENDER                0
1880 #define ACPI_NHLT_DIR_CAPTURE               1
1881 #define ACPI_NHLT_DIR_RENDER_LOOPBACK       2
1882 #define ACPI_NHLT_DIR_RENDER_FEEDBACK       3
1883 #define ACPI_NHLT_DIR_RESERVED              4   /* 4 and above are reserved */
1884 
1885 /* Capabilities = 2 */
1886 
1887 typedef struct acpi_nhlt_device_specific_config
1888 {
1889     UINT32                  CapabilitiesSize;
1890     UINT8                   VirtualSlot;
1891     UINT8                   ConfigType;
1892 
1893 } ACPI_NHLT_DEVICE_SPECIFIC_CONFIG;
1894 
1895 /* Capabilities = 3 */
1896 
1897 typedef struct acpi_nhlt_device_specific_config_a
1898 {
1899     UINT32                  CapabilitiesSize;
1900     UINT8                   VirtualSlot;
1901     UINT8                   ConfigType;
1902     UINT8                   ArrayType;
1903 
1904 } ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A;
1905 
1906 /* Capabilities = 3 */
1907 
1908 typedef struct acpi_nhlt_device_specific_config_d
1909 {
1910     UINT8                   VirtualSlot;
1911     UINT8                   ConfigType;
1912     UINT8                   ArrayType;
1913 
1914 } ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D;
1915 
1916 /* Values for Config Type above */
1917 
1918 #define ACPI_NHLT_CONFIG_TYPE_GENERIC              0x00
1919 #define ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY            0x01
1920 #define ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK      0x03
1921 #define ACPI_NHLT_CONFIG_TYPE_RESERVED             0x04   /* 4 and above are reserved */
1922 
1923 /* Capabilities = 0 */
1924 
1925 typedef struct acpi_nhlt_device_specific_config_b
1926 {
1927     UINT32                  CapabilitiesSize;
1928 
1929 } ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B;
1930 
1931 /* Capabilities = 1 */
1932 
1933 typedef struct acpi_nhlt_device_specific_config_c
1934 {
1935     UINT32                  CapabilitiesSize;
1936     UINT8                   VirtualSlot;
1937 
1938 } ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C;
1939 
1940 typedef struct acpi_nhlt_render_device_specific_config
1941 {
1942     UINT32                  CapabilitiesSize;
1943     UINT8                   VirtualSlot;
1944 
1945 } ACPI_NHLT_RENDER_DEVICE_SPECIFIC_CONFIG;
1946 
1947 typedef struct acpi_nhlt_wave_extensible
1948 {
1949     UINT16                  FormatTag;
1950     UINT16                  ChannelCount;
1951     UINT32                  SamplesPerSec;
1952     UINT32                  AvgBytesPerSec;
1953     UINT16                  BlockAlign;
1954     UINT16                  BitsPerSample;
1955     UINT16                  ExtraFormatSize;
1956     UINT16                  ValidBitsPerSample;
1957     UINT32                  ChannelMask;
1958     UINT8                   SubFormatGuid[16];
1959 
1960 } ACPI_NHLT_WAVE_EXTENSIBLE;
1961 
1962 /* Values for ChannelMask above */
1963 
1964 #define ACPI_NHLT_SPKR_FRONT_LEFT             0x1
1965 #define ACPI_NHLT_SPKR_FRONT_RIGHT            0x2
1966 #define ACPI_NHLT_SPKR_FRONT_CENTER           0x4
1967 #define ACPI_NHLT_SPKR_LOW_FREQ               0x8
1968 #define ACPI_NHLT_SPKR_BACK_LEFT              0x10
1969 #define ACPI_NHLT_SPKR_BACK_RIGHT             0x20
1970 #define ACPI_NHLT_SPKR_FRONT_LEFT_OF_CENTER   0x40
1971 #define ACPI_NHLT_SPKR_FRONT_RIGHT_OF_CENTER  0x80
1972 #define ACPI_NHLT_SPKR_BACK_CENTER            0x100
1973 #define ACPI_NHLT_SPKR_SIDE_LEFT              0x200
1974 #define ACPI_NHLT_SPKR_SIDE_RIGHT             0x400
1975 #define ACPI_NHLT_SPKR_TOP_CENTER             0x800
1976 #define ACPI_NHLT_SPKR_TOP_FRONT_LEFT         0x1000
1977 #define ACPI_NHLT_SPKR_TOP_FRONT_CENTER       0x2000
1978 #define ACPI_NHLT_SPKR_TOP_FRONT_RIGHT        0x4000
1979 #define ACPI_NHLT_SPKR_TOP_BACK_LEFT          0x8000
1980 #define ACPI_NHLT_SPKR_TOP_BACK_CENTER        0x10000
1981 #define ACPI_NHLT_SPKR_TOP_BACK_RIGHT         0x20000
1982 
1983 typedef struct acpi_nhlt_format_config
1984 {
1985     ACPI_NHLT_WAVE_EXTENSIBLE   Format;
1986     UINT32                      CapabilitySize;
1987     UINT8                       Capabilities[];
1988 
1989 } ACPI_NHLT_FORMAT_CONFIG;
1990 
1991 typedef struct acpi_nhlt_formats_config
1992 {
1993     UINT8                   FormatsCount;
1994 
1995 } ACPI_NHLT_FORMATS_CONFIG;
1996 
1997 typedef struct acpi_nhlt_device_specific_hdr
1998 {
1999     UINT8                   VirtualSlot;
2000     UINT8                   ConfigType;
2001 
2002 } ACPI_NHLT_DEVICE_SPECIFIC_HDR;
2003 
2004 /* Types for ConfigType above */
2005 
2006 #define ACPI_NHLT_GENERIC                   0
2007 #define ACPI_NHLT_MIC                       1
2008 #define ACPI_NHLT_RENDER                    3
2009 
2010 typedef struct acpi_nhlt_mic_device_specific_config
2011 {
2012     ACPI_NHLT_DEVICE_SPECIFIC_HDR   DeviceConfig;
2013     UINT8                           ArrayTypeExt;
2014 
2015 } ACPI_NHLT_MIC_DEVICE_SPECIFIC_CONFIG;
2016 
2017 /* Values for ArrayTypeExt above */
2018 
2019 #define ACPI_NHLT_ARRAY_TYPE_RESERVED               0x09 // 9 and below are reserved
2020 #define ACPI_NHLT_SMALL_LINEAR_2ELEMENT             0x0A
2021 #define ACPI_NHLT_BIG_LINEAR_2ELEMENT               0x0B
2022 #define ACPI_NHLT_FIRST_GEOMETRY_LINEAR_4ELEMENT    0x0C
2023 #define ACPI_NHLT_PLANAR_LSHAPED_4ELEMENT           0x0D
2024 #define ACPI_NHLT_SECOND_GEOMETRY_LINEAR_4ELEMENT   0x0E
2025 #define ACPI_NHLT_VENDOR_DEFINED                    0x0F
2026 #define ACPI_NHLT_ARRAY_TYPE_MASK                   0x0F
2027 #define ACPI_NHLT_ARRAY_TYPE_EXT_MASK               0x10
2028 
2029 #define ACPI_NHLT_NO_EXTENSION                      0x0
2030 #define ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT           (1<<4)
2031 
2032 typedef struct acpi_nhlt_vendor_mic_count
2033 {
2034     UINT8                           MicrophoneCount;
2035 
2036 } ACPI_NHLT_VENDOR_MIC_COUNT;
2037 
2038 typedef struct acpi_nhlt_vendor_mic_config
2039 {
2040     UINT8                   Type;
2041     UINT8                   Panel;
2042     UINT16                  SpeakerPositionDistance;    // mm
2043     UINT16                  HorizontalOffset;           // mm
2044     UINT16                  VerticalOffset;             // mm
2045     UINT8                   FrequencyLowBand;           // 5*Hz
2046     UINT8                   FrequencyHighBand;          // 500*Hz
2047     UINT16                  DirectionAngle;             // -180 - + 180
2048     UINT16                  ElevationAngle;             // -180 - + 180
2049     UINT16                  WorkVerticalAngleBegin;     // -180 - + 180 with 2 deg step
2050     UINT16                  WorkVerticalAngleEnd;       // -180 - + 180 with 2 deg step
2051     UINT16                  WorkHorizontalAngleBegin;   // -180 - + 180 with 2 deg step
2052     UINT16                  WorkHorizontalAngleEnd;     // -180 - + 180 with 2 deg step
2053 
2054 } ACPI_NHLT_VENDOR_MIC_CONFIG;
2055 
2056 /* Values for Type field above */
2057 
2058 #define ACPI_NHLT_MIC_OMNIDIRECTIONAL       0
2059 #define ACPI_NHLT_MIC_SUBCARDIOID           1
2060 #define ACPI_NHLT_MIC_CARDIOID              2
2061 #define ACPI_NHLT_MIC_SUPER_CARDIOID        3
2062 #define ACPI_NHLT_MIC_HYPER_CARDIOID        4
2063 #define ACPI_NHLT_MIC_8_SHAPED              5
2064 #define ACPI_NHLT_MIC_RESERVED6             6 // 6 is reserved
2065 #define ACPI_NHLT_MIC_VENDOR_DEFINED        7
2066 #define ACPI_NHLT_MIC_RESERVED              8 // 8 and above are reserved
2067 
2068 /* Values for Panel field above */
2069 
2070 #define ACPI_NHLT_MIC_POSITION_TOP          0
2071 #define ACPI_NHLT_MIC_POSITION_BOTTOM       1
2072 #define ACPI_NHLT_MIC_POSITION_LEFT         2
2073 #define ACPI_NHLT_MIC_POSITION_RIGHT        3
2074 #define ACPI_NHLT_MIC_POSITION_FRONT        4
2075 #define ACPI_NHLT_MIC_POSITION_BACK         5
2076 #define ACPI_NHLT_MIC_POSITION_RESERVED     6 // 6 and above are reserved
2077 
2078 typedef struct acpi_nhlt_vendor_mic_device_specific_config
2079 {
2080     ACPI_NHLT_MIC_DEVICE_SPECIFIC_CONFIG    MicArrayDeviceConfig;
2081     UINT8                                   NumberOfMicrophones;
2082     ACPI_NHLT_VENDOR_MIC_CONFIG             MicConfig[];            // Indexed by NumberOfMicrophones
2083 
2084 } ACPI_NHLT_VENDOR_MIC_DEVICE_SPECIFIC_CONFIG;
2085 
2086 /* Microphone SNR and Sensitivity extension */
2087 
2088 typedef struct acpi_nhlt_mic_snr_sensitivity_extension
2089 {
2090     UINT32                  SNR;
2091     UINT32                  Sensitivity;
2092 
2093 } ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION;
2094 
2095 /* Render device with feedback */
2096 
2097 typedef struct acpi_nhlt_render_feedback_device_specific_config
2098 {
2099     UINT8                               FeedbackVirtualSlot;    // Render slot in case of capture
2100     UINT16                              FeedbackChannels;       // Informative only
2101     UINT16                              FeedbackValidBitsPerSample;
2102 
2103 } ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG;
2104 
2105 /* Linux-specific structures */
2106 
2107 typedef struct acpi_nhlt_linux_specific_count
2108 {
2109     UINT8                               StructureCount;
2110 
2111 } ACPI_NHLT_LINUX_SPECIFIC_COUNT;
2112 
2113 typedef struct acpi_nhlt_linux_specific_data
2114 {
2115     UINT8                               DeviceId[16];
2116     UINT8                               DeviceInstanceId;
2117     UINT8                               DevicePortId;
2118 
2119 } ACPI_NHLT_LINUX_SPECIFIC_DATA;
2120 
2121 typedef struct acpi_nhlt_linux_specific_data_b
2122 {
2123     UINT8                               SpecificData[18];
2124 
2125 } ACPI_NHLT_LINUX_SPECIFIC_DATA_B;
2126 
2127 typedef struct acpi_nhlt_table_terminator
2128 {
2129     UINT32                  TerminatorValue;
2130     UINT32                  TerminatorSignature;
2131 
2132 } ACPI_NHLT_TABLE_TERMINATOR;
2133 
2134 
2135 /*******************************************************************************
2136  *
2137  * PCCT - Platform Communications Channel Table (ACPI 5.0)
2138  *        Version 2 (ACPI 6.2)
2139  *
2140  ******************************************************************************/
2141 
2142 typedef struct acpi_table_pcct
2143 {
2144     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2145     UINT32                  Flags;
2146     UINT64                  Reserved;
2147 
2148 } ACPI_TABLE_PCCT;
2149 
2150 /* Values for Flags field above */
2151 
2152 #define ACPI_PCCT_DOORBELL              1
2153 
2154 /* Values for subtable type in ACPI_SUBTABLE_HEADER */
2155 
2156 enum AcpiPcctType
2157 {
2158     ACPI_PCCT_TYPE_GENERIC_SUBSPACE             = 0,
2159     ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE          = 1,
2160     ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2    = 2,    /* ACPI 6.1 */
2161     ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE      = 3,    /* ACPI 6.2 */
2162     ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE       = 4,    /* ACPI 6.2 */
2163     ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE         = 5,    /* ACPI 6.4 */
2164     ACPI_PCCT_TYPE_RESERVED                     = 6     /* 6 and greater are reserved */
2165 };
2166 
2167 /*
2168  * PCCT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
2169  */
2170 
2171 /* 0: Generic Communications Subspace */
2172 
2173 typedef struct acpi_pcct_subspace
2174 {
2175     ACPI_SUBTABLE_HEADER    Header;
2176     UINT8                   Reserved[6];
2177     UINT64                  BaseAddress;
2178     UINT64                  Length;
2179     ACPI_GENERIC_ADDRESS    DoorbellRegister;
2180     UINT64                  PreserveMask;
2181     UINT64                  WriteMask;
2182     UINT32                  Latency;
2183     UINT32                  MaxAccessRate;
2184     UINT16                  MinTurnaroundTime;
2185 
2186 } ACPI_PCCT_SUBSPACE;
2187 
2188 
2189 /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
2190 
2191 typedef struct acpi_pcct_hw_reduced
2192 {
2193     ACPI_SUBTABLE_HEADER    Header;
2194     UINT32                  PlatformInterrupt;
2195     UINT8                   Flags;
2196     UINT8                   Reserved;
2197     UINT64                  BaseAddress;
2198     UINT64                  Length;
2199     ACPI_GENERIC_ADDRESS    DoorbellRegister;
2200     UINT64                  PreserveMask;
2201     UINT64                  WriteMask;
2202     UINT32                  Latency;
2203     UINT32                  MaxAccessRate;
2204     UINT16                  MinTurnaroundTime;
2205 
2206 } ACPI_PCCT_HW_REDUCED;
2207 
2208 
2209 /* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
2210 
2211 typedef struct acpi_pcct_hw_reduced_type2
2212 {
2213     ACPI_SUBTABLE_HEADER    Header;
2214     UINT32                  PlatformInterrupt;
2215     UINT8                   Flags;
2216     UINT8                   Reserved;
2217     UINT64                  BaseAddress;
2218     UINT64                  Length;
2219     ACPI_GENERIC_ADDRESS    DoorbellRegister;
2220     UINT64                  PreserveMask;
2221     UINT64                  WriteMask;
2222     UINT32                  Latency;
2223     UINT32                  MaxAccessRate;
2224     UINT16                  MinTurnaroundTime;
2225     ACPI_GENERIC_ADDRESS    PlatformAckRegister;
2226     UINT64                  AckPreserveMask;
2227     UINT64                  AckWriteMask;
2228 
2229 } ACPI_PCCT_HW_REDUCED_TYPE2;
2230 
2231 
2232 /* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
2233 
2234 typedef struct acpi_pcct_ext_pcc_master
2235 {
2236     ACPI_SUBTABLE_HEADER    Header;
2237     UINT32                  PlatformInterrupt;
2238     UINT8                   Flags;
2239     UINT8                   Reserved1;
2240     UINT64                  BaseAddress;
2241     UINT32                  Length;
2242     ACPI_GENERIC_ADDRESS    DoorbellRegister;
2243     UINT64                  PreserveMask;
2244     UINT64                  WriteMask;
2245     UINT32                  Latency;
2246     UINT32                  MaxAccessRate;
2247     UINT32                  MinTurnaroundTime;
2248     ACPI_GENERIC_ADDRESS    PlatformAckRegister;
2249     UINT64                  AckPreserveMask;
2250     UINT64                  AckSetMask;
2251     UINT64                  Reserved2;
2252     ACPI_GENERIC_ADDRESS    CmdCompleteRegister;
2253     UINT64                  CmdCompleteMask;
2254     ACPI_GENERIC_ADDRESS    CmdUpdateRegister;
2255     UINT64                  CmdUpdatePreserveMask;
2256     UINT64                  CmdUpdateSetMask;
2257     ACPI_GENERIC_ADDRESS    ErrorStatusRegister;
2258     UINT64                  ErrorStatusMask;
2259 
2260 } ACPI_PCCT_EXT_PCC_MASTER;
2261 
2262 
2263 /* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
2264 
2265 typedef struct acpi_pcct_ext_pcc_slave
2266 {
2267     ACPI_SUBTABLE_HEADER    Header;
2268     UINT32                  PlatformInterrupt;
2269     UINT8                   Flags;
2270     UINT8                   Reserved1;
2271     UINT64                  BaseAddress;
2272     UINT32                  Length;
2273     ACPI_GENERIC_ADDRESS    DoorbellRegister;
2274     UINT64                  PreserveMask;
2275     UINT64                  WriteMask;
2276     UINT32                  Latency;
2277     UINT32                  MaxAccessRate;
2278     UINT32                  MinTurnaroundTime;
2279     ACPI_GENERIC_ADDRESS    PlatformAckRegister;
2280     UINT64                  AckPreserveMask;
2281     UINT64                  AckSetMask;
2282     UINT64                  Reserved2;
2283     ACPI_GENERIC_ADDRESS    CmdCompleteRegister;
2284     UINT64                  CmdCompleteMask;
2285     ACPI_GENERIC_ADDRESS    CmdUpdateRegister;
2286     UINT64                  CmdUpdatePreserveMask;
2287     UINT64                  CmdUpdateSetMask;
2288     ACPI_GENERIC_ADDRESS    ErrorStatusRegister;
2289     UINT64                  ErrorStatusMask;
2290 
2291 } ACPI_PCCT_EXT_PCC_SLAVE;
2292 
2293 /* 5: HW Registers based Communications Subspace */
2294 
2295 typedef struct acpi_pcct_hw_reg
2296 {
2297     ACPI_SUBTABLE_HEADER    Header;
2298     UINT16                  Version;
2299     UINT64                  BaseAddress;
2300     UINT64                  Length;
2301     ACPI_GENERIC_ADDRESS    DoorbellRegister;
2302     UINT64                  DoorbellPreserve;
2303     UINT64                  DoorbellWrite;
2304     ACPI_GENERIC_ADDRESS    CmdCompleteRegister;
2305     UINT64                  CmdCompleteMask;
2306     ACPI_GENERIC_ADDRESS    ErrorStatusRegister;
2307     UINT64                  ErrorStatusMask;
2308     UINT32                  NominalLatency;
2309     UINT32                  MinTurnaroundTime;
2310 
2311 } ACPI_PCCT_HW_REG;
2312 
2313 
2314 /* Values for doorbell flags above */
2315 
2316 #define ACPI_PCCT_INTERRUPT_POLARITY    (1)
2317 #define ACPI_PCCT_INTERRUPT_MODE        (1<<1)
2318 
2319 
2320 /*
2321  * PCC memory structures (not part of the ACPI table)
2322  */
2323 
2324 /* Shared Memory Region */
2325 
2326 typedef struct acpi_pcct_shared_memory
2327 {
2328     UINT32                  Signature;
2329     UINT16                  Command;
2330     UINT16                  Status;
2331 
2332 } ACPI_PCCT_SHARED_MEMORY;
2333 
2334 
2335 /* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
2336 
2337 typedef struct acpi_pcct_ext_pcc_shared_memory
2338 {
2339     UINT32                  Signature;
2340     UINT32                  Flags;
2341     UINT32                  Length;
2342     UINT32                  Command;
2343 
2344 } ACPI_PCCT_EXT_PCC_SHARED_MEMORY;
2345 
2346 
2347 /*******************************************************************************
2348  *
2349  * PDTT - Platform Debug Trigger Table (ACPI 6.2)
2350  *        Version 0
2351  *
2352  ******************************************************************************/
2353 
2354 typedef struct acpi_table_pdtt
2355 {
2356     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2357     UINT8                   TriggerCount;
2358     UINT8                   Reserved[3];
2359     UINT32                  ArrayOffset;
2360 
2361 } ACPI_TABLE_PDTT;
2362 
2363 
2364 /*
2365  * PDTT Communication Channel Identifier Structure.
2366  * The number of these structures is defined by TriggerCount above,
2367  * starting at ArrayOffset.
2368  */
2369 typedef struct acpi_pdtt_channel
2370 {
2371     UINT8                   SubchannelId;
2372     UINT8                   Flags;
2373 
2374 } ACPI_PDTT_CHANNEL;
2375 
2376 /* Flags for above */
2377 
2378 #define ACPI_PDTT_RUNTIME_TRIGGER           (1)
2379 #define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
2380 #define ACPI_PDTT_TRIGGER_ORDER             (1<<2)
2381 
2382 
2383 /*******************************************************************************
2384  *
2385  * PHAT - Platform Health Assessment Table (ACPI 6.4)
2386  *        Version 1
2387  *
2388  ******************************************************************************/
2389 
2390 typedef struct acpi_table_phat
2391 {
2392     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2393 
2394 } ACPI_TABLE_PHAT;
2395 
2396 /* Common header for PHAT subtables that follow main table */
2397 
2398 typedef struct acpi_phat_header
2399 {
2400     UINT16                  Type;
2401     UINT16                  Length;
2402     UINT8                   Revision;
2403 
2404 } ACPI_PHAT_HEADER;
2405 
2406 
2407 /* Values for Type field above */
2408 
2409 #define ACPI_PHAT_TYPE_FW_VERSION_DATA  0
2410 #define ACPI_PHAT_TYPE_FW_HEALTH_DATA   1
2411 #define ACPI_PHAT_TYPE_RESERVED         2 /* 0x02-0xFFFF are reserved */
2412 
2413 /*
2414  * PHAT subtables, correspond to Type in ACPI_PHAT_HEADER
2415  */
2416 
2417 /* 0: Firmware Version Data Record */
2418 
2419 typedef struct acpi_phat_version_data
2420 {
2421     ACPI_PHAT_HEADER        Header;
2422     UINT8                   Reserved[3];
2423     UINT32                  ElementCount;
2424 
2425 } ACPI_PHAT_VERSION_DATA;
2426 
2427 typedef struct acpi_phat_version_element
2428 {
2429     UINT8                   Guid[16];
2430     UINT64                  VersionValue;
2431     UINT32                  ProducerId;
2432 
2433 } ACPI_PHAT_VERSION_ELEMENT;
2434 
2435 
2436 /* 1: Firmware Health Data Record */
2437 
2438 typedef struct acpi_phat_health_data
2439 {
2440     ACPI_PHAT_HEADER        Header;
2441     UINT8                   Reserved[2];
2442     UINT8                   Health;
2443     UINT8                   DeviceGuid[16];
2444     UINT32                  DeviceSpecificOffset; /* Zero if no Device-specific data */
2445 
2446 } ACPI_PHAT_HEALTH_DATA;
2447 
2448 /* Values for Health field above */
2449 
2450 #define ACPI_PHAT_ERRORS_FOUND          0
2451 #define ACPI_PHAT_NO_ERRORS             1
2452 #define ACPI_PHAT_UNKNOWN_ERRORS        2
2453 #define ACPI_PHAT_ADVISORY              3
2454 
2455 
2456 /*******************************************************************************
2457  *
2458  * PMTT - Platform Memory Topology Table (ACPI 5.0)
2459  *        Version 1
2460  *
2461  ******************************************************************************/
2462 
2463 typedef struct acpi_table_pmtt
2464 {
2465     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2466     UINT32                  MemoryDeviceCount;
2467     /*
2468      * Immediately followed by:
2469      * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount];
2470      */
2471 
2472 } ACPI_TABLE_PMTT;
2473 
2474 
2475 /* Common header for PMTT subtables that follow main table */
2476 
2477 typedef struct acpi_pmtt_header
2478 {
2479     UINT8                   Type;
2480     UINT8                   Reserved1;
2481     UINT16                  Length;
2482     UINT16                  Flags;
2483     UINT16                  Reserved2;
2484     UINT32                  MemoryDeviceCount;  /* Zero means no memory device structs follow */
2485     /*
2486      * Immediately followed by:
2487      * UINT8 TypeSpecificData[]
2488      * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount];
2489      */
2490 
2491 } ACPI_PMTT_HEADER;
2492 
2493 /* Values for Type field above */
2494 
2495 #define ACPI_PMTT_TYPE_SOCKET           0
2496 #define ACPI_PMTT_TYPE_CONTROLLER       1
2497 #define ACPI_PMTT_TYPE_DIMM             2
2498 #define ACPI_PMTT_TYPE_RESERVED         3 /* 0x03-0xFE are reserved */
2499 #define ACPI_PMTT_TYPE_VENDOR           0xFF
2500 
2501 /* Values for Flags field above */
2502 
2503 #define ACPI_PMTT_TOP_LEVEL             0x0001
2504 #define ACPI_PMTT_PHYSICAL              0x0002
2505 #define ACPI_PMTT_MEMORY_TYPE           0x000C
2506 
2507 
2508 /*
2509  * PMTT subtables, correspond to Type in acpi_pmtt_header
2510  */
2511 
2512 
2513 /* 0: Socket Structure */
2514 
2515 typedef struct acpi_pmtt_socket
2516 {
2517     ACPI_PMTT_HEADER        Header;
2518     UINT16                  SocketId;
2519     UINT16                  Reserved;
2520 
2521 } ACPI_PMTT_SOCKET;
2522     /*
2523      * Immediately followed by:
2524      * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount];
2525      */
2526 
2527 
2528 /* 1: Memory Controller subtable */
2529 
2530 typedef struct acpi_pmtt_controller
2531 {
2532     ACPI_PMTT_HEADER        Header;
2533     UINT16                  ControllerId;
2534     UINT16                  Reserved;
2535 
2536 } ACPI_PMTT_CONTROLLER;
2537     /*
2538      * Immediately followed by:
2539      * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount];
2540      */
2541 
2542 
2543 /* 2: Physical Component Identifier (DIMM) */
2544 
2545 typedef struct acpi_pmtt_physical_component
2546 {
2547     ACPI_PMTT_HEADER        Header;
2548     UINT32                  BiosHandle;
2549 
2550 } ACPI_PMTT_PHYSICAL_COMPONENT;
2551 
2552 
2553 /* 0xFF: Vendor Specific Data */
2554 
2555 typedef struct acpi_pmtt_vendor_specific
2556 {
2557     ACPI_PMTT_HEADER        Header;
2558     UINT8                   TypeUuid[16];
2559     UINT8                   Specific[];
2560     /*
2561      * Immediately followed by:
2562      * UINT8 VendorSpecificData[];
2563      * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount];
2564      */
2565 
2566 } ACPI_PMTT_VENDOR_SPECIFIC;
2567 
2568 
2569 /*******************************************************************************
2570  *
2571  * PPTT - Processor Properties Topology Table (ACPI 6.2)
2572  *        Version 1
2573  *
2574  ******************************************************************************/
2575 
2576 typedef struct acpi_table_pptt
2577 {
2578     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2579 
2580 } ACPI_TABLE_PPTT;
2581 
2582 /* Values for Type field above */
2583 
2584 enum AcpiPpttType
2585 {
2586     ACPI_PPTT_TYPE_PROCESSOR            = 0,
2587     ACPI_PPTT_TYPE_CACHE                = 1,
2588     ACPI_PPTT_TYPE_ID                   = 2,
2589     ACPI_PPTT_TYPE_RESERVED             = 3
2590 };
2591 
2592 
2593 /* 0: Processor Hierarchy Node Structure */
2594 
2595 typedef struct acpi_pptt_processor
2596 {
2597     ACPI_SUBTABLE_HEADER    Header;
2598     UINT16                  Reserved;
2599     UINT32                  Flags;
2600     UINT32                  Parent;
2601     UINT32                  AcpiProcessorId;
2602     UINT32                  NumberOfPrivResources;
2603 
2604 } ACPI_PPTT_PROCESSOR;
2605 
2606 /* Flags */
2607 
2608 #define ACPI_PPTT_PHYSICAL_PACKAGE          (1)
2609 #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID   (1<<1)
2610 #define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD  (1<<2)  /* ACPI 6.3 */
2611 #define ACPI_PPTT_ACPI_LEAF_NODE            (1<<3)  /* ACPI 6.3 */
2612 #define ACPI_PPTT_ACPI_IDENTICAL            (1<<4)  /* ACPI 6.3 */
2613 
2614 
2615 /* 1: Cache Type Structure */
2616 
2617 typedef struct acpi_pptt_cache
2618 {
2619     ACPI_SUBTABLE_HEADER    Header;
2620     UINT16                  Reserved;
2621     UINT32                  Flags;
2622     UINT32                  NextLevelOfCache;
2623     UINT32                  Size;
2624     UINT32                  NumberOfSets;
2625     UINT8                   Associativity;
2626     UINT8                   Attributes;
2627     UINT16                  LineSize;
2628 
2629 } ACPI_PPTT_CACHE;
2630 
2631 /* 1: Cache Type Structure for PPTT version 3 */
2632 
2633 typedef struct acpi_pptt_cache_v1
2634 {
2635     UINT32                  CacheId;
2636 
2637 } ACPI_PPTT_CACHE_V1;
2638 
2639 
2640 /* Flags */
2641 
2642 #define ACPI_PPTT_SIZE_PROPERTY_VALID       (1)     /* Physical property valid */
2643 #define ACPI_PPTT_NUMBER_OF_SETS_VALID      (1<<1)  /* Number of sets valid */
2644 #define ACPI_PPTT_ASSOCIATIVITY_VALID       (1<<2)  /* Associativity valid */
2645 #define ACPI_PPTT_ALLOCATION_TYPE_VALID     (1<<3)  /* Allocation type valid */
2646 #define ACPI_PPTT_CACHE_TYPE_VALID          (1<<4)  /* Cache type valid */
2647 #define ACPI_PPTT_WRITE_POLICY_VALID        (1<<5)  /* Write policy valid */
2648 #define ACPI_PPTT_LINE_SIZE_VALID           (1<<6)  /* Line size valid */
2649 #define ACPI_PPTT_CACHE_ID_VALID            (1<<7)  /* Cache ID valid */
2650 
2651 /* Masks for Attributes */
2652 
2653 #define ACPI_PPTT_MASK_ALLOCATION_TYPE      (0x03)  /* Allocation type */
2654 #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)  /* Cache type */
2655 #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)  /* Write policy */
2656 
2657 /* Attributes describing cache */
2658 #define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)   /* Cache line is allocated on read */
2659 #define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)  /* Cache line is allocated on write */
2660 #define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)  /* Cache line is allocated on read and write */
2661 #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)  /* Alternate representation of above */
2662 
2663 #define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)   /* Data cache */
2664 #define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)  /* Instruction cache */
2665 #define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)  /* Unified I & D cache */
2666 #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)  /* Alternate representation of above */
2667 
2668 #define ACPI_PPTT_CACHE_POLICY_WB           (0x0)   /* Cache is write back */
2669 #define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)  /* Cache is write through */
2670 
2671 /* 2: ID Structure */
2672 
2673 typedef struct acpi_pptt_id
2674 {
2675     ACPI_SUBTABLE_HEADER    Header;
2676     UINT16                  Reserved;
2677     UINT32                  VendorId;
2678     UINT64                  Level1Id;
2679     UINT64                  Level2Id;
2680     UINT16                  MajorRev;
2681     UINT16                  MinorRev;
2682     UINT16                  SpinRev;
2683 
2684 } ACPI_PPTT_ID;
2685 
2686 
2687 /*******************************************************************************
2688  *
2689  * PRMT - Platform Runtime Mechanism Table
2690  *        Version 1
2691  *
2692  ******************************************************************************/
2693 
2694 typedef struct acpi_table_prmt
2695 {
2696     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2697 
2698 } ACPI_TABLE_PRMT;
2699 
2700 typedef struct acpi_table_prmt_header
2701 {
2702     UINT8                   PlatformGuid[16];
2703     UINT32                  ModuleInfoOffset;
2704     UINT32                  ModuleInfoCount;
2705 
2706 } ACPI_TABLE_PRMT_HEADER;
2707 
2708 typedef struct acpi_prmt_module_header
2709 {
2710 	UINT16                  Revision;
2711 	UINT16                  Length;
2712 
2713 } ACPI_PRMT_MODULE_HEADER;
2714 
2715 typedef struct acpi_prmt_module_info
2716 {
2717     UINT16                  Revision;
2718     UINT16                  Length;
2719     UINT8                   ModuleGuid[16];
2720     UINT16                  MajorRev;
2721     UINT16                  MinorRev;
2722     UINT16                  HandlerInfoCount;
2723     UINT32                  HandlerInfoOffset;
2724     UINT64                  MmioListPointer;
2725 
2726 } ACPI_PRMT_MODULE_INFO;
2727 
2728 typedef struct acpi_prmt_handler_info
2729 {
2730     UINT16                  Revision;
2731     UINT16                  Length;
2732     UINT8                   HandlerGuid[16];
2733     UINT64                  HandlerAddress;
2734     UINT64                  StaticDataBufferAddress;
2735     UINT64                  AcpiParamBufferAddress;
2736 
2737 } ACPI_PRMT_HANDLER_INFO;
2738 
2739 
2740 /*******************************************************************************
2741  *
2742  * RASF - RAS Feature Table (ACPI 5.0)
2743  *        Version 1
2744  *
2745  ******************************************************************************/
2746 
2747 typedef struct acpi_table_rasf
2748 {
2749     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2750     UINT8                   ChannelId[12];
2751 
2752 } ACPI_TABLE_RASF;
2753 
2754 /* RASF Platform Communication Channel Shared Memory Region */
2755 
2756 typedef struct acpi_rasf_shared_memory
2757 {
2758     UINT32                  Signature;
2759     UINT16                  Command;
2760     UINT16                  Status;
2761     UINT16                  Version;
2762     UINT8                   Capabilities[16];
2763     UINT8                   SetCapabilities[16];
2764     UINT16                  NumParameterBlocks;
2765     UINT32                  SetCapabilitiesStatus;
2766 
2767 } ACPI_RASF_SHARED_MEMORY;
2768 
2769 /* RASF Parameter Block Structure Header */
2770 
2771 typedef struct acpi_rasf_parameter_block
2772 {
2773     UINT16                  Type;
2774     UINT16                  Version;
2775     UINT16                  Length;
2776 
2777 } ACPI_RASF_PARAMETER_BLOCK;
2778 
2779 /* RASF Parameter Block Structure for PATROL_SCRUB */
2780 
2781 typedef struct acpi_rasf_patrol_scrub_parameter
2782 {
2783     ACPI_RASF_PARAMETER_BLOCK   Header;
2784     UINT16                      PatrolScrubCommand;
2785     UINT64                      RequestedAddressRange[2];
2786     UINT64                      ActualAddressRange[2];
2787     UINT16                      Flags;
2788     UINT8                       RequestedSpeed;
2789 
2790 } ACPI_RASF_PATROL_SCRUB_PARAMETER;
2791 
2792 /* Masks for Flags and Speed fields above */
2793 
2794 #define ACPI_RASF_SCRUBBER_RUNNING      1
2795 #define ACPI_RASF_SPEED                 (7<<1)
2796 #define ACPI_RASF_SPEED_SLOW            (0<<1)
2797 #define ACPI_RASF_SPEED_MEDIUM          (4<<1)
2798 #define ACPI_RASF_SPEED_FAST            (7<<1)
2799 
2800 /* Channel Commands */
2801 
2802 enum AcpiRasfCommands
2803 {
2804     ACPI_RASF_EXECUTE_RASF_COMMAND      = 1
2805 };
2806 
2807 /* Platform RAS Capabilities */
2808 
2809 enum AcpiRasfCapabiliities
2810 {
2811     ACPI_HW_PATROL_SCRUB_SUPPORTED      = 0,
2812     ACPI_SW_PATROL_SCRUB_EXPOSED        = 1
2813 };
2814 
2815 /* Patrol Scrub Commands */
2816 
2817 enum AcpiRasfPatrolScrubCommands
2818 {
2819     ACPI_RASF_GET_PATROL_PARAMETERS     = 1,
2820     ACPI_RASF_START_PATROL_SCRUBBER     = 2,
2821     ACPI_RASF_STOP_PATROL_SCRUBBER      = 3
2822 };
2823 
2824 /* Channel Command flags */
2825 
2826 #define ACPI_RASF_GENERATE_SCI          (1<<15)
2827 
2828 /* Status values */
2829 
2830 enum AcpiRasfStatus
2831 {
2832     ACPI_RASF_SUCCESS                   = 0,
2833     ACPI_RASF_NOT_VALID                 = 1,
2834     ACPI_RASF_NOT_SUPPORTED             = 2,
2835     ACPI_RASF_BUSY                      = 3,
2836     ACPI_RASF_FAILED                    = 4,
2837     ACPI_RASF_ABORTED                   = 5,
2838     ACPI_RASF_INVALID_DATA              = 6
2839 };
2840 
2841 /* Status flags */
2842 
2843 #define ACPI_RASF_COMMAND_COMPLETE      (1)
2844 #define ACPI_RASF_SCI_DOORBELL          (1<<1)
2845 #define ACPI_RASF_ERROR                 (1<<2)
2846 #define ACPI_RASF_STATUS                (0x1F<<3)
2847 
2848 
2849 /*******************************************************************************
2850  *
2851  * RGRT - Regulatory Graphics Resource Table
2852  *        Version 1
2853  *
2854  * Conforms to "ACPI RGRT" available at:
2855  * https://microsoft.github.io/mu/dyn/mu_plus/MsCorePkg/AcpiRGRT/feature_acpi_rgrt/
2856  *
2857  ******************************************************************************/
2858 
2859 typedef struct acpi_table_rgrt
2860 {
2861     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2862     UINT16                  Version;
2863     UINT8                   ImageType;
2864     UINT8                   Reserved;
2865     UINT8                   Image[0];
2866 
2867 } ACPI_TABLE_RGRT;
2868 
2869 /* ImageType values */
2870 
2871 enum AcpiRgrtImageType
2872 {
2873     ACPI_RGRT_TYPE_RESERVED0            = 0,
2874     ACPI_RGRT_IMAGE_TYPE_PNG            = 1,
2875     ACPI_RGRT_TYPE_RESERVED             = 2     /* 2 and greater are reserved */
2876 };
2877 
2878 
2879 /*******************************************************************************
2880  *
2881  * SBST - Smart Battery Specification Table
2882  *        Version 1
2883  *
2884  ******************************************************************************/
2885 
2886 typedef struct acpi_table_sbst
2887 {
2888     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2889     UINT32                  WarningLevel;
2890     UINT32                  LowLevel;
2891     UINT32                  CriticalLevel;
2892 
2893 } ACPI_TABLE_SBST;
2894 
2895 
2896 /*******************************************************************************
2897  *
2898  * SDEI - Software Delegated Exception Interface Descriptor Table
2899  *
2900  * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
2901  * May 8th, 2017. Copyright 2017 ARM Ltd.
2902  *
2903  ******************************************************************************/
2904 
2905 typedef struct acpi_table_sdei
2906 {
2907     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2908 
2909 } ACPI_TABLE_SDEI;
2910 
2911 
2912 /*******************************************************************************
2913  *
2914  * SDEV - Secure Devices Table (ACPI 6.2)
2915  *        Version 1
2916  *
2917  ******************************************************************************/
2918 
2919 typedef struct acpi_table_sdev
2920 {
2921     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
2922 
2923 } ACPI_TABLE_SDEV;
2924 
2925 
2926 typedef struct acpi_sdev_header
2927 {
2928     UINT8                   Type;
2929     UINT8                   Flags;
2930     UINT16                  Length;
2931 
2932 } ACPI_SDEV_HEADER;
2933 
2934 
2935 /* Values for subtable type above */
2936 
2937 enum AcpiSdevType
2938 {
2939     ACPI_SDEV_TYPE_NAMESPACE_DEVICE     = 0,
2940     ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
2941     ACPI_SDEV_TYPE_RESERVED             = 2     /* 2 and greater are reserved */
2942 };
2943 
2944 /* Values for flags above */
2945 
2946 #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
2947 #define ACPI_SDEV_SECURE_COMPONENTS_PRESENT (1<<1)
2948 
2949 /*
2950  * SDEV subtables
2951  */
2952 
2953 /* 0: Namespace Device Based Secure Device Structure */
2954 
2955 typedef struct acpi_sdev_namespace
2956 {
2957     ACPI_SDEV_HEADER        Header;
2958     UINT16                  DeviceIdOffset;
2959     UINT16                  DeviceIdLength;
2960     UINT16                  VendorDataOffset;
2961     UINT16                  VendorDataLength;
2962 
2963 } ACPI_SDEV_NAMESPACE;
2964 
2965 typedef struct acpi_sdev_secure_component
2966 {
2967     UINT16                  SecureComponentOffset;
2968     UINT16                  SecureComponentLength;
2969 
2970 } ACPI_SDEV_SECURE_COMPONENT;
2971 
2972 
2973 /*
2974  * SDEV sub-subtables ("Components") for above
2975  */
2976 typedef struct acpi_sdev_component
2977 {
2978     ACPI_SDEV_HEADER        Header;
2979 
2980 } ACPI_SDEV_COMPONENT;
2981 
2982 
2983 /* Values for sub-subtable type above */
2984 
2985 enum AcpiSacType
2986 {
2987     ACPI_SDEV_TYPE_ID_COMPONENT     = 0,
2988     ACPI_SDEV_TYPE_MEM_COMPONENT    = 1
2989 };
2990 
2991 typedef struct acpi_sdev_id_component
2992 {
2993     ACPI_SDEV_HEADER        Header;
2994     UINT16                  HardwareIdOffset;
2995     UINT16                  HardwareIdLength;
2996     UINT16                  SubsystemIdOffset;
2997     UINT16                  SubsystemIdLength;
2998     UINT16                  HardwareRevision;
2999     UINT8                   HardwareRevPresent;
3000     UINT8                   ClassCodePresent;
3001     UINT8                   PciBaseClass;
3002     UINT8                   PciSubClass;
3003     UINT8                   PciProgrammingXface;
3004 
3005 } ACPI_SDEV_ID_COMPONENT;
3006 
3007 typedef struct acpi_sdev_mem_component
3008 {
3009     ACPI_SDEV_HEADER        Header;
3010     UINT32                  Reserved;
3011     UINT64                  MemoryBaseAddress;
3012     UINT64                  MemoryLength;
3013 
3014 } ACPI_SDEV_MEM_COMPONENT;
3015 
3016 
3017 /* 1: PCIe Endpoint Device Based Device Structure */
3018 
3019 typedef struct acpi_sdev_pcie
3020 {
3021     ACPI_SDEV_HEADER        Header;
3022     UINT16                  Segment;
3023     UINT16                  StartBus;
3024     UINT16                  PathOffset;
3025     UINT16                  PathLength;
3026     UINT16                  VendorDataOffset;
3027     UINT16                  VendorDataLength;
3028 
3029 } ACPI_SDEV_PCIE;
3030 
3031 /* 1a: PCIe Endpoint path entry */
3032 
3033 typedef struct acpi_sdev_pcie_path
3034 {
3035     UINT8                   Device;
3036     UINT8                   Function;
3037 
3038 } ACPI_SDEV_PCIE_PATH;
3039 
3040 
3041 /*******************************************************************************
3042  *
3043  * SVKL - Storage Volume Key Location Table (ACPI 6.4)
3044  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
3045  *        Trust Domain Extensions (Intel TDX)".
3046  *        Version 1
3047  *
3048  ******************************************************************************/
3049 
3050 typedef struct acpi_table_svkl
3051 {
3052     ACPI_TABLE_HEADER       Header; /* Common ACPI table header */
3053     UINT32                  Count;
3054 
3055 } ACPI_TABLE_SVKL;
3056 
3057 typedef struct acpi_svkl_key
3058 {
3059     UINT16                  Type;
3060     UINT16                  Format;
3061     UINT32                  Size;
3062     UINT64                  Address;
3063 
3064 } ACPI_SVKL_KEY;
3065 
3066 enum acpi_svkl_type
3067 {
3068     ACPI_SVKL_TYPE_MAIN_STORAGE = 0,
3069     ACPI_SVKL_TYPE_RESERVED     = 1 /* 1 and greater are reserved */
3070 };
3071 
3072 enum acpi_svkl_format
3073 {
3074     ACPI_SVKL_FORMAT_RAW_BINARY = 0,
3075     ACPI_SVKL_FORMAT_RESERVED   = 1 /* 1 and greater are reserved */
3076 };
3077 
3078 
3079 /*******************************************************************************
3080  *
3081  * TDEL - TD-Event Log
3082  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
3083  *        Trust Domain Extensions (Intel TDX)".
3084  *        September 2020
3085  *
3086  ******************************************************************************/
3087 
3088 typedef struct acpi_table_tdel
3089 {
3090     ACPI_TABLE_HEADER       Header; /* Common ACPI table header */
3091     UINT32                  Reserved;
3092     UINT64                  LogAreaMinimumLength;
3093     UINT64                  LogAreaStartAddress;
3094 
3095 } ACPI_TABLE_TDEL;
3096 
3097 /* Reset to default packing */
3098 
3099 #pragma pack()
3100 
3101 #endif /* __ACTBL2_H__ */
3102