1 /******************************************************************************
3 * Module Name: dttable1.c - handling for specific ACPI tables
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12 * All rights reserved.
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
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
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;
37 * The above copyright and patent license is granted only if the following
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.
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
80 * 4. Disclaimer and Export Compliance
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
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
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.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
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.
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.
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.
150 *****************************************************************************/
152 /* Compile all complex data tables, signatures starting with A-I */
154 #include "aslcompiler.h"
156 #define _COMPONENT DT_COMPILER
157 ACPI_MODULE_NAME ("dttable1")
160 static ACPI_DMTABLE_INFO TableInfoAsfAddress[] =
162 {ACPI_DMT_BUFFER, 0, "Addresses", 0},
163 {ACPI_DMT_EXIT, 0, NULL, 0}
166 static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] =
168 {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0},
169 {ACPI_DMT_EXIT, 0, NULL, 0}
173 /******************************************************************************
175 * FUNCTION: DtCompileAsf
177 * PARAMETERS: List - Current field list pointer
181 * DESCRIPTION: Compile ASF!.
183 *****************************************************************************/
189 ACPI_ASF_INFO *AsfTable;
190 DT_SUBTABLE *Subtable;
191 DT_SUBTABLE *ParentTable;
192 ACPI_DMTABLE_INFO *InfoTable;
193 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
194 UINT32 DataCount = 0;
197 DT_FIELD **PFieldList = (DT_FIELD **) List;
198 DT_FIELD *SubtableStart;
203 SubtableStart = *PFieldList;
204 Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr,
206 if (ACPI_FAILURE (Status))
211 ParentTable = DtPeekSubtable ();
212 DtInsertSubtable (ParentTable, Subtable);
213 DtPushSubtable (Subtable);
215 AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer);
217 switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
219 case ACPI_ASF_TYPE_INFO:
221 InfoTable = AcpiDmTableInfoAsf0;
224 case ACPI_ASF_TYPE_ALERT:
226 InfoTable = AcpiDmTableInfoAsf1;
229 case ACPI_ASF_TYPE_CONTROL:
231 InfoTable = AcpiDmTableInfoAsf2;
234 case ACPI_ASF_TYPE_BOOT:
236 InfoTable = AcpiDmTableInfoAsf3;
239 case ACPI_ASF_TYPE_ADDRESS:
241 InfoTable = AcpiDmTableInfoAsf4;
246 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
250 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
251 if (ACPI_FAILURE (Status))
256 ParentTable = DtPeekSubtable ();
257 DtInsertSubtable (ParentTable, Subtable);
259 switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
261 case ACPI_ASF_TYPE_INFO:
263 DataInfoTable = NULL;
266 case ACPI_ASF_TYPE_ALERT:
268 DataInfoTable = AcpiDmTableInfoAsf1a;
269 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT,
270 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
271 sizeof (ACPI_ASF_HEADER)))->Alerts;
274 case ACPI_ASF_TYPE_CONTROL:
276 DataInfoTable = AcpiDmTableInfoAsf2a;
277 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE,
278 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
279 sizeof (ACPI_ASF_HEADER)))->Controls;
282 case ACPI_ASF_TYPE_BOOT:
284 DataInfoTable = NULL;
287 case ACPI_ASF_TYPE_ADDRESS:
289 DataInfoTable = TableInfoAsfAddress;
290 DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS,
291 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
292 sizeof (ACPI_ASF_HEADER)))->Devices;
297 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
303 switch (AsfTable->Header.Type & 0x7F)
305 case ACPI_ASF_TYPE_ADDRESS:
307 while (DataCount > 0)
309 Status = DtCompileTable (PFieldList, DataInfoTable,
311 if (ACPI_FAILURE (Status))
316 DtInsertSubtable (ParentTable, Subtable);
317 DataCount = DataCount - Subtable->Length;
323 for (i = 0; i < DataCount; i++)
325 Status = DtCompileTable (PFieldList, DataInfoTable,
327 if (ACPI_FAILURE (Status))
332 DtInsertSubtable (ParentTable, Subtable);
345 /******************************************************************************
347 * FUNCTION: DtCompileCedt
349 * PARAMETERS: List - Current field list pointer
353 * DESCRIPTION: Compile CEDT.
355 *****************************************************************************/
362 DT_SUBTABLE *Subtable;
363 DT_SUBTABLE *ParentTable;
364 DT_FIELD **PFieldList = (DT_FIELD **) List;
365 ACPI_CEDT_HEADER *CedtHeader;
366 DT_FIELD *SubtableStart;
369 /* Walk the parse tree */
373 SubtableStart = *PFieldList;
377 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedtHdr,
379 if (ACPI_FAILURE (Status))
384 ParentTable = DtPeekSubtable ();
385 DtInsertSubtable (ParentTable, Subtable);
386 DtPushSubtable (Subtable);
388 CedtHeader = ACPI_CAST_PTR (ACPI_CEDT_HEADER, Subtable->Buffer);
390 switch (CedtHeader->Type)
392 case ACPI_CEDT_TYPE_CHBS:
398 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "CEDT");
404 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt0, &Subtable);
405 if (ACPI_FAILURE (Status))
410 ParentTable = DtPeekSubtable ();
411 DtInsertSubtable (ParentTable, Subtable);
419 /******************************************************************************
421 * FUNCTION: DtCompileCpep
423 * PARAMETERS: List - Current field list pointer
427 * DESCRIPTION: Compile CPEP.
429 *****************************************************************************/
438 Status = DtCompileTwoSubtables (List,
439 AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0);
444 /******************************************************************************
446 * FUNCTION: DtCompileCsrt
448 * PARAMETERS: List - Current field list pointer
452 * DESCRIPTION: Compile CSRT.
454 *****************************************************************************/
460 ACPI_STATUS Status = AE_OK;
461 DT_SUBTABLE *Subtable;
462 DT_SUBTABLE *ParentTable;
463 DT_FIELD **PFieldList = (DT_FIELD **) List;
464 UINT32 DescriptorCount;
468 /* Subtables (Resource Groups) */
470 ParentTable = DtPeekSubtable ();
473 /* Resource group subtable */
475 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt0,
477 if (ACPI_FAILURE (Status))
482 /* Compute the number of resource descriptors */
485 (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
486 Subtable->Buffer))->Length -
487 (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
488 Subtable->Buffer))->SharedInfoLength -
489 sizeof (ACPI_CSRT_GROUP);
491 DescriptorCount = (GroupLength /
492 sizeof (ACPI_CSRT_DESCRIPTOR));
494 DtInsertSubtable (ParentTable, Subtable);
495 DtPushSubtable (Subtable);
496 ParentTable = DtPeekSubtable ();
498 /* Shared info subtable (One per resource group) */
500 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt1,
502 if (ACPI_FAILURE (Status))
507 DtInsertSubtable (ParentTable, Subtable);
509 /* Sub-Subtables (Resource Descriptors) */
511 while (*PFieldList && DescriptorCount)
514 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2,
516 if (ACPI_FAILURE (Status))
521 DtInsertSubtable (ParentTable, Subtable);
523 DtPushSubtable (Subtable);
524 ParentTable = DtPeekSubtable ();
527 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a,
529 if (ACPI_FAILURE (Status))
535 DtInsertSubtable (ParentTable, Subtable);
540 ParentTable = DtPeekSubtable ();
545 ParentTable = DtPeekSubtable ();
552 /******************************************************************************
554 * FUNCTION: DtCompileDbg2
556 * PARAMETERS: List - Current field list pointer
560 * DESCRIPTION: Compile DBG2.
562 *****************************************************************************/
569 DT_SUBTABLE *Subtable;
570 DT_SUBTABLE *ParentTable;
571 DT_FIELD **PFieldList = (DT_FIELD **) List;
572 UINT32 SubtableCount;
573 ACPI_DBG2_HEADER *Dbg2Header;
574 ACPI_DBG2_DEVICE *DeviceInfo;
575 UINT16 CurrentOffset;
581 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2, &Subtable);
582 if (ACPI_FAILURE (Status))
587 ParentTable = DtPeekSubtable ();
588 DtInsertSubtable (ParentTable, Subtable);
590 /* Main table fields */
592 Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
593 Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
594 ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
596 SubtableCount = Dbg2Header->InfoCount;
597 DtPushSubtable (Subtable);
599 /* Process all Device Information subtables (Count = InfoCount) */
601 while (*PFieldList && SubtableCount)
603 /* Subtable: Debug Device Information */
605 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Device,
607 if (ACPI_FAILURE (Status))
612 DeviceInfo = ACPI_CAST_PTR (ACPI_DBG2_DEVICE, Subtable->Buffer);
613 CurrentOffset = (UINT16) sizeof (ACPI_DBG2_DEVICE);
615 ParentTable = DtPeekSubtable ();
616 DtInsertSubtable (ParentTable, Subtable);
617 DtPushSubtable (Subtable);
619 ParentTable = DtPeekSubtable ();
621 /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
623 DeviceInfo->BaseAddressOffset = CurrentOffset;
624 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
626 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
628 if (ACPI_FAILURE (Status))
633 CurrentOffset += (UINT16) sizeof (ACPI_GENERIC_ADDRESS);
634 DtInsertSubtable (ParentTable, Subtable);
637 /* AddressSize array (Required, size = RegisterCount) */
639 DeviceInfo->AddressSizeOffset = CurrentOffset;
640 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
642 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
644 if (ACPI_FAILURE (Status))
649 CurrentOffset += (UINT16) sizeof (UINT32);
650 DtInsertSubtable (ParentTable, Subtable);
653 /* NamespaceString device identifier (Required, size = NamePathLength) */
655 DeviceInfo->NamepathOffset = CurrentOffset;
656 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
658 if (ACPI_FAILURE (Status))
663 /* Update the device info header */
665 DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
666 CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
667 DtInsertSubtable (ParentTable, Subtable);
669 /* OemData - Variable-length data (Optional, size = OemDataLength) */
671 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData,
673 if (Status == AE_END_OF_TABLE)
675 /* optional field was not found and we're at the end of the file */
679 else if (ACPI_FAILURE (Status))
684 /* Update the device info header (zeros if no OEM data present) */
686 DeviceInfo->OemDataOffset = 0;
687 DeviceInfo->OemDataLength = 0;
689 /* Optional subtable (OemData) */
691 if (Subtable && Subtable->Length)
693 DeviceInfo->OemDataOffset = CurrentOffset;
694 DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
696 DtInsertSubtable (ParentTable, Subtable);
700 DtPopSubtable (); /* Get next Device Information subtable */
708 /******************************************************************************
710 * FUNCTION: DtCompileDmar
712 * PARAMETERS: List - Current field list pointer
716 * DESCRIPTION: Compile DMAR.
718 *****************************************************************************/
725 DT_SUBTABLE *Subtable;
726 DT_SUBTABLE *ParentTable;
727 DT_FIELD **PFieldList = (DT_FIELD **) List;
728 DT_FIELD *SubtableStart;
729 ACPI_DMTABLE_INFO *InfoTable;
730 ACPI_DMAR_HEADER *DmarHeader;
731 ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
732 UINT32 DeviceScopeLength;
733 UINT32 PciPathLength;
736 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
737 if (ACPI_FAILURE (Status))
742 ParentTable = DtPeekSubtable ();
743 DtInsertSubtable (ParentTable, Subtable);
744 DtPushSubtable (Subtable);
750 SubtableStart = *PFieldList;
751 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr,
753 if (ACPI_FAILURE (Status))
758 ParentTable = DtPeekSubtable ();
759 DtInsertSubtable (ParentTable, Subtable);
760 DtPushSubtable (Subtable);
762 DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
764 switch (DmarHeader->Type)
766 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
768 InfoTable = AcpiDmTableInfoDmar0;
771 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
773 InfoTable = AcpiDmTableInfoDmar1;
776 case ACPI_DMAR_TYPE_ROOT_ATS:
778 InfoTable = AcpiDmTableInfoDmar2;
781 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
783 InfoTable = AcpiDmTableInfoDmar3;
786 case ACPI_DMAR_TYPE_NAMESPACE:
788 InfoTable = AcpiDmTableInfoDmar4;
793 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR");
799 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
800 if (ACPI_FAILURE (Status))
805 ParentTable = DtPeekSubtable ();
806 DtInsertSubtable (ParentTable, Subtable);
809 * Optional Device Scope subtables
811 if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
812 (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
814 /* These types do not support device scopes */
820 DtPushSubtable (Subtable);
821 DeviceScopeLength = DmarHeader->Length - Subtable->Length -
823 while (DeviceScopeLength)
825 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
827 if (Status == AE_NOT_FOUND)
832 ParentTable = DtPeekSubtable ();
833 DtInsertSubtable (ParentTable, Subtable);
834 DtPushSubtable (Subtable);
836 DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer);
838 /* Optional PCI Paths */
840 PciPathLength = DmarDeviceScope->Length - Subtable->Length;
841 while (PciPathLength)
843 Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
845 if (Status == AE_NOT_FOUND)
851 ParentTable = DtPeekSubtable ();
852 DtInsertSubtable (ParentTable, Subtable);
853 PciPathLength -= Subtable->Length;
857 DeviceScopeLength -= DmarDeviceScope->Length;
868 /******************************************************************************
870 * FUNCTION: DtCompileDrtm
872 * PARAMETERS: List - Current field list pointer
876 * DESCRIPTION: Compile DRTM.
878 *****************************************************************************/
885 DT_SUBTABLE *Subtable;
886 DT_SUBTABLE *ParentTable;
887 DT_FIELD **PFieldList = (DT_FIELD **) List;
889 /* ACPI_TABLE_DRTM *Drtm; */
890 ACPI_DRTM_VTABLE_LIST *DrtmVtl;
891 ACPI_DRTM_RESOURCE_LIST *DrtmRl;
892 /* ACPI_DRTM_DPS_ID *DrtmDps; */
895 ParentTable = DtPeekSubtable ();
897 /* Compile DRTM header */
899 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm,
901 if (ACPI_FAILURE (Status))
905 DtInsertSubtable (ParentTable, Subtable);
908 * Using ACPI_SUB_PTR, We needn't define a separate structure. Care
909 * should be taken to avoid accessing ACPI_TABLE_HADER fields.
912 Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM,
913 Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
917 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0,
919 if (ACPI_FAILURE (Status))
924 DtInsertSubtable (ParentTable, Subtable);
925 DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer);
927 DtPushSubtable (Subtable);
928 ParentTable = DtPeekSubtable ();
933 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a,
935 if (ACPI_FAILURE (Status))
943 DtInsertSubtable (ParentTable, Subtable);
947 DrtmVtl->ValidatedTableCount = Count;
949 ParentTable = DtPeekSubtable ();
953 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1,
955 if (ACPI_FAILURE (Status))
960 DtInsertSubtable (ParentTable, Subtable);
961 DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer);
963 DtPushSubtable (Subtable);
964 ParentTable = DtPeekSubtable ();
969 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a,
971 if (ACPI_FAILURE (Status))
981 DtInsertSubtable (ParentTable, Subtable);
985 DrtmRl->ResourceCount = Count;
987 ParentTable = DtPeekSubtable ();
991 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2,
993 if (ACPI_FAILURE (Status))
997 DtInsertSubtable (ParentTable, Subtable);
998 /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/
1005 /******************************************************************************
1007 * FUNCTION: DtCompileEinj
1009 * PARAMETERS: List - Current field list pointer
1013 * DESCRIPTION: Compile EINJ.
1015 *****************************************************************************/
1024 Status = DtCompileTwoSubtables (List,
1025 AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0);
1030 /******************************************************************************
1032 * FUNCTION: DtCompileErst
1034 * PARAMETERS: List - Current field list pointer
1038 * DESCRIPTION: Compile ERST.
1040 *****************************************************************************/
1049 Status = DtCompileTwoSubtables (List,
1050 AcpiDmTableInfoErst, AcpiDmTableInfoEinj0);
1055 /******************************************************************************
1057 * FUNCTION: DtCompileGtdt
1059 * PARAMETERS: List - Current field list pointer
1063 * DESCRIPTION: Compile GTDT.
1065 *****************************************************************************/
1072 DT_SUBTABLE *Subtable;
1073 DT_SUBTABLE *ParentTable;
1074 DT_FIELD **PFieldList = (DT_FIELD **) List;
1075 DT_FIELD *SubtableStart;
1076 ACPI_SUBTABLE_HEADER *GtdtHeader;
1077 ACPI_DMTABLE_INFO *InfoTable;
1079 ACPI_TABLE_HEADER *Header;
1082 ParentTable = DtPeekSubtable ();
1084 Header = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
1086 /* Compile the main table */
1088 Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt,
1090 if (ACPI_FAILURE (Status))
1095 /* GTDT revision 3 later contains 2 extra fields before subtables */
1097 if (Header->Revision > 2)
1099 ParentTable = DtPeekSubtable ();
1100 DtInsertSubtable (ParentTable, Subtable);
1102 Status = DtCompileTable (PFieldList,
1103 AcpiDmTableInfoGtdtEl2, &Subtable);
1104 if (ACPI_FAILURE (Status))
1110 ParentTable = DtPeekSubtable ();
1111 DtInsertSubtable (ParentTable, Subtable);
1115 SubtableStart = *PFieldList;
1116 Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdtHdr,
1118 if (ACPI_FAILURE (Status))
1123 ParentTable = DtPeekSubtable ();
1124 DtInsertSubtable (ParentTable, Subtable);
1125 DtPushSubtable (Subtable);
1127 GtdtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1129 switch (GtdtHeader->Type)
1131 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1133 InfoTable = AcpiDmTableInfoGtdt0;
1136 case ACPI_GTDT_TYPE_WATCHDOG:
1138 InfoTable = AcpiDmTableInfoGtdt1;
1143 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "GTDT");
1147 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1148 if (ACPI_FAILURE (Status))
1153 ParentTable = DtPeekSubtable ();
1154 DtInsertSubtable (ParentTable, Subtable);
1157 * Additional GT block subtable data
1160 switch (GtdtHeader->Type)
1162 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1164 DtPushSubtable (Subtable);
1165 ParentTable = DtPeekSubtable ();
1167 GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1168 Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
1172 Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt0a,
1174 if (ACPI_FAILURE (Status))
1179 DtInsertSubtable (ParentTable, Subtable);
1198 /******************************************************************************
1200 * FUNCTION: DtCompileFpdt
1202 * PARAMETERS: List - Current field list pointer
1206 * DESCRIPTION: Compile FPDT.
1208 *****************************************************************************/
1215 ACPI_FPDT_HEADER *FpdtHeader;
1216 DT_SUBTABLE *Subtable;
1217 DT_SUBTABLE *ParentTable;
1218 ACPI_DMTABLE_INFO *InfoTable;
1219 DT_FIELD **PFieldList = (DT_FIELD **) List;
1220 DT_FIELD *SubtableStart;
1225 SubtableStart = *PFieldList;
1226 Status = DtCompileTable (PFieldList, AcpiDmTableInfoFpdtHdr,
1228 if (ACPI_FAILURE (Status))
1233 ParentTable = DtPeekSubtable ();
1234 DtInsertSubtable (ParentTable, Subtable);
1235 DtPushSubtable (Subtable);
1237 FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1239 switch (FpdtHeader->Type)
1241 case ACPI_FPDT_TYPE_BOOT:
1243 InfoTable = AcpiDmTableInfoFpdt0;
1246 case ACPI_FPDT_TYPE_S3PERF:
1248 InfoTable = AcpiDmTableInfoFpdt1;
1253 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "FPDT");
1258 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1259 if (ACPI_FAILURE (Status))
1264 ParentTable = DtPeekSubtable ();
1265 DtInsertSubtable (ParentTable, Subtable);
1273 /******************************************************************************
1275 * FUNCTION: DtCompileHest
1277 * PARAMETERS: List - Current field list pointer
1281 * DESCRIPTION: Compile HEST.
1283 *****************************************************************************/
1290 DT_SUBTABLE *Subtable;
1291 DT_SUBTABLE *ParentTable;
1292 DT_FIELD **PFieldList = (DT_FIELD **) List;
1293 DT_FIELD *SubtableStart;
1294 ACPI_DMTABLE_INFO *InfoTable;
1299 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
1301 if (ACPI_FAILURE (Status))
1306 ParentTable = DtPeekSubtable ();
1307 DtInsertSubtable (ParentTable, Subtable);
1311 /* Get subtable type */
1313 SubtableStart = *PFieldList;
1314 DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
1318 case ACPI_HEST_TYPE_IA32_CHECK:
1320 InfoTable = AcpiDmTableInfoHest0;
1323 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1325 InfoTable = AcpiDmTableInfoHest1;
1328 case ACPI_HEST_TYPE_IA32_NMI:
1330 InfoTable = AcpiDmTableInfoHest2;
1333 case ACPI_HEST_TYPE_AER_ROOT_PORT:
1335 InfoTable = AcpiDmTableInfoHest6;
1338 case ACPI_HEST_TYPE_AER_ENDPOINT:
1340 InfoTable = AcpiDmTableInfoHest7;
1343 case ACPI_HEST_TYPE_AER_BRIDGE:
1345 InfoTable = AcpiDmTableInfoHest8;
1348 case ACPI_HEST_TYPE_GENERIC_ERROR:
1350 InfoTable = AcpiDmTableInfoHest9;
1353 case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1355 InfoTable = AcpiDmTableInfoHest10;
1358 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1360 InfoTable = AcpiDmTableInfoHest11;
1365 /* Cannot continue on unknown type */
1367 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST");
1371 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1372 if (ACPI_FAILURE (Status))
1377 DtInsertSubtable (ParentTable, Subtable);
1380 * Additional subtable data - IA32 Error Bank(s)
1385 case ACPI_HEST_TYPE_IA32_CHECK:
1387 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1388 Subtable->Buffer))->NumHardwareBanks;
1391 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1393 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1394 Subtable->Buffer))->NumHardwareBanks;
1397 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1399 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK,
1400 Subtable->Buffer))->NumHardwareBanks;
1410 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank,
1412 if (ACPI_FAILURE (Status))
1417 DtInsertSubtable (ParentTable, Subtable);
1426 /******************************************************************************
1428 * FUNCTION: DtCompileHmat
1430 * PARAMETERS: List - Current field list pointer
1434 * DESCRIPTION: Compile HMAT.
1436 *****************************************************************************/
1443 DT_SUBTABLE *Subtable;
1444 DT_SUBTABLE *ParentTable;
1445 DT_FIELD **PFieldList = (DT_FIELD **) List;
1446 DT_FIELD *SubtableStart;
1447 DT_FIELD *EntryStart;
1448 ACPI_HMAT_STRUCTURE *HmatStruct;
1449 ACPI_HMAT_LOCALITY *HmatLocality;
1450 ACPI_HMAT_CACHE *HmatCache;
1451 ACPI_DMTABLE_INFO *InfoTable;
1455 UINT16 SMBIOSHandleNumber;
1458 ParentTable = DtPeekSubtable ();
1460 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmat,
1462 if (ACPI_FAILURE (Status))
1466 DtInsertSubtable (ParentTable, Subtable);
1470 /* Compile HMAT structure header */
1472 SubtableStart = *PFieldList;
1473 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmatHdr,
1475 if (ACPI_FAILURE (Status))
1479 DtInsertSubtable (ParentTable, Subtable);
1481 HmatStruct = ACPI_CAST_PTR (ACPI_HMAT_STRUCTURE, Subtable->Buffer);
1482 HmatStruct->Length = Subtable->Length;
1484 /* Compile HMAT structure body */
1486 switch (HmatStruct->Type)
1488 case ACPI_HMAT_TYPE_ADDRESS_RANGE:
1490 InfoTable = AcpiDmTableInfoHmat0;
1493 case ACPI_HMAT_TYPE_LOCALITY:
1495 InfoTable = AcpiDmTableInfoHmat1;
1498 case ACPI_HMAT_TYPE_CACHE:
1500 InfoTable = AcpiDmTableInfoHmat2;
1505 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HMAT");
1509 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1510 if (ACPI_FAILURE (Status))
1514 DtInsertSubtable (ParentTable, Subtable);
1515 HmatStruct->Length += Subtable->Length;
1517 /* Compile HMAT structure additionals */
1519 switch (HmatStruct->Type)
1521 case ACPI_HMAT_TYPE_LOCALITY:
1523 HmatLocality = ACPI_SUB_PTR (ACPI_HMAT_LOCALITY,
1524 Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE));
1526 /* Compile initiator proximity domain list */
1531 Status = DtCompileTable (PFieldList,
1532 AcpiDmTableInfoHmat1a, &Subtable);
1533 if (ACPI_FAILURE (Status))
1541 DtInsertSubtable (ParentTable, Subtable);
1542 HmatStruct->Length += Subtable->Length;
1545 HmatLocality->NumberOfInitiatorPDs = IntPDNumber;
1547 /* Compile target proximity domain list */
1552 Status = DtCompileTable (PFieldList,
1553 AcpiDmTableInfoHmat1b, &Subtable);
1554 if (ACPI_FAILURE (Status))
1562 DtInsertSubtable (ParentTable, Subtable);
1563 HmatStruct->Length += Subtable->Length;
1566 HmatLocality->NumberOfTargetPDs = TgtPDNumber;
1568 /* Save start of the entries for reporting errors */
1570 EntryStart = *PFieldList;
1572 /* Compile latency/bandwidth entries */
1577 Status = DtCompileTable (PFieldList,
1578 AcpiDmTableInfoHmat1c, &Subtable);
1579 if (ACPI_FAILURE (Status))
1587 DtInsertSubtable (ParentTable, Subtable);
1588 HmatStruct->Length += Subtable->Length;
1592 /* Validate number of entries */
1595 ((UINT64)IntPDNumber * (UINT64)TgtPDNumber))
1597 DtFatal (ASL_MSG_INVALID_EXPRESSION, EntryStart, "HMAT");
1602 case ACPI_HMAT_TYPE_CACHE:
1604 /* Compile SMBIOS handles */
1606 HmatCache = ACPI_SUB_PTR (ACPI_HMAT_CACHE,
1607 Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE));
1608 SMBIOSHandleNumber = 0;
1611 Status = DtCompileTable (PFieldList,
1612 AcpiDmTableInfoHmat2a, &Subtable);
1613 if (ACPI_FAILURE (Status))
1621 DtInsertSubtable (ParentTable, Subtable);
1622 HmatStruct->Length += Subtable->Length;
1623 SMBIOSHandleNumber++;
1625 HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber;
1638 /******************************************************************************
1640 * FUNCTION: DtCompileIort
1642 * PARAMETERS: List - Current field list pointer
1646 * DESCRIPTION: Compile IORT.
1648 *****************************************************************************/
1655 DT_SUBTABLE *Subtable;
1656 DT_SUBTABLE *ParentTable;
1657 DT_FIELD **PFieldList = (DT_FIELD **) List;
1658 DT_FIELD *SubtableStart;
1659 ACPI_TABLE_HEADER *Table;
1660 ACPI_TABLE_IORT *Iort;
1661 ACPI_IORT_NODE *IortNode;
1662 ACPI_IORT_ITS_GROUP *IortItsGroup;
1663 ACPI_IORT_SMMU *IortSmmu;
1664 ACPI_IORT_RMR *IortRmr;
1667 UINT32 IdMappingNumber;
1669 UINT32 ContextIrptNumber;
1670 UINT32 PmuIrptNumber;
1671 UINT32 PaddingLength;
1676 ParentTable = DtPeekSubtable ();
1678 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort,
1680 if (ACPI_FAILURE (Status))
1684 DtInsertSubtable (ParentTable, Subtable);
1686 Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
1687 Revision = Table->Revision;
1689 /* Both IORT Rev E and E.a have known issues and are not supported */
1691 if (Revision == 1 || Revision == 2)
1693 DtError (ASL_ERROR, ASL_MSG_UNSUPPORTED, NULL, "IORT table revision");
1698 * Using ACPI_SUB_PTR, We needn't define a separate structure. Care
1699 * should be taken to avoid accessing ACPI_TABLE_HEADER fields.
1701 Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT,
1702 Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
1705 * OptionalPadding - Variable-length data
1706 * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT))
1707 * Optionally allows the generic data types to be used for filling
1710 Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
1711 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
1713 if (ACPI_FAILURE (Status))
1719 DtInsertSubtable (ParentTable, Subtable);
1720 Iort->NodeOffset += Subtable->Length;
1724 Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList),
1725 AcpiDmTableInfoIortHdr[0].Name, &PaddingLength);
1726 if (ACPI_FAILURE (Status))
1730 Iort->NodeOffset += PaddingLength;
1736 SubtableStart = *PFieldList;
1739 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr,
1742 else if (Revision >= 3)
1744 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr3,
1748 if (ACPI_FAILURE (Status))
1753 DtInsertSubtable (ParentTable, Subtable);
1754 IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer);
1755 NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
1757 DtPushSubtable (Subtable);
1758 ParentTable = DtPeekSubtable ();
1760 switch (IortNode->Type)
1762 case ACPI_IORT_NODE_ITS_GROUP:
1764 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0,
1766 if (ACPI_FAILURE (Status))
1771 DtInsertSubtable (ParentTable, Subtable);
1772 IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer);
1773 NodeLength += Subtable->Length;
1778 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a,
1780 if (ACPI_FAILURE (Status))
1789 DtInsertSubtable (ParentTable, Subtable);
1790 NodeLength += Subtable->Length;
1794 IortItsGroup->ItsCount = ItsNumber;
1797 case ACPI_IORT_NODE_NAMED_COMPONENT:
1799 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1,
1801 if (ACPI_FAILURE (Status))
1806 DtInsertSubtable (ParentTable, Subtable);
1807 NodeLength += Subtable->Length;
1810 * Padding - Variable-length data
1811 * Optionally allows the offset of the ID mappings to be used
1812 * for filling this field.
1814 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a,
1816 if (ACPI_FAILURE (Status))
1823 DtInsertSubtable (ParentTable, Subtable);
1824 NodeLength += Subtable->Length;
1828 if (NodeLength > IortNode->MappingOffset)
1830 return (AE_BAD_DATA);
1833 if (NodeLength < IortNode->MappingOffset)
1835 Status = DtCompilePadding (
1836 IortNode->MappingOffset - NodeLength,
1838 if (ACPI_FAILURE (Status))
1843 DtInsertSubtable (ParentTable, Subtable);
1844 NodeLength = IortNode->MappingOffset;
1849 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
1851 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2,
1853 if (ACPI_FAILURE (Status))
1858 DtInsertSubtable (ParentTable, Subtable);
1859 NodeLength += Subtable->Length;
1862 case ACPI_IORT_NODE_SMMU:
1864 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3,
1866 if (ACPI_FAILURE (Status))
1871 DtInsertSubtable (ParentTable, Subtable);
1872 IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer);
1873 NodeLength += Subtable->Length;
1875 /* Compile global interrupt array */
1877 IortSmmu->GlobalInterruptOffset = NodeLength;
1878 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
1880 if (ACPI_FAILURE (Status))
1885 DtInsertSubtable (ParentTable, Subtable);
1886 NodeLength += Subtable->Length;
1888 /* Compile context interrupt array */
1890 ContextIrptNumber = 0;
1891 IortSmmu->ContextInterruptOffset = NodeLength;
1894 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
1896 if (ACPI_FAILURE (Status))
1906 DtInsertSubtable (ParentTable, Subtable);
1907 NodeLength += Subtable->Length;
1908 ContextIrptNumber++;
1911 IortSmmu->ContextInterruptCount = ContextIrptNumber;
1913 /* Compile PMU interrupt array */
1916 IortSmmu->PmuInterruptOffset = NodeLength;
1919 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
1921 if (ACPI_FAILURE (Status))
1931 DtInsertSubtable (ParentTable, Subtable);
1932 NodeLength += Subtable->Length;
1936 IortSmmu->PmuInterruptCount = PmuIrptNumber;
1939 case ACPI_IORT_NODE_SMMU_V3:
1941 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort4,
1943 if (ACPI_FAILURE (Status))
1948 DtInsertSubtable (ParentTable, Subtable);
1949 NodeLength += Subtable->Length;
1952 case ACPI_IORT_NODE_PMCG:
1954 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort5,
1956 if (ACPI_FAILURE (Status))
1961 DtInsertSubtable (ParentTable, Subtable);
1962 NodeLength += Subtable->Length;
1965 case ACPI_IORT_NODE_RMR:
1967 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort6,
1969 if (ACPI_FAILURE (Status))
1974 DtInsertSubtable (ParentTable, Subtable);
1975 IortRmr = ACPI_CAST_PTR (ACPI_IORT_RMR, Subtable->Buffer);
1976 NodeLength += Subtable->Length;
1978 /* Compile RMR Descriptors */
1981 IortRmr->RmrOffset = NodeLength;
1984 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort6a,
1986 if (ACPI_FAILURE (Status))
1996 DtInsertSubtable (ParentTable, Subtable);
1997 NodeLength += sizeof (ACPI_IORT_RMR_DESC);
2001 IortRmr->RmrCount = RmrCount;
2006 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT");
2010 /* Compile Array of ID mappings */
2012 IortNode->MappingOffset = NodeLength;
2013 IdMappingNumber = 0;
2016 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap,
2018 if (ACPI_FAILURE (Status))
2028 DtInsertSubtable (ParentTable, Subtable);
2029 NodeLength += sizeof (ACPI_IORT_ID_MAPPING);
2033 IortNode->MappingCount = IdMappingNumber;
2034 if (!IdMappingNumber)
2036 IortNode->MappingOffset = 0;
2040 * Node length can be determined by DT_LENGTH option
2041 * IortNode->Length = NodeLength;
2044 ParentTable = DtPeekSubtable ();
2048 Iort->NodeCount = NodeNumber;
2053 /******************************************************************************
2055 * FUNCTION: DtCompileIvrs
2057 * PARAMETERS: List - Current field list pointer
2061 * DESCRIPTION: Compile IVRS.
2063 *****************************************************************************/
2070 DT_SUBTABLE *Subtable;
2071 DT_SUBTABLE *ParentTable;
2072 DT_FIELD **PFieldList = (DT_FIELD **) List;
2073 DT_FIELD *SubtableStart;
2074 ACPI_DMTABLE_INFO *InfoTable;
2075 ACPI_IVRS_HEADER *IvrsHeader;
2079 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs,
2081 if (ACPI_FAILURE (Status))
2086 ParentTable = DtPeekSubtable ();
2087 DtInsertSubtable (ParentTable, Subtable);
2091 SubtableStart = *PFieldList;
2092 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr,
2094 if (ACPI_FAILURE (Status))
2099 ParentTable = DtPeekSubtable ();
2100 DtInsertSubtable (ParentTable, Subtable);
2101 DtPushSubtable (Subtable);
2103 IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer);
2105 switch (IvrsHeader->Type)
2107 case ACPI_IVRS_TYPE_HARDWARE1:
2109 InfoTable = AcpiDmTableInfoIvrs0;
2112 case ACPI_IVRS_TYPE_HARDWARE2:
2114 InfoTable = AcpiDmTableInfoIvrs01;
2117 case ACPI_IVRS_TYPE_MEMORY1:
2118 case ACPI_IVRS_TYPE_MEMORY2:
2119 case ACPI_IVRS_TYPE_MEMORY3:
2121 InfoTable = AcpiDmTableInfoIvrs1;
2126 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS");
2130 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
2131 if (ACPI_FAILURE (Status))
2136 ParentTable = DtPeekSubtable ();
2137 DtInsertSubtable (ParentTable, Subtable);
2139 if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
2140 IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE2)
2142 while (*PFieldList &&
2143 !strcmp ((*PFieldList)->Name, "Entry Type"))
2145 SubtableStart = *PFieldList;
2146 DtCompileInteger (&EntryType, *PFieldList, 1, 0);
2150 /* 4-byte device entries */
2152 case ACPI_IVRS_TYPE_PAD4:
2153 case ACPI_IVRS_TYPE_ALL:
2154 case ACPI_IVRS_TYPE_SELECT:
2155 case ACPI_IVRS_TYPE_START:
2156 case ACPI_IVRS_TYPE_END:
2158 InfoTable = AcpiDmTableInfoIvrs4;
2161 /* 8-byte entries, type A */
2163 case ACPI_IVRS_TYPE_ALIAS_SELECT:
2164 case ACPI_IVRS_TYPE_ALIAS_START:
2166 InfoTable = AcpiDmTableInfoIvrs8a;
2169 /* 8-byte entries, type B */
2171 case ACPI_IVRS_TYPE_PAD8:
2172 case ACPI_IVRS_TYPE_EXT_SELECT:
2173 case ACPI_IVRS_TYPE_EXT_START:
2175 InfoTable = AcpiDmTableInfoIvrs8b;
2178 /* 8-byte entries, type C */
2180 case ACPI_IVRS_TYPE_SPECIAL:
2182 InfoTable = AcpiDmTableInfoIvrs8c;
2187 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart,
2188 "IVRS Device Entry");
2192 Status = DtCompileTable (PFieldList, InfoTable,
2194 if (ACPI_FAILURE (Status))
2199 DtInsertSubtable (ParentTable, Subtable);