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