1 /******************************************************************************
3 * Module Name: dttable.c - handling for specific ACPI tables
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2011, 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 #define __DTTABLE_C__
118 /* Compile all complex data tables */
120 #include "aslcompiler.h"
121 #include "dtcompiler.h"
123 #define _COMPONENT DT_COMPILER
124 ACPI_MODULE_NAME ("dttable")
127 /* TBD: merge these into dmtbinfo.c? */
129 static ACPI_DMTABLE_INFO TableInfoAsfAddress[] =
131 {ACPI_DMT_BUFFER, 0, "Addresses", 0},
132 {ACPI_DMT_EXIT, 0, NULL, 0}
135 static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] =
137 {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0},
138 {ACPI_DMT_EXIT, 0, NULL, 0}
142 /* TBD: move to acmacros.h */
144 #define ACPI_SUB_PTR(t, a, b) \
145 ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b)))
148 /* Local prototypes */
151 DtCompileTwoSubtables (
153 ACPI_DMTABLE_INFO *TableInfo1,
154 ACPI_DMTABLE_INFO *TableInfo2);
157 /******************************************************************************
159 * FUNCTION: DtCompileTwoSubtables
161 * PARAMETERS: List - Current field list pointer
162 * TableInfo1 - Info table 1
163 * TableInfo1 - Info table 2
167 * DESCRIPTION: Compile tables with a header and one or more same subtables.
168 * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT
170 *****************************************************************************/
173 DtCompileTwoSubtables (
175 ACPI_DMTABLE_INFO *TableInfo1,
176 ACPI_DMTABLE_INFO *TableInfo2)
179 DT_SUBTABLE *Subtable;
180 DT_SUBTABLE *ParentTable;
181 DT_FIELD **PFieldList = (DT_FIELD **) List;
184 Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE);
185 if (ACPI_FAILURE (Status))
190 ParentTable = DtPeekSubtable ();
191 DtInsertSubtable (ParentTable, Subtable);
195 Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE);
196 if (ACPI_FAILURE (Status))
201 DtInsertSubtable (ParentTable, Subtable);
208 /******************************************************************************
210 * FUNCTION: DtCompileFacs
212 * PARAMETERS: PFieldList - Current field list pointer
216 * DESCRIPTION: Compile FACS.
218 *****************************************************************************/
222 DT_FIELD **PFieldList)
224 DT_SUBTABLE *Subtable;
225 UINT8 *ReservedBuffer;
230 Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs,
231 &Gbl_RootTable, TRUE);
232 if (ACPI_FAILURE (Status))
237 /* Large FACS reserved area at the end of the table */
239 ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1);
240 ReservedBuffer = UtLocalCalloc (ReservedSize);
242 DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
244 ACPI_FREE (ReservedBuffer);
245 DtInsertSubtable (Gbl_RootTable, Subtable);
250 /******************************************************************************
252 * FUNCTION: DtCompileRsdp
254 * PARAMETERS: PFieldList - Current field list pointer
258 * DESCRIPTION: Compile RSDP.
260 *****************************************************************************/
264 DT_FIELD **PFieldList)
266 DT_SUBTABLE *Subtable;
267 ACPI_TABLE_RSDP *Rsdp;
268 ACPI_RSDP_EXTENSION *RsdpExtension;
272 /* Compile the "common" RSDP (ACPI 1.0) */
274 Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1,
275 &Gbl_RootTable, TRUE);
276 if (ACPI_FAILURE (Status))
281 Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer);
282 DtSetTableChecksum (&Rsdp->Checksum);
284 if (Rsdp->Revision > 0)
286 /* Compile the "extended" part of the RSDP as a subtable */
288 Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2,
290 if (ACPI_FAILURE (Status))
295 DtInsertSubtable (Gbl_RootTable, Subtable);
297 /* Set length and extended checksum for entire RSDP */
299 RsdpExtension = ACPI_CAST_PTR (ACPI_RSDP_EXTENSION, Subtable->Buffer);
300 RsdpExtension->Length = Gbl_RootTable->Length + Subtable->Length;
301 DtSetTableChecksum (&RsdpExtension->ExtendedChecksum);
308 /******************************************************************************
310 * FUNCTION: DtCompileAsf
312 * PARAMETERS: List - Current field list pointer
316 * DESCRIPTION: Compile ASF!.
318 *****************************************************************************/
324 ACPI_ASF_INFO *AsfTable;
325 DT_SUBTABLE *Subtable;
326 DT_SUBTABLE *ParentTable;
327 ACPI_DMTABLE_INFO *InfoTable;
328 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
329 UINT32 DataCount = 0;
332 DT_FIELD **PFieldList = (DT_FIELD **) List;
333 DT_FIELD *SubtableStart;
338 SubtableStart = *PFieldList;
339 Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr,
341 if (ACPI_FAILURE (Status))
346 ParentTable = DtPeekSubtable ();
347 DtInsertSubtable (ParentTable, Subtable);
348 DtPushSubtable (Subtable);
350 AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer);
352 switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
354 case ACPI_ASF_TYPE_INFO:
355 InfoTable = AcpiDmTableInfoAsf0;
358 case ACPI_ASF_TYPE_ALERT:
359 InfoTable = AcpiDmTableInfoAsf1;
362 case ACPI_ASF_TYPE_CONTROL:
363 InfoTable = AcpiDmTableInfoAsf2;
366 case ACPI_ASF_TYPE_BOOT:
367 InfoTable = AcpiDmTableInfoAsf3;
370 case ACPI_ASF_TYPE_ADDRESS:
371 InfoTable = AcpiDmTableInfoAsf4;
375 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
379 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
380 if (ACPI_FAILURE (Status))
385 ParentTable = DtPeekSubtable ();
386 DtInsertSubtable (ParentTable, Subtable);
388 switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
390 case ACPI_ASF_TYPE_INFO:
391 DataInfoTable = NULL;
394 case ACPI_ASF_TYPE_ALERT:
395 DataInfoTable = AcpiDmTableInfoAsf1a;
396 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT,
397 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
398 sizeof (ACPI_ASF_HEADER)))->Alerts;
401 case ACPI_ASF_TYPE_CONTROL:
402 DataInfoTable = AcpiDmTableInfoAsf2a;
403 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE,
404 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
405 sizeof (ACPI_ASF_HEADER)))->Controls;
408 case ACPI_ASF_TYPE_BOOT:
409 DataInfoTable = NULL;
412 case ACPI_ASF_TYPE_ADDRESS:
413 DataInfoTable = TableInfoAsfAddress;
414 DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS,
415 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
416 sizeof (ACPI_ASF_HEADER)))->Devices;
420 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
426 switch (AsfTable->Header.Type & 0x7F)
428 case ACPI_ASF_TYPE_ADDRESS:
430 while (DataCount > 0)
432 Status = DtCompileTable (PFieldList, DataInfoTable,
434 if (ACPI_FAILURE (Status))
439 DtInsertSubtable (ParentTable, Subtable);
440 DataCount = DataCount - Subtable->Length;
446 for (i = 0; i < DataCount; i++)
448 Status = DtCompileTable (PFieldList, DataInfoTable,
450 if (ACPI_FAILURE (Status))
455 DtInsertSubtable (ParentTable, Subtable);
468 /******************************************************************************
470 * FUNCTION: DtCompileCpep
472 * PARAMETERS: List - Current field list pointer
476 * DESCRIPTION: Compile CPEP.
478 *****************************************************************************/
487 Status = DtCompileTwoSubtables (List,
488 AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0);
493 /******************************************************************************
495 * FUNCTION: DtCompileDmar
497 * PARAMETERS: List - Current field list pointer
501 * DESCRIPTION: Compile DMAR.
503 *****************************************************************************/
510 DT_SUBTABLE *Subtable;
511 DT_SUBTABLE *ParentTable;
512 DT_FIELD **PFieldList = (DT_FIELD **) List;
513 DT_FIELD *SubtableStart;
514 ACPI_DMTABLE_INFO *InfoTable;
515 ACPI_DMAR_HEADER *DmarHeader;
516 UINT8 *ReservedBuffer;
520 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE);
521 if (ACPI_FAILURE (Status))
526 ParentTable = DtPeekSubtable ();
527 DtInsertSubtable (ParentTable, Subtable);
529 /* DMAR Reserved area */
531 ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved);
532 ReservedBuffer = UtLocalCalloc (ReservedSize);
534 DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
536 ACPI_FREE (ReservedBuffer);
537 ParentTable = DtPeekSubtable ();
538 DtInsertSubtable (ParentTable, Subtable);
544 SubtableStart = *PFieldList;
545 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr,
547 if (ACPI_FAILURE (Status))
552 ParentTable = DtPeekSubtable ();
553 DtInsertSubtable (ParentTable, Subtable);
554 DtPushSubtable (Subtable);
556 DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
558 switch (DmarHeader->Type)
560 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
561 InfoTable = AcpiDmTableInfoDmar0;
563 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
564 InfoTable = AcpiDmTableInfoDmar1;
566 case ACPI_DMAR_TYPE_ATSR:
567 InfoTable = AcpiDmTableInfoDmar2;
569 case ACPI_DMAR_HARDWARE_AFFINITY:
570 InfoTable = AcpiDmTableInfoDmar3;
573 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR");
579 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
580 if (ACPI_FAILURE (Status))
585 ParentTable = DtPeekSubtable ();
586 DtInsertSubtable (ParentTable, Subtable);
588 /* Optional Device Scope subtables */
592 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
594 if (Status == AE_NOT_FOUND)
599 ParentTable = DtPeekSubtable ();
600 DtInsertSubtable (ParentTable, Subtable);
601 DtPushSubtable (Subtable);
603 /* Optional PCI Paths */
607 Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
609 if (Status == AE_NOT_FOUND)
615 ParentTable = DtPeekSubtable ();
616 DtInsertSubtable (ParentTable, Subtable);
627 /******************************************************************************
629 * FUNCTION: DtCompileEinj
631 * PARAMETERS: List - Current field list pointer
635 * DESCRIPTION: Compile EINJ.
637 *****************************************************************************/
646 Status = DtCompileTwoSubtables (List,
647 AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0);
652 /******************************************************************************
654 * FUNCTION: DtCompileErst
656 * PARAMETERS: List - Current field list pointer
660 * DESCRIPTION: Compile ERST.
662 *****************************************************************************/
671 Status = DtCompileTwoSubtables (List,
672 AcpiDmTableInfoErst, AcpiDmTableInfoEinj0);
677 /******************************************************************************
679 * FUNCTION: DtCompileFadt
681 * PARAMETERS: List - Current field list pointer
685 * DESCRIPTION: Compile FADT.
687 *****************************************************************************/
694 DT_SUBTABLE *Subtable;
695 DT_SUBTABLE *ParentTable;
696 DT_FIELD **PFieldList = (DT_FIELD **) List;
697 ACPI_TABLE_HEADER *Table;
701 Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt1,
703 if (ACPI_FAILURE (Status))
708 ParentTable = DtPeekSubtable ();
709 DtInsertSubtable (ParentTable, Subtable);
711 Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
712 Revision = Table->Revision;
716 Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt2,
718 if (ACPI_FAILURE (Status))
723 DtInsertSubtable (ParentTable, Subtable);
725 else if (Revision >= 2)
727 Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt3,
729 if (ACPI_FAILURE (Status))
734 DtInsertSubtable (ParentTable, Subtable);
741 /******************************************************************************
743 * FUNCTION: DtCompileHest
745 * PARAMETERS: List - Current field list pointer
749 * DESCRIPTION: Compile HEST.
751 *****************************************************************************/
758 DT_SUBTABLE *Subtable;
759 DT_SUBTABLE *ParentTable;
760 DT_FIELD **PFieldList = (DT_FIELD **) List;
761 DT_FIELD *SubtableStart;
762 ACPI_DMTABLE_INFO *InfoTable;
767 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
769 if (ACPI_FAILURE (Status))
774 ParentTable = DtPeekSubtable ();
775 DtInsertSubtable (ParentTable, Subtable);
779 /* Get subtable type */
781 SubtableStart = *PFieldList;
782 DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
786 case ACPI_HEST_TYPE_IA32_CHECK:
787 InfoTable = AcpiDmTableInfoHest0;
790 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
791 InfoTable = AcpiDmTableInfoHest1;
794 case ACPI_HEST_TYPE_IA32_NMI:
795 InfoTable = AcpiDmTableInfoHest2;
798 case ACPI_HEST_TYPE_AER_ROOT_PORT:
799 InfoTable = AcpiDmTableInfoHest6;
802 case ACPI_HEST_TYPE_AER_ENDPOINT:
803 InfoTable = AcpiDmTableInfoHest7;
806 case ACPI_HEST_TYPE_AER_BRIDGE:
807 InfoTable = AcpiDmTableInfoHest8;
810 case ACPI_HEST_TYPE_GENERIC_ERROR:
811 InfoTable = AcpiDmTableInfoHest9;
815 /* Cannot continue on unknown type */
817 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST");
821 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
822 if (ACPI_FAILURE (Status))
827 DtInsertSubtable (ParentTable, Subtable);
830 * Additional subtable data - IA32 Error Bank(s)
835 case ACPI_HEST_TYPE_IA32_CHECK:
836 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
837 Subtable->Buffer))->NumHardwareBanks;
840 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
841 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
842 Subtable->Buffer))->NumHardwareBanks;
851 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank,
853 if (ACPI_FAILURE (Status))
858 DtInsertSubtable (ParentTable, Subtable);
867 /******************************************************************************
869 * FUNCTION: DtCompileIvrs
871 * PARAMETERS: List - Current field list pointer
875 * DESCRIPTION: Compile IVRS.
877 *****************************************************************************/
884 DT_SUBTABLE *Subtable;
885 DT_SUBTABLE *ParentTable;
886 DT_FIELD **PFieldList = (DT_FIELD **) List;
887 DT_FIELD *SubtableStart;
888 ACPI_DMTABLE_INFO *InfoTable;
889 ACPI_IVRS_HEADER *IvrsHeader;
893 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs,
895 if (ACPI_FAILURE (Status))
900 ParentTable = DtPeekSubtable ();
901 DtInsertSubtable (ParentTable, Subtable);
905 SubtableStart = *PFieldList;
906 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr,
908 if (ACPI_FAILURE (Status))
913 ParentTable = DtPeekSubtable ();
914 DtInsertSubtable (ParentTable, Subtable);
915 DtPushSubtable (Subtable);
917 IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer);
919 switch (IvrsHeader->Type)
921 case ACPI_IVRS_TYPE_HARDWARE:
922 InfoTable = AcpiDmTableInfoIvrs0;
925 case ACPI_IVRS_TYPE_MEMORY1:
926 case ACPI_IVRS_TYPE_MEMORY2:
927 case ACPI_IVRS_TYPE_MEMORY3:
928 InfoTable = AcpiDmTableInfoIvrs1;
932 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS");
936 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
937 if (ACPI_FAILURE (Status))
942 ParentTable = DtPeekSubtable ();
943 DtInsertSubtable (ParentTable, Subtable);
945 if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE)
947 while (*PFieldList &&
948 !ACPI_STRCMP ((*PFieldList)->Name, "Entry Type"))
950 SubtableStart = *PFieldList;
951 DtCompileInteger (&EntryType, *PFieldList, 1, 0);
955 /* 4-byte device entries */
957 case ACPI_IVRS_TYPE_PAD4:
958 case ACPI_IVRS_TYPE_ALL:
959 case ACPI_IVRS_TYPE_SELECT:
960 case ACPI_IVRS_TYPE_START:
961 case ACPI_IVRS_TYPE_END:
963 InfoTable = AcpiDmTableInfoIvrs4;
966 /* 8-byte entries, type A */
968 case ACPI_IVRS_TYPE_ALIAS_SELECT:
969 case ACPI_IVRS_TYPE_ALIAS_START:
971 InfoTable = AcpiDmTableInfoIvrs8a;
974 /* 8-byte entries, type B */
976 case ACPI_IVRS_TYPE_PAD8:
977 case ACPI_IVRS_TYPE_EXT_SELECT:
978 case ACPI_IVRS_TYPE_EXT_START:
980 InfoTable = AcpiDmTableInfoIvrs8b;
983 /* 8-byte entries, type C */
985 case ACPI_IVRS_TYPE_SPECIAL:
987 InfoTable = AcpiDmTableInfoIvrs8c;
991 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart,
992 "IVRS Device Entry");
996 Status = DtCompileTable (PFieldList, InfoTable,
998 if (ACPI_FAILURE (Status))
1003 DtInsertSubtable (ParentTable, Subtable);
1014 /******************************************************************************
1016 * FUNCTION: DtCompileMadt
1018 * PARAMETERS: List - Current field list pointer
1022 * DESCRIPTION: Compile MADT.
1024 *****************************************************************************/
1031 DT_SUBTABLE *Subtable;
1032 DT_SUBTABLE *ParentTable;
1033 DT_FIELD **PFieldList = (DT_FIELD **) List;
1034 DT_FIELD *SubtableStart;
1035 ACPI_SUBTABLE_HEADER *MadtHeader;
1036 ACPI_DMTABLE_INFO *InfoTable;
1039 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt,
1041 if (ACPI_FAILURE (Status))
1046 ParentTable = DtPeekSubtable ();
1047 DtInsertSubtable (ParentTable, Subtable);
1051 SubtableStart = *PFieldList;
1052 Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr,
1054 if (ACPI_FAILURE (Status))
1059 ParentTable = DtPeekSubtable ();
1060 DtInsertSubtable (ParentTable, Subtable);
1061 DtPushSubtable (Subtable);
1063 MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1065 switch (MadtHeader->Type)
1067 case ACPI_MADT_TYPE_LOCAL_APIC:
1068 InfoTable = AcpiDmTableInfoMadt0;
1070 case ACPI_MADT_TYPE_IO_APIC:
1071 InfoTable = AcpiDmTableInfoMadt1;
1073 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
1074 InfoTable = AcpiDmTableInfoMadt2;
1076 case ACPI_MADT_TYPE_NMI_SOURCE:
1077 InfoTable = AcpiDmTableInfoMadt3;
1079 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
1080 InfoTable = AcpiDmTableInfoMadt4;
1082 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
1083 InfoTable = AcpiDmTableInfoMadt5;
1085 case ACPI_MADT_TYPE_IO_SAPIC:
1086 InfoTable = AcpiDmTableInfoMadt6;
1088 case ACPI_MADT_TYPE_LOCAL_SAPIC:
1089 InfoTable = AcpiDmTableInfoMadt7;
1091 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
1092 InfoTable = AcpiDmTableInfoMadt8;
1094 case ACPI_MADT_TYPE_LOCAL_X2APIC:
1095 InfoTable = AcpiDmTableInfoMadt9;
1097 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
1098 InfoTable = AcpiDmTableInfoMadt10;
1101 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT");
1105 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1106 if (ACPI_FAILURE (Status))
1111 ParentTable = DtPeekSubtable ();
1112 DtInsertSubtable (ParentTable, Subtable);
1120 /******************************************************************************
1122 * FUNCTION: DtCompileMcfg
1124 * PARAMETERS: List - Current field list pointer
1128 * DESCRIPTION: Compile MCFG.
1130 *****************************************************************************/
1139 Status = DtCompileTwoSubtables (List,
1140 AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0);
1145 /******************************************************************************
1147 * FUNCTION: DtCompileMsct
1149 * PARAMETERS: List - Current field list pointer
1153 * DESCRIPTION: Compile MSCT.
1155 *****************************************************************************/
1164 Status = DtCompileTwoSubtables (List,
1165 AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0);
1170 /******************************************************************************
1172 * FUNCTION: DtCompileRsdt
1174 * PARAMETERS: List - Current field list pointer
1178 * DESCRIPTION: Compile RSDT.
1180 *****************************************************************************/
1186 DT_SUBTABLE *Subtable;
1187 DT_SUBTABLE *ParentTable;
1188 DT_FIELD *FieldList = *(DT_FIELD **) List;
1192 ParentTable = DtPeekSubtable ();
1196 DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
1198 DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
1199 DtInsertSubtable (ParentTable, Subtable);
1200 FieldList = FieldList->Next;
1207 /******************************************************************************
1209 * FUNCTION: DtCompileSlit
1211 * PARAMETERS: List - Current field list pointer
1215 * DESCRIPTION: Compile SLIT.
1217 *****************************************************************************/
1224 DT_SUBTABLE *Subtable;
1225 DT_SUBTABLE *ParentTable;
1226 DT_FIELD **PFieldList = (DT_FIELD **) List;
1227 DT_FIELD *FieldList;
1229 UINT8 *LocalityBuffer;
1230 UINT32 RemainingData;
1233 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1235 if (ACPI_FAILURE (Status))
1240 ParentTable = DtPeekSubtable ();
1241 DtInsertSubtable (ParentTable, Subtable);
1243 Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
1244 LocalityBuffer = UtLocalCalloc (Localities);
1246 FieldList = *PFieldList;
1249 /* Handle multiple-line buffer */
1251 RemainingData = Localities;
1252 while (RemainingData && FieldList)
1254 RemainingData = DtCompileBuffer (
1255 LocalityBuffer + (Localities - RemainingData),
1256 FieldList->Value, FieldList, RemainingData);
1257 FieldList = FieldList->Next;
1260 DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
1261 DtInsertSubtable (ParentTable, Subtable);
1264 ACPI_FREE (LocalityBuffer);
1269 /******************************************************************************
1271 * FUNCTION: DtCompileSrat
1273 * PARAMETERS: List - Current field list pointer
1277 * DESCRIPTION: Compile SRAT.
1279 *****************************************************************************/
1286 DT_SUBTABLE *Subtable;
1287 DT_SUBTABLE *ParentTable;
1288 DT_FIELD **PFieldList = (DT_FIELD **) List;
1289 DT_FIELD *SubtableStart;
1290 ACPI_SUBTABLE_HEADER *SratHeader;
1291 ACPI_DMTABLE_INFO *InfoTable;
1294 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
1296 if (ACPI_FAILURE (Status))
1301 ParentTable = DtPeekSubtable ();
1302 DtInsertSubtable (ParentTable, Subtable);
1306 SubtableStart = *PFieldList;
1307 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
1309 if (ACPI_FAILURE (Status))
1314 ParentTable = DtPeekSubtable ();
1315 DtInsertSubtable (ParentTable, Subtable);
1316 DtPushSubtable (Subtable);
1318 SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1320 switch (SratHeader->Type)
1322 case ACPI_SRAT_TYPE_CPU_AFFINITY:
1323 InfoTable = AcpiDmTableInfoSrat0;
1325 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1326 InfoTable = AcpiDmTableInfoSrat1;
1328 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1329 InfoTable = AcpiDmTableInfoSrat2;
1332 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
1336 Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1337 if (ACPI_FAILURE (Status))
1342 ParentTable = DtPeekSubtable ();
1343 DtInsertSubtable (ParentTable, Subtable);
1351 /******************************************************************************
1353 * FUNCTION: DtGetGenericTableInfo
1355 * PARAMETERS: Name - Generic type name
1357 * RETURN: Info entry
1359 * DESCRIPTION: Obtain table info for a generic name entry
1361 *****************************************************************************/
1364 DtGetGenericTableInfo (
1367 ACPI_DMTABLE_INFO *Info;
1376 /* Search info table for name match */
1380 Info = AcpiDmTableInfoGeneric[i];
1381 if (Info->Opcode == ACPI_DMT_EXIT)
1387 if (!ACPI_STRCMP (Name, Info->Name))
1397 /******************************************************************************
1399 * FUNCTION: DtCompileUefi
1401 * PARAMETERS: List - Current field list pointer
1405 * DESCRIPTION: Compile UEFI.
1407 *****************************************************************************/
1414 DT_SUBTABLE *Subtable;
1415 DT_SUBTABLE *ParentTable;
1416 DT_FIELD **PFieldList = (DT_FIELD **) List;
1417 ACPI_DMTABLE_INFO *Info;
1421 /* Compile the predefined portion of the UEFI table */
1423 Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
1425 if (ACPI_FAILURE (Status))
1430 DataOffset = (UINT16 *) (Subtable->Buffer + 16);
1431 *DataOffset = sizeof (ACPI_TABLE_UEFI);
1433 ParentTable = DtPeekSubtable ();
1434 DtInsertSubtable (ParentTable, Subtable);
1437 * Compile the "generic" portion of the UEFI table. This
1438 * part of the table is not predefined and any of the generic
1439 * operators may be used.
1442 /* Find any and all labels in the entire generic portion */
1444 DtDetectAllLabels (*PFieldList);
1446 /* Now we can actually compile the parse tree */
1450 Info = DtGetGenericTableInfo ((*PFieldList)->Name);
1453 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1454 (*PFieldList)->Name);
1455 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1456 (*PFieldList), MsgBuffer);
1458 *PFieldList = (*PFieldList)->Next;
1462 Status = DtCompileTable (PFieldList, Info,
1464 if (ACPI_SUCCESS (Status))
1466 DtInsertSubtable (ParentTable, Subtable);
1470 *PFieldList = (*PFieldList)->Next;
1472 if (Status == AE_NOT_FOUND)
1474 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1475 (*PFieldList)->Name);
1476 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1477 (*PFieldList), MsgBuffer);
1486 /******************************************************************************
1488 * FUNCTION: DtCompileWdat
1490 * PARAMETERS: List - Current field list pointer
1494 * DESCRIPTION: Compile WDAT.
1496 *****************************************************************************/
1505 Status = DtCompileTwoSubtables (List,
1506 AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
1511 /******************************************************************************
1513 * FUNCTION: DtCompileXsdt
1515 * PARAMETERS: List - Current field list pointer
1519 * DESCRIPTION: Compile XSDT.
1521 *****************************************************************************/
1527 DT_SUBTABLE *Subtable;
1528 DT_SUBTABLE *ParentTable;
1529 DT_FIELD *FieldList = *(DT_FIELD **) List;
1532 ParentTable = DtPeekSubtable ();
1536 DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
1538 DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
1539 DtInsertSubtable (ParentTable, Subtable);
1540 FieldList = FieldList->Next;