1 /******************************************************************************
3 * Module Name: dttable2.c - handling for specific ACPI tables
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2017, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
155 #include <contrib/dev/acpica/compiler/dtcompiler.h>
157 #define _COMPONENT DT_COMPILER
158 ACPI_MODULE_NAME ("dttable2")
161 /******************************************************************************
163 * FUNCTION: DtCompileLpit
165 * PARAMETERS: List - Current field list pointer
169 * DESCRIPTION: Compile LPIT.
171 *****************************************************************************/
178 DT_SUBTABLE *Subtable;
179 DT_SUBTABLE *ParentTable;
180 DT_FIELD **PFieldList = (DT_FIELD **) List;
181 DT_FIELD *SubtableStart;
182 ACPI_DMTABLE_INFO *InfoTable;
183 ACPI_LPIT_HEADER *LpitHeader;
186 /* Note: Main table consists only of the standard ACPI table header */
190 SubtableStart = *PFieldList;
192 /* LPIT Subtable header */
194 Status = DtCompileTable (PFieldList, AcpiDmTableInfoLpitHdr,
196 if (ACPI_FAILURE (Status))
201 ParentTable = DtPeekSubtable ();
202 DtInsertSubtable (ParentTable, Subtable);
203 DtPushSubtable (Subtable);
205 LpitHeader = ACPI_CAST_PTR (ACPI_LPIT_HEADER, Subtable->Buffer);
207 switch (LpitHeader->Type)
209 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
211 InfoTable = AcpiDmTableInfoLpit0;
216 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT");
222 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
223 if (ACPI_FAILURE (Status))
228 ParentTable = DtPeekSubtable ();
229 DtInsertSubtable (ParentTable, Subtable);
237 /******************************************************************************
239 * FUNCTION: DtCompileMadt
241 * PARAMETERS: List - Current field list pointer
245 * DESCRIPTION: Compile MADT.
247 *****************************************************************************/
254 DT_SUBTABLE *Subtable;
255 DT_SUBTABLE *ParentTable;
256 DT_FIELD **PFieldList = (DT_FIELD **) List;
257 DT_FIELD *SubtableStart;
258 ACPI_SUBTABLE_HEADER *MadtHeader;
259 ACPI_DMTABLE_INFO *InfoTable;
262 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt,
264 if (ACPI_FAILURE (Status))
269 ParentTable = DtPeekSubtable ();
270 DtInsertSubtable (ParentTable, Subtable);
274 SubtableStart = *PFieldList;
275 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr,
277 if (ACPI_FAILURE (Status))
282 ParentTable = DtPeekSubtable ();
283 DtInsertSubtable (ParentTable, Subtable);
284 DtPushSubtable (Subtable);
286 MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
288 switch (MadtHeader->Type)
290 case ACPI_MADT_TYPE_LOCAL_APIC:
292 InfoTable = AcpiDmTableInfoMadt0;
295 case ACPI_MADT_TYPE_IO_APIC:
297 InfoTable = AcpiDmTableInfoMadt1;
300 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
302 InfoTable = AcpiDmTableInfoMadt2;
305 case ACPI_MADT_TYPE_NMI_SOURCE:
307 InfoTable = AcpiDmTableInfoMadt3;
310 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
312 InfoTable = AcpiDmTableInfoMadt4;
315 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
317 InfoTable = AcpiDmTableInfoMadt5;
320 case ACPI_MADT_TYPE_IO_SAPIC:
322 InfoTable = AcpiDmTableInfoMadt6;
325 case ACPI_MADT_TYPE_LOCAL_SAPIC:
327 InfoTable = AcpiDmTableInfoMadt7;
330 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
332 InfoTable = AcpiDmTableInfoMadt8;
335 case ACPI_MADT_TYPE_LOCAL_X2APIC:
337 InfoTable = AcpiDmTableInfoMadt9;
340 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
342 InfoTable = AcpiDmTableInfoMadt10;
345 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
347 InfoTable = AcpiDmTableInfoMadt11;
350 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
352 InfoTable = AcpiDmTableInfoMadt12;
355 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
357 InfoTable = AcpiDmTableInfoMadt13;
360 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
362 InfoTable = AcpiDmTableInfoMadt14;
365 case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
367 InfoTable = AcpiDmTableInfoMadt15;
372 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT");
376 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
377 if (ACPI_FAILURE (Status))
382 ParentTable = DtPeekSubtable ();
383 DtInsertSubtable (ParentTable, Subtable);
391 /******************************************************************************
393 * FUNCTION: DtCompileMcfg
395 * PARAMETERS: List - Current field list pointer
399 * DESCRIPTION: Compile MCFG.
401 *****************************************************************************/
410 Status = DtCompileTwoSubtables (List,
411 AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0);
416 /******************************************************************************
418 * FUNCTION: DtCompileMpst
420 * PARAMETERS: List - Current field list pointer
424 * DESCRIPTION: Compile MPST.
426 *****************************************************************************/
433 DT_SUBTABLE *Subtable;
434 DT_SUBTABLE *ParentTable;
435 DT_FIELD **PFieldList = (DT_FIELD **) List;
436 ACPI_MPST_CHANNEL *MpstChannelInfo;
437 ACPI_MPST_POWER_NODE *MpstPowerNode;
438 ACPI_MPST_DATA_HDR *MpstDataHeader;
439 UINT16 SubtableCount;
440 UINT32 PowerStateCount;
441 UINT32 ComponentCount;
446 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable, TRUE);
447 if (ACPI_FAILURE (Status))
452 ParentTable = DtPeekSubtable ();
453 DtInsertSubtable (ParentTable, Subtable);
454 DtPushSubtable (Subtable);
456 MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
457 SubtableCount = MpstChannelInfo->PowerNodeCount;
459 while (*PFieldList && SubtableCount)
461 /* Subtable: Memory Power Node(s) */
463 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0,
465 if (ACPI_FAILURE (Status))
470 ParentTable = DtPeekSubtable ();
471 DtInsertSubtable (ParentTable, Subtable);
472 DtPushSubtable (Subtable);
474 MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
475 PowerStateCount = MpstPowerNode->NumPowerStates;
476 ComponentCount = MpstPowerNode->NumPhysicalComponents;
478 ParentTable = DtPeekSubtable ();
480 /* Sub-subtables - Memory Power State Structure(s) */
482 while (*PFieldList && PowerStateCount)
484 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A,
486 if (ACPI_FAILURE (Status))
491 DtInsertSubtable (ParentTable, Subtable);
495 /* Sub-subtables - Physical Component ID Structure(s) */
497 while (*PFieldList && ComponentCount)
499 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B,
501 if (ACPI_FAILURE (Status))
506 DtInsertSubtable (ParentTable, Subtable);
514 /* Subtable: Count of Memory Power State Characteristic structures */
518 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable, TRUE);
519 if (ACPI_FAILURE (Status))
524 ParentTable = DtPeekSubtable ();
525 DtInsertSubtable (ParentTable, Subtable);
526 DtPushSubtable (Subtable);
528 MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
529 SubtableCount = MpstDataHeader->CharacteristicsCount;
531 ParentTable = DtPeekSubtable ();
533 /* Subtable: Memory Power State Characteristics structure(s) */
535 while (*PFieldList && SubtableCount)
537 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2,
539 if (ACPI_FAILURE (Status))
544 DtInsertSubtable (ParentTable, Subtable);
553 /******************************************************************************
555 * FUNCTION: DtCompileMsct
557 * PARAMETERS: List - Current field list pointer
561 * DESCRIPTION: Compile MSCT.
563 *****************************************************************************/
572 Status = DtCompileTwoSubtables (List,
573 AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0);
578 /******************************************************************************
580 * FUNCTION: DtCompileMtmr
582 * PARAMETERS: List - Current field list pointer
586 * DESCRIPTION: Compile MTMR.
588 *****************************************************************************/
597 Status = DtCompileTwoSubtables (List,
598 AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0);
603 /******************************************************************************
605 * FUNCTION: DtCompileNfit
607 * PARAMETERS: List - Current field list pointer
611 * DESCRIPTION: Compile NFIT.
613 *****************************************************************************/
620 DT_SUBTABLE *Subtable;
621 DT_SUBTABLE *ParentTable;
622 DT_FIELD **PFieldList = (DT_FIELD **) List;
623 DT_FIELD *SubtableStart;
624 ACPI_NFIT_HEADER *NfitHeader;
625 ACPI_DMTABLE_INFO *InfoTable;
627 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
628 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
633 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit,
635 if (ACPI_FAILURE (Status))
640 ParentTable = DtPeekSubtable ();
641 DtInsertSubtable (ParentTable, Subtable);
642 DtPushSubtable (Subtable);
648 SubtableStart = *PFieldList;
649 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr,
651 if (ACPI_FAILURE (Status))
656 ParentTable = DtPeekSubtable ();
657 DtInsertSubtable (ParentTable, Subtable);
658 DtPushSubtable (Subtable);
660 NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
662 switch (NfitHeader->Type)
664 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
666 InfoTable = AcpiDmTableInfoNfit0;
669 case ACPI_NFIT_TYPE_MEMORY_MAP:
671 InfoTable = AcpiDmTableInfoNfit1;
674 case ACPI_NFIT_TYPE_INTERLEAVE:
676 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer);
677 InfoTable = AcpiDmTableInfoNfit2;
680 case ACPI_NFIT_TYPE_SMBIOS:
682 InfoTable = AcpiDmTableInfoNfit3;
685 case ACPI_NFIT_TYPE_CONTROL_REGION:
687 InfoTable = AcpiDmTableInfoNfit4;
690 case ACPI_NFIT_TYPE_DATA_REGION:
692 InfoTable = AcpiDmTableInfoNfit5;
695 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
697 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer);
698 InfoTable = AcpiDmTableInfoNfit6;
703 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT");
707 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
708 if (ACPI_FAILURE (Status))
713 ParentTable = DtPeekSubtable ();
714 DtInsertSubtable (ParentTable, Subtable);
717 switch (NfitHeader->Type)
719 case ACPI_NFIT_TYPE_INTERLEAVE:
722 DtPushSubtable (Subtable);
725 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a,
727 if (ACPI_FAILURE (Status))
738 ParentTable = DtPeekSubtable ();
739 DtInsertSubtable (ParentTable, Subtable);
743 Interleave->LineCount = Count;
747 case ACPI_NFIT_TYPE_SMBIOS:
751 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a,
753 if (ACPI_FAILURE (Status))
760 DtInsertSubtable (ParentTable, Subtable);
765 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
768 DtPushSubtable (Subtable);
771 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a,
773 if (ACPI_FAILURE (Status))
784 ParentTable = DtPeekSubtable ();
785 DtInsertSubtable (ParentTable, Subtable);
789 Hint->HintCount = (UINT16) Count;
802 /******************************************************************************
804 * FUNCTION: DtCompilePcct
806 * PARAMETERS: List - Current field list pointer
810 * DESCRIPTION: Compile PCCT.
812 *****************************************************************************/
819 DT_SUBTABLE *Subtable;
820 DT_SUBTABLE *ParentTable;
821 DT_FIELD **PFieldList = (DT_FIELD **) List;
822 DT_FIELD *SubtableStart;
823 ACPI_SUBTABLE_HEADER *PcctHeader;
824 ACPI_DMTABLE_INFO *InfoTable;
829 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct,
831 if (ACPI_FAILURE (Status))
836 ParentTable = DtPeekSubtable ();
837 DtInsertSubtable (ParentTable, Subtable);
843 SubtableStart = *PFieldList;
844 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcctHdr,
846 if (ACPI_FAILURE (Status))
851 ParentTable = DtPeekSubtable ();
852 DtInsertSubtable (ParentTable, Subtable);
853 DtPushSubtable (Subtable);
855 PcctHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
857 switch (PcctHeader->Type)
859 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
861 InfoTable = AcpiDmTableInfoPcct0;
864 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
866 InfoTable = AcpiDmTableInfoPcct1;
869 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
871 InfoTable = AcpiDmTableInfoPcct2;
876 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT");
880 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
881 if (ACPI_FAILURE (Status))
886 ParentTable = DtPeekSubtable ();
887 DtInsertSubtable (ParentTable, Subtable);
895 /******************************************************************************
897 * FUNCTION: DtCompilePmtt
899 * PARAMETERS: List - Current field list pointer
903 * DESCRIPTION: Compile PMTT.
905 *****************************************************************************/
912 DT_SUBTABLE *Subtable;
913 DT_SUBTABLE *ParentTable;
914 DT_FIELD **PFieldList = (DT_FIELD **) List;
915 DT_FIELD *SubtableStart;
916 ACPI_PMTT_HEADER *PmttHeader;
917 ACPI_PMTT_CONTROLLER *PmttController;
919 UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET;
924 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable, TRUE);
925 if (ACPI_FAILURE (Status))
930 ParentTable = DtPeekSubtable ();
931 DtInsertSubtable (ParentTable, Subtable);
932 DtPushSubtable (Subtable);
936 SubtableStart = *PFieldList;
937 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr,
939 if (ACPI_FAILURE (Status))
944 PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer);
945 while (PrevType >= PmttHeader->Type)
949 if (PrevType == ACPI_PMTT_TYPE_SOCKET)
957 PrevType = PmttHeader->Type;
959 ParentTable = DtPeekSubtable ();
960 DtInsertSubtable (ParentTable, Subtable);
961 DtPushSubtable (Subtable);
963 switch (PmttHeader->Type)
965 case ACPI_PMTT_TYPE_SOCKET:
967 /* Subtable: Socket Structure */
969 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0,
971 if (ACPI_FAILURE (Status))
976 ParentTable = DtPeekSubtable ();
977 DtInsertSubtable (ParentTable, Subtable);
980 case ACPI_PMTT_TYPE_CONTROLLER:
982 /* Subtable: Memory Controller Structure */
984 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1,
986 if (ACPI_FAILURE (Status))
991 ParentTable = DtPeekSubtable ();
992 DtInsertSubtable (ParentTable, Subtable);
994 PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
995 (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
996 DomainCount = PmttController->DomainCount;
1000 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a,
1002 if (ACPI_FAILURE (Status))
1007 DtInsertSubtable (ParentTable, Subtable);
1012 case ACPI_PMTT_TYPE_DIMM:
1014 /* Subtable: Physical Component Structure */
1016 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2,
1018 if (ACPI_FAILURE (Status))
1023 ParentTable = DtPeekSubtable ();
1024 DtInsertSubtable (ParentTable, Subtable);
1029 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT");
1038 /******************************************************************************
1040 * FUNCTION: DtCompileRsdt
1042 * PARAMETERS: List - Current field list pointer
1046 * DESCRIPTION: Compile RSDT.
1048 *****************************************************************************/
1054 DT_SUBTABLE *Subtable;
1055 DT_SUBTABLE *ParentTable;
1056 DT_FIELD *FieldList = *(DT_FIELD **) List;
1060 ParentTable = DtPeekSubtable ();
1064 DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
1066 DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
1067 DtInsertSubtable (ParentTable, Subtable);
1068 FieldList = FieldList->Next;
1075 /******************************************************************************
1077 * FUNCTION: DtCompileS3pt
1079 * PARAMETERS: PFieldList - Current field list pointer
1083 * DESCRIPTION: Compile S3PT (Pointed to by FPDT)
1085 *****************************************************************************/
1089 DT_FIELD **PFieldList)
1092 ACPI_FPDT_HEADER *S3ptHeader;
1093 DT_SUBTABLE *Subtable;
1094 DT_SUBTABLE *ParentTable;
1095 ACPI_DMTABLE_INFO *InfoTable;
1096 DT_FIELD *SubtableStart;
1099 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
1100 &Gbl_RootTable, TRUE);
1101 if (ACPI_FAILURE (Status))
1106 DtPushSubtable (Gbl_RootTable);
1110 SubtableStart = *PFieldList;
1111 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr,
1113 if (ACPI_FAILURE (Status))
1118 ParentTable = DtPeekSubtable ();
1119 DtInsertSubtable (ParentTable, Subtable);
1120 DtPushSubtable (Subtable);
1122 S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1124 switch (S3ptHeader->Type)
1126 case ACPI_S3PT_TYPE_RESUME:
1128 InfoTable = AcpiDmTableInfoS3pt0;
1131 case ACPI_S3PT_TYPE_SUSPEND:
1133 InfoTable = AcpiDmTableInfoS3pt1;
1138 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT");
1142 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1143 if (ACPI_FAILURE (Status))
1148 ParentTable = DtPeekSubtable ();
1149 DtInsertSubtable (ParentTable, Subtable);
1157 /******************************************************************************
1159 * FUNCTION: DtCompileSlic
1161 * PARAMETERS: List - Current field list pointer
1165 * DESCRIPTION: Compile SLIC.
1167 *****************************************************************************/
1174 DT_SUBTABLE *Subtable;
1175 DT_SUBTABLE *ParentTable;
1176 DT_FIELD **PFieldList = (DT_FIELD **) List;
1181 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic,
1183 if (ACPI_FAILURE (Status))
1188 ParentTable = DtPeekSubtable ();
1189 DtInsertSubtable (ParentTable, Subtable);
1190 DtPushSubtable (Subtable);
1198 /******************************************************************************
1200 * FUNCTION: DtCompileSlit
1202 * PARAMETERS: List - Current field list pointer
1206 * DESCRIPTION: Compile SLIT.
1208 *****************************************************************************/
1215 DT_SUBTABLE *Subtable;
1216 DT_SUBTABLE *ParentTable;
1217 DT_FIELD **PFieldList = (DT_FIELD **) List;
1218 DT_FIELD *FieldList;
1220 UINT8 *LocalityBuffer;
1223 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1225 if (ACPI_FAILURE (Status))
1230 ParentTable = DtPeekSubtable ();
1231 DtInsertSubtable (ParentTable, Subtable);
1233 Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
1234 LocalityBuffer = UtLocalCalloc (Localities);
1236 /* Compile each locality buffer */
1238 FieldList = *PFieldList;
1241 DtCompileBuffer (LocalityBuffer,
1242 FieldList->Value, FieldList, Localities);
1244 DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
1245 DtInsertSubtable (ParentTable, Subtable);
1246 FieldList = FieldList->Next;
1249 ACPI_FREE (LocalityBuffer);
1254 /******************************************************************************
1256 * FUNCTION: DtCompileSrat
1258 * PARAMETERS: List - Current field list pointer
1262 * DESCRIPTION: Compile SRAT.
1264 *****************************************************************************/
1271 DT_SUBTABLE *Subtable;
1272 DT_SUBTABLE *ParentTable;
1273 DT_FIELD **PFieldList = (DT_FIELD **) List;
1274 DT_FIELD *SubtableStart;
1275 ACPI_SUBTABLE_HEADER *SratHeader;
1276 ACPI_DMTABLE_INFO *InfoTable;
1279 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
1281 if (ACPI_FAILURE (Status))
1286 ParentTable = DtPeekSubtable ();
1287 DtInsertSubtable (ParentTable, Subtable);
1291 SubtableStart = *PFieldList;
1292 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
1294 if (ACPI_FAILURE (Status))
1299 ParentTable = DtPeekSubtable ();
1300 DtInsertSubtable (ParentTable, Subtable);
1301 DtPushSubtable (Subtable);
1303 SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1305 switch (SratHeader->Type)
1307 case ACPI_SRAT_TYPE_CPU_AFFINITY:
1309 InfoTable = AcpiDmTableInfoSrat0;
1312 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1314 InfoTable = AcpiDmTableInfoSrat1;
1317 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1319 InfoTable = AcpiDmTableInfoSrat2;
1322 case ACPI_SRAT_TYPE_GICC_AFFINITY:
1324 InfoTable = AcpiDmTableInfoSrat3;
1329 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
1333 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1334 if (ACPI_FAILURE (Status))
1339 ParentTable = DtPeekSubtable ();
1340 DtInsertSubtable (ParentTable, Subtable);
1348 /******************************************************************************
1350 * FUNCTION: DtCompileStao
1352 * PARAMETERS: PFieldList - Current field list pointer
1356 * DESCRIPTION: Compile STAO.
1358 *****************************************************************************/
1364 DT_FIELD **PFieldList = (DT_FIELD **) List;
1365 DT_SUBTABLE *Subtable;
1366 DT_SUBTABLE *ParentTable;
1370 /* Compile the main table */
1372 Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao,
1374 if (ACPI_FAILURE (Status))
1379 ParentTable = DtPeekSubtable ();
1380 DtInsertSubtable (ParentTable, Subtable);
1382 /* Compile each ASCII namestring as a subtable */
1386 Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr,
1388 if (ACPI_FAILURE (Status))
1393 ParentTable = DtPeekSubtable ();
1394 DtInsertSubtable (ParentTable, Subtable);
1401 /******************************************************************************
1403 * FUNCTION: DtCompileTcpa
1405 * PARAMETERS: PFieldList - Current field list pointer
1409 * DESCRIPTION: Compile TCPA.
1411 *****************************************************************************/
1417 DT_FIELD **PFieldList = (DT_FIELD **) List;
1418 DT_SUBTABLE *Subtable;
1419 ACPI_TABLE_TCPA_HDR *TcpaHeader;
1420 DT_SUBTABLE *ParentTable;
1424 /* Compile the main table */
1426 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr,
1428 if (ACPI_FAILURE (Status))
1433 ParentTable = DtPeekSubtable ();
1434 DtInsertSubtable (ParentTable, Subtable);
1437 * Examine the PlatformClass field to determine the table type.
1438 * Either a client or server table. Only one.
1440 TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
1442 switch (TcpaHeader->PlatformClass)
1444 case ACPI_TCPA_CLIENT_TABLE:
1446 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient,
1450 case ACPI_TCPA_SERVER_TABLE:
1452 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer,
1458 AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
1459 TcpaHeader->PlatformClass);
1464 ParentTable = DtPeekSubtable ();
1465 DtInsertSubtable (ParentTable, Subtable);
1470 /******************************************************************************
1472 * FUNCTION: DtGetGenericTableInfo
1474 * PARAMETERS: Name - Generic type name
1476 * RETURN: Info entry
1478 * DESCRIPTION: Obtain table info for a generic name entry
1480 *****************************************************************************/
1483 DtGetGenericTableInfo (
1486 ACPI_DMTABLE_INFO *Info;
1495 /* Search info table for name match */
1499 Info = AcpiDmTableInfoGeneric[i];
1500 if (Info->Opcode == ACPI_DMT_EXIT)
1506 /* Use caseless compare for generic keywords */
1508 if (!AcpiUtStricmp (Name, Info->Name))
1518 /******************************************************************************
1520 * FUNCTION: DtCompileUefi
1522 * PARAMETERS: List - Current field list pointer
1526 * DESCRIPTION: Compile UEFI.
1528 *****************************************************************************/
1535 DT_SUBTABLE *Subtable;
1536 DT_SUBTABLE *ParentTable;
1537 DT_FIELD **PFieldList = (DT_FIELD **) List;
1541 /* Compile the predefined portion of the UEFI table */
1543 Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
1545 if (ACPI_FAILURE (Status))
1550 DataOffset = (UINT16 *) (Subtable->Buffer + 16);
1551 *DataOffset = sizeof (ACPI_TABLE_UEFI);
1553 ParentTable = DtPeekSubtable ();
1554 DtInsertSubtable (ParentTable, Subtable);
1557 * Compile the "generic" portion of the UEFI table. This
1558 * part of the table is not predefined and any of the generic
1559 * operators may be used.
1561 DtCompileGeneric ((void **) PFieldList, NULL, NULL);
1566 /******************************************************************************
1568 * FUNCTION: DtCompileVrtc
1570 * PARAMETERS: List - Current field list pointer
1574 * DESCRIPTION: Compile VRTC.
1576 *****************************************************************************/
1585 Status = DtCompileTwoSubtables (List,
1586 AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0);
1591 /******************************************************************************
1593 * FUNCTION: DtCompileWdat
1595 * PARAMETERS: List - Current field list pointer
1599 * DESCRIPTION: Compile WDAT.
1601 *****************************************************************************/
1610 Status = DtCompileTwoSubtables (List,
1611 AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
1616 /******************************************************************************
1618 * FUNCTION: DtCompileWpbt
1620 * PARAMETERS: List - Current field list pointer
1624 * DESCRIPTION: Compile WPBT.
1626 *****************************************************************************/
1632 DT_FIELD **PFieldList = (DT_FIELD **) List;
1633 DT_SUBTABLE *Subtable;
1634 DT_SUBTABLE *ParentTable;
1635 ACPI_TABLE_WPBT *Table;
1640 /* Compile the main table */
1642 Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt,
1644 if (ACPI_FAILURE (Status))
1649 ParentTable = DtPeekSubtable ();
1650 DtInsertSubtable (ParentTable, Subtable);
1652 /* Compile the argument list subtable */
1654 Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0,
1656 if (ACPI_FAILURE (Status))
1661 /* Extract the length of the Arguments buffer, insert into main table */
1663 Length = (UINT16) Subtable->TotalLength;
1664 Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
1665 Table->ArgumentsLength = Length;
1667 ParentTable = DtPeekSubtable ();
1668 DtInsertSubtable (ParentTable, Subtable);
1673 /******************************************************************************
1675 * FUNCTION: DtCompileXsdt
1677 * PARAMETERS: List - Current field list pointer
1681 * DESCRIPTION: Compile XSDT.
1683 *****************************************************************************/
1689 DT_SUBTABLE *Subtable;
1690 DT_SUBTABLE *ParentTable;
1691 DT_FIELD *FieldList = *(DT_FIELD **) List;
1695 ParentTable = DtPeekSubtable ();
1699 DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
1701 DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
1702 DtInsertSubtable (ParentTable, Subtable);
1703 FieldList = FieldList->Next;
1710 /******************************************************************************
1712 * FUNCTION: DtCompileGeneric
1714 * PARAMETERS: List - Current field list pointer
1715 * Name - Field name to end generic compiling
1716 * Length - Compiled table length to return
1720 * DESCRIPTION: Compile generic unknown table.
1722 *****************************************************************************/
1731 DT_SUBTABLE *Subtable;
1732 DT_SUBTABLE *ParentTable;
1733 DT_FIELD **PFieldList = (DT_FIELD **) List;
1734 ACPI_DMTABLE_INFO *Info;
1737 ParentTable = DtPeekSubtable ();
1740 * Compile the "generic" portion of the table. This
1741 * part of the table is not predefined and any of the generic
1742 * operators may be used.
1745 /* Find any and all labels in the entire generic portion */
1747 DtDetectAllLabels (*PFieldList);
1749 /* Now we can actually compile the parse tree */
1751 if (Length && *Length)
1757 if (Name && !strcmp ((*PFieldList)->Name, Name))
1762 Info = DtGetGenericTableInfo ((*PFieldList)->Name);
1765 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1766 (*PFieldList)->Name);
1767 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1768 (*PFieldList), MsgBuffer);
1770 *PFieldList = (*PFieldList)->Next;
1774 Status = DtCompileTable (PFieldList, Info,
1776 if (ACPI_SUCCESS (Status))
1778 DtInsertSubtable (ParentTable, Subtable);
1781 *Length += Subtable->Length;
1786 *PFieldList = (*PFieldList)->Next;
1788 if (Status == AE_NOT_FOUND)
1790 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1791 (*PFieldList)->Name);
1792 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1793 (*PFieldList), MsgBuffer);