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;
874 case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
876 InfoTable = AcpiDmTableInfoPcct3;
879 case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
881 InfoTable = AcpiDmTableInfoPcct4;
886 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT");
890 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
891 if (ACPI_FAILURE (Status))
896 ParentTable = DtPeekSubtable ();
897 DtInsertSubtable (ParentTable, Subtable);
905 /******************************************************************************
907 * FUNCTION: DtCompilePmtt
909 * PARAMETERS: List - Current field list pointer
913 * DESCRIPTION: Compile PMTT.
915 *****************************************************************************/
922 DT_SUBTABLE *Subtable;
923 DT_SUBTABLE *ParentTable;
924 DT_FIELD **PFieldList = (DT_FIELD **) List;
925 DT_FIELD *SubtableStart;
926 ACPI_PMTT_HEADER *PmttHeader;
927 ACPI_PMTT_CONTROLLER *PmttController;
929 UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET;
934 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable, TRUE);
935 if (ACPI_FAILURE (Status))
940 ParentTable = DtPeekSubtable ();
941 DtInsertSubtable (ParentTable, Subtable);
942 DtPushSubtable (Subtable);
946 SubtableStart = *PFieldList;
947 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr,
949 if (ACPI_FAILURE (Status))
954 PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer);
955 while (PrevType >= PmttHeader->Type)
959 if (PrevType == ACPI_PMTT_TYPE_SOCKET)
967 PrevType = PmttHeader->Type;
969 ParentTable = DtPeekSubtable ();
970 DtInsertSubtable (ParentTable, Subtable);
971 DtPushSubtable (Subtable);
973 switch (PmttHeader->Type)
975 case ACPI_PMTT_TYPE_SOCKET:
977 /* Subtable: Socket Structure */
979 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0,
981 if (ACPI_FAILURE (Status))
986 ParentTable = DtPeekSubtable ();
987 DtInsertSubtable (ParentTable, Subtable);
990 case ACPI_PMTT_TYPE_CONTROLLER:
992 /* Subtable: Memory Controller Structure */
994 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1,
996 if (ACPI_FAILURE (Status))
1001 ParentTable = DtPeekSubtable ();
1002 DtInsertSubtable (ParentTable, Subtable);
1004 PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
1005 (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
1006 DomainCount = PmttController->DomainCount;
1010 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a,
1012 if (ACPI_FAILURE (Status))
1017 DtInsertSubtable (ParentTable, Subtable);
1022 case ACPI_PMTT_TYPE_DIMM:
1024 /* Subtable: Physical Component Structure */
1026 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2,
1028 if (ACPI_FAILURE (Status))
1033 ParentTable = DtPeekSubtable ();
1034 DtInsertSubtable (ParentTable, Subtable);
1039 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT");
1048 /******************************************************************************
1050 * FUNCTION: DtCompilePptt
1052 * PARAMETERS: List - Current field list pointer
1056 * DESCRIPTION: Compile PPTT.
1058 *****************************************************************************/
1065 ACPI_SUBTABLE_HEADER *PpttHeader;
1066 ACPI_PPTT_PROCESSOR *PpttProcessor = NULL;
1067 DT_SUBTABLE *Subtable;
1068 DT_SUBTABLE *ParentTable;
1069 ACPI_DMTABLE_INFO *InfoTable;
1070 DT_FIELD **PFieldList = (DT_FIELD **) List;
1071 DT_FIELD *SubtableStart;
1074 ParentTable = DtPeekSubtable ();
1077 SubtableStart = *PFieldList;
1079 /* Compile PPTT subtable header */
1081 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPpttHdr,
1083 if (ACPI_FAILURE (Status))
1087 DtInsertSubtable (ParentTable, Subtable);
1088 PpttHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1089 PpttHeader->Length = (UINT8)(Subtable->Length);
1091 switch (PpttHeader->Type)
1093 case ACPI_PPTT_TYPE_PROCESSOR:
1095 InfoTable = AcpiDmTableInfoPptt0;
1098 case ACPI_PPTT_TYPE_CACHE:
1100 InfoTable = AcpiDmTableInfoPptt1;
1103 case ACPI_PPTT_TYPE_ID:
1105 InfoTable = AcpiDmTableInfoPptt2;
1110 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PPTT");
1114 /* Compile PPTT subtable body */
1116 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1117 if (ACPI_FAILURE (Status))
1121 DtInsertSubtable (ParentTable, Subtable);
1122 PpttHeader->Length += (UINT8)(Subtable->Length);
1124 /* Compile PPTT subtable additionals */
1126 switch (PpttHeader->Type)
1128 case ACPI_PPTT_TYPE_PROCESSOR:
1130 PpttProcessor = ACPI_SUB_PTR (ACPI_PPTT_PROCESSOR,
1131 Subtable->Buffer, sizeof (ACPI_SUBTABLE_HEADER));
1134 /* Compile initiator proximity domain list */
1136 PpttProcessor->NumberOfPrivResources = 0;
1139 Status = DtCompileTable (PFieldList,
1140 AcpiDmTableInfoPptt0a, &Subtable, TRUE);
1141 if (ACPI_FAILURE (Status))
1150 DtInsertSubtable (ParentTable, Subtable);
1151 PpttHeader->Length += (UINT8)(Subtable->Length);
1152 PpttProcessor->NumberOfPrivResources++;
1167 /******************************************************************************
1169 * FUNCTION: DtCompileRsdt
1171 * PARAMETERS: List - Current field list pointer
1175 * DESCRIPTION: Compile RSDT.
1177 *****************************************************************************/
1183 DT_SUBTABLE *Subtable;
1184 DT_SUBTABLE *ParentTable;
1185 DT_FIELD *FieldList = *(DT_FIELD **) List;
1189 ParentTable = DtPeekSubtable ();
1193 DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
1195 DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
1196 DtInsertSubtable (ParentTable, Subtable);
1197 FieldList = FieldList->Next;
1204 /******************************************************************************
1206 * FUNCTION: DtCompileS3pt
1208 * PARAMETERS: PFieldList - Current field list pointer
1212 * DESCRIPTION: Compile S3PT (Pointed to by FPDT)
1214 *****************************************************************************/
1218 DT_FIELD **PFieldList)
1221 ACPI_FPDT_HEADER *S3ptHeader;
1222 DT_SUBTABLE *Subtable;
1223 DT_SUBTABLE *ParentTable;
1224 ACPI_DMTABLE_INFO *InfoTable;
1225 DT_FIELD *SubtableStart;
1228 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
1229 &Gbl_RootTable, TRUE);
1230 if (ACPI_FAILURE (Status))
1235 DtPushSubtable (Gbl_RootTable);
1239 SubtableStart = *PFieldList;
1240 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr,
1242 if (ACPI_FAILURE (Status))
1247 ParentTable = DtPeekSubtable ();
1248 DtInsertSubtable (ParentTable, Subtable);
1249 DtPushSubtable (Subtable);
1251 S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1253 switch (S3ptHeader->Type)
1255 case ACPI_S3PT_TYPE_RESUME:
1257 InfoTable = AcpiDmTableInfoS3pt0;
1260 case ACPI_S3PT_TYPE_SUSPEND:
1262 InfoTable = AcpiDmTableInfoS3pt1;
1267 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT");
1271 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1272 if (ACPI_FAILURE (Status))
1277 ParentTable = DtPeekSubtable ();
1278 DtInsertSubtable (ParentTable, Subtable);
1286 /******************************************************************************
1288 * FUNCTION: DtCompileSlic
1290 * PARAMETERS: List - Current field list pointer
1294 * DESCRIPTION: Compile SLIC.
1296 *****************************************************************************/
1303 DT_SUBTABLE *Subtable;
1304 DT_SUBTABLE *ParentTable;
1305 DT_FIELD **PFieldList = (DT_FIELD **) List;
1310 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic,
1312 if (ACPI_FAILURE (Status))
1317 ParentTable = DtPeekSubtable ();
1318 DtInsertSubtable (ParentTable, Subtable);
1319 DtPushSubtable (Subtable);
1327 /******************************************************************************
1329 * FUNCTION: DtCompileSlit
1331 * PARAMETERS: List - Current field list pointer
1335 * DESCRIPTION: Compile SLIT.
1337 *****************************************************************************/
1344 DT_SUBTABLE *Subtable;
1345 DT_SUBTABLE *ParentTable;
1346 DT_FIELD **PFieldList = (DT_FIELD **) List;
1347 DT_FIELD *FieldList;
1349 UINT8 *LocalityBuffer;
1352 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1354 if (ACPI_FAILURE (Status))
1359 ParentTable = DtPeekSubtable ();
1360 DtInsertSubtable (ParentTable, Subtable);
1362 Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
1363 LocalityBuffer = UtLocalCalloc (Localities);
1365 /* Compile each locality buffer */
1367 FieldList = *PFieldList;
1370 DtCompileBuffer (LocalityBuffer,
1371 FieldList->Value, FieldList, Localities);
1373 DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
1374 DtInsertSubtable (ParentTable, Subtable);
1375 FieldList = FieldList->Next;
1378 ACPI_FREE (LocalityBuffer);
1383 /******************************************************************************
1385 * FUNCTION: DtCompileSrat
1387 * PARAMETERS: List - Current field list pointer
1391 * DESCRIPTION: Compile SRAT.
1393 *****************************************************************************/
1400 DT_SUBTABLE *Subtable;
1401 DT_SUBTABLE *ParentTable;
1402 DT_FIELD **PFieldList = (DT_FIELD **) List;
1403 DT_FIELD *SubtableStart;
1404 ACPI_SUBTABLE_HEADER *SratHeader;
1405 ACPI_DMTABLE_INFO *InfoTable;
1408 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
1410 if (ACPI_FAILURE (Status))
1415 ParentTable = DtPeekSubtable ();
1416 DtInsertSubtable (ParentTable, Subtable);
1420 SubtableStart = *PFieldList;
1421 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
1423 if (ACPI_FAILURE (Status))
1428 ParentTable = DtPeekSubtable ();
1429 DtInsertSubtable (ParentTable, Subtable);
1430 DtPushSubtable (Subtable);
1432 SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1434 switch (SratHeader->Type)
1436 case ACPI_SRAT_TYPE_CPU_AFFINITY:
1438 InfoTable = AcpiDmTableInfoSrat0;
1441 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1443 InfoTable = AcpiDmTableInfoSrat1;
1446 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1448 InfoTable = AcpiDmTableInfoSrat2;
1451 case ACPI_SRAT_TYPE_GICC_AFFINITY:
1453 InfoTable = AcpiDmTableInfoSrat3;
1456 case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
1458 InfoTable = AcpiDmTableInfoSrat4;
1463 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
1467 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1468 if (ACPI_FAILURE (Status))
1473 ParentTable = DtPeekSubtable ();
1474 DtInsertSubtable (ParentTable, Subtable);
1482 /******************************************************************************
1484 * FUNCTION: DtCompileStao
1486 * PARAMETERS: PFieldList - Current field list pointer
1490 * DESCRIPTION: Compile STAO.
1492 *****************************************************************************/
1498 DT_FIELD **PFieldList = (DT_FIELD **) List;
1499 DT_SUBTABLE *Subtable;
1500 DT_SUBTABLE *ParentTable;
1504 /* Compile the main table */
1506 Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao,
1508 if (ACPI_FAILURE (Status))
1513 ParentTable = DtPeekSubtable ();
1514 DtInsertSubtable (ParentTable, Subtable);
1516 /* Compile each ASCII namestring as a subtable */
1520 Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr,
1522 if (ACPI_FAILURE (Status))
1527 ParentTable = DtPeekSubtable ();
1528 DtInsertSubtable (ParentTable, Subtable);
1535 /******************************************************************************
1537 * FUNCTION: DtCompileTcpa
1539 * PARAMETERS: PFieldList - Current field list pointer
1543 * DESCRIPTION: Compile TCPA.
1545 *****************************************************************************/
1551 DT_FIELD **PFieldList = (DT_FIELD **) List;
1552 DT_SUBTABLE *Subtable;
1553 ACPI_TABLE_TCPA_HDR *TcpaHeader;
1554 DT_SUBTABLE *ParentTable;
1558 /* Compile the main table */
1560 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr,
1562 if (ACPI_FAILURE (Status))
1567 ParentTable = DtPeekSubtable ();
1568 DtInsertSubtable (ParentTable, Subtable);
1571 * Examine the PlatformClass field to determine the table type.
1572 * Either a client or server table. Only one.
1574 TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
1576 switch (TcpaHeader->PlatformClass)
1578 case ACPI_TCPA_CLIENT_TABLE:
1580 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient,
1584 case ACPI_TCPA_SERVER_TABLE:
1586 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer,
1592 AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
1593 TcpaHeader->PlatformClass);
1598 ParentTable = DtPeekSubtable ();
1599 DtInsertSubtable (ParentTable, Subtable);
1604 /******************************************************************************
1606 * FUNCTION: DtGetGenericTableInfo
1608 * PARAMETERS: Name - Generic type name
1610 * RETURN: Info entry
1612 * DESCRIPTION: Obtain table info for a generic name entry
1614 *****************************************************************************/
1617 DtGetGenericTableInfo (
1620 ACPI_DMTABLE_INFO *Info;
1629 /* Search info table for name match */
1633 Info = AcpiDmTableInfoGeneric[i];
1634 if (Info->Opcode == ACPI_DMT_EXIT)
1640 /* Use caseless compare for generic keywords */
1642 if (!AcpiUtStricmp (Name, Info->Name))
1652 /******************************************************************************
1654 * FUNCTION: DtCompileUefi
1656 * PARAMETERS: List - Current field list pointer
1660 * DESCRIPTION: Compile UEFI.
1662 *****************************************************************************/
1669 DT_SUBTABLE *Subtable;
1670 DT_SUBTABLE *ParentTable;
1671 DT_FIELD **PFieldList = (DT_FIELD **) List;
1675 /* Compile the predefined portion of the UEFI table */
1677 Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
1679 if (ACPI_FAILURE (Status))
1684 DataOffset = (UINT16 *) (Subtable->Buffer + 16);
1685 *DataOffset = sizeof (ACPI_TABLE_UEFI);
1687 ParentTable = DtPeekSubtable ();
1688 DtInsertSubtable (ParentTable, Subtable);
1691 * Compile the "generic" portion of the UEFI table. This
1692 * part of the table is not predefined and any of the generic
1693 * operators may be used.
1695 DtCompileGeneric ((void **) PFieldList, NULL, NULL);
1700 /******************************************************************************
1702 * FUNCTION: DtCompileVrtc
1704 * PARAMETERS: List - Current field list pointer
1708 * DESCRIPTION: Compile VRTC.
1710 *****************************************************************************/
1719 Status = DtCompileTwoSubtables (List,
1720 AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0);
1725 /******************************************************************************
1727 * FUNCTION: DtCompileWdat
1729 * PARAMETERS: List - Current field list pointer
1733 * DESCRIPTION: Compile WDAT.
1735 *****************************************************************************/
1744 Status = DtCompileTwoSubtables (List,
1745 AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
1750 /******************************************************************************
1752 * FUNCTION: DtCompileWpbt
1754 * PARAMETERS: List - Current field list pointer
1758 * DESCRIPTION: Compile WPBT.
1760 *****************************************************************************/
1766 DT_FIELD **PFieldList = (DT_FIELD **) List;
1767 DT_SUBTABLE *Subtable;
1768 DT_SUBTABLE *ParentTable;
1769 ACPI_TABLE_WPBT *Table;
1774 /* Compile the main table */
1776 Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt,
1778 if (ACPI_FAILURE (Status))
1783 ParentTable = DtPeekSubtable ();
1784 DtInsertSubtable (ParentTable, Subtable);
1786 /* Compile the argument list subtable */
1788 Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0,
1790 if (ACPI_FAILURE (Status))
1795 /* Extract the length of the Arguments buffer, insert into main table */
1797 Length = (UINT16) Subtable->TotalLength;
1798 Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
1799 Table->ArgumentsLength = Length;
1801 ParentTable = DtPeekSubtable ();
1802 DtInsertSubtable (ParentTable, Subtable);
1807 /******************************************************************************
1809 * FUNCTION: DtCompileXsdt
1811 * PARAMETERS: List - Current field list pointer
1815 * DESCRIPTION: Compile XSDT.
1817 *****************************************************************************/
1823 DT_SUBTABLE *Subtable;
1824 DT_SUBTABLE *ParentTable;
1825 DT_FIELD *FieldList = *(DT_FIELD **) List;
1829 ParentTable = DtPeekSubtable ();
1833 DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
1835 DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
1836 DtInsertSubtable (ParentTable, Subtable);
1837 FieldList = FieldList->Next;
1844 /******************************************************************************
1846 * FUNCTION: DtCompileGeneric
1848 * PARAMETERS: List - Current field list pointer
1849 * Name - Field name to end generic compiling
1850 * Length - Compiled table length to return
1854 * DESCRIPTION: Compile generic unknown table.
1856 *****************************************************************************/
1865 DT_SUBTABLE *Subtable;
1866 DT_SUBTABLE *ParentTable;
1867 DT_FIELD **PFieldList = (DT_FIELD **) List;
1868 ACPI_DMTABLE_INFO *Info;
1871 ParentTable = DtPeekSubtable ();
1874 * Compile the "generic" portion of the table. This
1875 * part of the table is not predefined and any of the generic
1876 * operators may be used.
1879 /* Find any and all labels in the entire generic portion */
1881 DtDetectAllLabels (*PFieldList);
1883 /* Now we can actually compile the parse tree */
1885 if (Length && *Length)
1891 if (Name && !strcmp ((*PFieldList)->Name, Name))
1896 Info = DtGetGenericTableInfo ((*PFieldList)->Name);
1899 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1900 (*PFieldList)->Name);
1901 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1902 (*PFieldList), MsgBuffer);
1904 *PFieldList = (*PFieldList)->Next;
1908 Status = DtCompileTable (PFieldList, Info,
1910 if (ACPI_SUCCESS (Status))
1912 DtInsertSubtable (ParentTable, Subtable);
1915 *Length += Subtable->Length;
1920 *PFieldList = (*PFieldList)->Next;
1922 if (Status == AE_NOT_FOUND)
1924 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1925 (*PFieldList)->Name);
1926 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1927 (*PFieldList), MsgBuffer);