xref: /freebsd/sys/contrib/dev/acpica/compiler/dttable2.c (revision ab00ac327a66a53edaac95b536b209db3ae2cd9f)
1 /******************************************************************************
2  *
3  * Module Name: dttable2.c - handling for specific ACPI tables
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
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
19  * property rights.
20  *
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
27  *
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;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
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.
53  *
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
64  * make.
65  *
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
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
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.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
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
88  * PARTICULAR PURPOSE.
89  *
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
97  * LIMITED REMEDY.
98  *
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.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
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.
133  *
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.
145  *
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.
149  *
150  *****************************************************************************/
151 
152 /* Compile all complex data tables, signatures starting with L-Z */
153 
154 #include <contrib/dev/acpica/compiler/aslcompiler.h>
155 #include <contrib/dev/acpica/compiler/dtcompiler.h>
156 
157 #define _COMPONENT          DT_COMPILER
158         ACPI_MODULE_NAME    ("dttable2")
159 
160 
161 /******************************************************************************
162  *
163  * FUNCTION:    DtCompileLpit
164  *
165  * PARAMETERS:  List                - Current field list pointer
166  *
167  * RETURN:      Status
168  *
169  * DESCRIPTION: Compile LPIT.
170  *
171  *****************************************************************************/
172 
173 ACPI_STATUS
174 DtCompileLpit (
175     void                    **List)
176 {
177     ACPI_STATUS             Status;
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;
184 
185 
186     /* Note: Main table consists only of the standard ACPI table header */
187 
188     while (*PFieldList)
189     {
190         SubtableStart = *PFieldList;
191 
192         /* LPIT Subtable header */
193 
194         Status = DtCompileTable (PFieldList, AcpiDmTableInfoLpitHdr,
195             &Subtable, TRUE);
196         if (ACPI_FAILURE (Status))
197         {
198             return (Status);
199         }
200 
201         ParentTable = DtPeekSubtable ();
202         DtInsertSubtable (ParentTable, Subtable);
203         DtPushSubtable (Subtable);
204 
205         LpitHeader = ACPI_CAST_PTR (ACPI_LPIT_HEADER, Subtable->Buffer);
206 
207         switch (LpitHeader->Type)
208         {
209         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
210 
211             InfoTable = AcpiDmTableInfoLpit0;
212             break;
213 
214         default:
215 
216             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT");
217             return (AE_ERROR);
218         }
219 
220         /* LPIT Subtable */
221 
222         Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
223         if (ACPI_FAILURE (Status))
224         {
225             return (Status);
226         }
227 
228         ParentTable = DtPeekSubtable ();
229         DtInsertSubtable (ParentTable, Subtable);
230         DtPopSubtable ();
231     }
232 
233     return (AE_OK);
234 }
235 
236 
237 /******************************************************************************
238  *
239  * FUNCTION:    DtCompileMadt
240  *
241  * PARAMETERS:  List                - Current field list pointer
242  *
243  * RETURN:      Status
244  *
245  * DESCRIPTION: Compile MADT.
246  *
247  *****************************************************************************/
248 
249 ACPI_STATUS
250 DtCompileMadt (
251     void                    **List)
252 {
253     ACPI_STATUS             Status;
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;
260 
261 
262     Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt,
263         &Subtable, TRUE);
264     if (ACPI_FAILURE (Status))
265     {
266         return (Status);
267     }
268 
269     ParentTable = DtPeekSubtable ();
270     DtInsertSubtable (ParentTable, Subtable);
271 
272     while (*PFieldList)
273     {
274         SubtableStart = *PFieldList;
275         Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr,
276             &Subtable, TRUE);
277         if (ACPI_FAILURE (Status))
278         {
279             return (Status);
280         }
281 
282         ParentTable = DtPeekSubtable ();
283         DtInsertSubtable (ParentTable, Subtable);
284         DtPushSubtable (Subtable);
285 
286         MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
287 
288         switch (MadtHeader->Type)
289         {
290         case ACPI_MADT_TYPE_LOCAL_APIC:
291 
292             InfoTable = AcpiDmTableInfoMadt0;
293             break;
294 
295         case ACPI_MADT_TYPE_IO_APIC:
296 
297             InfoTable = AcpiDmTableInfoMadt1;
298             break;
299 
300         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
301 
302             InfoTable = AcpiDmTableInfoMadt2;
303             break;
304 
305         case ACPI_MADT_TYPE_NMI_SOURCE:
306 
307             InfoTable = AcpiDmTableInfoMadt3;
308             break;
309 
310         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
311 
312             InfoTable = AcpiDmTableInfoMadt4;
313             break;
314 
315         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
316 
317             InfoTable = AcpiDmTableInfoMadt5;
318             break;
319 
320         case ACPI_MADT_TYPE_IO_SAPIC:
321 
322             InfoTable = AcpiDmTableInfoMadt6;
323             break;
324 
325         case ACPI_MADT_TYPE_LOCAL_SAPIC:
326 
327             InfoTable = AcpiDmTableInfoMadt7;
328             break;
329 
330         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
331 
332             InfoTable = AcpiDmTableInfoMadt8;
333             break;
334 
335         case ACPI_MADT_TYPE_LOCAL_X2APIC:
336 
337             InfoTable = AcpiDmTableInfoMadt9;
338             break;
339 
340         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
341 
342             InfoTable = AcpiDmTableInfoMadt10;
343             break;
344 
345         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
346 
347             InfoTable = AcpiDmTableInfoMadt11;
348             break;
349 
350         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
351 
352             InfoTable = AcpiDmTableInfoMadt12;
353             break;
354 
355         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
356 
357             InfoTable = AcpiDmTableInfoMadt13;
358             break;
359 
360         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
361 
362             InfoTable = AcpiDmTableInfoMadt14;
363             break;
364 
365         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
366 
367             InfoTable = AcpiDmTableInfoMadt15;
368             break;
369 
370         default:
371 
372             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT");
373             return (AE_ERROR);
374         }
375 
376         Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
377         if (ACPI_FAILURE (Status))
378         {
379             return (Status);
380         }
381 
382         ParentTable = DtPeekSubtable ();
383         DtInsertSubtable (ParentTable, Subtable);
384         DtPopSubtable ();
385     }
386 
387     return (AE_OK);
388 }
389 
390 
391 /******************************************************************************
392  *
393  * FUNCTION:    DtCompileMcfg
394  *
395  * PARAMETERS:  List                - Current field list pointer
396  *
397  * RETURN:      Status
398  *
399  * DESCRIPTION: Compile MCFG.
400  *
401  *****************************************************************************/
402 
403 ACPI_STATUS
404 DtCompileMcfg (
405     void                    **List)
406 {
407     ACPI_STATUS             Status;
408 
409 
410     Status = DtCompileTwoSubtables (List,
411         AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0);
412     return (Status);
413 }
414 
415 
416 /******************************************************************************
417  *
418  * FUNCTION:    DtCompileMpst
419  *
420  * PARAMETERS:  List                - Current field list pointer
421  *
422  * RETURN:      Status
423  *
424  * DESCRIPTION: Compile MPST.
425  *
426  *****************************************************************************/
427 
428 ACPI_STATUS
429 DtCompileMpst (
430     void                    **List)
431 {
432     ACPI_STATUS             Status;
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;
442 
443 
444     /* Main table */
445 
446     Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable, TRUE);
447     if (ACPI_FAILURE (Status))
448     {
449         return (Status);
450     }
451 
452     ParentTable = DtPeekSubtable ();
453     DtInsertSubtable (ParentTable, Subtable);
454     DtPushSubtable (Subtable);
455 
456     MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
457     SubtableCount = MpstChannelInfo->PowerNodeCount;
458 
459     while (*PFieldList && SubtableCount)
460     {
461         /* Subtable: Memory Power Node(s) */
462 
463         Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0,
464             &Subtable, TRUE);
465         if (ACPI_FAILURE (Status))
466         {
467             return (Status);
468         }
469 
470         ParentTable = DtPeekSubtable ();
471         DtInsertSubtable (ParentTable, Subtable);
472         DtPushSubtable (Subtable);
473 
474         MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
475         PowerStateCount = MpstPowerNode->NumPowerStates;
476         ComponentCount = MpstPowerNode->NumPhysicalComponents;
477 
478         ParentTable = DtPeekSubtable ();
479 
480         /* Sub-subtables - Memory Power State Structure(s) */
481 
482         while (*PFieldList && PowerStateCount)
483         {
484             Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A,
485                 &Subtable, TRUE);
486             if (ACPI_FAILURE (Status))
487             {
488                 return (Status);
489             }
490 
491             DtInsertSubtable (ParentTable, Subtable);
492             PowerStateCount--;
493         }
494 
495         /* Sub-subtables - Physical Component ID Structure(s) */
496 
497         while (*PFieldList && ComponentCount)
498         {
499             Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B,
500                 &Subtable, TRUE);
501             if (ACPI_FAILURE (Status))
502             {
503                 return (Status);
504             }
505 
506             DtInsertSubtable (ParentTable, Subtable);
507             ComponentCount--;
508         }
509 
510         SubtableCount--;
511         DtPopSubtable ();
512     }
513 
514     /* Subtable: Count of Memory Power State Characteristic structures */
515 
516     DtPopSubtable ();
517 
518     Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable, TRUE);
519     if (ACPI_FAILURE (Status))
520     {
521         return (Status);
522     }
523 
524     ParentTable = DtPeekSubtable ();
525     DtInsertSubtable (ParentTable, Subtable);
526     DtPushSubtable (Subtable);
527 
528     MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
529     SubtableCount = MpstDataHeader->CharacteristicsCount;
530 
531     ParentTable = DtPeekSubtable ();
532 
533     /* Subtable: Memory Power State Characteristics structure(s) */
534 
535     while (*PFieldList && SubtableCount)
536     {
537         Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2,
538             &Subtable, TRUE);
539         if (ACPI_FAILURE (Status))
540         {
541             return (Status);
542         }
543 
544         DtInsertSubtable (ParentTable, Subtable);
545         SubtableCount--;
546     }
547 
548     DtPopSubtable ();
549     return (AE_OK);
550 }
551 
552 
553 /******************************************************************************
554  *
555  * FUNCTION:    DtCompileMsct
556  *
557  * PARAMETERS:  List                - Current field list pointer
558  *
559  * RETURN:      Status
560  *
561  * DESCRIPTION: Compile MSCT.
562  *
563  *****************************************************************************/
564 
565 ACPI_STATUS
566 DtCompileMsct (
567     void                    **List)
568 {
569     ACPI_STATUS             Status;
570 
571 
572     Status = DtCompileTwoSubtables (List,
573         AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0);
574     return (Status);
575 }
576 
577 
578 /******************************************************************************
579  *
580  * FUNCTION:    DtCompileMtmr
581  *
582  * PARAMETERS:  List                - Current field list pointer
583  *
584  * RETURN:      Status
585  *
586  * DESCRIPTION: Compile MTMR.
587  *
588  *****************************************************************************/
589 
590 ACPI_STATUS
591 DtCompileMtmr (
592     void                    **List)
593 {
594     ACPI_STATUS             Status;
595 
596 
597     Status = DtCompileTwoSubtables (List,
598         AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0);
599     return (Status);
600 }
601 
602 
603 /******************************************************************************
604  *
605  * FUNCTION:    DtCompileNfit
606  *
607  * PARAMETERS:  List                - Current field list pointer
608  *
609  * RETURN:      Status
610  *
611  * DESCRIPTION: Compile NFIT.
612  *
613  *****************************************************************************/
614 
615 ACPI_STATUS
616 DtCompileNfit (
617     void                    **List)
618 {
619     ACPI_STATUS             Status;
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;
626     UINT32                  Count;
627     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
628     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
629 
630 
631     /* Main table */
632 
633     Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit,
634         &Subtable, TRUE);
635     if (ACPI_FAILURE (Status))
636     {
637         return (Status);
638     }
639 
640     ParentTable = DtPeekSubtable ();
641     DtInsertSubtable (ParentTable, Subtable);
642     DtPushSubtable (Subtable);
643 
644     /* Subtables */
645 
646     while (*PFieldList)
647     {
648         SubtableStart = *PFieldList;
649         Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr,
650             &Subtable, TRUE);
651         if (ACPI_FAILURE (Status))
652         {
653             return (Status);
654         }
655 
656         ParentTable = DtPeekSubtable ();
657         DtInsertSubtable (ParentTable, Subtable);
658         DtPushSubtable (Subtable);
659 
660         NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
661 
662         switch (NfitHeader->Type)
663         {
664         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
665 
666             InfoTable = AcpiDmTableInfoNfit0;
667             break;
668 
669         case ACPI_NFIT_TYPE_MEMORY_MAP:
670 
671             InfoTable = AcpiDmTableInfoNfit1;
672             break;
673 
674         case ACPI_NFIT_TYPE_INTERLEAVE:
675 
676             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer);
677             InfoTable = AcpiDmTableInfoNfit2;
678             break;
679 
680         case ACPI_NFIT_TYPE_SMBIOS:
681 
682             InfoTable = AcpiDmTableInfoNfit3;
683             break;
684 
685         case ACPI_NFIT_TYPE_CONTROL_REGION:
686 
687             InfoTable = AcpiDmTableInfoNfit4;
688             break;
689 
690         case ACPI_NFIT_TYPE_DATA_REGION:
691 
692             InfoTable = AcpiDmTableInfoNfit5;
693             break;
694 
695         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
696 
697             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer);
698             InfoTable = AcpiDmTableInfoNfit6;
699             break;
700 
701         default:
702 
703             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT");
704             return (AE_ERROR);
705         }
706 
707         Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
708         if (ACPI_FAILURE (Status))
709         {
710             return (Status);
711         }
712 
713         ParentTable = DtPeekSubtable ();
714         DtInsertSubtable (ParentTable, Subtable);
715         DtPopSubtable ();
716 
717         switch (NfitHeader->Type)
718         {
719         case ACPI_NFIT_TYPE_INTERLEAVE:
720 
721             Count = 0;
722             DtPushSubtable (Subtable);
723             while (*PFieldList)
724             {
725                 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a,
726                     &Subtable, FALSE);
727                 if (ACPI_FAILURE (Status))
728                 {
729                     return (Status);
730                 }
731 
732                 if (!Subtable)
733                 {
734                     DtPopSubtable ();
735                     break;
736                 }
737 
738                 ParentTable = DtPeekSubtable ();
739                 DtInsertSubtable (ParentTable, Subtable);
740                 Count++;
741             }
742 
743             Interleave->LineCount = Count;
744             DtPopSubtable ();
745             break;
746 
747         case ACPI_NFIT_TYPE_SMBIOS:
748 
749             if (*PFieldList)
750             {
751                 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a,
752                     &Subtable, TRUE);
753                 if (ACPI_FAILURE (Status))
754                 {
755                     return (Status);
756                 }
757 
758                 if (Subtable)
759                 {
760                     DtInsertSubtable (ParentTable, Subtable);
761                 }
762             }
763             break;
764 
765         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
766 
767             Count = 0;
768             DtPushSubtable (Subtable);
769             while (*PFieldList)
770             {
771                 Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a,
772                     &Subtable, FALSE);
773                 if (ACPI_FAILURE (Status))
774                 {
775                     return (Status);
776                 }
777 
778                 if (!Subtable)
779                 {
780                     DtPopSubtable ();
781                     break;
782                 }
783 
784                 ParentTable = DtPeekSubtable ();
785                 DtInsertSubtable (ParentTable, Subtable);
786                 Count++;
787             }
788 
789             Hint->HintCount = (UINT16) Count;
790             DtPopSubtable ();
791             break;
792 
793         default:
794             break;
795         }
796     }
797 
798     return (AE_OK);
799 }
800 
801 
802 /******************************************************************************
803  *
804  * FUNCTION:    DtCompilePcct
805  *
806  * PARAMETERS:  List                - Current field list pointer
807  *
808  * RETURN:      Status
809  *
810  * DESCRIPTION: Compile PCCT.
811  *
812  *****************************************************************************/
813 
814 ACPI_STATUS
815 DtCompilePcct (
816     void                    **List)
817 {
818     ACPI_STATUS             Status;
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;
825 
826 
827     /* Main table */
828 
829     Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct,
830         &Subtable, TRUE);
831     if (ACPI_FAILURE (Status))
832     {
833         return (Status);
834     }
835 
836     ParentTable = DtPeekSubtable ();
837     DtInsertSubtable (ParentTable, Subtable);
838 
839     /* Subtables */
840 
841     while (*PFieldList)
842     {
843         SubtableStart = *PFieldList;
844         Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcctHdr,
845             &Subtable, TRUE);
846         if (ACPI_FAILURE (Status))
847         {
848             return (Status);
849         }
850 
851         ParentTable = DtPeekSubtable ();
852         DtInsertSubtable (ParentTable, Subtable);
853         DtPushSubtable (Subtable);
854 
855         PcctHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
856 
857         switch (PcctHeader->Type)
858         {
859         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
860 
861             InfoTable = AcpiDmTableInfoPcct0;
862             break;
863 
864         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
865 
866             InfoTable = AcpiDmTableInfoPcct1;
867             break;
868 
869         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
870 
871             InfoTable = AcpiDmTableInfoPcct2;
872             break;
873 
874         default:
875 
876             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT");
877             return (AE_ERROR);
878         }
879 
880         Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
881         if (ACPI_FAILURE (Status))
882         {
883             return (Status);
884         }
885 
886         ParentTable = DtPeekSubtable ();
887         DtInsertSubtable (ParentTable, Subtable);
888         DtPopSubtable ();
889     }
890 
891     return (AE_OK);
892 }
893 
894 
895 /******************************************************************************
896  *
897  * FUNCTION:    DtCompilePmtt
898  *
899  * PARAMETERS:  List                - Current field list pointer
900  *
901  * RETURN:      Status
902  *
903  * DESCRIPTION: Compile PMTT.
904  *
905  *****************************************************************************/
906 
907 ACPI_STATUS
908 DtCompilePmtt (
909     void                    **List)
910 {
911     ACPI_STATUS             Status;
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;
918     UINT16                  DomainCount;
919     UINT8                   PrevType = ACPI_PMTT_TYPE_SOCKET;
920 
921 
922     /* Main table */
923 
924     Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable, TRUE);
925     if (ACPI_FAILURE (Status))
926     {
927         return (Status);
928     }
929 
930     ParentTable = DtPeekSubtable ();
931     DtInsertSubtable (ParentTable, Subtable);
932     DtPushSubtable (Subtable);
933 
934     while (*PFieldList)
935     {
936         SubtableStart = *PFieldList;
937         Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr,
938             &Subtable, TRUE);
939         if (ACPI_FAILURE (Status))
940         {
941             return (Status);
942         }
943 
944         PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer);
945         while (PrevType >= PmttHeader->Type)
946         {
947             DtPopSubtable ();
948 
949             if (PrevType == ACPI_PMTT_TYPE_SOCKET)
950             {
951                 break;
952             }
953 
954             PrevType--;
955         }
956 
957         PrevType = PmttHeader->Type;
958 
959         ParentTable = DtPeekSubtable ();
960         DtInsertSubtable (ParentTable, Subtable);
961         DtPushSubtable (Subtable);
962 
963         switch (PmttHeader->Type)
964         {
965         case ACPI_PMTT_TYPE_SOCKET:
966 
967             /* Subtable: Socket Structure */
968 
969             Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0,
970                 &Subtable, TRUE);
971             if (ACPI_FAILURE (Status))
972             {
973                 return (Status);
974             }
975 
976             ParentTable = DtPeekSubtable ();
977             DtInsertSubtable (ParentTable, Subtable);
978             break;
979 
980         case ACPI_PMTT_TYPE_CONTROLLER:
981 
982             /* Subtable: Memory Controller Structure */
983 
984             Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1,
985                 &Subtable, TRUE);
986             if (ACPI_FAILURE (Status))
987             {
988                 return (Status);
989             }
990 
991             ParentTable = DtPeekSubtable ();
992             DtInsertSubtable (ParentTable, Subtable);
993 
994             PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
995                 (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
996             DomainCount = PmttController->DomainCount;
997 
998             while (DomainCount)
999             {
1000                 Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a,
1001                     &Subtable, TRUE);
1002                 if (ACPI_FAILURE (Status))
1003                 {
1004                     return (Status);
1005                 }
1006 
1007                 DtInsertSubtable (ParentTable, Subtable);
1008                 DomainCount--;
1009             }
1010             break;
1011 
1012         case ACPI_PMTT_TYPE_DIMM:
1013 
1014             /* Subtable: Physical Component Structure */
1015 
1016             Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2,
1017                 &Subtable, TRUE);
1018             if (ACPI_FAILURE (Status))
1019             {
1020                 return (Status);
1021             }
1022 
1023             ParentTable = DtPeekSubtable ();
1024             DtInsertSubtable (ParentTable, Subtable);
1025             break;
1026 
1027         default:
1028 
1029             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT");
1030             return (AE_ERROR);
1031         }
1032     }
1033 
1034     return (Status);
1035 }
1036 
1037 
1038 /******************************************************************************
1039  *
1040  * FUNCTION:    DtCompileRsdt
1041  *
1042  * PARAMETERS:  List                - Current field list pointer
1043  *
1044  * RETURN:      Status
1045  *
1046  * DESCRIPTION: Compile RSDT.
1047  *
1048  *****************************************************************************/
1049 
1050 ACPI_STATUS
1051 DtCompileRsdt (
1052     void                    **List)
1053 {
1054     DT_SUBTABLE             *Subtable;
1055     DT_SUBTABLE             *ParentTable;
1056     DT_FIELD                *FieldList = *(DT_FIELD **) List;
1057     UINT32                  Address;
1058 
1059 
1060     ParentTable = DtPeekSubtable ();
1061 
1062     while (FieldList)
1063     {
1064         DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
1065 
1066         DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
1067         DtInsertSubtable (ParentTable, Subtable);
1068         FieldList = FieldList->Next;
1069     }
1070 
1071     return (AE_OK);
1072 }
1073 
1074 
1075 /******************************************************************************
1076  *
1077  * FUNCTION:    DtCompileS3pt
1078  *
1079  * PARAMETERS:  PFieldList          - Current field list pointer
1080  *
1081  * RETURN:      Status
1082  *
1083  * DESCRIPTION: Compile S3PT (Pointed to by FPDT)
1084  *
1085  *****************************************************************************/
1086 
1087 ACPI_STATUS
1088 DtCompileS3pt (
1089     DT_FIELD                **PFieldList)
1090 {
1091     ACPI_STATUS             Status;
1092     ACPI_FPDT_HEADER        *S3ptHeader;
1093     DT_SUBTABLE             *Subtable;
1094     DT_SUBTABLE             *ParentTable;
1095     ACPI_DMTABLE_INFO       *InfoTable;
1096     DT_FIELD                *SubtableStart;
1097 
1098 
1099     Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
1100         &Gbl_RootTable, TRUE);
1101     if (ACPI_FAILURE (Status))
1102     {
1103         return (Status);
1104     }
1105 
1106     DtPushSubtable (Gbl_RootTable);
1107 
1108     while (*PFieldList)
1109     {
1110         SubtableStart = *PFieldList;
1111         Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr,
1112             &Subtable, TRUE);
1113         if (ACPI_FAILURE (Status))
1114         {
1115             return (Status);
1116         }
1117 
1118         ParentTable = DtPeekSubtable ();
1119         DtInsertSubtable (ParentTable, Subtable);
1120         DtPushSubtable (Subtable);
1121 
1122         S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1123 
1124         switch (S3ptHeader->Type)
1125         {
1126         case ACPI_S3PT_TYPE_RESUME:
1127 
1128             InfoTable = AcpiDmTableInfoS3pt0;
1129             break;
1130 
1131         case ACPI_S3PT_TYPE_SUSPEND:
1132 
1133             InfoTable = AcpiDmTableInfoS3pt1;
1134             break;
1135 
1136         default:
1137 
1138             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT");
1139             return (AE_ERROR);
1140         }
1141 
1142         Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1143         if (ACPI_FAILURE (Status))
1144         {
1145             return (Status);
1146         }
1147 
1148         ParentTable = DtPeekSubtable ();
1149         DtInsertSubtable (ParentTable, Subtable);
1150         DtPopSubtable ();
1151     }
1152 
1153     return (AE_OK);
1154 }
1155 
1156 
1157 /******************************************************************************
1158  *
1159  * FUNCTION:    DtCompileSlic
1160  *
1161  * PARAMETERS:  List                - Current field list pointer
1162  *
1163  * RETURN:      Status
1164  *
1165  * DESCRIPTION: Compile SLIC.
1166  *
1167  *****************************************************************************/
1168 
1169 ACPI_STATUS
1170 DtCompileSlic (
1171     void                    **List)
1172 {
1173     ACPI_STATUS             Status;
1174     DT_SUBTABLE             *Subtable;
1175     DT_SUBTABLE             *ParentTable;
1176     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1177 
1178 
1179     while (*PFieldList)
1180     {
1181         Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic,
1182             &Subtable, TRUE);
1183         if (ACPI_FAILURE (Status))
1184         {
1185             return (Status);
1186         }
1187 
1188         ParentTable = DtPeekSubtable ();
1189         DtInsertSubtable (ParentTable, Subtable);
1190         DtPushSubtable (Subtable);
1191         DtPopSubtable ();
1192     }
1193 
1194     return (AE_OK);
1195 }
1196 
1197 
1198 /******************************************************************************
1199  *
1200  * FUNCTION:    DtCompileSlit
1201  *
1202  * PARAMETERS:  List                - Current field list pointer
1203  *
1204  * RETURN:      Status
1205  *
1206  * DESCRIPTION: Compile SLIT.
1207  *
1208  *****************************************************************************/
1209 
1210 ACPI_STATUS
1211 DtCompileSlit (
1212     void                    **List)
1213 {
1214     ACPI_STATUS             Status;
1215     DT_SUBTABLE             *Subtable;
1216     DT_SUBTABLE             *ParentTable;
1217     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1218     DT_FIELD                *FieldList;
1219     UINT32                  Localities;
1220     UINT8                   *LocalityBuffer;
1221 
1222 
1223     Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1224         &Subtable, TRUE);
1225     if (ACPI_FAILURE (Status))
1226     {
1227         return (Status);
1228     }
1229 
1230     ParentTable = DtPeekSubtable ();
1231     DtInsertSubtable (ParentTable, Subtable);
1232 
1233     Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
1234     LocalityBuffer = UtLocalCalloc (Localities);
1235 
1236     /* Compile each locality buffer */
1237 
1238     FieldList = *PFieldList;
1239     while (FieldList)
1240     {
1241         DtCompileBuffer (LocalityBuffer,
1242             FieldList->Value, FieldList, Localities);
1243 
1244         DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
1245         DtInsertSubtable (ParentTable, Subtable);
1246         FieldList = FieldList->Next;
1247     }
1248 
1249     ACPI_FREE (LocalityBuffer);
1250     return (AE_OK);
1251 }
1252 
1253 
1254 /******************************************************************************
1255  *
1256  * FUNCTION:    DtCompileSrat
1257  *
1258  * PARAMETERS:  List                - Current field list pointer
1259  *
1260  * RETURN:      Status
1261  *
1262  * DESCRIPTION: Compile SRAT.
1263  *
1264  *****************************************************************************/
1265 
1266 ACPI_STATUS
1267 DtCompileSrat (
1268     void                    **List)
1269 {
1270     ACPI_STATUS             Status;
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;
1277 
1278 
1279     Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
1280         &Subtable, TRUE);
1281     if (ACPI_FAILURE (Status))
1282     {
1283         return (Status);
1284     }
1285 
1286     ParentTable = DtPeekSubtable ();
1287     DtInsertSubtable (ParentTable, Subtable);
1288 
1289     while (*PFieldList)
1290     {
1291         SubtableStart = *PFieldList;
1292         Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
1293             &Subtable, TRUE);
1294         if (ACPI_FAILURE (Status))
1295         {
1296             return (Status);
1297         }
1298 
1299         ParentTable = DtPeekSubtable ();
1300         DtInsertSubtable (ParentTable, Subtable);
1301         DtPushSubtable (Subtable);
1302 
1303         SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1304 
1305         switch (SratHeader->Type)
1306         {
1307         case ACPI_SRAT_TYPE_CPU_AFFINITY:
1308 
1309             InfoTable = AcpiDmTableInfoSrat0;
1310             break;
1311 
1312         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1313 
1314             InfoTable = AcpiDmTableInfoSrat1;
1315             break;
1316 
1317         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1318 
1319             InfoTable = AcpiDmTableInfoSrat2;
1320             break;
1321 
1322         case ACPI_SRAT_TYPE_GICC_AFFINITY:
1323 
1324             InfoTable = AcpiDmTableInfoSrat3;
1325             break;
1326 
1327         default:
1328 
1329             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
1330             return (AE_ERROR);
1331         }
1332 
1333         Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
1334         if (ACPI_FAILURE (Status))
1335         {
1336             return (Status);
1337         }
1338 
1339         ParentTable = DtPeekSubtable ();
1340         DtInsertSubtable (ParentTable, Subtable);
1341         DtPopSubtable ();
1342     }
1343 
1344     return (AE_OK);
1345 }
1346 
1347 
1348 /******************************************************************************
1349  *
1350  * FUNCTION:    DtCompileStao
1351  *
1352  * PARAMETERS:  PFieldList          - Current field list pointer
1353  *
1354  * RETURN:      Status
1355  *
1356  * DESCRIPTION: Compile STAO.
1357  *
1358  *****************************************************************************/
1359 
1360 ACPI_STATUS
1361 DtCompileStao (
1362     void                    **List)
1363 {
1364     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1365     DT_SUBTABLE             *Subtable;
1366     DT_SUBTABLE             *ParentTable;
1367     ACPI_STATUS             Status;
1368 
1369 
1370     /* Compile the main table */
1371 
1372     Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao,
1373         &Subtable, TRUE);
1374     if (ACPI_FAILURE (Status))
1375     {
1376         return (Status);
1377     }
1378 
1379     ParentTable = DtPeekSubtable ();
1380     DtInsertSubtable (ParentTable, Subtable);
1381 
1382     /* Compile each ASCII namestring as a subtable */
1383 
1384     while (*PFieldList)
1385     {
1386         Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr,
1387             &Subtable, TRUE);
1388         if (ACPI_FAILURE (Status))
1389         {
1390             return (Status);
1391         }
1392 
1393         ParentTable = DtPeekSubtable ();
1394         DtInsertSubtable (ParentTable, Subtable);
1395     }
1396 
1397     return (AE_OK);
1398 }
1399 
1400 
1401 /******************************************************************************
1402  *
1403  * FUNCTION:    DtCompileTcpa
1404  *
1405  * PARAMETERS:  PFieldList          - Current field list pointer
1406  *
1407  * RETURN:      Status
1408  *
1409  * DESCRIPTION: Compile TCPA.
1410  *
1411  *****************************************************************************/
1412 
1413 ACPI_STATUS
1414 DtCompileTcpa (
1415     void                    **List)
1416 {
1417     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1418     DT_SUBTABLE             *Subtable;
1419     ACPI_TABLE_TCPA_HDR     *TcpaHeader;
1420     DT_SUBTABLE             *ParentTable;
1421     ACPI_STATUS             Status;
1422 
1423 
1424     /* Compile the main table */
1425 
1426     Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr,
1427         &Subtable, TRUE);
1428     if (ACPI_FAILURE (Status))
1429     {
1430         return (Status);
1431     }
1432 
1433     ParentTable = DtPeekSubtable ();
1434     DtInsertSubtable (ParentTable, Subtable);
1435 
1436     /*
1437      * Examine the PlatformClass field to determine the table type.
1438      * Either a client or server table. Only one.
1439      */
1440     TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
1441 
1442     switch (TcpaHeader->PlatformClass)
1443     {
1444     case ACPI_TCPA_CLIENT_TABLE:
1445 
1446         Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient,
1447             &Subtable, TRUE);
1448         break;
1449 
1450     case ACPI_TCPA_SERVER_TABLE:
1451 
1452         Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer,
1453             &Subtable, TRUE);
1454         break;
1455 
1456     default:
1457 
1458         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
1459             TcpaHeader->PlatformClass);
1460         Status = AE_ERROR;
1461         break;
1462     }
1463 
1464     ParentTable = DtPeekSubtable ();
1465     DtInsertSubtable (ParentTable, Subtable);
1466     return (Status);
1467 }
1468 
1469 
1470 /******************************************************************************
1471  *
1472  * FUNCTION:    DtGetGenericTableInfo
1473  *
1474  * PARAMETERS:  Name                - Generic type name
1475  *
1476  * RETURN:      Info entry
1477  *
1478  * DESCRIPTION: Obtain table info for a generic name entry
1479  *
1480  *****************************************************************************/
1481 
1482 ACPI_DMTABLE_INFO *
1483 DtGetGenericTableInfo (
1484     char                    *Name)
1485 {
1486     ACPI_DMTABLE_INFO       *Info;
1487     UINT32                  i;
1488 
1489 
1490     if (!Name)
1491     {
1492         return (NULL);
1493     }
1494 
1495     /* Search info table for name match */
1496 
1497     for (i = 0; ; i++)
1498     {
1499         Info = AcpiDmTableInfoGeneric[i];
1500         if (Info->Opcode == ACPI_DMT_EXIT)
1501         {
1502             Info = NULL;
1503             break;
1504         }
1505 
1506         /* Use caseless compare for generic keywords */
1507 
1508         if (!AcpiUtStricmp (Name, Info->Name))
1509         {
1510             break;
1511         }
1512     }
1513 
1514     return (Info);
1515 }
1516 
1517 
1518 /******************************************************************************
1519  *
1520  * FUNCTION:    DtCompileUefi
1521  *
1522  * PARAMETERS:  List                - Current field list pointer
1523  *
1524  * RETURN:      Status
1525  *
1526  * DESCRIPTION: Compile UEFI.
1527  *
1528  *****************************************************************************/
1529 
1530 ACPI_STATUS
1531 DtCompileUefi (
1532     void                    **List)
1533 {
1534     ACPI_STATUS             Status;
1535     DT_SUBTABLE             *Subtable;
1536     DT_SUBTABLE             *ParentTable;
1537     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1538     UINT16                  *DataOffset;
1539 
1540 
1541     /* Compile the predefined portion of the UEFI table */
1542 
1543     Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
1544         &Subtable, TRUE);
1545     if (ACPI_FAILURE (Status))
1546     {
1547         return (Status);
1548     }
1549 
1550     DataOffset = (UINT16 *) (Subtable->Buffer + 16);
1551     *DataOffset = sizeof (ACPI_TABLE_UEFI);
1552 
1553     ParentTable = DtPeekSubtable ();
1554     DtInsertSubtable (ParentTable, Subtable);
1555 
1556     /*
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.
1560      */
1561     DtCompileGeneric ((void **) PFieldList, NULL, NULL);
1562     return (AE_OK);
1563 }
1564 
1565 
1566 /******************************************************************************
1567  *
1568  * FUNCTION:    DtCompileVrtc
1569  *
1570  * PARAMETERS:  List                - Current field list pointer
1571  *
1572  * RETURN:      Status
1573  *
1574  * DESCRIPTION: Compile VRTC.
1575  *
1576  *****************************************************************************/
1577 
1578 ACPI_STATUS
1579 DtCompileVrtc (
1580     void                    **List)
1581 {
1582     ACPI_STATUS             Status;
1583 
1584 
1585     Status = DtCompileTwoSubtables (List,
1586         AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0);
1587     return (Status);
1588 }
1589 
1590 
1591 /******************************************************************************
1592  *
1593  * FUNCTION:    DtCompileWdat
1594  *
1595  * PARAMETERS:  List                - Current field list pointer
1596  *
1597  * RETURN:      Status
1598  *
1599  * DESCRIPTION: Compile WDAT.
1600  *
1601  *****************************************************************************/
1602 
1603 ACPI_STATUS
1604 DtCompileWdat (
1605     void                    **List)
1606 {
1607     ACPI_STATUS             Status;
1608 
1609 
1610     Status = DtCompileTwoSubtables (List,
1611         AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
1612     return (Status);
1613 }
1614 
1615 
1616 /******************************************************************************
1617  *
1618  * FUNCTION:    DtCompileWpbt
1619  *
1620  * PARAMETERS:  List                - Current field list pointer
1621  *
1622  * RETURN:      Status
1623  *
1624  * DESCRIPTION: Compile WPBT.
1625  *
1626  *****************************************************************************/
1627 
1628 ACPI_STATUS
1629 DtCompileWpbt (
1630     void                    **List)
1631 {
1632     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1633     DT_SUBTABLE             *Subtable;
1634     DT_SUBTABLE             *ParentTable;
1635     ACPI_TABLE_WPBT         *Table;
1636     ACPI_STATUS             Status;
1637     UINT16                  Length;
1638 
1639 
1640     /* Compile the main table */
1641 
1642     Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt,
1643         &Subtable, TRUE);
1644     if (ACPI_FAILURE (Status))
1645     {
1646         return (Status);
1647     }
1648 
1649     ParentTable = DtPeekSubtable ();
1650     DtInsertSubtable (ParentTable, Subtable);
1651 
1652     /* Compile the argument list subtable */
1653 
1654     Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0,
1655         &Subtable, TRUE);
1656     if (ACPI_FAILURE (Status))
1657     {
1658         return (Status);
1659     }
1660 
1661     /* Extract the length of the Arguments buffer, insert into main table */
1662 
1663     Length = (UINT16) Subtable->TotalLength;
1664     Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
1665     Table->ArgumentsLength = Length;
1666 
1667     ParentTable = DtPeekSubtable ();
1668     DtInsertSubtable (ParentTable, Subtable);
1669     return (AE_OK);
1670 }
1671 
1672 
1673 /******************************************************************************
1674  *
1675  * FUNCTION:    DtCompileXsdt
1676  *
1677  * PARAMETERS:  List                - Current field list pointer
1678  *
1679  * RETURN:      Status
1680  *
1681  * DESCRIPTION: Compile XSDT.
1682  *
1683  *****************************************************************************/
1684 
1685 ACPI_STATUS
1686 DtCompileXsdt (
1687     void                    **List)
1688 {
1689     DT_SUBTABLE             *Subtable;
1690     DT_SUBTABLE             *ParentTable;
1691     DT_FIELD                *FieldList = *(DT_FIELD **) List;
1692     UINT64                  Address;
1693 
1694 
1695     ParentTable = DtPeekSubtable ();
1696 
1697     while (FieldList)
1698     {
1699         DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
1700 
1701         DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
1702         DtInsertSubtable (ParentTable, Subtable);
1703         FieldList = FieldList->Next;
1704     }
1705 
1706     return (AE_OK);
1707 }
1708 
1709 
1710 /******************************************************************************
1711  *
1712  * FUNCTION:    DtCompileGeneric
1713  *
1714  * PARAMETERS:  List                - Current field list pointer
1715  *              Name                - Field name to end generic compiling
1716  *              Length              - Compiled table length to return
1717  *
1718  * RETURN:      Status
1719  *
1720  * DESCRIPTION: Compile generic unknown table.
1721  *
1722  *****************************************************************************/
1723 
1724 ACPI_STATUS
1725 DtCompileGeneric (
1726     void                    **List,
1727     char                    *Name,
1728     UINT32                  *Length)
1729 {
1730     ACPI_STATUS             Status;
1731     DT_SUBTABLE             *Subtable;
1732     DT_SUBTABLE             *ParentTable;
1733     DT_FIELD                **PFieldList = (DT_FIELD **) List;
1734     ACPI_DMTABLE_INFO       *Info;
1735 
1736 
1737     ParentTable = DtPeekSubtable ();
1738 
1739     /*
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.
1743      */
1744 
1745     /* Find any and all labels in the entire generic portion */
1746 
1747     DtDetectAllLabels (*PFieldList);
1748 
1749     /* Now we can actually compile the parse tree */
1750 
1751     if (Length && *Length)
1752     {
1753         *Length = 0;
1754     }
1755     while (*PFieldList)
1756     {
1757         if (Name && !strcmp ((*PFieldList)->Name, Name))
1758         {
1759             break;
1760         }
1761 
1762         Info = DtGetGenericTableInfo ((*PFieldList)->Name);
1763         if (!Info)
1764         {
1765             sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1766                 (*PFieldList)->Name);
1767             DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1768                 (*PFieldList), MsgBuffer);
1769 
1770             *PFieldList = (*PFieldList)->Next;
1771             continue;
1772         }
1773 
1774         Status = DtCompileTable (PFieldList, Info,
1775             &Subtable, TRUE);
1776         if (ACPI_SUCCESS (Status))
1777         {
1778             DtInsertSubtable (ParentTable, Subtable);
1779             if (Length)
1780             {
1781                 *Length += Subtable->Length;
1782             }
1783         }
1784         else
1785         {
1786             *PFieldList = (*PFieldList)->Next;
1787 
1788             if (Status == AE_NOT_FOUND)
1789             {
1790                 sprintf (MsgBuffer, "Generic data type \"%s\" not found",
1791                     (*PFieldList)->Name);
1792                 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
1793                     (*PFieldList), MsgBuffer);
1794             }
1795         }
1796     }
1797 
1798     return (AE_OK);
1799 }
1800