1 /******************************************************************************
3 * Module Name: dttable2.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 L-Z */
154 #include "aslcompiler.h"
156 #define _COMPONENT DT_COMPILER
157 ACPI_MODULE_NAME ("dttable2")
160 /******************************************************************************
162 * FUNCTION: DtCompileLpit
164 * PARAMETERS: List - Current field list pointer
168 * DESCRIPTION: Compile LPIT.
170 *****************************************************************************/
177 DT_SUBTABLE *Subtable;
178 DT_SUBTABLE *ParentTable;
179 DT_FIELD **PFieldList = (DT_FIELD **) List;
180 DT_FIELD *SubtableStart;
181 ACPI_DMTABLE_INFO *InfoTable;
182 ACPI_LPIT_HEADER *LpitHeader;
185 /* Note: Main table consists only of the standard ACPI table header */
189 SubtableStart = *PFieldList;
191 /* LPIT Subtable header */
193 Status = DtCompileTable (PFieldList, AcpiDmTableInfoLpitHdr,
195 if (ACPI_FAILURE (Status))
200 ParentTable = DtPeekSubtable ();
201 DtInsertSubtable (ParentTable, Subtable);
202 DtPushSubtable (Subtable);
204 LpitHeader = ACPI_CAST_PTR (ACPI_LPIT_HEADER, Subtable->Buffer);
206 switch (LpitHeader->Type)
208 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
210 InfoTable = AcpiDmTableInfoLpit0;
215 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT");
221 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
222 if (ACPI_FAILURE (Status))
227 ParentTable = DtPeekSubtable ();
228 DtInsertSubtable (ParentTable, Subtable);
236 /******************************************************************************
238 * FUNCTION: DtCompileMadt
240 * PARAMETERS: List - Current field list pointer
244 * DESCRIPTION: Compile MADT.
246 *****************************************************************************/
253 DT_SUBTABLE *Subtable;
254 DT_SUBTABLE *ParentTable;
255 DT_FIELD **PFieldList = (DT_FIELD **) List;
256 DT_FIELD *SubtableStart;
257 ACPI_SUBTABLE_HEADER *MadtHeader;
258 ACPI_DMTABLE_INFO *InfoTable;
261 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt,
263 if (ACPI_FAILURE (Status))
268 ParentTable = DtPeekSubtable ();
269 DtInsertSubtable (ParentTable, Subtable);
273 SubtableStart = *PFieldList;
274 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr,
276 if (ACPI_FAILURE (Status))
281 ParentTable = DtPeekSubtable ();
282 DtInsertSubtable (ParentTable, Subtable);
283 DtPushSubtable (Subtable);
285 MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
287 switch (MadtHeader->Type)
289 case ACPI_MADT_TYPE_LOCAL_APIC:
291 InfoTable = AcpiDmTableInfoMadt0;
294 case ACPI_MADT_TYPE_IO_APIC:
296 InfoTable = AcpiDmTableInfoMadt1;
299 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
301 InfoTable = AcpiDmTableInfoMadt2;
304 case ACPI_MADT_TYPE_NMI_SOURCE:
306 InfoTable = AcpiDmTableInfoMadt3;
309 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
311 InfoTable = AcpiDmTableInfoMadt4;
314 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
316 InfoTable = AcpiDmTableInfoMadt5;
319 case ACPI_MADT_TYPE_IO_SAPIC:
321 InfoTable = AcpiDmTableInfoMadt6;
324 case ACPI_MADT_TYPE_LOCAL_SAPIC:
326 InfoTable = AcpiDmTableInfoMadt7;
329 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
331 InfoTable = AcpiDmTableInfoMadt8;
334 case ACPI_MADT_TYPE_LOCAL_X2APIC:
336 InfoTable = AcpiDmTableInfoMadt9;
339 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
341 InfoTable = AcpiDmTableInfoMadt10;
344 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
346 InfoTable = AcpiDmTableInfoMadt11;
349 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
351 InfoTable = AcpiDmTableInfoMadt12;
354 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
356 InfoTable = AcpiDmTableInfoMadt13;
359 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
361 InfoTable = AcpiDmTableInfoMadt14;
364 case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
366 InfoTable = AcpiDmTableInfoMadt15;
369 case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
371 InfoTable = AcpiDmTableInfoMadt16;
376 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT");
380 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
381 if (ACPI_FAILURE (Status))
386 ParentTable = DtPeekSubtable ();
387 DtInsertSubtable (ParentTable, Subtable);
395 /******************************************************************************
397 * FUNCTION: DtCompileMcfg
399 * PARAMETERS: List - Current field list pointer
403 * DESCRIPTION: Compile MCFG.
405 *****************************************************************************/
414 Status = DtCompileTwoSubtables (List,
415 AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0);
420 /******************************************************************************
422 * FUNCTION: DtCompileMpst
424 * PARAMETERS: List - Current field list pointer
428 * DESCRIPTION: Compile MPST.
430 *****************************************************************************/
437 DT_SUBTABLE *Subtable;
438 DT_SUBTABLE *ParentTable;
439 DT_FIELD **PFieldList = (DT_FIELD **) List;
440 ACPI_MPST_CHANNEL *MpstChannelInfo;
441 ACPI_MPST_POWER_NODE *MpstPowerNode;
442 ACPI_MPST_DATA_HDR *MpstDataHeader;
443 UINT16 SubtableCount;
444 UINT32 PowerStateCount;
445 UINT32 ComponentCount;
450 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable);
451 if (ACPI_FAILURE (Status))
456 ParentTable = DtPeekSubtable ();
457 DtInsertSubtable (ParentTable, Subtable);
458 DtPushSubtable (Subtable);
460 MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
461 SubtableCount = MpstChannelInfo->PowerNodeCount;
463 while (*PFieldList && SubtableCount)
465 /* Subtable: Memory Power Node(s) */
467 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0,
469 if (ACPI_FAILURE (Status))
474 ParentTable = DtPeekSubtable ();
475 DtInsertSubtable (ParentTable, Subtable);
476 DtPushSubtable (Subtable);
478 MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
479 PowerStateCount = MpstPowerNode->NumPowerStates;
480 ComponentCount = MpstPowerNode->NumPhysicalComponents;
482 ParentTable = DtPeekSubtable ();
484 /* Sub-subtables - Memory Power State Structure(s) */
486 while (*PFieldList && PowerStateCount)
488 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A,
490 if (ACPI_FAILURE (Status))
495 DtInsertSubtable (ParentTable, Subtable);
499 /* Sub-subtables - Physical Component ID Structure(s) */
501 while (*PFieldList && ComponentCount)
503 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B,
505 if (ACPI_FAILURE (Status))
510 DtInsertSubtable (ParentTable, Subtable);
518 /* Subtable: Count of Memory Power State Characteristic structures */
522 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable);
523 if (ACPI_FAILURE (Status))
528 ParentTable = DtPeekSubtable ();
529 DtInsertSubtable (ParentTable, Subtable);
530 DtPushSubtable (Subtable);
532 MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
533 SubtableCount = MpstDataHeader->CharacteristicsCount;
535 ParentTable = DtPeekSubtable ();
537 /* Subtable: Memory Power State Characteristics structure(s) */
539 while (*PFieldList && SubtableCount)
541 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2,
543 if (ACPI_FAILURE (Status))
548 DtInsertSubtable (ParentTable, Subtable);
557 /******************************************************************************
559 * FUNCTION: DtCompileMsct
561 * PARAMETERS: List - Current field list pointer
565 * DESCRIPTION: Compile MSCT.
567 *****************************************************************************/
576 Status = DtCompileTwoSubtables (List,
577 AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0);
582 /******************************************************************************
584 * FUNCTION: DtCompileNfit
586 * PARAMETERS: List - Current field list pointer
590 * DESCRIPTION: Compile NFIT.
592 *****************************************************************************/
599 DT_SUBTABLE *Subtable;
600 DT_SUBTABLE *ParentTable;
601 DT_FIELD **PFieldList = (DT_FIELD **) List;
602 DT_FIELD *SubtableStart;
603 ACPI_NFIT_HEADER *NfitHeader;
604 ACPI_DMTABLE_INFO *InfoTable;
606 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
607 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
612 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit,
614 if (ACPI_FAILURE (Status))
619 ParentTable = DtPeekSubtable ();
620 DtInsertSubtable (ParentTable, Subtable);
621 DtPushSubtable (Subtable);
627 SubtableStart = *PFieldList;
628 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr,
630 if (ACPI_FAILURE (Status))
635 ParentTable = DtPeekSubtable ();
636 DtInsertSubtable (ParentTable, Subtable);
637 DtPushSubtable (Subtable);
639 NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
641 switch (NfitHeader->Type)
643 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
645 InfoTable = AcpiDmTableInfoNfit0;
648 case ACPI_NFIT_TYPE_MEMORY_MAP:
650 InfoTable = AcpiDmTableInfoNfit1;
653 case ACPI_NFIT_TYPE_INTERLEAVE:
655 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer);
656 InfoTable = AcpiDmTableInfoNfit2;
659 case ACPI_NFIT_TYPE_SMBIOS:
661 InfoTable = AcpiDmTableInfoNfit3;
664 case ACPI_NFIT_TYPE_CONTROL_REGION:
666 InfoTable = AcpiDmTableInfoNfit4;
669 case ACPI_NFIT_TYPE_DATA_REGION:
671 InfoTable = AcpiDmTableInfoNfit5;
674 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
676 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer);
677 InfoTable = AcpiDmTableInfoNfit6;
680 case ACPI_NFIT_TYPE_CAPABILITIES:
682 InfoTable = AcpiDmTableInfoNfit7;
687 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT");
691 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
692 if (ACPI_FAILURE (Status))
697 ParentTable = DtPeekSubtable ();
698 DtInsertSubtable (ParentTable, Subtable);
701 switch (NfitHeader->Type)
703 case ACPI_NFIT_TYPE_INTERLEAVE:
706 DtPushSubtable (Subtable);
709 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a,
711 if (ACPI_FAILURE (Status))
722 ParentTable = DtPeekSubtable ();
723 DtInsertSubtable (ParentTable, Subtable);
727 Interleave->LineCount = Count;
730 case ACPI_NFIT_TYPE_SMBIOS:
734 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a,
736 if (ACPI_FAILURE (Status))
743 DtInsertSubtable (ParentTable, Subtable);
748 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
751 DtPushSubtable (Subtable);
754 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a,
756 if (ACPI_FAILURE (Status))
767 ParentTable = DtPeekSubtable ();
768 DtInsertSubtable (ParentTable, Subtable);
772 Hint->HintCount = (UINT16) Count;
784 /******************************************************************************
786 * FUNCTION: DtCompileNhlt
788 * PARAMETERS: List - Current field list pointer
792 * DESCRIPTION: Compile NHLT.
794 *****************************************************************************/
801 UINT32 EndpointCount;
802 UINT32 MicrophoneCount;
804 DT_SUBTABLE *Subtable;
805 DT_SUBTABLE *ParentTable;
806 DT_FIELD **PFieldList = (DT_FIELD **) List;
807 UINT32 CapabilitiesSize;
810 UINT8 LinuxSpecificCount;
813 ACPI_TABLE_NHLT_ENDPOINT_COUNT *MainTable;
814 ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A *DevSpecific;
815 ACPI_NHLT_VENDOR_MIC_COUNT *MicCount;
816 ACPI_NHLT_FORMATS_CONFIG *FormatsConfig;
817 ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D *ConfigSpecific;
818 ACPI_NHLT_LINUX_SPECIFIC_COUNT *LinuxSpecific;
823 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt,
825 if (ACPI_FAILURE (Status))
830 /* Get the Endpoint Descriptor count */
832 ParentTable = DtPeekSubtable ();
833 DtInsertSubtable (ParentTable, Subtable);
834 DtPushSubtable (Subtable);
836 MainTable = ACPI_CAST_PTR (ACPI_TABLE_NHLT_ENDPOINT_COUNT, Subtable->Buffer);
837 EndpointCount = MainTable->EndpointCount;
843 /* Variable number of Endpoint descriptors */
845 for (i = 0; i < EndpointCount; i++)
847 /* Do the Endpoint Descriptor */
849 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt0,
851 if (ACPI_FAILURE (Status))
856 ParentTable = DtPeekSubtable ();
857 DtInsertSubtable (ParentTable, Subtable);
858 DtPushSubtable (Subtable);
860 /* Do the Device Specific table */
862 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5b,
864 if (ACPI_FAILURE (Status))
869 ParentTable = DtPeekSubtable ();
870 DtInsertSubtable (ParentTable, Subtable);
871 DtPushSubtable (Subtable);
873 DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable->Buffer);
874 CapabilitiesSize = DevSpecific->CapabilitiesSize;
879 switch (CapabilitiesSize)
886 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5c,
888 if (ACPI_FAILURE (Status))
893 ParentTable = DtPeekSubtable ();
894 DtInsertSubtable (ParentTable, Subtable);
899 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5,
901 if (ACPI_FAILURE (Status))
906 ParentTable = DtPeekSubtable ();
907 DtInsertSubtable (ParentTable, Subtable);
912 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5a,
914 if (ACPI_FAILURE (Status))
919 ParentTable = DtPeekSubtable ();
920 DtInsertSubtable (ParentTable, Subtable);
922 ConfigSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D, Subtable->Buffer);
923 ArrayType = ConfigSpecific->ArrayType;
924 ConfigType = ConfigSpecific->ConfigType;
929 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5,
931 if (ACPI_FAILURE (Status))
936 ParentTable = DtPeekSubtable ();
937 DtInsertSubtable (ParentTable, Subtable);
939 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt6b,
941 if (ACPI_FAILURE (Status))
946 ParentTable = DtPeekSubtable ();
947 DtInsertSubtable (ParentTable, Subtable);
949 ConfigSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D, Subtable->Buffer);
950 ArrayType = ConfigSpecific->ArrayType;
951 ConfigType = ConfigSpecific->ConfigType;
956 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5a,
958 if (ACPI_FAILURE (Status))
963 ParentTable = DtPeekSubtable ();
964 DtInsertSubtable (ParentTable, Subtable);
966 ConfigSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D, Subtable->Buffer);
967 ArrayType = ConfigSpecific->ArrayType;
968 ConfigType = ConfigSpecific->ConfigType;
971 } /* switch (CapabilitiesSize) */
973 if (CapabilitiesSize >= 3)
975 /* Check for a vendor-defined mic array */
977 if (ConfigType == ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY)
979 if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_MASK) == ACPI_NHLT_VENDOR_DEFINED)
981 /* Get the microphone count */
983 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt6a,
985 if (ACPI_FAILURE (Status))
990 MicCount = ACPI_CAST_PTR (ACPI_NHLT_VENDOR_MIC_COUNT, Subtable->Buffer);
991 MicrophoneCount = MicCount->MicrophoneCount;
993 ParentTable = DtPeekSubtable ();
994 DtInsertSubtable (ParentTable, Subtable);
996 /* Variable number of microphones */
998 for (j = 0; j < MicrophoneCount; j++)
1000 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt6,
1002 if (ACPI_FAILURE (Status))
1007 ParentTable = DtPeekSubtable ();
1008 DtInsertSubtable (ParentTable, Subtable);
1011 /* Do the MIC_SNR_SENSITIVITY_EXTENSION, if present */
1013 if (ArrayType & ACPI_NHLT_ARRAY_TYPE_EXT_MASK)
1015 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt9,
1017 if (ACPI_FAILURE (Status))
1022 ParentTable = DtPeekSubtable ();
1023 DtInsertSubtable (ParentTable, Subtable);
1029 /* Get the formats count */
1032 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt4,
1034 if (ACPI_FAILURE (Status))
1039 ParentTable = DtPeekSubtable ();
1040 DtInsertSubtable (ParentTable, Subtable);
1042 FormatsConfig = ACPI_CAST_PTR (ACPI_NHLT_FORMATS_CONFIG, Subtable->Buffer);
1043 FormatsCount = FormatsConfig->FormatsCount;
1045 /* Variable number of wave_format_extensible structs */
1047 for (j = 0; j < FormatsCount; j++)
1049 /* Do the main wave_format_extensible structure */
1051 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3,
1053 if (ACPI_FAILURE (Status))
1058 ParentTable = DtPeekSubtable ();
1059 DtInsertSubtable (ParentTable, Subtable);
1060 DtPushSubtable (Subtable);
1062 /* Do the capabilities list */
1064 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3a,
1066 if (ACPI_FAILURE (Status))
1072 ParentTable = DtPeekSubtable ();
1073 DtInsertSubtable (ParentTable, Subtable);
1075 } /* for (j = 0; j < FormatsCount; j++) */
1078 * If we are not done with the current Endpoint yet, then there must be
1079 * some Linux-specific structure(s) yet to be processed. First, get
1080 * the count of such structure(s).
1082 if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
1084 /* Get the count of Linux-specific structures */
1086 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7,
1088 if (ACPI_FAILURE (Status))
1093 ParentTable = DtPeekSubtable ();
1094 DtInsertSubtable (ParentTable, Subtable);
1096 LinuxSpecific = ACPI_CAST_PTR (ACPI_NHLT_LINUX_SPECIFIC_COUNT, Subtable->Buffer);
1097 LinuxSpecificCount = LinuxSpecific->StructureCount;
1099 for (j = 0; j < LinuxSpecificCount; j++)
1102 * Compile the following Linux-specific fields:
1104 * 2) Device Instance ID
1107 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7a,
1109 if (ACPI_FAILURE (Status))
1114 ParentTable = DtPeekSubtable ();
1115 DtInsertSubtable (ParentTable, Subtable);
1118 * To have a valid Linux-specific "Specific Data" at this
1120 * 1) The next field must be named "Specific Data"
1122 if (!strcmp ((const char *) (*PFieldList)->Name, "Specific Data"))
1124 /* Compile the "Specific Data" field */
1126 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7b,
1128 if (ACPI_FAILURE (Status))
1133 ParentTable = DtPeekSubtable ();
1134 DtInsertSubtable (ParentTable, Subtable);
1137 } /* for (j = 0; j < LinuxSpecificCount; j++) */
1142 } /* for (i = 0; i < EndpointCount; i++) */
1145 * All Endpoint Descriptors are completed.
1146 * Do the table terminator structure (not in NHLT spec, optional)
1148 if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
1150 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt8,
1152 if (ACPI_FAILURE (Status))
1157 ParentTable = DtPeekSubtable ();
1158 DtInsertSubtable (ParentTable, Subtable);
1168 /******************************************************************************
1170 * FUNCTION: DtCompilePcct
1172 * PARAMETERS: List - Current field list pointer
1176 * DESCRIPTION: Compile PCCT.
1178 *****************************************************************************/
1185 DT_SUBTABLE *Subtable;
1186 DT_SUBTABLE *ParentTable;
1187 DT_FIELD **PFieldList = (DT_FIELD **) List;
1188 DT_FIELD *SubtableStart;
1189 ACPI_SUBTABLE_HEADER *PcctHeader;
1190 ACPI_DMTABLE_INFO *InfoTable;
1195 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct,
1197 if (ACPI_FAILURE (Status))
1202 ParentTable = DtPeekSubtable ();
1203 DtInsertSubtable (ParentTable, Subtable);
1209 SubtableStart = *PFieldList;
1210 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcctHdr,
1212 if (ACPI_FAILURE (Status))
1217 ParentTable = DtPeekSubtable ();
1218 DtInsertSubtable (ParentTable, Subtable);
1219 DtPushSubtable (Subtable);
1221 PcctHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1223 switch (PcctHeader->Type)
1225 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
1227 InfoTable = AcpiDmTableInfoPcct0;
1230 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
1232 InfoTable = AcpiDmTableInfoPcct1;
1235 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
1237 InfoTable = AcpiDmTableInfoPcct2;
1240 case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
1242 InfoTable = AcpiDmTableInfoPcct3;
1245 case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
1247 InfoTable = AcpiDmTableInfoPcct4;
1250 case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
1252 InfoTable = AcpiDmTableInfoPcct5;
1257 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT");
1261 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1262 if (ACPI_FAILURE (Status))
1267 ParentTable = DtPeekSubtable ();
1268 DtInsertSubtable (ParentTable, Subtable);
1276 /******************************************************************************
1278 * FUNCTION: DtCompilePdtt
1280 * PARAMETERS: List - Current field list pointer
1284 * DESCRIPTION: Compile PDTT.
1286 *****************************************************************************/
1293 DT_SUBTABLE *Subtable;
1294 DT_SUBTABLE *ParentTable;
1295 DT_FIELD **PFieldList = (DT_FIELD **) List;
1296 ACPI_TABLE_PDTT *PdttHeader;
1302 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt, &Subtable);
1303 if (ACPI_FAILURE (Status))
1308 ParentTable = DtPeekSubtable ();
1309 DtInsertSubtable (ParentTable, Subtable);
1311 PdttHeader = ACPI_CAST_PTR (ACPI_TABLE_PDTT, ParentTable->Buffer);
1312 PdttHeader->ArrayOffset = sizeof (ACPI_TABLE_PDTT);
1314 /* There is only one type of subtable at this time, no need to decode */
1318 /* List of subchannel IDs, each 2 bytes */
1320 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt0,
1322 if (ACPI_FAILURE (Status))
1327 DtInsertSubtable (ParentTable, Subtable);
1331 PdttHeader->TriggerCount = (UINT8) Count;
1336 /******************************************************************************
1338 * FUNCTION: DtCompilePhat
1340 * PARAMETERS: List - Current field list pointer
1344 * DESCRIPTION: Compile Phat.
1346 *****************************************************************************/
1352 ACPI_STATUS Status = AE_OK;
1353 DT_SUBTABLE *Subtable;
1354 DT_SUBTABLE *ParentTable;
1355 DT_FIELD **PFieldList = (DT_FIELD **) List;
1356 ACPI_PHAT_HEADER *PhatHeader;
1357 ACPI_DMTABLE_INFO *Info;
1358 ACPI_PHAT_VERSION_DATA *VersionData;
1362 /* The table consist of subtables */
1366 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhatHdr, &Subtable);
1367 if (ACPI_FAILURE (Status))
1372 ParentTable = DtPeekSubtable ();
1373 DtInsertSubtable (ParentTable, Subtable);
1374 DtPushSubtable (Subtable);
1376 PhatHeader = ACPI_CAST_PTR (ACPI_PHAT_HEADER, Subtable->Buffer);
1378 switch (PhatHeader->Type)
1380 case ACPI_PHAT_TYPE_FW_VERSION_DATA:
1382 Info = AcpiDmTableInfoPhat0;
1383 PhatHeader->Length = sizeof (ACPI_PHAT_VERSION_DATA);
1386 case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
1388 Info = AcpiDmTableInfoPhat1;
1389 PhatHeader->Length = sizeof (ACPI_PHAT_HEALTH_DATA);
1394 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, *PFieldList, "PHAT");
1400 Status = DtCompileTable (PFieldList, Info, &Subtable);
1401 if (ACPI_FAILURE (Status))
1406 ParentTable = DtPeekSubtable ();
1407 DtInsertSubtable (ParentTable, Subtable);
1409 switch (PhatHeader->Type)
1411 case ACPI_PHAT_TYPE_FW_VERSION_DATA:
1413 VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA,
1414 (Subtable->Buffer - sizeof (ACPI_PHAT_HEADER)));
1415 RecordCount = VersionData->ElementCount;
1419 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat0a,
1421 if (ACPI_FAILURE (Status))
1425 ParentTable = DtPeekSubtable ();
1426 DtInsertSubtable (ParentTable, Subtable);
1429 PhatHeader->Length += sizeof (ACPI_PHAT_VERSION_ELEMENT);
1433 case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
1435 /* Compile device path */
1437 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat1a, &Subtable);
1438 if (ACPI_FAILURE (Status))
1442 ParentTable = DtPeekSubtable ();
1443 DtInsertSubtable (ParentTable, Subtable);
1445 PhatHeader->Length += (UINT16) Subtable->Length;
1447 /* Compile vendor specific data */
1449 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat1b, &Subtable);
1450 if (ACPI_FAILURE (Status))
1454 ParentTable = DtPeekSubtable ();
1455 DtInsertSubtable (ParentTable, Subtable);
1457 PhatHeader->Length += (UINT16) Subtable->Length;
1463 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, *PFieldList, "PHAT");
1472 /******************************************************************************
1474 * FUNCTION: DtCompilePmtt
1476 * PARAMETERS: List - Current field list pointer
1480 * DESCRIPTION: Compile PMTT.
1482 *****************************************************************************/
1489 DT_SUBTABLE *Subtable;
1490 DT_SUBTABLE *ParentTable;
1491 DT_FIELD **PFieldList = (DT_FIELD **) List;
1492 DT_FIELD *SubtableStart;
1498 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable);
1499 if (ACPI_FAILURE (Status))
1504 ParentTable = DtPeekSubtable ();
1505 DtInsertSubtable (ParentTable, Subtable);
1506 DtPushSubtable (Subtable);
1512 SubtableStart = *PFieldList;
1513 DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
1517 case ACPI_PMTT_TYPE_SOCKET:
1519 /* Subtable: Socket Structure */
1521 DbgPrint (ASL_DEBUG_OUTPUT, "Compile PMTT_TYPE_SOCKET (0)\n");
1523 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0,
1525 if (ACPI_FAILURE (Status))
1532 case ACPI_PMTT_TYPE_CONTROLLER:
1534 /* Subtable: Memory Controller Structure */
1536 DbgPrint (ASL_DEBUG_OUTPUT, "Compile PMTT_TYPE_CONTROLLER (1)\n");
1538 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1,
1540 if (ACPI_FAILURE (Status))
1547 case ACPI_PMTT_TYPE_DIMM:
1549 /* Subtable: Physical Component (DIMM) Structure */
1551 DbgPrint (ASL_DEBUG_OUTPUT, "Compile PMTT_TYPE_DIMM (2)\n");
1552 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2,
1554 if (ACPI_FAILURE (Status))
1561 case ACPI_PMTT_TYPE_VENDOR:
1563 /* Subtable: Vendor-specific Structure */
1565 DbgPrint (ASL_DEBUG_OUTPUT, "Compile PMTT_TYPE_VENDOR(FF)\n");
1566 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttVendor,
1568 if (ACPI_FAILURE (Status))
1577 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT");
1581 DtInsertSubtable (ParentTable, Subtable);
1588 /******************************************************************************
1590 * FUNCTION: DtCompilePptt
1592 * PARAMETERS: List - Current field list pointer
1596 * DESCRIPTION: Compile PPTT.
1598 *****************************************************************************/
1605 ACPI_SUBTABLE_HEADER *PpttHeader;
1606 ACPI_PPTT_PROCESSOR *PpttProcessor = NULL;
1607 DT_SUBTABLE *Subtable;
1608 DT_SUBTABLE *ParentTable;
1609 ACPI_DMTABLE_INFO *InfoTable;
1610 DT_FIELD **PFieldList = (DT_FIELD **) List;
1611 DT_FIELD *SubtableStart;
1612 ACPI_TABLE_HEADER *PpttAcpiHeader;
1615 ParentTable = DtPeekSubtable ();
1618 SubtableStart = *PFieldList;
1620 /* Compile PPTT subtable header */
1622 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPpttHdr,
1624 if (ACPI_FAILURE (Status))
1628 DtInsertSubtable (ParentTable, Subtable);
1629 PpttHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1630 PpttHeader->Length = (UINT8)(Subtable->Length);
1632 switch (PpttHeader->Type)
1634 case ACPI_PPTT_TYPE_PROCESSOR:
1636 InfoTable = AcpiDmTableInfoPptt0;
1639 case ACPI_PPTT_TYPE_CACHE:
1641 InfoTable = AcpiDmTableInfoPptt1;
1644 case ACPI_PPTT_TYPE_ID:
1646 InfoTable = AcpiDmTableInfoPptt2;
1651 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PPTT");
1655 /* Compile PPTT subtable body */
1657 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1658 if (ACPI_FAILURE (Status))
1662 DtInsertSubtable (ParentTable, Subtable);
1663 PpttHeader->Length += (UINT8)(Subtable->Length);
1665 /* Compile PPTT subtable additionals */
1667 switch (PpttHeader->Type)
1669 case ACPI_PPTT_TYPE_PROCESSOR:
1671 PpttProcessor = ACPI_SUB_PTR (ACPI_PPTT_PROCESSOR,
1672 Subtable->Buffer, sizeof (ACPI_SUBTABLE_HEADER));
1675 /* Compile initiator proximity domain list */
1677 PpttProcessor->NumberOfPrivResources = 0;
1680 Status = DtCompileTable (PFieldList,
1681 AcpiDmTableInfoPptt0a, &Subtable);
1682 if (ACPI_FAILURE (Status))
1691 DtInsertSubtable (ParentTable, Subtable);
1692 PpttHeader->Length += (UINT8)(Subtable->Length);
1693 PpttProcessor->NumberOfPrivResources++;
1698 case ACPI_PPTT_TYPE_CACHE:
1700 PpttAcpiHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
1701 AslGbl_RootTable->Buffer);
1702 if (PpttAcpiHeader->Revision < 3)
1706 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPptt1a,
1708 DtInsertSubtable (ParentTable, Subtable);
1709 PpttHeader->Length += (UINT8)(Subtable->Length);
1722 /******************************************************************************
1724 * FUNCTION: DtCompilePrmt
1726 * PARAMETERS: List - Current field list pointer
1730 * DESCRIPTION: Compile PRMT.
1732 *****************************************************************************/
1739 ACPI_TABLE_PRMT_HEADER *PrmtHeader;
1740 ACPI_PRMT_MODULE_INFO *PrmtModuleInfo;
1741 DT_SUBTABLE *Subtable;
1742 DT_SUBTABLE *ParentTable;
1743 DT_FIELD **PFieldList = (DT_FIELD **) List;
1746 ParentTable = DtPeekSubtable ();
1748 /* Compile PRMT subtable header */
1750 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPrmtHdr,
1752 if (ACPI_FAILURE (Status))
1756 DtInsertSubtable (ParentTable, Subtable);
1757 PrmtHeader = ACPI_CAST_PTR (ACPI_TABLE_PRMT_HEADER, Subtable->Buffer);
1759 for (i = 0; i < PrmtHeader->ModuleInfoCount; i++)
1761 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPrmtModule,
1763 if (ACPI_FAILURE (Status))
1767 DtInsertSubtable (ParentTable, Subtable);
1768 PrmtModuleInfo = ACPI_CAST_PTR (ACPI_PRMT_MODULE_INFO, Subtable->Buffer);
1770 for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; j++)
1772 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPrmtHandler,
1774 if (ACPI_FAILURE (Status))
1778 DtInsertSubtable (ParentTable, Subtable);
1786 /******************************************************************************
1788 * FUNCTION: DtCompileRgrt
1790 * PARAMETERS: List - Current field list pointer
1794 * DESCRIPTION: Compile RGRT.
1796 *****************************************************************************/
1803 DT_SUBTABLE *Subtable;
1804 DT_SUBTABLE *ParentTable;
1805 DT_FIELD **PFieldList = (DT_FIELD **) List;
1808 /* Compile the main table */
1810 Status = DtCompileTable (PFieldList, AcpiDmTableInfoRgrt,
1812 if (ACPI_FAILURE (Status))
1817 ParentTable = DtPeekSubtable ();
1818 DtInsertSubtable (ParentTable, Subtable);
1820 /* Compile the "Subtable" -- actually just the binary (PNG) image */
1822 Status = DtCompileTable (PFieldList, AcpiDmTableInfoRgrt0,
1824 if (ACPI_FAILURE (Status))
1829 DtInsertSubtable (ParentTable, Subtable);
1834 /******************************************************************************
1836 * FUNCTION: DtCompileRsdt
1838 * PARAMETERS: List - Current field list pointer
1842 * DESCRIPTION: Compile RSDT.
1844 *****************************************************************************/
1850 DT_SUBTABLE *Subtable;
1851 DT_SUBTABLE *ParentTable;
1852 DT_FIELD *FieldList = *(DT_FIELD **) List;
1856 ParentTable = DtPeekSubtable ();
1860 DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
1862 DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
1863 DtInsertSubtable (ParentTable, Subtable);
1864 FieldList = FieldList->Next;
1871 /******************************************************************************
1873 * FUNCTION: DtCompileS3pt
1875 * PARAMETERS: PFieldList - Current field list pointer
1879 * DESCRIPTION: Compile S3PT (Pointed to by FPDT)
1881 *****************************************************************************/
1885 DT_FIELD **PFieldList)
1888 ACPI_FPDT_HEADER *S3ptHeader;
1889 DT_SUBTABLE *Subtable;
1890 DT_SUBTABLE *ParentTable;
1891 ACPI_DMTABLE_INFO *InfoTable;
1892 DT_FIELD *SubtableStart;
1895 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
1897 if (ACPI_FAILURE (Status))
1902 DtPushSubtable (AslGbl_RootTable);
1906 SubtableStart = *PFieldList;
1907 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr,
1909 if (ACPI_FAILURE (Status))
1914 ParentTable = DtPeekSubtable ();
1915 DtInsertSubtable (ParentTable, Subtable);
1916 DtPushSubtable (Subtable);
1918 S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1920 switch (S3ptHeader->Type)
1922 case ACPI_S3PT_TYPE_RESUME:
1924 InfoTable = AcpiDmTableInfoS3pt0;
1927 case ACPI_S3PT_TYPE_SUSPEND:
1929 InfoTable = AcpiDmTableInfoS3pt1;
1934 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT");
1938 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1939 if (ACPI_FAILURE (Status))
1944 ParentTable = DtPeekSubtable ();
1945 DtInsertSubtable (ParentTable, Subtable);
1953 /******************************************************************************
1955 * FUNCTION: DtCompileSdev
1957 * PARAMETERS: List - Current field list pointer
1961 * DESCRIPTION: Compile SDEV.
1963 *****************************************************************************/
1970 ACPI_SDEV_HEADER *SdevHeader;
1971 ACPI_SDEV_HEADER *SecureComponentHeader;
1972 DT_SUBTABLE *Subtable;
1973 DT_SUBTABLE *ParentTable;
1974 ACPI_DMTABLE_INFO *InfoTable;
1975 ACPI_DMTABLE_INFO *SecureComponentInfoTable = NULL;
1976 DT_FIELD **PFieldList = (DT_FIELD **) List;
1977 DT_FIELD *SubtableStart;
1978 ACPI_SDEV_PCIE *Pcie = NULL;
1979 ACPI_SDEV_NAMESPACE *Namesp = NULL;
1981 ACPI_SDEV_SECURE_COMPONENT *SecureComponent = NULL;
1982 UINT16 ComponentLength = 0;
1989 /* Compile common SDEV subtable header */
1991 SubtableStart = *PFieldList;
1992 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdevHdr,
1994 if (ACPI_FAILURE (Status))
1999 ParentTable = DtPeekSubtable ();
2000 DtInsertSubtable (ParentTable, Subtable);
2001 DtPushSubtable (Subtable);
2003 SdevHeader = ACPI_CAST_PTR (ACPI_SDEV_HEADER, Subtable->Buffer);
2004 SdevHeader->Length = (UINT8)(sizeof (ACPI_SDEV_HEADER));
2006 switch (SdevHeader->Type)
2008 case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2010 InfoTable = AcpiDmTableInfoSdev0;
2011 Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable->Buffer);
2012 SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
2013 ACPI_ADD_PTR (UINT8, Subtable->Buffer, sizeof(ACPI_SDEV_NAMESPACE)));
2016 case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2018 InfoTable = AcpiDmTableInfoSdev1;
2019 Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable->Buffer);
2024 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV");
2028 /* Compile SDEV subtable body */
2030 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
2031 if (ACPI_FAILURE (Status))
2036 ParentTable = DtPeekSubtable ();
2037 DtInsertSubtable (ParentTable, Subtable);
2039 /* Optional data fields are appended to the main subtable body */
2041 switch (SdevHeader->Type)
2043 case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2046 * Device Id Offset will be be calculated differently depending on
2047 * the presence of secure access components.
2049 Namesp->DeviceIdOffset = 0;
2050 ComponentLength = 0;
2052 /* If the secure access component exists, get the structures */
2054 if (SdevHeader->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
2056 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev0b,
2058 if (ACPI_FAILURE (Status))
2062 ParentTable = DtPeekSubtable ();
2063 DtInsertSubtable (ParentTable, Subtable);
2065 Namesp->DeviceIdOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
2067 /* Compile a secure access component header */
2069 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdevSecCompHdr,
2071 if (ACPI_FAILURE (Status))
2075 ParentTable = DtPeekSubtable ();
2076 DtInsertSubtable (ParentTable, Subtable);
2078 /* Compile the secure access component */
2080 SecureComponentHeader = ACPI_CAST_PTR (ACPI_SDEV_HEADER, Subtable->Buffer);
2081 switch (SecureComponentHeader->Type)
2083 case ACPI_SDEV_TYPE_ID_COMPONENT:
2085 SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
2086 Namesp->DeviceIdOffset += sizeof (ACPI_SDEV_ID_COMPONENT);
2087 ComponentLength = sizeof (ACPI_SDEV_ID_COMPONENT);
2090 case ACPI_SDEV_TYPE_MEM_COMPONENT:
2092 SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
2093 Namesp->DeviceIdOffset += sizeof (ACPI_SDEV_MEM_COMPONENT);
2094 ComponentLength = sizeof (ACPI_SDEV_MEM_COMPONENT);
2099 /* Any other secure component types are undefined */
2104 Status = DtCompileTable (PFieldList, SecureComponentInfoTable,
2106 if (ACPI_FAILURE (Status))
2110 ParentTable = DtPeekSubtable ();
2111 DtInsertSubtable (ParentTable, Subtable);
2113 SecureComponent->SecureComponentOffset =
2114 sizeof (ACPI_SDEV_NAMESPACE) + sizeof (ACPI_SDEV_SECURE_COMPONENT);
2115 SecureComponent->SecureComponentLength = ComponentLength;
2119 * Add the secure component to the subtable to be added for the
2120 * the namespace subtable's length
2122 ComponentLength += sizeof (ACPI_SDEV_SECURE_COMPONENT);
2125 /* Append DeviceId namespace string */
2127 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev0a,
2129 if (ACPI_FAILURE (Status))
2139 ParentTable = DtPeekSubtable ();
2140 DtInsertSubtable (ParentTable, Subtable);
2142 Namesp->DeviceIdOffset += sizeof (ACPI_SDEV_NAMESPACE);
2144 Namesp->DeviceIdLength = (UINT16) Subtable->Length;
2146 /* Append Vendor data */
2148 Namesp->VendorDataLength = 0;
2149 Namesp->VendorDataOffset = 0;
2153 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b,
2155 if (ACPI_FAILURE (Status))
2162 ParentTable = DtPeekSubtable ();
2163 DtInsertSubtable (ParentTable, Subtable);
2165 Namesp->VendorDataOffset =
2166 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
2167 Namesp->VendorDataLength =
2168 (UINT16) Subtable->Length;
2170 /* Final size of entire namespace structure */
2172 SdevHeader->Length = (UINT16)(sizeof(ACPI_SDEV_NAMESPACE) +
2173 Subtable->Length + Namesp->DeviceIdLength) + ComponentLength;
2179 case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2181 /* Append the PCIe path info first */
2184 while (*PFieldList && !strcmp ((*PFieldList)->Name, "Device"))
2186 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1a,
2188 if (ACPI_FAILURE (Status))
2199 ParentTable = DtPeekSubtable ();
2200 DtInsertSubtable (ParentTable, Subtable);
2204 /* Path offset will point immediately after the main subtable */
2206 Pcie->PathOffset = sizeof (ACPI_SDEV_PCIE);
2207 Pcie->PathLength = (UINT16)
2208 (EntryCount * sizeof (ACPI_SDEV_PCIE_PATH));
2210 /* Append the Vendor Data last */
2212 Pcie->VendorDataLength = 0;
2213 Pcie->VendorDataOffset = 0;
2217 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b,
2219 if (ACPI_FAILURE (Status))
2226 ParentTable = DtPeekSubtable ();
2227 DtInsertSubtable (ParentTable, Subtable);
2229 Pcie->VendorDataOffset =
2230 Pcie->PathOffset + Pcie->PathLength;
2231 Pcie->VendorDataLength = (UINT16)
2236 SdevHeader->Length =
2237 sizeof (ACPI_SDEV_PCIE) +
2238 Pcie->PathLength + Pcie->VendorDataLength;
2243 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV");
2254 /******************************************************************************
2256 * FUNCTION: DtCompileSlic
2258 * PARAMETERS: List - Current field list pointer
2262 * DESCRIPTION: Compile SLIC.
2264 *****************************************************************************/
2271 DT_SUBTABLE *Subtable;
2272 DT_SUBTABLE *ParentTable;
2273 DT_FIELD **PFieldList = (DT_FIELD **) List;
2278 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic,
2280 if (ACPI_FAILURE (Status))
2285 ParentTable = DtPeekSubtable ();
2286 DtInsertSubtable (ParentTable, Subtable);
2287 DtPushSubtable (Subtable);
2295 /******************************************************************************
2297 * FUNCTION: DtCompileSlit
2299 * PARAMETERS: List - Current field list pointer
2303 * DESCRIPTION: Compile SLIT.
2305 *****************************************************************************/
2312 DT_SUBTABLE *Subtable;
2313 DT_SUBTABLE *ParentTable;
2314 DT_FIELD **PFieldList = (DT_FIELD **) List;
2315 DT_FIELD *FieldList;
2316 DT_FIELD *EndOfFieldList = NULL;
2318 UINT32 LocalityListLength;
2319 UINT8 *LocalityBuffer;
2322 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
2324 if (ACPI_FAILURE (Status))
2329 ParentTable = DtPeekSubtable ();
2330 DtInsertSubtable (ParentTable, Subtable);
2332 Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
2333 LocalityBuffer = UtLocalCalloc (Localities);
2334 LocalityListLength = 0;
2336 /* Compile each locality buffer */
2338 FieldList = *PFieldList;
2341 DtCompileBuffer (LocalityBuffer,
2342 FieldList->Value, FieldList, Localities);
2344 LocalityListLength++;
2345 DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
2346 DtInsertSubtable (ParentTable, Subtable);
2347 EndOfFieldList = FieldList;
2348 FieldList = FieldList->Next;
2351 if (LocalityListLength != Localities)
2353 sprintf(AslGbl_MsgBuffer,
2354 "Found %u entries, must match LocalityCount: %u",
2355 LocalityListLength, Localities);
2356 DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
2357 ACPI_FREE (LocalityBuffer);
2361 ACPI_FREE (LocalityBuffer);
2366 /******************************************************************************
2368 * FUNCTION: DtCompileSrat
2370 * PARAMETERS: List - Current field list pointer
2374 * DESCRIPTION: Compile SRAT.
2376 *****************************************************************************/
2383 DT_SUBTABLE *Subtable;
2384 DT_SUBTABLE *ParentTable;
2385 DT_FIELD **PFieldList = (DT_FIELD **) List;
2386 DT_FIELD *SubtableStart;
2387 ACPI_SUBTABLE_HEADER *SratHeader;
2388 ACPI_DMTABLE_INFO *InfoTable;
2391 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
2393 if (ACPI_FAILURE (Status))
2398 ParentTable = DtPeekSubtable ();
2399 DtInsertSubtable (ParentTable, Subtable);
2403 SubtableStart = *PFieldList;
2404 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
2406 if (ACPI_FAILURE (Status))
2411 ParentTable = DtPeekSubtable ();
2412 DtInsertSubtable (ParentTable, Subtable);
2413 DtPushSubtable (Subtable);
2415 SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
2417 switch (SratHeader->Type)
2419 case ACPI_SRAT_TYPE_CPU_AFFINITY:
2421 InfoTable = AcpiDmTableInfoSrat0;
2424 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
2426 InfoTable = AcpiDmTableInfoSrat1;
2429 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
2431 InfoTable = AcpiDmTableInfoSrat2;
2434 case ACPI_SRAT_TYPE_GICC_AFFINITY:
2436 InfoTable = AcpiDmTableInfoSrat3;
2439 case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
2441 InfoTable = AcpiDmTableInfoSrat4;
2444 case ACPI_SRAT_TYPE_GENERIC_AFFINITY:
2446 InfoTable = AcpiDmTableInfoSrat5;
2449 case ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY:
2451 InfoTable = AcpiDmTableInfoSrat6;
2456 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
2460 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
2461 if (ACPI_FAILURE (Status))
2466 ParentTable = DtPeekSubtable ();
2467 DtInsertSubtable (ParentTable, Subtable);
2475 /******************************************************************************
2477 * FUNCTION: DtCompileStao
2479 * PARAMETERS: PFieldList - Current field list pointer
2483 * DESCRIPTION: Compile STAO.
2485 *****************************************************************************/
2491 DT_FIELD **PFieldList = (DT_FIELD **) List;
2492 DT_SUBTABLE *Subtable;
2493 DT_SUBTABLE *ParentTable;
2497 /* Compile the main table */
2499 Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao,
2501 if (ACPI_FAILURE (Status))
2506 ParentTable = DtPeekSubtable ();
2507 DtInsertSubtable (ParentTable, Subtable);
2509 /* Compile each ASCII namestring as a subtable */
2513 Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr,
2515 if (ACPI_FAILURE (Status))
2520 ParentTable = DtPeekSubtable ();
2521 DtInsertSubtable (ParentTable, Subtable);
2528 /******************************************************************************
2530 * FUNCTION: DtCompileSvkl
2532 * PARAMETERS: PFieldList - Current field list pointer
2536 * DESCRIPTION: Compile SVKL.
2538 * NOTES: SVKL is essentially a flat table, with a small main table and
2539 * a variable number of a single type of subtable.
2541 *****************************************************************************/
2547 DT_FIELD **PFieldList = (DT_FIELD **) List;
2548 DT_SUBTABLE *Subtable;
2549 DT_SUBTABLE *ParentTable;
2553 /* Compile the main table */
2555 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSvkl,
2557 if (ACPI_FAILURE (Status))
2562 ParentTable = DtPeekSubtable ();
2563 DtInsertSubtable (ParentTable, Subtable);
2565 /* Compile each subtable */
2569 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSvkl0,
2571 if (ACPI_FAILURE (Status))
2576 ParentTable = DtPeekSubtable ();
2577 DtInsertSubtable (ParentTable, Subtable);
2584 /******************************************************************************
2586 * FUNCTION: DtCompileTcpa
2588 * PARAMETERS: PFieldList - Current field list pointer
2592 * DESCRIPTION: Compile TCPA.
2594 *****************************************************************************/
2600 DT_FIELD **PFieldList = (DT_FIELD **) List;
2601 DT_SUBTABLE *Subtable;
2602 ACPI_TABLE_TCPA_HDR *TcpaHeader;
2603 DT_SUBTABLE *ParentTable;
2607 /* Compile the main table */
2609 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr,
2611 if (ACPI_FAILURE (Status))
2616 ParentTable = DtPeekSubtable ();
2617 DtInsertSubtable (ParentTable, Subtable);
2620 * Examine the PlatformClass field to determine the table type.
2621 * Either a client or server table. Only one.
2623 TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
2625 switch (TcpaHeader->PlatformClass)
2627 case ACPI_TCPA_CLIENT_TABLE:
2629 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient,
2633 case ACPI_TCPA_SERVER_TABLE:
2635 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer,
2641 AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
2642 TcpaHeader->PlatformClass);
2647 ParentTable = DtPeekSubtable ();
2648 DtInsertSubtable (ParentTable, Subtable);
2653 /******************************************************************************
2655 * FUNCTION: DtCompileTpm2Rev3
2657 * PARAMETERS: PFieldList - Current field list pointer
2661 * DESCRIPTION: Compile TPM2 revision 3
2663 *****************************************************************************/
2668 DT_FIELD **PFieldList = (DT_FIELD **) List;
2669 DT_SUBTABLE *Subtable;
2670 ACPI_TABLE_TPM23 *Tpm23Header;
2671 DT_SUBTABLE *ParentTable;
2672 ACPI_STATUS Status = AE_OK;
2675 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm23,
2678 ParentTable = DtPeekSubtable ();
2679 DtInsertSubtable (ParentTable, Subtable);
2680 Tpm23Header = ACPI_CAST_PTR (ACPI_TABLE_TPM23, ParentTable->Buffer);
2682 /* Subtable type depends on the StartMethod */
2684 switch (Tpm23Header->StartMethod)
2686 case ACPI_TPM23_ACPI_START_METHOD:
2688 /* Subtable specific to to ARM_SMC */
2690 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm23a,
2692 if (ACPI_FAILURE (Status))
2697 ParentTable = DtPeekSubtable ();
2698 DtInsertSubtable (ParentTable, Subtable);
2709 /******************************************************************************
2711 * FUNCTION: DtCompileTpm2
2713 * PARAMETERS: PFieldList - Current field list pointer
2717 * DESCRIPTION: Compile TPM2.
2719 *****************************************************************************/
2725 DT_FIELD **PFieldList = (DT_FIELD **) List;
2726 DT_SUBTABLE *Subtable;
2727 ACPI_TABLE_TPM2 *Tpm2Header;
2728 DT_SUBTABLE *ParentTable;
2729 ACPI_STATUS Status = AE_OK;
2730 ACPI_TABLE_HEADER *Header;
2733 ParentTable = DtPeekSubtable ();
2735 Header = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
2737 if (Header->Revision == 3)
2739 return (DtCompileTpm2Rev3 (List));
2742 /* Compile the main table */
2744 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2,
2746 if (ACPI_FAILURE (Status))
2751 ParentTable = DtPeekSubtable ();
2752 DtInsertSubtable (ParentTable, Subtable);
2754 Tpm2Header = ACPI_CAST_PTR (ACPI_TABLE_TPM2, ParentTable->Buffer);
2756 /* Method parameters */
2757 /* Optional: Log area minimum length */
2758 /* Optional: Log area start address */
2759 /* TBD: Optional fields above not fully implemented (not optional at this time) */
2761 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2a,
2763 if (ACPI_FAILURE (Status))
2768 ParentTable = DtPeekSubtable ();
2769 DtInsertSubtable (ParentTable, Subtable);
2772 /* Subtable type depends on the StartMethod */
2774 switch (Tpm2Header->StartMethod)
2776 case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
2778 /* Subtable specific to to ARM_SMC */
2780 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm211,
2782 if (ACPI_FAILURE (Status))
2787 ParentTable = DtPeekSubtable ();
2788 DtInsertSubtable (ParentTable, Subtable);
2791 case ACPI_TPM2_START_METHOD:
2792 case ACPI_TPM2_MEMORY_MAPPED:
2793 case ACPI_TPM2_COMMAND_BUFFER:
2794 case ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD:
2797 case ACPI_TPM2_RESERVED1:
2798 case ACPI_TPM2_RESERVED3:
2799 case ACPI_TPM2_RESERVED4:
2800 case ACPI_TPM2_RESERVED5:
2801 case ACPI_TPM2_RESERVED9:
2802 case ACPI_TPM2_RESERVED10:
2804 AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
2805 Tpm2Header->StartMethod);
2809 case ACPI_TPM2_NOT_ALLOWED:
2812 AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
2813 Tpm2Header->StartMethod);
2822 /******************************************************************************
2824 * FUNCTION: DtGetGenericTableInfo
2826 * PARAMETERS: Name - Generic type name
2828 * RETURN: Info entry
2830 * DESCRIPTION: Obtain table info for a generic name entry
2832 *****************************************************************************/
2835 DtGetGenericTableInfo (
2838 ACPI_DMTABLE_INFO *Info;
2847 /* Search info table for name match */
2851 Info = AcpiDmTableInfoGeneric[i];
2852 if (Info->Opcode == ACPI_DMT_EXIT)
2858 /* Use caseless compare for generic keywords */
2860 if (!AcpiUtStricmp (Name, Info->Name))
2870 /******************************************************************************
2872 * FUNCTION: DtCompileUefi
2874 * PARAMETERS: List - Current field list pointer
2878 * DESCRIPTION: Compile UEFI.
2880 *****************************************************************************/
2887 DT_SUBTABLE *Subtable;
2888 DT_SUBTABLE *ParentTable;
2889 DT_FIELD **PFieldList = (DT_FIELD **) List;
2893 /* Compile the predefined portion of the UEFI table */
2895 Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
2897 if (ACPI_FAILURE (Status))
2902 DataOffset = (UINT16 *) (Subtable->Buffer + 16);
2903 *DataOffset = sizeof (ACPI_TABLE_UEFI);
2905 ParentTable = DtPeekSubtable ();
2906 DtInsertSubtable (ParentTable, Subtable);
2909 * Compile the "generic" portion of the UEFI table. This
2910 * part of the table is not predefined and any of the generic
2911 * operators may be used.
2913 DtCompileGeneric ((void **) PFieldList, NULL, NULL);
2918 /******************************************************************************
2920 * FUNCTION: DtCompileViot
2922 * PARAMETERS: List - Current field list pointer
2926 * DESCRIPTION: Compile VIOT.
2928 *****************************************************************************/
2935 DT_SUBTABLE *Subtable;
2936 DT_SUBTABLE *ParentTable;
2937 DT_FIELD **PFieldList = (DT_FIELD **) List;
2938 DT_FIELD *SubtableStart;
2939 ACPI_TABLE_VIOT *Viot;
2940 ACPI_VIOT_HEADER *ViotHeader;
2941 ACPI_DMTABLE_INFO *InfoTable;
2944 ParentTable = DtPeekSubtable ();
2946 Status = DtCompileTable (PFieldList, AcpiDmTableInfoViot, &Subtable);
2947 if (ACPI_FAILURE (Status))
2951 DtInsertSubtable (ParentTable, Subtable);
2954 * Using ACPI_SUB_PTR, We needn't define a separate structure. Care
2955 * should be taken to avoid accessing ACPI_TABLE_HEADER fields.
2957 Viot = ACPI_SUB_PTR (ACPI_TABLE_VIOT, Subtable->Buffer,
2958 sizeof (ACPI_TABLE_HEADER));
2960 Viot->NodeOffset = sizeof (ACPI_TABLE_VIOT);
2963 while (*PFieldList) {
2964 SubtableStart = *PFieldList;
2965 Status = DtCompileTable (PFieldList, AcpiDmTableInfoViotHeader,
2967 if (ACPI_FAILURE (Status))
2972 ParentTable = DtPeekSubtable ();
2973 DtInsertSubtable (ParentTable, Subtable);
2974 DtPushSubtable (Subtable);
2976 ViotHeader = ACPI_CAST_PTR (ACPI_VIOT_HEADER, Subtable->Buffer);
2978 switch (ViotHeader->Type)
2980 case ACPI_VIOT_NODE_PCI_RANGE:
2982 InfoTable = AcpiDmTableInfoViot1;
2985 case ACPI_VIOT_NODE_MMIO:
2987 InfoTable = AcpiDmTableInfoViot2;
2990 case ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI:
2992 InfoTable = AcpiDmTableInfoViot3;
2995 case ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO:
2997 InfoTable = AcpiDmTableInfoViot4;
3002 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "VIOT");
3006 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
3007 if (ACPI_FAILURE (Status))
3012 ParentTable = DtPeekSubtable ();
3013 DtInsertSubtable (ParentTable, Subtable);
3018 Viot->NodeCount = NodeCount;
3023 /******************************************************************************
3025 * FUNCTION: DtCompileWdat
3027 * PARAMETERS: List - Current field list pointer
3031 * DESCRIPTION: Compile WDAT.
3033 *****************************************************************************/
3042 Status = DtCompileTwoSubtables (List,
3043 AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
3048 /******************************************************************************
3050 * FUNCTION: DtCompileWpbt
3052 * PARAMETERS: List - Current field list pointer
3056 * DESCRIPTION: Compile WPBT.
3058 *****************************************************************************/
3064 DT_FIELD **PFieldList = (DT_FIELD **) List;
3065 DT_SUBTABLE *Subtable;
3066 DT_SUBTABLE *ParentTable;
3067 ACPI_TABLE_WPBT *Table;
3071 /* Compile the main table */
3073 Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, &Subtable);
3074 if (ACPI_FAILURE (Status))
3079 ParentTable = DtPeekSubtable ();
3080 DtInsertSubtable (ParentTable, Subtable);
3081 Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
3084 * Exit now if there are no arguments specified. This is indicated by:
3085 * The "Command-line Arguments" field has not been specified (if specified,
3086 * it will be the last field in the field list -- after the main table).
3087 * Set the Argument Length in the main table to zero.
3091 Table->ArgumentsLength = 0;
3095 /* Compile the argument list subtable */
3097 Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, &Subtable);
3098 if (ACPI_FAILURE (Status))
3103 /* Extract the length of the Arguments buffer, insert into main table */
3105 Table->ArgumentsLength = (UINT16) Subtable->TotalLength;
3106 DtInsertSubtable (ParentTable, Subtable);
3111 /******************************************************************************
3113 * FUNCTION: DtCompileXsdt
3115 * PARAMETERS: List - Current field list pointer
3119 * DESCRIPTION: Compile XSDT.
3121 *****************************************************************************/
3127 DT_SUBTABLE *Subtable;
3128 DT_SUBTABLE *ParentTable;
3129 DT_FIELD *FieldList = *(DT_FIELD **) List;
3133 ParentTable = DtPeekSubtable ();
3137 DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
3139 DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
3140 DtInsertSubtable (ParentTable, Subtable);
3141 FieldList = FieldList->Next;
3148 /******************************************************************************
3150 * FUNCTION: DtCompileGeneric
3152 * PARAMETERS: List - Current field list pointer
3153 * Name - Field name to end generic compiling
3154 * Length - Compiled table length to return
3158 * DESCRIPTION: Compile generic unknown table.
3160 *****************************************************************************/
3169 DT_SUBTABLE *Subtable;
3170 DT_SUBTABLE *ParentTable;
3171 DT_FIELD **PFieldList = (DT_FIELD **) List;
3172 ACPI_DMTABLE_INFO *Info;
3175 ParentTable = DtPeekSubtable ();
3178 * Compile the "generic" portion of the table. This
3179 * part of the table is not predefined and any of the generic
3180 * operators may be used.
3183 /* Find any and all labels in the entire generic portion */
3185 DtDetectAllLabels (*PFieldList);
3187 /* Now we can actually compile the parse tree */
3189 if (Length && *Length)
3195 if (Name && !strcmp ((*PFieldList)->Name, Name))
3200 Info = DtGetGenericTableInfo ((*PFieldList)->Name);
3203 sprintf (AslGbl_MsgBuffer, "Generic data type \"%s\" not found",
3204 (*PFieldList)->Name);
3205 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
3206 (*PFieldList), AslGbl_MsgBuffer);
3208 *PFieldList = (*PFieldList)->Next;
3212 Status = DtCompileTable (PFieldList, Info,
3214 if (ACPI_SUCCESS (Status))
3216 DtInsertSubtable (ParentTable, Subtable);
3219 *Length += Subtable->Length;
3224 *PFieldList = (*PFieldList)->Next;
3226 if (Status == AE_NOT_FOUND)
3228 sprintf (AslGbl_MsgBuffer, "Generic data type \"%s\" not found",
3229 (*PFieldList)->Name);
3230 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
3231 (*PFieldList), AslGbl_MsgBuffer);