1bc36eafdSMike Gerdts /******************************************************************************
2bc36eafdSMike Gerdts *
3bc36eafdSMike Gerdts * Module Name: dttable2.c - handling for specific ACPI tables
4bc36eafdSMike Gerdts *
5bc36eafdSMike Gerdts *****************************************************************************/
6bc36eafdSMike Gerdts
7*35786f68SRobert Mustacchi /******************************************************************************
8*35786f68SRobert Mustacchi *
9*35786f68SRobert Mustacchi * 1. Copyright Notice
10*35786f68SRobert Mustacchi *
11*35786f68SRobert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12bc36eafdSMike Gerdts * All rights reserved.
13bc36eafdSMike Gerdts *
14*35786f68SRobert Mustacchi * 2. License
15*35786f68SRobert Mustacchi *
16*35786f68SRobert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
17*35786f68SRobert Mustacchi * rights. You may have additional license terms from the party that provided
18*35786f68SRobert Mustacchi * you this software, covering your right to use that party's intellectual
19*35786f68SRobert Mustacchi * property rights.
20*35786f68SRobert Mustacchi *
21*35786f68SRobert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*35786f68SRobert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
23*35786f68SRobert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*35786f68SRobert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
25*35786f68SRobert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
26*35786f68SRobert Mustacchi * Code in any form, with the right to sublicense such rights; and
27*35786f68SRobert Mustacchi *
28*35786f68SRobert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*35786f68SRobert Mustacchi * license (with the right to sublicense), under only those claims of Intel
30*35786f68SRobert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
31*35786f68SRobert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
32*35786f68SRobert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
33*35786f68SRobert Mustacchi * license, and in no event shall the patent license extend to any additions
34*35786f68SRobert Mustacchi * to or modifications of the Original Intel Code. No other license or right
35*35786f68SRobert Mustacchi * is granted directly or by implication, estoppel or otherwise;
36*35786f68SRobert Mustacchi *
37*35786f68SRobert Mustacchi * The above copyright and patent license is granted only if the following
38*35786f68SRobert Mustacchi * conditions are met:
39*35786f68SRobert Mustacchi *
40*35786f68SRobert Mustacchi * 3. Conditions
41*35786f68SRobert Mustacchi *
42*35786f68SRobert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*35786f68SRobert Mustacchi * Redistribution of source code of any substantial portion of the Covered
44*35786f68SRobert Mustacchi * Code or modification with rights to further distribute source must include
45*35786f68SRobert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
46*35786f68SRobert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
47*35786f68SRobert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
48*35786f68SRobert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
49*35786f68SRobert Mustacchi * Code and the date of any change. Licensee must include in that file the
50*35786f68SRobert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
51*35786f68SRobert Mustacchi * must include a prominent statement that the modification is derived,
52*35786f68SRobert Mustacchi * directly or indirectly, from Original Intel Code.
53*35786f68SRobert Mustacchi *
54*35786f68SRobert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*35786f68SRobert Mustacchi * Redistribution of source code of any substantial portion of the Covered
56*35786f68SRobert Mustacchi * Code or modification without rights to further distribute source must
57*35786f68SRobert Mustacchi * include the following Disclaimer and Export Compliance provision in the
58*35786f68SRobert Mustacchi * documentation and/or other materials provided with distribution. In
59*35786f68SRobert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
60*35786f68SRobert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
61*35786f68SRobert Mustacchi * license from Licensee to its licensee is limited to the intellectual
62*35786f68SRobert Mustacchi * property embodied in the software Licensee provides to its licensee, and
63*35786f68SRobert Mustacchi * not to intellectual property embodied in modifications its licensee may
64*35786f68SRobert Mustacchi * make.
65*35786f68SRobert Mustacchi *
66*35786f68SRobert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*35786f68SRobert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
68*35786f68SRobert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
69*35786f68SRobert Mustacchi * provision in the documentation and/or other materials provided with the
70*35786f68SRobert Mustacchi * distribution.
71*35786f68SRobert Mustacchi *
72*35786f68SRobert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
73*35786f68SRobert Mustacchi * Intel Code.
74*35786f68SRobert Mustacchi *
75*35786f68SRobert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*35786f68SRobert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
77*35786f68SRobert Mustacchi * other dealings in products derived from or relating to the Covered Code
78*35786f68SRobert Mustacchi * without prior written authorization from Intel.
79*35786f68SRobert Mustacchi *
80*35786f68SRobert Mustacchi * 4. Disclaimer and Export Compliance
81*35786f68SRobert Mustacchi *
82*35786f68SRobert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*35786f68SRobert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*35786f68SRobert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85*35786f68SRobert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86*35786f68SRobert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87*35786f68SRobert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*35786f68SRobert Mustacchi * PARTICULAR PURPOSE.
89*35786f68SRobert Mustacchi *
90*35786f68SRobert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*35786f68SRobert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*35786f68SRobert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*35786f68SRobert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*35786f68SRobert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*35786f68SRobert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96*35786f68SRobert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*35786f68SRobert Mustacchi * LIMITED REMEDY.
98*35786f68SRobert Mustacchi *
99*35786f68SRobert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*35786f68SRobert Mustacchi * software or system incorporating such software without first obtaining any
101*35786f68SRobert Mustacchi * required license or other approval from the U. S. Department of Commerce or
102*35786f68SRobert Mustacchi * any other agency or department of the United States Government. In the
103*35786f68SRobert Mustacchi * event Licensee exports any such software from the United States or
104*35786f68SRobert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
105*35786f68SRobert Mustacchi * ensure that the distribution and export/re-export of the software is in
106*35786f68SRobert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
107*35786f68SRobert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*35786f68SRobert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
109*35786f68SRobert Mustacchi * software, or service, directly or indirectly, to any country for which the
110*35786f68SRobert Mustacchi * United States government or any agency thereof requires an export license,
111*35786f68SRobert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
112*35786f68SRobert Mustacchi * such license, approval or letter.
113*35786f68SRobert Mustacchi *
114*35786f68SRobert Mustacchi *****************************************************************************
115*35786f68SRobert Mustacchi *
116*35786f68SRobert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
117*35786f68SRobert Mustacchi * following license:
118*35786f68SRobert Mustacchi *
119bc36eafdSMike Gerdts * Redistribution and use in source and binary forms, with or without
120bc36eafdSMike Gerdts * modification, are permitted provided that the following conditions
121bc36eafdSMike Gerdts * are met:
122bc36eafdSMike Gerdts * 1. Redistributions of source code must retain the above copyright
123bc36eafdSMike Gerdts * notice, this list of conditions, and the following disclaimer,
124bc36eafdSMike Gerdts * without modification.
125bc36eafdSMike Gerdts * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126bc36eafdSMike Gerdts * substantially similar to the "NO WARRANTY" disclaimer below
127bc36eafdSMike Gerdts * ("Disclaimer") and any redistribution must be conditioned upon
128bc36eafdSMike Gerdts * including a substantially similar Disclaimer requirement for further
129bc36eafdSMike Gerdts * binary redistribution.
130bc36eafdSMike Gerdts * 3. Neither the names of the above-listed copyright holders nor the names
131bc36eafdSMike Gerdts * of any contributors may be used to endorse or promote products derived
132bc36eafdSMike Gerdts * from this software without specific prior written permission.
133bc36eafdSMike Gerdts *
134bc36eafdSMike Gerdts * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135bc36eafdSMike Gerdts * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*35786f68SRobert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137bc36eafdSMike Gerdts * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138*35786f68SRobert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139*35786f68SRobert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140*35786f68SRobert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141*35786f68SRobert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142*35786f68SRobert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143*35786f68SRobert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144*35786f68SRobert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145*35786f68SRobert Mustacchi *
146*35786f68SRobert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
147*35786f68SRobert Mustacchi * GNU General Public License ("GPL") version 2 as published by the Free
148*35786f68SRobert Mustacchi * Software Foundation.
149*35786f68SRobert Mustacchi *
150*35786f68SRobert Mustacchi *****************************************************************************/
151bc36eafdSMike Gerdts
152bc36eafdSMike Gerdts /* Compile all complex data tables, signatures starting with L-Z */
153bc36eafdSMike Gerdts
154bc36eafdSMike Gerdts #include "aslcompiler.h"
155bc36eafdSMike Gerdts
156bc36eafdSMike Gerdts #define _COMPONENT DT_COMPILER
157bc36eafdSMike Gerdts ACPI_MODULE_NAME ("dttable2")
158bc36eafdSMike Gerdts
159bc36eafdSMike Gerdts
160bc36eafdSMike Gerdts /******************************************************************************
161bc36eafdSMike Gerdts *
162bc36eafdSMike Gerdts * FUNCTION: DtCompileLpit
163bc36eafdSMike Gerdts *
164bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
165bc36eafdSMike Gerdts *
166bc36eafdSMike Gerdts * RETURN: Status
167bc36eafdSMike Gerdts *
168bc36eafdSMike Gerdts * DESCRIPTION: Compile LPIT.
169bc36eafdSMike Gerdts *
170bc36eafdSMike Gerdts *****************************************************************************/
171bc36eafdSMike Gerdts
172bc36eafdSMike Gerdts ACPI_STATUS
DtCompileLpit(void ** List)173bc36eafdSMike Gerdts DtCompileLpit (
174bc36eafdSMike Gerdts void **List)
175bc36eafdSMike Gerdts {
176bc36eafdSMike Gerdts ACPI_STATUS Status;
177bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
178bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
179bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
180bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
181bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
182bc36eafdSMike Gerdts ACPI_LPIT_HEADER *LpitHeader;
183bc36eafdSMike Gerdts
184bc36eafdSMike Gerdts
185bc36eafdSMike Gerdts /* Note: Main table consists only of the standard ACPI table header */
186bc36eafdSMike Gerdts
187bc36eafdSMike Gerdts while (*PFieldList)
188bc36eafdSMike Gerdts {
189bc36eafdSMike Gerdts SubtableStart = *PFieldList;
190bc36eafdSMike Gerdts
191bc36eafdSMike Gerdts /* LPIT Subtable header */
192bc36eafdSMike Gerdts
193bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoLpitHdr,
194*35786f68SRobert Mustacchi &Subtable);
195bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
196bc36eafdSMike Gerdts {
197bc36eafdSMike Gerdts return (Status);
198bc36eafdSMike Gerdts }
199bc36eafdSMike Gerdts
200bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
201bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
202bc36eafdSMike Gerdts DtPushSubtable (Subtable);
203bc36eafdSMike Gerdts
204bc36eafdSMike Gerdts LpitHeader = ACPI_CAST_PTR (ACPI_LPIT_HEADER, Subtable->Buffer);
205bc36eafdSMike Gerdts
206bc36eafdSMike Gerdts switch (LpitHeader->Type)
207bc36eafdSMike Gerdts {
208bc36eafdSMike Gerdts case ACPI_LPIT_TYPE_NATIVE_CSTATE:
209bc36eafdSMike Gerdts
210bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoLpit0;
211bc36eafdSMike Gerdts break;
212bc36eafdSMike Gerdts
213bc36eafdSMike Gerdts default:
214bc36eafdSMike Gerdts
215bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT");
216bc36eafdSMike Gerdts return (AE_ERROR);
217bc36eafdSMike Gerdts }
218bc36eafdSMike Gerdts
219bc36eafdSMike Gerdts /* LPIT Subtable */
220bc36eafdSMike Gerdts
221*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
222bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
223bc36eafdSMike Gerdts {
224bc36eafdSMike Gerdts return (Status);
225bc36eafdSMike Gerdts }
226bc36eafdSMike Gerdts
227bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
228bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
229bc36eafdSMike Gerdts DtPopSubtable ();
230bc36eafdSMike Gerdts }
231bc36eafdSMike Gerdts
232bc36eafdSMike Gerdts return (AE_OK);
233bc36eafdSMike Gerdts }
234bc36eafdSMike Gerdts
235bc36eafdSMike Gerdts
236bc36eafdSMike Gerdts /******************************************************************************
237bc36eafdSMike Gerdts *
238bc36eafdSMike Gerdts * FUNCTION: DtCompileMadt
239bc36eafdSMike Gerdts *
240bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
241bc36eafdSMike Gerdts *
242bc36eafdSMike Gerdts * RETURN: Status
243bc36eafdSMike Gerdts *
244bc36eafdSMike Gerdts * DESCRIPTION: Compile MADT.
245bc36eafdSMike Gerdts *
246bc36eafdSMike Gerdts *****************************************************************************/
247bc36eafdSMike Gerdts
248bc36eafdSMike Gerdts ACPI_STATUS
DtCompileMadt(void ** List)249bc36eafdSMike Gerdts DtCompileMadt (
250bc36eafdSMike Gerdts void **List)
251bc36eafdSMike Gerdts {
252bc36eafdSMike Gerdts ACPI_STATUS Status;
253bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
254bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
255bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
256bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
257bc36eafdSMike Gerdts ACPI_SUBTABLE_HEADER *MadtHeader;
258bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
259bc36eafdSMike Gerdts
260bc36eafdSMike Gerdts
261bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt,
262*35786f68SRobert Mustacchi &Subtable);
263bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
264bc36eafdSMike Gerdts {
265bc36eafdSMike Gerdts return (Status);
266bc36eafdSMike Gerdts }
267bc36eafdSMike Gerdts
268bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
269bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
270bc36eafdSMike Gerdts
271bc36eafdSMike Gerdts while (*PFieldList)
272bc36eafdSMike Gerdts {
273bc36eafdSMike Gerdts SubtableStart = *PFieldList;
274bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr,
275*35786f68SRobert Mustacchi &Subtable);
276bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
277bc36eafdSMike Gerdts {
278bc36eafdSMike Gerdts return (Status);
279bc36eafdSMike Gerdts }
280bc36eafdSMike Gerdts
281bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
282bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
283bc36eafdSMike Gerdts DtPushSubtable (Subtable);
284bc36eafdSMike Gerdts
285bc36eafdSMike Gerdts MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
286bc36eafdSMike Gerdts
287bc36eafdSMike Gerdts switch (MadtHeader->Type)
288bc36eafdSMike Gerdts {
289bc36eafdSMike Gerdts case ACPI_MADT_TYPE_LOCAL_APIC:
290bc36eafdSMike Gerdts
291bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt0;
292bc36eafdSMike Gerdts break;
293bc36eafdSMike Gerdts
294bc36eafdSMike Gerdts case ACPI_MADT_TYPE_IO_APIC:
295bc36eafdSMike Gerdts
296bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt1;
297bc36eafdSMike Gerdts break;
298bc36eafdSMike Gerdts
299bc36eafdSMike Gerdts case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
300bc36eafdSMike Gerdts
301bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt2;
302bc36eafdSMike Gerdts break;
303bc36eafdSMike Gerdts
304bc36eafdSMike Gerdts case ACPI_MADT_TYPE_NMI_SOURCE:
305bc36eafdSMike Gerdts
306bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt3;
307bc36eafdSMike Gerdts break;
308bc36eafdSMike Gerdts
309bc36eafdSMike Gerdts case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
310bc36eafdSMike Gerdts
311bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt4;
312bc36eafdSMike Gerdts break;
313bc36eafdSMike Gerdts
314bc36eafdSMike Gerdts case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
315bc36eafdSMike Gerdts
316bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt5;
317bc36eafdSMike Gerdts break;
318bc36eafdSMike Gerdts
319bc36eafdSMike Gerdts case ACPI_MADT_TYPE_IO_SAPIC:
320bc36eafdSMike Gerdts
321bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt6;
322bc36eafdSMike Gerdts break;
323bc36eafdSMike Gerdts
324bc36eafdSMike Gerdts case ACPI_MADT_TYPE_LOCAL_SAPIC:
325bc36eafdSMike Gerdts
326bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt7;
327bc36eafdSMike Gerdts break;
328bc36eafdSMike Gerdts
329bc36eafdSMike Gerdts case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
330bc36eafdSMike Gerdts
331bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt8;
332bc36eafdSMike Gerdts break;
333bc36eafdSMike Gerdts
334bc36eafdSMike Gerdts case ACPI_MADT_TYPE_LOCAL_X2APIC:
335bc36eafdSMike Gerdts
336bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt9;
337bc36eafdSMike Gerdts break;
338bc36eafdSMike Gerdts
339bc36eafdSMike Gerdts case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
340bc36eafdSMike Gerdts
341bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt10;
342bc36eafdSMike Gerdts break;
343bc36eafdSMike Gerdts
344bc36eafdSMike Gerdts case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
345bc36eafdSMike Gerdts
346bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt11;
347bc36eafdSMike Gerdts break;
348bc36eafdSMike Gerdts
349bc36eafdSMike Gerdts case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
350bc36eafdSMike Gerdts
351bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt12;
352bc36eafdSMike Gerdts break;
353bc36eafdSMike Gerdts
354bc36eafdSMike Gerdts case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
355bc36eafdSMike Gerdts
356bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt13;
357bc36eafdSMike Gerdts break;
358bc36eafdSMike Gerdts
359bc36eafdSMike Gerdts case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
360bc36eafdSMike Gerdts
361bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt14;
362bc36eafdSMike Gerdts break;
363bc36eafdSMike Gerdts
364bc36eafdSMike Gerdts case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
365bc36eafdSMike Gerdts
366bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoMadt15;
367bc36eafdSMike Gerdts break;
368bc36eafdSMike Gerdts
369bc36eafdSMike Gerdts default:
370bc36eafdSMike Gerdts
371bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT");
372bc36eafdSMike Gerdts return (AE_ERROR);
373bc36eafdSMike Gerdts }
374bc36eafdSMike Gerdts
375*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
376bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
377bc36eafdSMike Gerdts {
378bc36eafdSMike Gerdts return (Status);
379bc36eafdSMike Gerdts }
380bc36eafdSMike Gerdts
381bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
382bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
383bc36eafdSMike Gerdts DtPopSubtable ();
384bc36eafdSMike Gerdts }
385bc36eafdSMike Gerdts
386bc36eafdSMike Gerdts return (AE_OK);
387bc36eafdSMike Gerdts }
388bc36eafdSMike Gerdts
389bc36eafdSMike Gerdts
390bc36eafdSMike Gerdts /******************************************************************************
391bc36eafdSMike Gerdts *
392bc36eafdSMike Gerdts * FUNCTION: DtCompileMcfg
393bc36eafdSMike Gerdts *
394bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
395bc36eafdSMike Gerdts *
396bc36eafdSMike Gerdts * RETURN: Status
397bc36eafdSMike Gerdts *
398bc36eafdSMike Gerdts * DESCRIPTION: Compile MCFG.
399bc36eafdSMike Gerdts *
400bc36eafdSMike Gerdts *****************************************************************************/
401bc36eafdSMike Gerdts
402bc36eafdSMike Gerdts ACPI_STATUS
DtCompileMcfg(void ** List)403bc36eafdSMike Gerdts DtCompileMcfg (
404bc36eafdSMike Gerdts void **List)
405bc36eafdSMike Gerdts {
406bc36eafdSMike Gerdts ACPI_STATUS Status;
407bc36eafdSMike Gerdts
408bc36eafdSMike Gerdts
409bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
410bc36eafdSMike Gerdts AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0);
411bc36eafdSMike Gerdts return (Status);
412bc36eafdSMike Gerdts }
413bc36eafdSMike Gerdts
414bc36eafdSMike Gerdts
415bc36eafdSMike Gerdts /******************************************************************************
416bc36eafdSMike Gerdts *
417bc36eafdSMike Gerdts * FUNCTION: DtCompileMpst
418bc36eafdSMike Gerdts *
419bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
420bc36eafdSMike Gerdts *
421bc36eafdSMike Gerdts * RETURN: Status
422bc36eafdSMike Gerdts *
423bc36eafdSMike Gerdts * DESCRIPTION: Compile MPST.
424bc36eafdSMike Gerdts *
425bc36eafdSMike Gerdts *****************************************************************************/
426bc36eafdSMike Gerdts
427bc36eafdSMike Gerdts ACPI_STATUS
DtCompileMpst(void ** List)428bc36eafdSMike Gerdts DtCompileMpst (
429bc36eafdSMike Gerdts void **List)
430bc36eafdSMike Gerdts {
431bc36eafdSMike Gerdts ACPI_STATUS Status;
432bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
433bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
434bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
435bc36eafdSMike Gerdts ACPI_MPST_CHANNEL *MpstChannelInfo;
436bc36eafdSMike Gerdts ACPI_MPST_POWER_NODE *MpstPowerNode;
437bc36eafdSMike Gerdts ACPI_MPST_DATA_HDR *MpstDataHeader;
438bc36eafdSMike Gerdts UINT16 SubtableCount;
439bc36eafdSMike Gerdts UINT32 PowerStateCount;
440bc36eafdSMike Gerdts UINT32 ComponentCount;
441bc36eafdSMike Gerdts
442bc36eafdSMike Gerdts
443bc36eafdSMike Gerdts /* Main table */
444bc36eafdSMike Gerdts
445*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable);
446bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
447bc36eafdSMike Gerdts {
448bc36eafdSMike Gerdts return (Status);
449bc36eafdSMike Gerdts }
450bc36eafdSMike Gerdts
451bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
452bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
453bc36eafdSMike Gerdts DtPushSubtable (Subtable);
454bc36eafdSMike Gerdts
455bc36eafdSMike Gerdts MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
456bc36eafdSMike Gerdts SubtableCount = MpstChannelInfo->PowerNodeCount;
457bc36eafdSMike Gerdts
458bc36eafdSMike Gerdts while (*PFieldList && SubtableCount)
459bc36eafdSMike Gerdts {
460bc36eafdSMike Gerdts /* Subtable: Memory Power Node(s) */
461bc36eafdSMike Gerdts
462bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0,
463*35786f68SRobert Mustacchi &Subtable);
464bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
465bc36eafdSMike Gerdts {
466bc36eafdSMike Gerdts return (Status);
467bc36eafdSMike Gerdts }
468bc36eafdSMike Gerdts
469bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
470bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
471bc36eafdSMike Gerdts DtPushSubtable (Subtable);
472bc36eafdSMike Gerdts
473bc36eafdSMike Gerdts MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
474bc36eafdSMike Gerdts PowerStateCount = MpstPowerNode->NumPowerStates;
475bc36eafdSMike Gerdts ComponentCount = MpstPowerNode->NumPhysicalComponents;
476bc36eafdSMike Gerdts
477bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
478bc36eafdSMike Gerdts
479bc36eafdSMike Gerdts /* Sub-subtables - Memory Power State Structure(s) */
480bc36eafdSMike Gerdts
481bc36eafdSMike Gerdts while (*PFieldList && PowerStateCount)
482bc36eafdSMike Gerdts {
483bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A,
484*35786f68SRobert Mustacchi &Subtable);
485bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
486bc36eafdSMike Gerdts {
487bc36eafdSMike Gerdts return (Status);
488bc36eafdSMike Gerdts }
489bc36eafdSMike Gerdts
490bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
491bc36eafdSMike Gerdts PowerStateCount--;
492bc36eafdSMike Gerdts }
493bc36eafdSMike Gerdts
494bc36eafdSMike Gerdts /* Sub-subtables - Physical Component ID Structure(s) */
495bc36eafdSMike Gerdts
496bc36eafdSMike Gerdts while (*PFieldList && ComponentCount)
497bc36eafdSMike Gerdts {
498bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B,
499*35786f68SRobert Mustacchi &Subtable);
500bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
501bc36eafdSMike Gerdts {
502bc36eafdSMike Gerdts return (Status);
503bc36eafdSMike Gerdts }
504bc36eafdSMike Gerdts
505bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
506bc36eafdSMike Gerdts ComponentCount--;
507bc36eafdSMike Gerdts }
508bc36eafdSMike Gerdts
509bc36eafdSMike Gerdts SubtableCount--;
510bc36eafdSMike Gerdts DtPopSubtable ();
511bc36eafdSMike Gerdts }
512bc36eafdSMike Gerdts
513bc36eafdSMike Gerdts /* Subtable: Count of Memory Power State Characteristic structures */
514bc36eafdSMike Gerdts
515bc36eafdSMike Gerdts DtPopSubtable ();
516bc36eafdSMike Gerdts
517*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable);
518bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
519bc36eafdSMike Gerdts {
520bc36eafdSMike Gerdts return (Status);
521bc36eafdSMike Gerdts }
522bc36eafdSMike Gerdts
523bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
524bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
525bc36eafdSMike Gerdts DtPushSubtable (Subtable);
526bc36eafdSMike Gerdts
527bc36eafdSMike Gerdts MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
528bc36eafdSMike Gerdts SubtableCount = MpstDataHeader->CharacteristicsCount;
529bc36eafdSMike Gerdts
530bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
531bc36eafdSMike Gerdts
532bc36eafdSMike Gerdts /* Subtable: Memory Power State Characteristics structure(s) */
533bc36eafdSMike Gerdts
534bc36eafdSMike Gerdts while (*PFieldList && SubtableCount)
535bc36eafdSMike Gerdts {
536bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2,
537*35786f68SRobert Mustacchi &Subtable);
538bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
539bc36eafdSMike Gerdts {
540bc36eafdSMike Gerdts return (Status);
541bc36eafdSMike Gerdts }
542bc36eafdSMike Gerdts
543bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
544bc36eafdSMike Gerdts SubtableCount--;
545bc36eafdSMike Gerdts }
546bc36eafdSMike Gerdts
547bc36eafdSMike Gerdts DtPopSubtable ();
548bc36eafdSMike Gerdts return (AE_OK);
549bc36eafdSMike Gerdts }
550bc36eafdSMike Gerdts
551bc36eafdSMike Gerdts
552bc36eafdSMike Gerdts /******************************************************************************
553bc36eafdSMike Gerdts *
554bc36eafdSMike Gerdts * FUNCTION: DtCompileMsct
555bc36eafdSMike Gerdts *
556bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
557bc36eafdSMike Gerdts *
558bc36eafdSMike Gerdts * RETURN: Status
559bc36eafdSMike Gerdts *
560bc36eafdSMike Gerdts * DESCRIPTION: Compile MSCT.
561bc36eafdSMike Gerdts *
562bc36eafdSMike Gerdts *****************************************************************************/
563bc36eafdSMike Gerdts
564bc36eafdSMike Gerdts ACPI_STATUS
DtCompileMsct(void ** List)565bc36eafdSMike Gerdts DtCompileMsct (
566bc36eafdSMike Gerdts void **List)
567bc36eafdSMike Gerdts {
568bc36eafdSMike Gerdts ACPI_STATUS Status;
569bc36eafdSMike Gerdts
570bc36eafdSMike Gerdts
571bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
572bc36eafdSMike Gerdts AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0);
573bc36eafdSMike Gerdts return (Status);
574bc36eafdSMike Gerdts }
575bc36eafdSMike Gerdts
576bc36eafdSMike Gerdts
577bc36eafdSMike Gerdts /******************************************************************************
578bc36eafdSMike Gerdts *
579bc36eafdSMike Gerdts * FUNCTION: DtCompileMtmr
580bc36eafdSMike Gerdts *
581bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
582bc36eafdSMike Gerdts *
583bc36eafdSMike Gerdts * RETURN: Status
584bc36eafdSMike Gerdts *
585bc36eafdSMike Gerdts * DESCRIPTION: Compile MTMR.
586bc36eafdSMike Gerdts *
587bc36eafdSMike Gerdts *****************************************************************************/
588bc36eafdSMike Gerdts
589bc36eafdSMike Gerdts ACPI_STATUS
DtCompileMtmr(void ** List)590bc36eafdSMike Gerdts DtCompileMtmr (
591bc36eafdSMike Gerdts void **List)
592bc36eafdSMike Gerdts {
593bc36eafdSMike Gerdts ACPI_STATUS Status;
594bc36eafdSMike Gerdts
595bc36eafdSMike Gerdts
596bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
597bc36eafdSMike Gerdts AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0);
598bc36eafdSMike Gerdts return (Status);
599bc36eafdSMike Gerdts }
600bc36eafdSMike Gerdts
601bc36eafdSMike Gerdts
602bc36eafdSMike Gerdts /******************************************************************************
603bc36eafdSMike Gerdts *
604bc36eafdSMike Gerdts * FUNCTION: DtCompileNfit
605bc36eafdSMike Gerdts *
606bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
607bc36eafdSMike Gerdts *
608bc36eafdSMike Gerdts * RETURN: Status
609bc36eafdSMike Gerdts *
610bc36eafdSMike Gerdts * DESCRIPTION: Compile NFIT.
611bc36eafdSMike Gerdts *
612bc36eafdSMike Gerdts *****************************************************************************/
613bc36eafdSMike Gerdts
614bc36eafdSMike Gerdts ACPI_STATUS
DtCompileNfit(void ** List)615bc36eafdSMike Gerdts DtCompileNfit (
616bc36eafdSMike Gerdts void **List)
617bc36eafdSMike Gerdts {
618bc36eafdSMike Gerdts ACPI_STATUS Status;
619bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
620bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
621bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
622bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
623bc36eafdSMike Gerdts ACPI_NFIT_HEADER *NfitHeader;
624bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
625bc36eafdSMike Gerdts UINT32 Count;
626bc36eafdSMike Gerdts ACPI_NFIT_INTERLEAVE *Interleave = NULL;
627bc36eafdSMike Gerdts ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
628bc36eafdSMike Gerdts
629bc36eafdSMike Gerdts
630bc36eafdSMike Gerdts /* Main table */
631bc36eafdSMike Gerdts
632bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit,
633*35786f68SRobert Mustacchi &Subtable);
634bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
635bc36eafdSMike Gerdts {
636bc36eafdSMike Gerdts return (Status);
637bc36eafdSMike Gerdts }
638bc36eafdSMike Gerdts
639bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
640bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
641bc36eafdSMike Gerdts DtPushSubtable (Subtable);
642bc36eafdSMike Gerdts
643bc36eafdSMike Gerdts /* Subtables */
644bc36eafdSMike Gerdts
645bc36eafdSMike Gerdts while (*PFieldList)
646bc36eafdSMike Gerdts {
647bc36eafdSMike Gerdts SubtableStart = *PFieldList;
648bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr,
649*35786f68SRobert Mustacchi &Subtable);
650bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
651bc36eafdSMike Gerdts {
652bc36eafdSMike Gerdts return (Status);
653bc36eafdSMike Gerdts }
654bc36eafdSMike Gerdts
655bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
656bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
657bc36eafdSMike Gerdts DtPushSubtable (Subtable);
658bc36eafdSMike Gerdts
659bc36eafdSMike Gerdts NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
660bc36eafdSMike Gerdts
661bc36eafdSMike Gerdts switch (NfitHeader->Type)
662bc36eafdSMike Gerdts {
663bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
664bc36eafdSMike Gerdts
665bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit0;
666bc36eafdSMike Gerdts break;
667bc36eafdSMike Gerdts
668bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_MEMORY_MAP:
669bc36eafdSMike Gerdts
670bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit1;
671bc36eafdSMike Gerdts break;
672bc36eafdSMike Gerdts
673bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_INTERLEAVE:
674bc36eafdSMike Gerdts
675bc36eafdSMike Gerdts Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer);
676bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit2;
677bc36eafdSMike Gerdts break;
678bc36eafdSMike Gerdts
679bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_SMBIOS:
680bc36eafdSMike Gerdts
681bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit3;
682bc36eafdSMike Gerdts break;
683bc36eafdSMike Gerdts
684bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_CONTROL_REGION:
685bc36eafdSMike Gerdts
686bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit4;
687bc36eafdSMike Gerdts break;
688bc36eafdSMike Gerdts
689bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_DATA_REGION:
690bc36eafdSMike Gerdts
691bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit5;
692bc36eafdSMike Gerdts break;
693bc36eafdSMike Gerdts
694bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
695bc36eafdSMike Gerdts
696bc36eafdSMike Gerdts Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer);
697bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoNfit6;
698bc36eafdSMike Gerdts break;
699bc36eafdSMike Gerdts
700*35786f68SRobert Mustacchi case ACPI_NFIT_TYPE_CAPABILITIES:
701*35786f68SRobert Mustacchi
702*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoNfit7;
703*35786f68SRobert Mustacchi break;
704*35786f68SRobert Mustacchi
705bc36eafdSMike Gerdts default:
706bc36eafdSMike Gerdts
707bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT");
708bc36eafdSMike Gerdts return (AE_ERROR);
709bc36eafdSMike Gerdts }
710bc36eafdSMike Gerdts
711*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
712bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
713bc36eafdSMike Gerdts {
714bc36eafdSMike Gerdts return (Status);
715bc36eafdSMike Gerdts }
716bc36eafdSMike Gerdts
717bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
718bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
719bc36eafdSMike Gerdts DtPopSubtable ();
720bc36eafdSMike Gerdts
721bc36eafdSMike Gerdts switch (NfitHeader->Type)
722bc36eafdSMike Gerdts {
723bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_INTERLEAVE:
724bc36eafdSMike Gerdts
725bc36eafdSMike Gerdts Count = 0;
726bc36eafdSMike Gerdts DtPushSubtable (Subtable);
727bc36eafdSMike Gerdts while (*PFieldList)
728bc36eafdSMike Gerdts {
729bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a,
730*35786f68SRobert Mustacchi &Subtable);
731bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
732bc36eafdSMike Gerdts {
733bc36eafdSMike Gerdts return (Status);
734bc36eafdSMike Gerdts }
735bc36eafdSMike Gerdts
736bc36eafdSMike Gerdts if (!Subtable)
737bc36eafdSMike Gerdts {
738bc36eafdSMike Gerdts DtPopSubtable ();
739bc36eafdSMike Gerdts break;
740bc36eafdSMike Gerdts }
741bc36eafdSMike Gerdts
742bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
743bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
744bc36eafdSMike Gerdts Count++;
745bc36eafdSMike Gerdts }
746bc36eafdSMike Gerdts
747bc36eafdSMike Gerdts Interleave->LineCount = Count;
748bc36eafdSMike Gerdts break;
749bc36eafdSMike Gerdts
750bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_SMBIOS:
751bc36eafdSMike Gerdts
752bc36eafdSMike Gerdts if (*PFieldList)
753bc36eafdSMike Gerdts {
754bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a,
755*35786f68SRobert Mustacchi &Subtable);
756bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
757bc36eafdSMike Gerdts {
758bc36eafdSMike Gerdts return (Status);
759bc36eafdSMike Gerdts }
760bc36eafdSMike Gerdts
761bc36eafdSMike Gerdts if (Subtable)
762bc36eafdSMike Gerdts {
763bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
764bc36eafdSMike Gerdts }
765bc36eafdSMike Gerdts }
766bc36eafdSMike Gerdts break;
767bc36eafdSMike Gerdts
768bc36eafdSMike Gerdts case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
769bc36eafdSMike Gerdts
770bc36eafdSMike Gerdts Count = 0;
771bc36eafdSMike Gerdts DtPushSubtable (Subtable);
772bc36eafdSMike Gerdts while (*PFieldList)
773bc36eafdSMike Gerdts {
774bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a,
775*35786f68SRobert Mustacchi &Subtable);
776bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
777bc36eafdSMike Gerdts {
778bc36eafdSMike Gerdts return (Status);
779bc36eafdSMike Gerdts }
780bc36eafdSMike Gerdts
781bc36eafdSMike Gerdts if (!Subtable)
782bc36eafdSMike Gerdts {
783bc36eafdSMike Gerdts DtPopSubtable ();
784bc36eafdSMike Gerdts break;
785bc36eafdSMike Gerdts }
786bc36eafdSMike Gerdts
787bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
788bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
789bc36eafdSMike Gerdts Count++;
790bc36eafdSMike Gerdts }
791bc36eafdSMike Gerdts
792bc36eafdSMike Gerdts Hint->HintCount = (UINT16) Count;
793bc36eafdSMike Gerdts break;
794bc36eafdSMike Gerdts
795bc36eafdSMike Gerdts default:
796bc36eafdSMike Gerdts break;
797bc36eafdSMike Gerdts }
798bc36eafdSMike Gerdts }
799bc36eafdSMike Gerdts
800bc36eafdSMike Gerdts return (AE_OK);
801bc36eafdSMike Gerdts }
802bc36eafdSMike Gerdts
803bc36eafdSMike Gerdts
804bc36eafdSMike Gerdts /******************************************************************************
805bc36eafdSMike Gerdts *
806bc36eafdSMike Gerdts * FUNCTION: DtCompilePcct
807bc36eafdSMike Gerdts *
808bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
809bc36eafdSMike Gerdts *
810bc36eafdSMike Gerdts * RETURN: Status
811bc36eafdSMike Gerdts *
812bc36eafdSMike Gerdts * DESCRIPTION: Compile PCCT.
813bc36eafdSMike Gerdts *
814bc36eafdSMike Gerdts *****************************************************************************/
815bc36eafdSMike Gerdts
816bc36eafdSMike Gerdts ACPI_STATUS
DtCompilePcct(void ** List)817bc36eafdSMike Gerdts DtCompilePcct (
818bc36eafdSMike Gerdts void **List)
819bc36eafdSMike Gerdts {
820bc36eafdSMike Gerdts ACPI_STATUS Status;
821bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
822bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
823bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
824bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
825bc36eafdSMike Gerdts ACPI_SUBTABLE_HEADER *PcctHeader;
826bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
827bc36eafdSMike Gerdts
828bc36eafdSMike Gerdts
829bc36eafdSMike Gerdts /* Main table */
830bc36eafdSMike Gerdts
831bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct,
832*35786f68SRobert Mustacchi &Subtable);
833bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
834bc36eafdSMike Gerdts {
835bc36eafdSMike Gerdts return (Status);
836bc36eafdSMike Gerdts }
837bc36eafdSMike Gerdts
838bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
839bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
840bc36eafdSMike Gerdts
841bc36eafdSMike Gerdts /* Subtables */
842bc36eafdSMike Gerdts
843bc36eafdSMike Gerdts while (*PFieldList)
844bc36eafdSMike Gerdts {
845bc36eafdSMike Gerdts SubtableStart = *PFieldList;
846bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcctHdr,
847*35786f68SRobert Mustacchi &Subtable);
848bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
849bc36eafdSMike Gerdts {
850bc36eafdSMike Gerdts return (Status);
851bc36eafdSMike Gerdts }
852bc36eafdSMike Gerdts
853bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
854bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
855bc36eafdSMike Gerdts DtPushSubtable (Subtable);
856bc36eafdSMike Gerdts
857bc36eafdSMike Gerdts PcctHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
858bc36eafdSMike Gerdts
859bc36eafdSMike Gerdts switch (PcctHeader->Type)
860bc36eafdSMike Gerdts {
861bc36eafdSMike Gerdts case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
862bc36eafdSMike Gerdts
863bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoPcct0;
864bc36eafdSMike Gerdts break;
865bc36eafdSMike Gerdts
866bc36eafdSMike Gerdts case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
867bc36eafdSMike Gerdts
868bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoPcct1;
869bc36eafdSMike Gerdts break;
870bc36eafdSMike Gerdts
871bc36eafdSMike Gerdts case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
872bc36eafdSMike Gerdts
873bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoPcct2;
874bc36eafdSMike Gerdts break;
875bc36eafdSMike Gerdts
876*35786f68SRobert Mustacchi case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
877*35786f68SRobert Mustacchi
878*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoPcct3;
879*35786f68SRobert Mustacchi break;
880*35786f68SRobert Mustacchi
881*35786f68SRobert Mustacchi case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
882*35786f68SRobert Mustacchi
883*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoPcct4;
884*35786f68SRobert Mustacchi break;
885*35786f68SRobert Mustacchi
886bc36eafdSMike Gerdts default:
887bc36eafdSMike Gerdts
888bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT");
889bc36eafdSMike Gerdts return (AE_ERROR);
890bc36eafdSMike Gerdts }
891bc36eafdSMike Gerdts
892*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
893bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
894bc36eafdSMike Gerdts {
895bc36eafdSMike Gerdts return (Status);
896bc36eafdSMike Gerdts }
897bc36eafdSMike Gerdts
898bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
899bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
900bc36eafdSMike Gerdts DtPopSubtable ();
901bc36eafdSMike Gerdts }
902bc36eafdSMike Gerdts
903bc36eafdSMike Gerdts return (AE_OK);
904bc36eafdSMike Gerdts }
905bc36eafdSMike Gerdts
906bc36eafdSMike Gerdts
907*35786f68SRobert Mustacchi /******************************************************************************
908*35786f68SRobert Mustacchi *
909*35786f68SRobert Mustacchi * FUNCTION: DtCompilePdtt
910*35786f68SRobert Mustacchi *
911*35786f68SRobert Mustacchi * PARAMETERS: List - Current field list pointer
912*35786f68SRobert Mustacchi *
913*35786f68SRobert Mustacchi * RETURN: Status
914*35786f68SRobert Mustacchi *
915*35786f68SRobert Mustacchi * DESCRIPTION: Compile PDTT.
916*35786f68SRobert Mustacchi *
917*35786f68SRobert Mustacchi *****************************************************************************/
918*35786f68SRobert Mustacchi
919*35786f68SRobert Mustacchi ACPI_STATUS
DtCompilePdtt(void ** List)920*35786f68SRobert Mustacchi DtCompilePdtt (
921*35786f68SRobert Mustacchi void **List)
922*35786f68SRobert Mustacchi {
923*35786f68SRobert Mustacchi ACPI_STATUS Status;
924*35786f68SRobert Mustacchi DT_SUBTABLE *Subtable;
925*35786f68SRobert Mustacchi DT_SUBTABLE *ParentTable;
926*35786f68SRobert Mustacchi DT_FIELD **PFieldList = (DT_FIELD **) List;
927*35786f68SRobert Mustacchi ACPI_TABLE_PDTT *PdttHeader;
928*35786f68SRobert Mustacchi UINT32 Count = 0;
929*35786f68SRobert Mustacchi
930*35786f68SRobert Mustacchi
931*35786f68SRobert Mustacchi /* Main table */
932*35786f68SRobert Mustacchi
933*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt, &Subtable);
934*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
935*35786f68SRobert Mustacchi {
936*35786f68SRobert Mustacchi return (Status);
937*35786f68SRobert Mustacchi }
938*35786f68SRobert Mustacchi
939*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
940*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
941*35786f68SRobert Mustacchi
942*35786f68SRobert Mustacchi PdttHeader = ACPI_CAST_PTR (ACPI_TABLE_PDTT, ParentTable->Buffer);
943*35786f68SRobert Mustacchi PdttHeader->ArrayOffset = sizeof (ACPI_TABLE_PDTT);
944*35786f68SRobert Mustacchi
945*35786f68SRobert Mustacchi /* There is only one type of subtable at this time, no need to decode */
946*35786f68SRobert Mustacchi
947*35786f68SRobert Mustacchi while (*PFieldList)
948*35786f68SRobert Mustacchi {
949*35786f68SRobert Mustacchi /* List of subchannel IDs, each 2 bytes */
950*35786f68SRobert Mustacchi
951*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt0,
952*35786f68SRobert Mustacchi &Subtable);
953*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
954*35786f68SRobert Mustacchi {
955*35786f68SRobert Mustacchi return (Status);
956*35786f68SRobert Mustacchi }
957*35786f68SRobert Mustacchi
958*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
959*35786f68SRobert Mustacchi Count++;
960*35786f68SRobert Mustacchi }
961*35786f68SRobert Mustacchi
962*35786f68SRobert Mustacchi PdttHeader->TriggerCount = (UINT8) Count;
963*35786f68SRobert Mustacchi return (AE_OK);
964*35786f68SRobert Mustacchi }
965*35786f68SRobert Mustacchi
966*35786f68SRobert Mustacchi
967bc36eafdSMike Gerdts /******************************************************************************
968bc36eafdSMike Gerdts *
969bc36eafdSMike Gerdts * FUNCTION: DtCompilePmtt
970bc36eafdSMike Gerdts *
971bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
972bc36eafdSMike Gerdts *
973bc36eafdSMike Gerdts * RETURN: Status
974bc36eafdSMike Gerdts *
975bc36eafdSMike Gerdts * DESCRIPTION: Compile PMTT.
976bc36eafdSMike Gerdts *
977bc36eafdSMike Gerdts *****************************************************************************/
978bc36eafdSMike Gerdts
979bc36eafdSMike Gerdts ACPI_STATUS
DtCompilePmtt(void ** List)980bc36eafdSMike Gerdts DtCompilePmtt (
981bc36eafdSMike Gerdts void **List)
982bc36eafdSMike Gerdts {
983bc36eafdSMike Gerdts ACPI_STATUS Status;
984bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
985bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
986bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
987bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
988bc36eafdSMike Gerdts ACPI_PMTT_HEADER *PmttHeader;
989bc36eafdSMike Gerdts ACPI_PMTT_CONTROLLER *PmttController;
990bc36eafdSMike Gerdts UINT16 DomainCount;
991bc36eafdSMike Gerdts UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET;
992bc36eafdSMike Gerdts
993bc36eafdSMike Gerdts
994bc36eafdSMike Gerdts /* Main table */
995bc36eafdSMike Gerdts
996*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable);
997bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
998bc36eafdSMike Gerdts {
999bc36eafdSMike Gerdts return (Status);
1000bc36eafdSMike Gerdts }
1001bc36eafdSMike Gerdts
1002bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1003bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1004bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1005bc36eafdSMike Gerdts
1006bc36eafdSMike Gerdts while (*PFieldList)
1007bc36eafdSMike Gerdts {
1008bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1009bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr,
1010*35786f68SRobert Mustacchi &Subtable);
1011bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1012bc36eafdSMike Gerdts {
1013bc36eafdSMike Gerdts return (Status);
1014bc36eafdSMike Gerdts }
1015bc36eafdSMike Gerdts
1016bc36eafdSMike Gerdts PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer);
1017bc36eafdSMike Gerdts while (PrevType >= PmttHeader->Type)
1018bc36eafdSMike Gerdts {
1019bc36eafdSMike Gerdts DtPopSubtable ();
1020bc36eafdSMike Gerdts
1021bc36eafdSMike Gerdts if (PrevType == ACPI_PMTT_TYPE_SOCKET)
1022bc36eafdSMike Gerdts {
1023bc36eafdSMike Gerdts break;
1024bc36eafdSMike Gerdts }
1025bc36eafdSMike Gerdts
1026bc36eafdSMike Gerdts PrevType--;
1027bc36eafdSMike Gerdts }
1028bc36eafdSMike Gerdts
1029bc36eafdSMike Gerdts PrevType = PmttHeader->Type;
1030bc36eafdSMike Gerdts
1031bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1032bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1033bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1034bc36eafdSMike Gerdts
1035bc36eafdSMike Gerdts switch (PmttHeader->Type)
1036bc36eafdSMike Gerdts {
1037bc36eafdSMike Gerdts case ACPI_PMTT_TYPE_SOCKET:
1038bc36eafdSMike Gerdts
1039bc36eafdSMike Gerdts /* Subtable: Socket Structure */
1040bc36eafdSMike Gerdts
1041bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0,
1042*35786f68SRobert Mustacchi &Subtable);
1043bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1044bc36eafdSMike Gerdts {
1045bc36eafdSMike Gerdts return (Status);
1046bc36eafdSMike Gerdts }
1047bc36eafdSMike Gerdts
1048bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1049bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1050bc36eafdSMike Gerdts break;
1051bc36eafdSMike Gerdts
1052bc36eafdSMike Gerdts case ACPI_PMTT_TYPE_CONTROLLER:
1053bc36eafdSMike Gerdts
1054bc36eafdSMike Gerdts /* Subtable: Memory Controller Structure */
1055bc36eafdSMike Gerdts
1056bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1,
1057*35786f68SRobert Mustacchi &Subtable);
1058bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1059bc36eafdSMike Gerdts {
1060bc36eafdSMike Gerdts return (Status);
1061bc36eafdSMike Gerdts }
1062bc36eafdSMike Gerdts
1063bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1064bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1065bc36eafdSMike Gerdts
1066bc36eafdSMike Gerdts PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
1067bc36eafdSMike Gerdts (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
1068bc36eafdSMike Gerdts DomainCount = PmttController->DomainCount;
1069bc36eafdSMike Gerdts
1070bc36eafdSMike Gerdts while (DomainCount)
1071bc36eafdSMike Gerdts {
1072bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a,
1073*35786f68SRobert Mustacchi &Subtable);
1074bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1075bc36eafdSMike Gerdts {
1076bc36eafdSMike Gerdts return (Status);
1077bc36eafdSMike Gerdts }
1078bc36eafdSMike Gerdts
1079bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1080bc36eafdSMike Gerdts DomainCount--;
1081bc36eafdSMike Gerdts }
1082bc36eafdSMike Gerdts break;
1083bc36eafdSMike Gerdts
1084bc36eafdSMike Gerdts case ACPI_PMTT_TYPE_DIMM:
1085bc36eafdSMike Gerdts
1086bc36eafdSMike Gerdts /* Subtable: Physical Component Structure */
1087bc36eafdSMike Gerdts
1088bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2,
1089*35786f68SRobert Mustacchi &Subtable);
1090bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1091bc36eafdSMike Gerdts {
1092bc36eafdSMike Gerdts return (Status);
1093bc36eafdSMike Gerdts }
1094bc36eafdSMike Gerdts
1095bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1096bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1097bc36eafdSMike Gerdts break;
1098bc36eafdSMike Gerdts
1099bc36eafdSMike Gerdts default:
1100bc36eafdSMike Gerdts
1101bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT");
1102bc36eafdSMike Gerdts return (AE_ERROR);
1103bc36eafdSMike Gerdts }
1104bc36eafdSMike Gerdts }
1105bc36eafdSMike Gerdts
1106bc36eafdSMike Gerdts return (Status);
1107bc36eafdSMike Gerdts }
1108bc36eafdSMike Gerdts
1109bc36eafdSMike Gerdts
1110*35786f68SRobert Mustacchi /******************************************************************************
1111*35786f68SRobert Mustacchi *
1112*35786f68SRobert Mustacchi * FUNCTION: DtCompilePptt
1113*35786f68SRobert Mustacchi *
1114*35786f68SRobert Mustacchi * PARAMETERS: List - Current field list pointer
1115*35786f68SRobert Mustacchi *
1116*35786f68SRobert Mustacchi * RETURN: Status
1117*35786f68SRobert Mustacchi *
1118*35786f68SRobert Mustacchi * DESCRIPTION: Compile PPTT.
1119*35786f68SRobert Mustacchi *
1120*35786f68SRobert Mustacchi *****************************************************************************/
1121*35786f68SRobert Mustacchi
1122*35786f68SRobert Mustacchi ACPI_STATUS
DtCompilePptt(void ** List)1123*35786f68SRobert Mustacchi DtCompilePptt (
1124*35786f68SRobert Mustacchi void **List)
1125*35786f68SRobert Mustacchi {
1126*35786f68SRobert Mustacchi ACPI_STATUS Status;
1127*35786f68SRobert Mustacchi ACPI_SUBTABLE_HEADER *PpttHeader;
1128*35786f68SRobert Mustacchi ACPI_PPTT_PROCESSOR *PpttProcessor = NULL;
1129*35786f68SRobert Mustacchi DT_SUBTABLE *Subtable;
1130*35786f68SRobert Mustacchi DT_SUBTABLE *ParentTable;
1131*35786f68SRobert Mustacchi ACPI_DMTABLE_INFO *InfoTable;
1132*35786f68SRobert Mustacchi DT_FIELD **PFieldList = (DT_FIELD **) List;
1133*35786f68SRobert Mustacchi DT_FIELD *SubtableStart;
1134*35786f68SRobert Mustacchi
1135*35786f68SRobert Mustacchi
1136*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1137*35786f68SRobert Mustacchi while (*PFieldList)
1138*35786f68SRobert Mustacchi {
1139*35786f68SRobert Mustacchi SubtableStart = *PFieldList;
1140*35786f68SRobert Mustacchi
1141*35786f68SRobert Mustacchi /* Compile PPTT subtable header */
1142*35786f68SRobert Mustacchi
1143*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoPpttHdr,
1144*35786f68SRobert Mustacchi &Subtable);
1145*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1146*35786f68SRobert Mustacchi {
1147*35786f68SRobert Mustacchi return (Status);
1148*35786f68SRobert Mustacchi }
1149*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1150*35786f68SRobert Mustacchi PpttHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1151*35786f68SRobert Mustacchi PpttHeader->Length = (UINT8)(Subtable->Length);
1152*35786f68SRobert Mustacchi
1153*35786f68SRobert Mustacchi switch (PpttHeader->Type)
1154*35786f68SRobert Mustacchi {
1155*35786f68SRobert Mustacchi case ACPI_PPTT_TYPE_PROCESSOR:
1156*35786f68SRobert Mustacchi
1157*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoPptt0;
1158*35786f68SRobert Mustacchi break;
1159*35786f68SRobert Mustacchi
1160*35786f68SRobert Mustacchi case ACPI_PPTT_TYPE_CACHE:
1161*35786f68SRobert Mustacchi
1162*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoPptt1;
1163*35786f68SRobert Mustacchi break;
1164*35786f68SRobert Mustacchi
1165*35786f68SRobert Mustacchi case ACPI_PPTT_TYPE_ID:
1166*35786f68SRobert Mustacchi
1167*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoPptt2;
1168*35786f68SRobert Mustacchi break;
1169*35786f68SRobert Mustacchi
1170*35786f68SRobert Mustacchi default:
1171*35786f68SRobert Mustacchi
1172*35786f68SRobert Mustacchi DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PPTT");
1173*35786f68SRobert Mustacchi return (AE_ERROR);
1174*35786f68SRobert Mustacchi }
1175*35786f68SRobert Mustacchi
1176*35786f68SRobert Mustacchi /* Compile PPTT subtable body */
1177*35786f68SRobert Mustacchi
1178*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1179*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1180*35786f68SRobert Mustacchi {
1181*35786f68SRobert Mustacchi return (Status);
1182*35786f68SRobert Mustacchi }
1183*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1184*35786f68SRobert Mustacchi PpttHeader->Length += (UINT8)(Subtable->Length);
1185*35786f68SRobert Mustacchi
1186*35786f68SRobert Mustacchi /* Compile PPTT subtable additionals */
1187*35786f68SRobert Mustacchi
1188*35786f68SRobert Mustacchi switch (PpttHeader->Type)
1189*35786f68SRobert Mustacchi {
1190*35786f68SRobert Mustacchi case ACPI_PPTT_TYPE_PROCESSOR:
1191*35786f68SRobert Mustacchi
1192*35786f68SRobert Mustacchi PpttProcessor = ACPI_SUB_PTR (ACPI_PPTT_PROCESSOR,
1193*35786f68SRobert Mustacchi Subtable->Buffer, sizeof (ACPI_SUBTABLE_HEADER));
1194*35786f68SRobert Mustacchi if (PpttProcessor)
1195*35786f68SRobert Mustacchi {
1196*35786f68SRobert Mustacchi /* Compile initiator proximity domain list */
1197*35786f68SRobert Mustacchi
1198*35786f68SRobert Mustacchi PpttProcessor->NumberOfPrivResources = 0;
1199*35786f68SRobert Mustacchi while (*PFieldList)
1200*35786f68SRobert Mustacchi {
1201*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList,
1202*35786f68SRobert Mustacchi AcpiDmTableInfoPptt0a, &Subtable);
1203*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1204*35786f68SRobert Mustacchi {
1205*35786f68SRobert Mustacchi return (Status);
1206*35786f68SRobert Mustacchi }
1207*35786f68SRobert Mustacchi if (!Subtable)
1208*35786f68SRobert Mustacchi {
1209*35786f68SRobert Mustacchi break;
1210*35786f68SRobert Mustacchi }
1211*35786f68SRobert Mustacchi
1212*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1213*35786f68SRobert Mustacchi PpttHeader->Length += (UINT8)(Subtable->Length);
1214*35786f68SRobert Mustacchi PpttProcessor->NumberOfPrivResources++;
1215*35786f68SRobert Mustacchi }
1216*35786f68SRobert Mustacchi }
1217*35786f68SRobert Mustacchi break;
1218*35786f68SRobert Mustacchi
1219*35786f68SRobert Mustacchi default:
1220*35786f68SRobert Mustacchi
1221*35786f68SRobert Mustacchi break;
1222*35786f68SRobert Mustacchi }
1223*35786f68SRobert Mustacchi }
1224*35786f68SRobert Mustacchi
1225*35786f68SRobert Mustacchi return (AE_OK);
1226*35786f68SRobert Mustacchi }
1227*35786f68SRobert Mustacchi
1228*35786f68SRobert Mustacchi
1229bc36eafdSMike Gerdts /******************************************************************************
1230bc36eafdSMike Gerdts *
1231bc36eafdSMike Gerdts * FUNCTION: DtCompileRsdt
1232bc36eafdSMike Gerdts *
1233bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1234bc36eafdSMike Gerdts *
1235bc36eafdSMike Gerdts * RETURN: Status
1236bc36eafdSMike Gerdts *
1237bc36eafdSMike Gerdts * DESCRIPTION: Compile RSDT.
1238bc36eafdSMike Gerdts *
1239bc36eafdSMike Gerdts *****************************************************************************/
1240bc36eafdSMike Gerdts
1241bc36eafdSMike Gerdts ACPI_STATUS
DtCompileRsdt(void ** List)1242bc36eafdSMike Gerdts DtCompileRsdt (
1243bc36eafdSMike Gerdts void **List)
1244bc36eafdSMike Gerdts {
1245bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1246bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1247bc36eafdSMike Gerdts DT_FIELD *FieldList = *(DT_FIELD **) List;
1248bc36eafdSMike Gerdts UINT32 Address;
1249bc36eafdSMike Gerdts
1250bc36eafdSMike Gerdts
1251bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1252bc36eafdSMike Gerdts
1253bc36eafdSMike Gerdts while (FieldList)
1254bc36eafdSMike Gerdts {
1255bc36eafdSMike Gerdts DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
1256bc36eafdSMike Gerdts
1257bc36eafdSMike Gerdts DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
1258bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1259bc36eafdSMike Gerdts FieldList = FieldList->Next;
1260bc36eafdSMike Gerdts }
1261bc36eafdSMike Gerdts
1262bc36eafdSMike Gerdts return (AE_OK);
1263bc36eafdSMike Gerdts }
1264bc36eafdSMike Gerdts
1265bc36eafdSMike Gerdts
1266bc36eafdSMike Gerdts /******************************************************************************
1267bc36eafdSMike Gerdts *
1268bc36eafdSMike Gerdts * FUNCTION: DtCompileS3pt
1269bc36eafdSMike Gerdts *
1270bc36eafdSMike Gerdts * PARAMETERS: PFieldList - Current field list pointer
1271bc36eafdSMike Gerdts *
1272bc36eafdSMike Gerdts * RETURN: Status
1273bc36eafdSMike Gerdts *
1274bc36eafdSMike Gerdts * DESCRIPTION: Compile S3PT (Pointed to by FPDT)
1275bc36eafdSMike Gerdts *
1276bc36eafdSMike Gerdts *****************************************************************************/
1277bc36eafdSMike Gerdts
1278bc36eafdSMike Gerdts ACPI_STATUS
DtCompileS3pt(DT_FIELD ** PFieldList)1279bc36eafdSMike Gerdts DtCompileS3pt (
1280bc36eafdSMike Gerdts DT_FIELD **PFieldList)
1281bc36eafdSMike Gerdts {
1282bc36eafdSMike Gerdts ACPI_STATUS Status;
1283bc36eafdSMike Gerdts ACPI_FPDT_HEADER *S3ptHeader;
1284bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1285bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1286bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
1287bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1288bc36eafdSMike Gerdts
1289bc36eafdSMike Gerdts
1290bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
1291*35786f68SRobert Mustacchi &Gbl_RootTable);
1292bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1293bc36eafdSMike Gerdts {
1294bc36eafdSMike Gerdts return (Status);
1295bc36eafdSMike Gerdts }
1296bc36eafdSMike Gerdts
1297bc36eafdSMike Gerdts DtPushSubtable (Gbl_RootTable);
1298bc36eafdSMike Gerdts
1299bc36eafdSMike Gerdts while (*PFieldList)
1300bc36eafdSMike Gerdts {
1301bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1302bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr,
1303*35786f68SRobert Mustacchi &Subtable);
1304bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1305bc36eafdSMike Gerdts {
1306bc36eafdSMike Gerdts return (Status);
1307bc36eafdSMike Gerdts }
1308bc36eafdSMike Gerdts
1309bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1310bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1311bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1312bc36eafdSMike Gerdts
1313bc36eafdSMike Gerdts S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1314bc36eafdSMike Gerdts
1315bc36eafdSMike Gerdts switch (S3ptHeader->Type)
1316bc36eafdSMike Gerdts {
1317bc36eafdSMike Gerdts case ACPI_S3PT_TYPE_RESUME:
1318bc36eafdSMike Gerdts
1319bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoS3pt0;
1320bc36eafdSMike Gerdts break;
1321bc36eafdSMike Gerdts
1322bc36eafdSMike Gerdts case ACPI_S3PT_TYPE_SUSPEND:
1323bc36eafdSMike Gerdts
1324bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoS3pt1;
1325bc36eafdSMike Gerdts break;
1326bc36eafdSMike Gerdts
1327bc36eafdSMike Gerdts default:
1328bc36eafdSMike Gerdts
1329bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT");
1330bc36eafdSMike Gerdts return (AE_ERROR);
1331bc36eafdSMike Gerdts }
1332bc36eafdSMike Gerdts
1333*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1334*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1335*35786f68SRobert Mustacchi {
1336*35786f68SRobert Mustacchi return (Status);
1337*35786f68SRobert Mustacchi }
1338*35786f68SRobert Mustacchi
1339*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1340*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1341*35786f68SRobert Mustacchi DtPopSubtable ();
1342*35786f68SRobert Mustacchi }
1343*35786f68SRobert Mustacchi
1344*35786f68SRobert Mustacchi return (AE_OK);
1345*35786f68SRobert Mustacchi }
1346*35786f68SRobert Mustacchi
1347*35786f68SRobert Mustacchi
1348*35786f68SRobert Mustacchi /******************************************************************************
1349*35786f68SRobert Mustacchi *
1350*35786f68SRobert Mustacchi * FUNCTION: DtCompileSdev
1351*35786f68SRobert Mustacchi *
1352*35786f68SRobert Mustacchi * PARAMETERS: List - Current field list pointer
1353*35786f68SRobert Mustacchi *
1354*35786f68SRobert Mustacchi * RETURN: Status
1355*35786f68SRobert Mustacchi *
1356*35786f68SRobert Mustacchi * DESCRIPTION: Compile SDEV.
1357*35786f68SRobert Mustacchi *
1358*35786f68SRobert Mustacchi *****************************************************************************/
1359*35786f68SRobert Mustacchi
1360*35786f68SRobert Mustacchi ACPI_STATUS
DtCompileSdev(void ** List)1361*35786f68SRobert Mustacchi DtCompileSdev (
1362*35786f68SRobert Mustacchi void **List)
1363*35786f68SRobert Mustacchi {
1364*35786f68SRobert Mustacchi ACPI_STATUS Status;
1365*35786f68SRobert Mustacchi ACPI_SDEV_HEADER *SdevHeader;
1366*35786f68SRobert Mustacchi DT_SUBTABLE *Subtable;
1367*35786f68SRobert Mustacchi DT_SUBTABLE *ParentTable;
1368*35786f68SRobert Mustacchi ACPI_DMTABLE_INFO *InfoTable;
1369*35786f68SRobert Mustacchi DT_FIELD **PFieldList = (DT_FIELD **) List;
1370*35786f68SRobert Mustacchi DT_FIELD *SubtableStart;
1371*35786f68SRobert Mustacchi ACPI_SDEV_PCIE *Pcie = NULL;
1372*35786f68SRobert Mustacchi ACPI_SDEV_NAMESPACE *Namesp = NULL;
1373*35786f68SRobert Mustacchi UINT32 EntryCount;
1374*35786f68SRobert Mustacchi
1375*35786f68SRobert Mustacchi
1376*35786f68SRobert Mustacchi /* Subtables */
1377*35786f68SRobert Mustacchi
1378*35786f68SRobert Mustacchi while (*PFieldList)
1379*35786f68SRobert Mustacchi {
1380*35786f68SRobert Mustacchi /* Compile common SDEV subtable header */
1381*35786f68SRobert Mustacchi
1382*35786f68SRobert Mustacchi SubtableStart = *PFieldList;
1383*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdevHdr,
1384*35786f68SRobert Mustacchi &Subtable);
1385*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1386*35786f68SRobert Mustacchi {
1387*35786f68SRobert Mustacchi return (Status);
1388*35786f68SRobert Mustacchi }
1389*35786f68SRobert Mustacchi
1390*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1391*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1392*35786f68SRobert Mustacchi DtPushSubtable (Subtable);
1393*35786f68SRobert Mustacchi
1394*35786f68SRobert Mustacchi SdevHeader = ACPI_CAST_PTR (ACPI_SDEV_HEADER, Subtable->Buffer);
1395*35786f68SRobert Mustacchi SdevHeader->Length = (UINT8)(sizeof (ACPI_SDEV_HEADER));
1396*35786f68SRobert Mustacchi
1397*35786f68SRobert Mustacchi switch (SdevHeader->Type)
1398*35786f68SRobert Mustacchi {
1399*35786f68SRobert Mustacchi case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
1400*35786f68SRobert Mustacchi
1401*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoSdev0;
1402*35786f68SRobert Mustacchi Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable->Buffer);
1403*35786f68SRobert Mustacchi break;
1404*35786f68SRobert Mustacchi
1405*35786f68SRobert Mustacchi case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
1406*35786f68SRobert Mustacchi
1407*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoSdev1;
1408*35786f68SRobert Mustacchi Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable->Buffer);
1409*35786f68SRobert Mustacchi break;
1410*35786f68SRobert Mustacchi
1411*35786f68SRobert Mustacchi default:
1412*35786f68SRobert Mustacchi
1413*35786f68SRobert Mustacchi DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV");
1414*35786f68SRobert Mustacchi return (AE_ERROR);
1415*35786f68SRobert Mustacchi }
1416*35786f68SRobert Mustacchi
1417*35786f68SRobert Mustacchi /* Compile SDEV subtable body */
1418*35786f68SRobert Mustacchi
1419*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1420bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1421bc36eafdSMike Gerdts {
1422bc36eafdSMike Gerdts return (Status);
1423bc36eafdSMike Gerdts }
1424bc36eafdSMike Gerdts
1425bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1426bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1427*35786f68SRobert Mustacchi
1428*35786f68SRobert Mustacchi /* Optional data fields are appended to the main subtable body */
1429*35786f68SRobert Mustacchi
1430*35786f68SRobert Mustacchi switch (SdevHeader->Type)
1431*35786f68SRobert Mustacchi {
1432*35786f68SRobert Mustacchi case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
1433*35786f68SRobert Mustacchi
1434*35786f68SRobert Mustacchi /* Append DeviceId namespace string */
1435*35786f68SRobert Mustacchi
1436*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev0a,
1437*35786f68SRobert Mustacchi &Subtable);
1438*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1439*35786f68SRobert Mustacchi {
1440*35786f68SRobert Mustacchi return (Status);
1441*35786f68SRobert Mustacchi }
1442*35786f68SRobert Mustacchi
1443*35786f68SRobert Mustacchi if (!Subtable)
1444*35786f68SRobert Mustacchi {
1445*35786f68SRobert Mustacchi break;
1446*35786f68SRobert Mustacchi }
1447*35786f68SRobert Mustacchi
1448*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1449*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1450*35786f68SRobert Mustacchi
1451*35786f68SRobert Mustacchi Namesp->DeviceIdOffset = sizeof (ACPI_SDEV_NAMESPACE);
1452*35786f68SRobert Mustacchi Namesp->DeviceIdLength = (UINT16) Subtable->Length;
1453*35786f68SRobert Mustacchi
1454*35786f68SRobert Mustacchi /* Append Vendor data */
1455*35786f68SRobert Mustacchi
1456*35786f68SRobert Mustacchi Namesp->VendorDataLength = 0;
1457*35786f68SRobert Mustacchi Namesp->VendorDataOffset = 0;
1458*35786f68SRobert Mustacchi
1459*35786f68SRobert Mustacchi if (*PFieldList)
1460*35786f68SRobert Mustacchi {
1461*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b,
1462*35786f68SRobert Mustacchi &Subtable);
1463*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1464*35786f68SRobert Mustacchi {
1465*35786f68SRobert Mustacchi return (Status);
1466*35786f68SRobert Mustacchi }
1467*35786f68SRobert Mustacchi
1468*35786f68SRobert Mustacchi if (Subtable)
1469*35786f68SRobert Mustacchi {
1470*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1471*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1472*35786f68SRobert Mustacchi
1473*35786f68SRobert Mustacchi Namesp->VendorDataOffset =
1474*35786f68SRobert Mustacchi Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
1475*35786f68SRobert Mustacchi Namesp->VendorDataLength =
1476*35786f68SRobert Mustacchi (UINT16) Subtable->Length;
1477*35786f68SRobert Mustacchi }
1478*35786f68SRobert Mustacchi }
1479*35786f68SRobert Mustacchi
1480*35786f68SRobert Mustacchi /* Final size of entire namespace structure */
1481*35786f68SRobert Mustacchi
1482*35786f68SRobert Mustacchi SdevHeader->Length = (UINT16) (sizeof (ACPI_SDEV_NAMESPACE) +
1483*35786f68SRobert Mustacchi Subtable->Length + Namesp->DeviceIdLength);
1484*35786f68SRobert Mustacchi break;
1485*35786f68SRobert Mustacchi
1486*35786f68SRobert Mustacchi case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
1487*35786f68SRobert Mustacchi
1488*35786f68SRobert Mustacchi /* Append the PCIe path info first */
1489*35786f68SRobert Mustacchi
1490*35786f68SRobert Mustacchi EntryCount = 0;
1491*35786f68SRobert Mustacchi while (*PFieldList && !strcmp ((*PFieldList)->Name, "Device"))
1492*35786f68SRobert Mustacchi {
1493*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1a,
1494*35786f68SRobert Mustacchi &Subtable);
1495*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1496*35786f68SRobert Mustacchi {
1497*35786f68SRobert Mustacchi return (Status);
1498*35786f68SRobert Mustacchi }
1499*35786f68SRobert Mustacchi
1500*35786f68SRobert Mustacchi if (!Subtable)
1501*35786f68SRobert Mustacchi {
1502*35786f68SRobert Mustacchi DtPopSubtable ();
1503*35786f68SRobert Mustacchi break;
1504*35786f68SRobert Mustacchi }
1505*35786f68SRobert Mustacchi
1506*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1507*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1508*35786f68SRobert Mustacchi EntryCount++;
1509*35786f68SRobert Mustacchi }
1510*35786f68SRobert Mustacchi
1511*35786f68SRobert Mustacchi /* Path offset will point immediately after the main subtable */
1512*35786f68SRobert Mustacchi
1513*35786f68SRobert Mustacchi Pcie->PathOffset = sizeof (ACPI_SDEV_PCIE);
1514*35786f68SRobert Mustacchi Pcie->PathLength = (UINT16)
1515*35786f68SRobert Mustacchi (EntryCount * sizeof (ACPI_SDEV_PCIE_PATH));
1516*35786f68SRobert Mustacchi
1517*35786f68SRobert Mustacchi /* Append the Vendor Data last */
1518*35786f68SRobert Mustacchi
1519*35786f68SRobert Mustacchi Pcie->VendorDataLength = 0;
1520*35786f68SRobert Mustacchi Pcie->VendorDataOffset = 0;
1521*35786f68SRobert Mustacchi
1522*35786f68SRobert Mustacchi if (*PFieldList)
1523*35786f68SRobert Mustacchi {
1524*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b,
1525*35786f68SRobert Mustacchi &Subtable);
1526*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1527*35786f68SRobert Mustacchi {
1528*35786f68SRobert Mustacchi return (Status);
1529*35786f68SRobert Mustacchi }
1530*35786f68SRobert Mustacchi
1531*35786f68SRobert Mustacchi if (Subtable)
1532*35786f68SRobert Mustacchi {
1533*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1534*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1535*35786f68SRobert Mustacchi
1536*35786f68SRobert Mustacchi Pcie->VendorDataOffset =
1537*35786f68SRobert Mustacchi Pcie->PathOffset + Pcie->PathLength;
1538*35786f68SRobert Mustacchi Pcie->VendorDataLength = (UINT16)
1539*35786f68SRobert Mustacchi Subtable->Length;
1540*35786f68SRobert Mustacchi }
1541*35786f68SRobert Mustacchi }
1542*35786f68SRobert Mustacchi
1543*35786f68SRobert Mustacchi SdevHeader->Length =
1544*35786f68SRobert Mustacchi sizeof (ACPI_SDEV_PCIE) +
1545*35786f68SRobert Mustacchi Pcie->PathLength + Pcie->VendorDataLength;
1546*35786f68SRobert Mustacchi break;
1547*35786f68SRobert Mustacchi
1548*35786f68SRobert Mustacchi default:
1549*35786f68SRobert Mustacchi
1550*35786f68SRobert Mustacchi DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV");
1551*35786f68SRobert Mustacchi return (AE_ERROR);
1552*35786f68SRobert Mustacchi }
1553*35786f68SRobert Mustacchi
1554bc36eafdSMike Gerdts DtPopSubtable ();
1555bc36eafdSMike Gerdts }
1556bc36eafdSMike Gerdts
1557bc36eafdSMike Gerdts return (AE_OK);
1558bc36eafdSMike Gerdts }
1559bc36eafdSMike Gerdts
1560bc36eafdSMike Gerdts
1561bc36eafdSMike Gerdts /******************************************************************************
1562bc36eafdSMike Gerdts *
1563bc36eafdSMike Gerdts * FUNCTION: DtCompileSlic
1564bc36eafdSMike Gerdts *
1565bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1566bc36eafdSMike Gerdts *
1567bc36eafdSMike Gerdts * RETURN: Status
1568bc36eafdSMike Gerdts *
1569bc36eafdSMike Gerdts * DESCRIPTION: Compile SLIC.
1570bc36eafdSMike Gerdts *
1571bc36eafdSMike Gerdts *****************************************************************************/
1572bc36eafdSMike Gerdts
1573bc36eafdSMike Gerdts ACPI_STATUS
DtCompileSlic(void ** List)1574bc36eafdSMike Gerdts DtCompileSlic (
1575bc36eafdSMike Gerdts void **List)
1576bc36eafdSMike Gerdts {
1577bc36eafdSMike Gerdts ACPI_STATUS Status;
1578bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1579bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1580bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1581bc36eafdSMike Gerdts
1582bc36eafdSMike Gerdts
1583bc36eafdSMike Gerdts while (*PFieldList)
1584bc36eafdSMike Gerdts {
1585bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic,
1586*35786f68SRobert Mustacchi &Subtable);
1587bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1588bc36eafdSMike Gerdts {
1589bc36eafdSMike Gerdts return (Status);
1590bc36eafdSMike Gerdts }
1591bc36eafdSMike Gerdts
1592bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1593bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1594bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1595bc36eafdSMike Gerdts DtPopSubtable ();
1596bc36eafdSMike Gerdts }
1597bc36eafdSMike Gerdts
1598bc36eafdSMike Gerdts return (AE_OK);
1599bc36eafdSMike Gerdts }
1600bc36eafdSMike Gerdts
1601bc36eafdSMike Gerdts
1602bc36eafdSMike Gerdts /******************************************************************************
1603bc36eafdSMike Gerdts *
1604bc36eafdSMike Gerdts * FUNCTION: DtCompileSlit
1605bc36eafdSMike Gerdts *
1606bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1607bc36eafdSMike Gerdts *
1608bc36eafdSMike Gerdts * RETURN: Status
1609bc36eafdSMike Gerdts *
1610bc36eafdSMike Gerdts * DESCRIPTION: Compile SLIT.
1611bc36eafdSMike Gerdts *
1612bc36eafdSMike Gerdts *****************************************************************************/
1613bc36eafdSMike Gerdts
1614bc36eafdSMike Gerdts ACPI_STATUS
DtCompileSlit(void ** List)1615bc36eafdSMike Gerdts DtCompileSlit (
1616bc36eafdSMike Gerdts void **List)
1617bc36eafdSMike Gerdts {
1618bc36eafdSMike Gerdts ACPI_STATUS Status;
1619bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1620bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1621bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1622bc36eafdSMike Gerdts DT_FIELD *FieldList;
1623bc36eafdSMike Gerdts UINT32 Localities;
1624bc36eafdSMike Gerdts UINT8 *LocalityBuffer;
1625bc36eafdSMike Gerdts
1626bc36eafdSMike Gerdts
1627bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1628*35786f68SRobert Mustacchi &Subtable);
1629bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1630bc36eafdSMike Gerdts {
1631bc36eafdSMike Gerdts return (Status);
1632bc36eafdSMike Gerdts }
1633bc36eafdSMike Gerdts
1634bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1635bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1636bc36eafdSMike Gerdts
1637bc36eafdSMike Gerdts Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
1638bc36eafdSMike Gerdts LocalityBuffer = UtLocalCalloc (Localities);
1639bc36eafdSMike Gerdts
1640bc36eafdSMike Gerdts /* Compile each locality buffer */
1641bc36eafdSMike Gerdts
1642bc36eafdSMike Gerdts FieldList = *PFieldList;
1643bc36eafdSMike Gerdts while (FieldList)
1644bc36eafdSMike Gerdts {
1645bc36eafdSMike Gerdts DtCompileBuffer (LocalityBuffer,
1646bc36eafdSMike Gerdts FieldList->Value, FieldList, Localities);
1647bc36eafdSMike Gerdts
1648bc36eafdSMike Gerdts DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
1649bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1650bc36eafdSMike Gerdts FieldList = FieldList->Next;
1651bc36eafdSMike Gerdts }
1652bc36eafdSMike Gerdts
1653bc36eafdSMike Gerdts ACPI_FREE (LocalityBuffer);
1654bc36eafdSMike Gerdts return (AE_OK);
1655bc36eafdSMike Gerdts }
1656bc36eafdSMike Gerdts
1657bc36eafdSMike Gerdts
1658bc36eafdSMike Gerdts /******************************************************************************
1659bc36eafdSMike Gerdts *
1660bc36eafdSMike Gerdts * FUNCTION: DtCompileSrat
1661bc36eafdSMike Gerdts *
1662bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1663bc36eafdSMike Gerdts *
1664bc36eafdSMike Gerdts * RETURN: Status
1665bc36eafdSMike Gerdts *
1666bc36eafdSMike Gerdts * DESCRIPTION: Compile SRAT.
1667bc36eafdSMike Gerdts *
1668bc36eafdSMike Gerdts *****************************************************************************/
1669bc36eafdSMike Gerdts
1670bc36eafdSMike Gerdts ACPI_STATUS
DtCompileSrat(void ** List)1671bc36eafdSMike Gerdts DtCompileSrat (
1672bc36eafdSMike Gerdts void **List)
1673bc36eafdSMike Gerdts {
1674bc36eafdSMike Gerdts ACPI_STATUS Status;
1675bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1676bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1677bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1678bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1679bc36eafdSMike Gerdts ACPI_SUBTABLE_HEADER *SratHeader;
1680bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
1681bc36eafdSMike Gerdts
1682bc36eafdSMike Gerdts
1683bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
1684*35786f68SRobert Mustacchi &Subtable);
1685bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1686bc36eafdSMike Gerdts {
1687bc36eafdSMike Gerdts return (Status);
1688bc36eafdSMike Gerdts }
1689bc36eafdSMike Gerdts
1690bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1691bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1692bc36eafdSMike Gerdts
1693bc36eafdSMike Gerdts while (*PFieldList)
1694bc36eafdSMike Gerdts {
1695bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1696bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
1697*35786f68SRobert Mustacchi &Subtable);
1698bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1699bc36eafdSMike Gerdts {
1700bc36eafdSMike Gerdts return (Status);
1701bc36eafdSMike Gerdts }
1702bc36eafdSMike Gerdts
1703bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1704bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1705bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1706bc36eafdSMike Gerdts
1707bc36eafdSMike Gerdts SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1708bc36eafdSMike Gerdts
1709bc36eafdSMike Gerdts switch (SratHeader->Type)
1710bc36eafdSMike Gerdts {
1711bc36eafdSMike Gerdts case ACPI_SRAT_TYPE_CPU_AFFINITY:
1712bc36eafdSMike Gerdts
1713bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoSrat0;
1714bc36eafdSMike Gerdts break;
1715bc36eafdSMike Gerdts
1716bc36eafdSMike Gerdts case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1717bc36eafdSMike Gerdts
1718bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoSrat1;
1719bc36eafdSMike Gerdts break;
1720bc36eafdSMike Gerdts
1721bc36eafdSMike Gerdts case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1722bc36eafdSMike Gerdts
1723bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoSrat2;
1724bc36eafdSMike Gerdts break;
1725bc36eafdSMike Gerdts
1726bc36eafdSMike Gerdts case ACPI_SRAT_TYPE_GICC_AFFINITY:
1727bc36eafdSMike Gerdts
1728bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoSrat3;
1729bc36eafdSMike Gerdts break;
1730bc36eafdSMike Gerdts
1731*35786f68SRobert Mustacchi case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
1732*35786f68SRobert Mustacchi
1733*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoSrat4;
1734*35786f68SRobert Mustacchi break;
1735*35786f68SRobert Mustacchi
1736bc36eafdSMike Gerdts default:
1737bc36eafdSMike Gerdts
1738bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
1739bc36eafdSMike Gerdts return (AE_ERROR);
1740bc36eafdSMike Gerdts }
1741bc36eafdSMike Gerdts
1742*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1743bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1744bc36eafdSMike Gerdts {
1745bc36eafdSMike Gerdts return (Status);
1746bc36eafdSMike Gerdts }
1747bc36eafdSMike Gerdts
1748bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1749bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1750bc36eafdSMike Gerdts DtPopSubtable ();
1751bc36eafdSMike Gerdts }
1752bc36eafdSMike Gerdts
1753bc36eafdSMike Gerdts return (AE_OK);
1754bc36eafdSMike Gerdts }
1755bc36eafdSMike Gerdts
1756bc36eafdSMike Gerdts
1757bc36eafdSMike Gerdts /******************************************************************************
1758bc36eafdSMike Gerdts *
1759bc36eafdSMike Gerdts * FUNCTION: DtCompileStao
1760bc36eafdSMike Gerdts *
1761bc36eafdSMike Gerdts * PARAMETERS: PFieldList - Current field list pointer
1762bc36eafdSMike Gerdts *
1763bc36eafdSMike Gerdts * RETURN: Status
1764bc36eafdSMike Gerdts *
1765bc36eafdSMike Gerdts * DESCRIPTION: Compile STAO.
1766bc36eafdSMike Gerdts *
1767bc36eafdSMike Gerdts *****************************************************************************/
1768bc36eafdSMike Gerdts
1769bc36eafdSMike Gerdts ACPI_STATUS
DtCompileStao(void ** List)1770bc36eafdSMike Gerdts DtCompileStao (
1771bc36eafdSMike Gerdts void **List)
1772bc36eafdSMike Gerdts {
1773bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1774bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1775bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1776bc36eafdSMike Gerdts ACPI_STATUS Status;
1777bc36eafdSMike Gerdts
1778bc36eafdSMike Gerdts
1779bc36eafdSMike Gerdts /* Compile the main table */
1780bc36eafdSMike Gerdts
1781bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao,
1782*35786f68SRobert Mustacchi &Subtable);
1783bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1784bc36eafdSMike Gerdts {
1785bc36eafdSMike Gerdts return (Status);
1786bc36eafdSMike Gerdts }
1787bc36eafdSMike Gerdts
1788bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1789bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1790bc36eafdSMike Gerdts
1791bc36eafdSMike Gerdts /* Compile each ASCII namestring as a subtable */
1792bc36eafdSMike Gerdts
1793bc36eafdSMike Gerdts while (*PFieldList)
1794bc36eafdSMike Gerdts {
1795bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr,
1796*35786f68SRobert Mustacchi &Subtable);
1797bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1798bc36eafdSMike Gerdts {
1799bc36eafdSMike Gerdts return (Status);
1800bc36eafdSMike Gerdts }
1801bc36eafdSMike Gerdts
1802bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1803bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1804bc36eafdSMike Gerdts }
1805bc36eafdSMike Gerdts
1806bc36eafdSMike Gerdts return (AE_OK);
1807bc36eafdSMike Gerdts }
1808bc36eafdSMike Gerdts
1809bc36eafdSMike Gerdts
1810bc36eafdSMike Gerdts /******************************************************************************
1811bc36eafdSMike Gerdts *
1812bc36eafdSMike Gerdts * FUNCTION: DtCompileTcpa
1813bc36eafdSMike Gerdts *
1814bc36eafdSMike Gerdts * PARAMETERS: PFieldList - Current field list pointer
1815bc36eafdSMike Gerdts *
1816bc36eafdSMike Gerdts * RETURN: Status
1817bc36eafdSMike Gerdts *
1818bc36eafdSMike Gerdts * DESCRIPTION: Compile TCPA.
1819bc36eafdSMike Gerdts *
1820bc36eafdSMike Gerdts *****************************************************************************/
1821bc36eafdSMike Gerdts
1822bc36eafdSMike Gerdts ACPI_STATUS
DtCompileTcpa(void ** List)1823bc36eafdSMike Gerdts DtCompileTcpa (
1824bc36eafdSMike Gerdts void **List)
1825bc36eafdSMike Gerdts {
1826bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1827bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1828bc36eafdSMike Gerdts ACPI_TABLE_TCPA_HDR *TcpaHeader;
1829bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1830bc36eafdSMike Gerdts ACPI_STATUS Status;
1831bc36eafdSMike Gerdts
1832bc36eafdSMike Gerdts
1833bc36eafdSMike Gerdts /* Compile the main table */
1834bc36eafdSMike Gerdts
1835bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr,
1836*35786f68SRobert Mustacchi &Subtable);
1837bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1838bc36eafdSMike Gerdts {
1839bc36eafdSMike Gerdts return (Status);
1840bc36eafdSMike Gerdts }
1841bc36eafdSMike Gerdts
1842bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1843bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1844bc36eafdSMike Gerdts
1845bc36eafdSMike Gerdts /*
1846bc36eafdSMike Gerdts * Examine the PlatformClass field to determine the table type.
1847bc36eafdSMike Gerdts * Either a client or server table. Only one.
1848bc36eafdSMike Gerdts */
1849bc36eafdSMike Gerdts TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
1850bc36eafdSMike Gerdts
1851bc36eafdSMike Gerdts switch (TcpaHeader->PlatformClass)
1852bc36eafdSMike Gerdts {
1853bc36eafdSMike Gerdts case ACPI_TCPA_CLIENT_TABLE:
1854bc36eafdSMike Gerdts
1855bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient,
1856*35786f68SRobert Mustacchi &Subtable);
1857bc36eafdSMike Gerdts break;
1858bc36eafdSMike Gerdts
1859bc36eafdSMike Gerdts case ACPI_TCPA_SERVER_TABLE:
1860bc36eafdSMike Gerdts
1861bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer,
1862*35786f68SRobert Mustacchi &Subtable);
1863bc36eafdSMike Gerdts break;
1864bc36eafdSMike Gerdts
1865bc36eafdSMike Gerdts default:
1866bc36eafdSMike Gerdts
1867bc36eafdSMike Gerdts AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
1868bc36eafdSMike Gerdts TcpaHeader->PlatformClass);
1869bc36eafdSMike Gerdts Status = AE_ERROR;
1870bc36eafdSMike Gerdts break;
1871bc36eafdSMike Gerdts }
1872bc36eafdSMike Gerdts
1873bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1874bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1875bc36eafdSMike Gerdts return (Status);
1876bc36eafdSMike Gerdts }
1877bc36eafdSMike Gerdts
1878bc36eafdSMike Gerdts
1879*35786f68SRobert Mustacchi /******************************************************************************
1880*35786f68SRobert Mustacchi *
1881*35786f68SRobert Mustacchi * FUNCTION: DtCompileTpm2
1882*35786f68SRobert Mustacchi *
1883*35786f68SRobert Mustacchi * PARAMETERS: PFieldList - Current field list pointer
1884*35786f68SRobert Mustacchi *
1885*35786f68SRobert Mustacchi * RETURN: Status
1886*35786f68SRobert Mustacchi *
1887*35786f68SRobert Mustacchi * DESCRIPTION: Compile TPM2.
1888*35786f68SRobert Mustacchi *
1889*35786f68SRobert Mustacchi *****************************************************************************/
1890*35786f68SRobert Mustacchi
1891*35786f68SRobert Mustacchi ACPI_STATUS
DtCompileTpm2(void ** List)1892*35786f68SRobert Mustacchi DtCompileTpm2 (
1893*35786f68SRobert Mustacchi void **List)
1894*35786f68SRobert Mustacchi {
1895*35786f68SRobert Mustacchi DT_FIELD **PFieldList = (DT_FIELD **) List;
1896*35786f68SRobert Mustacchi DT_SUBTABLE *Subtable;
1897*35786f68SRobert Mustacchi ACPI_TABLE_TPM2 *Tpm2Header;
1898*35786f68SRobert Mustacchi DT_SUBTABLE *ParentTable;
1899*35786f68SRobert Mustacchi ACPI_STATUS Status = AE_OK;
1900*35786f68SRobert Mustacchi
1901*35786f68SRobert Mustacchi
1902*35786f68SRobert Mustacchi /* Compile the main table */
1903*35786f68SRobert Mustacchi
1904*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2,
1905*35786f68SRobert Mustacchi &Subtable);
1906*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1907*35786f68SRobert Mustacchi {
1908*35786f68SRobert Mustacchi return (Status);
1909*35786f68SRobert Mustacchi }
1910*35786f68SRobert Mustacchi
1911*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1912*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1913*35786f68SRobert Mustacchi
1914*35786f68SRobert Mustacchi Tpm2Header = ACPI_CAST_PTR (ACPI_TABLE_TPM2, ParentTable->Buffer);
1915*35786f68SRobert Mustacchi
1916*35786f68SRobert Mustacchi /* Method parameters */
1917*35786f68SRobert Mustacchi /* Optional: Log area minimum length */
1918*35786f68SRobert Mustacchi /* Optional: Log area start address */
1919*35786f68SRobert Mustacchi /* TBD: Optional fields above not fully implemented (not optional at this time) */
1920*35786f68SRobert Mustacchi
1921*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2a,
1922*35786f68SRobert Mustacchi &Subtable);
1923*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1924*35786f68SRobert Mustacchi {
1925*35786f68SRobert Mustacchi return (Status);
1926*35786f68SRobert Mustacchi }
1927*35786f68SRobert Mustacchi
1928*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1929*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1930*35786f68SRobert Mustacchi
1931*35786f68SRobert Mustacchi
1932*35786f68SRobert Mustacchi /* Subtable type depends on the StartMethod */
1933*35786f68SRobert Mustacchi
1934*35786f68SRobert Mustacchi switch (Tpm2Header->StartMethod)
1935*35786f68SRobert Mustacchi {
1936*35786f68SRobert Mustacchi case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
1937*35786f68SRobert Mustacchi
1938*35786f68SRobert Mustacchi /* Subtable specific to to ARM_SMC */
1939*35786f68SRobert Mustacchi
1940*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm211,
1941*35786f68SRobert Mustacchi &Subtable);
1942*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1943*35786f68SRobert Mustacchi {
1944*35786f68SRobert Mustacchi return (Status);
1945*35786f68SRobert Mustacchi }
1946*35786f68SRobert Mustacchi
1947*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1948*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1949*35786f68SRobert Mustacchi break;
1950*35786f68SRobert Mustacchi
1951*35786f68SRobert Mustacchi case ACPI_TPM2_START_METHOD:
1952*35786f68SRobert Mustacchi case ACPI_TPM2_MEMORY_MAPPED:
1953*35786f68SRobert Mustacchi case ACPI_TPM2_COMMAND_BUFFER:
1954*35786f68SRobert Mustacchi case ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD:
1955*35786f68SRobert Mustacchi break;
1956*35786f68SRobert Mustacchi
1957*35786f68SRobert Mustacchi case ACPI_TPM2_RESERVED1:
1958*35786f68SRobert Mustacchi case ACPI_TPM2_RESERVED3:
1959*35786f68SRobert Mustacchi case ACPI_TPM2_RESERVED4:
1960*35786f68SRobert Mustacchi case ACPI_TPM2_RESERVED5:
1961*35786f68SRobert Mustacchi case ACPI_TPM2_RESERVED9:
1962*35786f68SRobert Mustacchi case ACPI_TPM2_RESERVED10:
1963*35786f68SRobert Mustacchi
1964*35786f68SRobert Mustacchi AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
1965*35786f68SRobert Mustacchi Tpm2Header->StartMethod);
1966*35786f68SRobert Mustacchi Status = AE_ERROR;
1967*35786f68SRobert Mustacchi break;
1968*35786f68SRobert Mustacchi
1969*35786f68SRobert Mustacchi case ACPI_TPM2_NOT_ALLOWED:
1970*35786f68SRobert Mustacchi default:
1971*35786f68SRobert Mustacchi
1972*35786f68SRobert Mustacchi AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
1973*35786f68SRobert Mustacchi Tpm2Header->StartMethod);
1974*35786f68SRobert Mustacchi Status = AE_ERROR;
1975*35786f68SRobert Mustacchi break;
1976*35786f68SRobert Mustacchi }
1977*35786f68SRobert Mustacchi
1978*35786f68SRobert Mustacchi return (Status);
1979*35786f68SRobert Mustacchi }
1980*35786f68SRobert Mustacchi
1981*35786f68SRobert Mustacchi
1982bc36eafdSMike Gerdts /******************************************************************************
1983bc36eafdSMike Gerdts *
1984bc36eafdSMike Gerdts * FUNCTION: DtGetGenericTableInfo
1985bc36eafdSMike Gerdts *
1986bc36eafdSMike Gerdts * PARAMETERS: Name - Generic type name
1987bc36eafdSMike Gerdts *
1988bc36eafdSMike Gerdts * RETURN: Info entry
1989bc36eafdSMike Gerdts *
1990bc36eafdSMike Gerdts * DESCRIPTION: Obtain table info for a generic name entry
1991bc36eafdSMike Gerdts *
1992bc36eafdSMike Gerdts *****************************************************************************/
1993bc36eafdSMike Gerdts
1994bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *
DtGetGenericTableInfo(char * Name)1995bc36eafdSMike Gerdts DtGetGenericTableInfo (
1996bc36eafdSMike Gerdts char *Name)
1997bc36eafdSMike Gerdts {
1998bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *Info;
1999bc36eafdSMike Gerdts UINT32 i;
2000bc36eafdSMike Gerdts
2001bc36eafdSMike Gerdts
2002bc36eafdSMike Gerdts if (!Name)
2003bc36eafdSMike Gerdts {
2004bc36eafdSMike Gerdts return (NULL);
2005bc36eafdSMike Gerdts }
2006bc36eafdSMike Gerdts
2007bc36eafdSMike Gerdts /* Search info table for name match */
2008bc36eafdSMike Gerdts
2009bc36eafdSMike Gerdts for (i = 0; ; i++)
2010bc36eafdSMike Gerdts {
2011bc36eafdSMike Gerdts Info = AcpiDmTableInfoGeneric[i];
2012bc36eafdSMike Gerdts if (Info->Opcode == ACPI_DMT_EXIT)
2013bc36eafdSMike Gerdts {
2014bc36eafdSMike Gerdts Info = NULL;
2015bc36eafdSMike Gerdts break;
2016bc36eafdSMike Gerdts }
2017bc36eafdSMike Gerdts
2018bc36eafdSMike Gerdts /* Use caseless compare for generic keywords */
2019bc36eafdSMike Gerdts
2020bc36eafdSMike Gerdts if (!AcpiUtStricmp (Name, Info->Name))
2021bc36eafdSMike Gerdts {
2022bc36eafdSMike Gerdts break;
2023bc36eafdSMike Gerdts }
2024bc36eafdSMike Gerdts }
2025bc36eafdSMike Gerdts
2026bc36eafdSMike Gerdts return (Info);
2027bc36eafdSMike Gerdts }
2028bc36eafdSMike Gerdts
2029bc36eafdSMike Gerdts
2030bc36eafdSMike Gerdts /******************************************************************************
2031bc36eafdSMike Gerdts *
2032bc36eafdSMike Gerdts * FUNCTION: DtCompileUefi
2033bc36eafdSMike Gerdts *
2034bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
2035bc36eafdSMike Gerdts *
2036bc36eafdSMike Gerdts * RETURN: Status
2037bc36eafdSMike Gerdts *
2038bc36eafdSMike Gerdts * DESCRIPTION: Compile UEFI.
2039bc36eafdSMike Gerdts *
2040bc36eafdSMike Gerdts *****************************************************************************/
2041bc36eafdSMike Gerdts
2042bc36eafdSMike Gerdts ACPI_STATUS
DtCompileUefi(void ** List)2043bc36eafdSMike Gerdts DtCompileUefi (
2044bc36eafdSMike Gerdts void **List)
2045bc36eafdSMike Gerdts {
2046bc36eafdSMike Gerdts ACPI_STATUS Status;
2047bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
2048bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
2049bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
2050bc36eafdSMike Gerdts UINT16 *DataOffset;
2051bc36eafdSMike Gerdts
2052bc36eafdSMike Gerdts
2053bc36eafdSMike Gerdts /* Compile the predefined portion of the UEFI table */
2054bc36eafdSMike Gerdts
2055bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
2056*35786f68SRobert Mustacchi &Subtable);
2057bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
2058bc36eafdSMike Gerdts {
2059bc36eafdSMike Gerdts return (Status);
2060bc36eafdSMike Gerdts }
2061bc36eafdSMike Gerdts
2062bc36eafdSMike Gerdts DataOffset = (UINT16 *) (Subtable->Buffer + 16);
2063bc36eafdSMike Gerdts *DataOffset = sizeof (ACPI_TABLE_UEFI);
2064bc36eafdSMike Gerdts
2065bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
2066bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
2067bc36eafdSMike Gerdts
2068bc36eafdSMike Gerdts /*
2069bc36eafdSMike Gerdts * Compile the "generic" portion of the UEFI table. This
2070bc36eafdSMike Gerdts * part of the table is not predefined and any of the generic
2071bc36eafdSMike Gerdts * operators may be used.
2072bc36eafdSMike Gerdts */
2073bc36eafdSMike Gerdts DtCompileGeneric ((void **) PFieldList, NULL, NULL);
2074bc36eafdSMike Gerdts return (AE_OK);
2075bc36eafdSMike Gerdts }
2076bc36eafdSMike Gerdts
2077bc36eafdSMike Gerdts
2078bc36eafdSMike Gerdts /******************************************************************************
2079bc36eafdSMike Gerdts *
2080bc36eafdSMike Gerdts * FUNCTION: DtCompileVrtc
2081bc36eafdSMike Gerdts *
2082bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
2083bc36eafdSMike Gerdts *
2084bc36eafdSMike Gerdts * RETURN: Status
2085bc36eafdSMike Gerdts *
2086bc36eafdSMike Gerdts * DESCRIPTION: Compile VRTC.
2087bc36eafdSMike Gerdts *
2088bc36eafdSMike Gerdts *****************************************************************************/
2089bc36eafdSMike Gerdts
2090bc36eafdSMike Gerdts ACPI_STATUS
DtCompileVrtc(void ** List)2091bc36eafdSMike Gerdts DtCompileVrtc (
2092bc36eafdSMike Gerdts void **List)
2093bc36eafdSMike Gerdts {
2094bc36eafdSMike Gerdts ACPI_STATUS Status;
2095bc36eafdSMike Gerdts
2096bc36eafdSMike Gerdts
2097bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
2098bc36eafdSMike Gerdts AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0);
2099bc36eafdSMike Gerdts return (Status);
2100bc36eafdSMike Gerdts }
2101bc36eafdSMike Gerdts
2102bc36eafdSMike Gerdts
2103bc36eafdSMike Gerdts /******************************************************************************
2104bc36eafdSMike Gerdts *
2105bc36eafdSMike Gerdts * FUNCTION: DtCompileWdat
2106bc36eafdSMike Gerdts *
2107bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
2108bc36eafdSMike Gerdts *
2109bc36eafdSMike Gerdts * RETURN: Status
2110bc36eafdSMike Gerdts *
2111bc36eafdSMike Gerdts * DESCRIPTION: Compile WDAT.
2112bc36eafdSMike Gerdts *
2113bc36eafdSMike Gerdts *****************************************************************************/
2114bc36eafdSMike Gerdts
2115bc36eafdSMike Gerdts ACPI_STATUS
DtCompileWdat(void ** List)2116bc36eafdSMike Gerdts DtCompileWdat (
2117bc36eafdSMike Gerdts void **List)
2118bc36eafdSMike Gerdts {
2119bc36eafdSMike Gerdts ACPI_STATUS Status;
2120bc36eafdSMike Gerdts
2121bc36eafdSMike Gerdts
2122bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
2123bc36eafdSMike Gerdts AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
2124bc36eafdSMike Gerdts return (Status);
2125bc36eafdSMike Gerdts }
2126bc36eafdSMike Gerdts
2127bc36eafdSMike Gerdts
2128bc36eafdSMike Gerdts /******************************************************************************
2129bc36eafdSMike Gerdts *
2130bc36eafdSMike Gerdts * FUNCTION: DtCompileWpbt
2131bc36eafdSMike Gerdts *
2132bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
2133bc36eafdSMike Gerdts *
2134bc36eafdSMike Gerdts * RETURN: Status
2135bc36eafdSMike Gerdts *
2136bc36eafdSMike Gerdts * DESCRIPTION: Compile WPBT.
2137bc36eafdSMike Gerdts *
2138bc36eafdSMike Gerdts *****************************************************************************/
2139bc36eafdSMike Gerdts
2140bc36eafdSMike Gerdts ACPI_STATUS
DtCompileWpbt(void ** List)2141bc36eafdSMike Gerdts DtCompileWpbt (
2142bc36eafdSMike Gerdts void **List)
2143bc36eafdSMike Gerdts {
2144bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
2145bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
2146bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
2147bc36eafdSMike Gerdts ACPI_TABLE_WPBT *Table;
2148bc36eafdSMike Gerdts ACPI_STATUS Status;
2149bc36eafdSMike Gerdts UINT16 Length;
2150bc36eafdSMike Gerdts
2151bc36eafdSMike Gerdts
2152bc36eafdSMike Gerdts /* Compile the main table */
2153bc36eafdSMike Gerdts
2154bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt,
2155*35786f68SRobert Mustacchi &Subtable);
2156bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
2157bc36eafdSMike Gerdts {
2158bc36eafdSMike Gerdts return (Status);
2159bc36eafdSMike Gerdts }
2160bc36eafdSMike Gerdts
2161bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
2162bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
2163bc36eafdSMike Gerdts
2164bc36eafdSMike Gerdts /* Compile the argument list subtable */
2165bc36eafdSMike Gerdts
2166bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0,
2167*35786f68SRobert Mustacchi &Subtable);
2168bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
2169bc36eafdSMike Gerdts {
2170bc36eafdSMike Gerdts return (Status);
2171bc36eafdSMike Gerdts }
2172bc36eafdSMike Gerdts
2173bc36eafdSMike Gerdts /* Extract the length of the Arguments buffer, insert into main table */
2174bc36eafdSMike Gerdts
2175bc36eafdSMike Gerdts Length = (UINT16) Subtable->TotalLength;
2176bc36eafdSMike Gerdts Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
2177bc36eafdSMike Gerdts Table->ArgumentsLength = Length;
2178bc36eafdSMike Gerdts
2179bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
2180bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
2181bc36eafdSMike Gerdts return (AE_OK);
2182bc36eafdSMike Gerdts }
2183bc36eafdSMike Gerdts
2184bc36eafdSMike Gerdts
2185bc36eafdSMike Gerdts /******************************************************************************
2186bc36eafdSMike Gerdts *
2187bc36eafdSMike Gerdts * FUNCTION: DtCompileXsdt
2188bc36eafdSMike Gerdts *
2189bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
2190bc36eafdSMike Gerdts *
2191bc36eafdSMike Gerdts * RETURN: Status
2192bc36eafdSMike Gerdts *
2193bc36eafdSMike Gerdts * DESCRIPTION: Compile XSDT.
2194bc36eafdSMike Gerdts *
2195bc36eafdSMike Gerdts *****************************************************************************/
2196bc36eafdSMike Gerdts
2197bc36eafdSMike Gerdts ACPI_STATUS
DtCompileXsdt(void ** List)2198bc36eafdSMike Gerdts DtCompileXsdt (
2199bc36eafdSMike Gerdts void **List)
2200bc36eafdSMike Gerdts {
2201bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
2202bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
2203bc36eafdSMike Gerdts DT_FIELD *FieldList = *(DT_FIELD **) List;
2204bc36eafdSMike Gerdts UINT64 Address;
2205bc36eafdSMike Gerdts
2206bc36eafdSMike Gerdts
2207bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
2208bc36eafdSMike Gerdts
2209bc36eafdSMike Gerdts while (FieldList)
2210bc36eafdSMike Gerdts {
2211bc36eafdSMike Gerdts DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
2212bc36eafdSMike Gerdts
2213bc36eafdSMike Gerdts DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
2214bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
2215bc36eafdSMike Gerdts FieldList = FieldList->Next;
2216bc36eafdSMike Gerdts }
2217bc36eafdSMike Gerdts
2218bc36eafdSMike Gerdts return (AE_OK);
2219bc36eafdSMike Gerdts }
2220bc36eafdSMike Gerdts
2221bc36eafdSMike Gerdts
2222bc36eafdSMike Gerdts /******************************************************************************
2223bc36eafdSMike Gerdts *
2224bc36eafdSMike Gerdts * FUNCTION: DtCompileGeneric
2225bc36eafdSMike Gerdts *
2226bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
2227bc36eafdSMike Gerdts * Name - Field name to end generic compiling
2228bc36eafdSMike Gerdts * Length - Compiled table length to return
2229bc36eafdSMike Gerdts *
2230bc36eafdSMike Gerdts * RETURN: Status
2231bc36eafdSMike Gerdts *
2232bc36eafdSMike Gerdts * DESCRIPTION: Compile generic unknown table.
2233bc36eafdSMike Gerdts *
2234bc36eafdSMike Gerdts *****************************************************************************/
2235bc36eafdSMike Gerdts
2236bc36eafdSMike Gerdts ACPI_STATUS
DtCompileGeneric(void ** List,char * Name,UINT32 * Length)2237bc36eafdSMike Gerdts DtCompileGeneric (
2238bc36eafdSMike Gerdts void **List,
2239bc36eafdSMike Gerdts char *Name,
2240bc36eafdSMike Gerdts UINT32 *Length)
2241bc36eafdSMike Gerdts {
2242bc36eafdSMike Gerdts ACPI_STATUS Status;
2243bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
2244bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
2245bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
2246bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *Info;
2247bc36eafdSMike Gerdts
2248bc36eafdSMike Gerdts
2249bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
2250bc36eafdSMike Gerdts
2251bc36eafdSMike Gerdts /*
2252bc36eafdSMike Gerdts * Compile the "generic" portion of the table. This
2253bc36eafdSMike Gerdts * part of the table is not predefined and any of the generic
2254bc36eafdSMike Gerdts * operators may be used.
2255bc36eafdSMike Gerdts */
2256bc36eafdSMike Gerdts
2257bc36eafdSMike Gerdts /* Find any and all labels in the entire generic portion */
2258bc36eafdSMike Gerdts
2259bc36eafdSMike Gerdts DtDetectAllLabels (*PFieldList);
2260bc36eafdSMike Gerdts
2261bc36eafdSMike Gerdts /* Now we can actually compile the parse tree */
2262bc36eafdSMike Gerdts
2263bc36eafdSMike Gerdts if (Length && *Length)
2264bc36eafdSMike Gerdts {
2265bc36eafdSMike Gerdts *Length = 0;
2266bc36eafdSMike Gerdts }
2267bc36eafdSMike Gerdts while (*PFieldList)
2268bc36eafdSMike Gerdts {
2269bc36eafdSMike Gerdts if (Name && !strcmp ((*PFieldList)->Name, Name))
2270bc36eafdSMike Gerdts {
2271bc36eafdSMike Gerdts break;
2272bc36eafdSMike Gerdts }
2273bc36eafdSMike Gerdts
2274bc36eafdSMike Gerdts Info = DtGetGenericTableInfo ((*PFieldList)->Name);
2275bc36eafdSMike Gerdts if (!Info)
2276bc36eafdSMike Gerdts {
2277bc36eafdSMike Gerdts sprintf (MsgBuffer, "Generic data type \"%s\" not found",
2278bc36eafdSMike Gerdts (*PFieldList)->Name);
2279bc36eafdSMike Gerdts DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
2280bc36eafdSMike Gerdts (*PFieldList), MsgBuffer);
2281bc36eafdSMike Gerdts
2282bc36eafdSMike Gerdts *PFieldList = (*PFieldList)->Next;
2283bc36eafdSMike Gerdts continue;
2284bc36eafdSMike Gerdts }
2285bc36eafdSMike Gerdts
2286bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, Info,
2287*35786f68SRobert Mustacchi &Subtable);
2288bc36eafdSMike Gerdts if (ACPI_SUCCESS (Status))
2289bc36eafdSMike Gerdts {
2290bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
2291bc36eafdSMike Gerdts if (Length)
2292bc36eafdSMike Gerdts {
2293bc36eafdSMike Gerdts *Length += Subtable->Length;
2294bc36eafdSMike Gerdts }
2295bc36eafdSMike Gerdts }
2296bc36eafdSMike Gerdts else
2297bc36eafdSMike Gerdts {
2298bc36eafdSMike Gerdts *PFieldList = (*PFieldList)->Next;
2299bc36eafdSMike Gerdts
2300bc36eafdSMike Gerdts if (Status == AE_NOT_FOUND)
2301bc36eafdSMike Gerdts {
2302bc36eafdSMike Gerdts sprintf (MsgBuffer, "Generic data type \"%s\" not found",
2303bc36eafdSMike Gerdts (*PFieldList)->Name);
2304bc36eafdSMike Gerdts DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
2305bc36eafdSMike Gerdts (*PFieldList), MsgBuffer);
2306bc36eafdSMike Gerdts }
2307bc36eafdSMike Gerdts }
2308bc36eafdSMike Gerdts }
2309bc36eafdSMike Gerdts
2310bc36eafdSMike Gerdts return (AE_OK);
2311bc36eafdSMike Gerdts }
2312