1bc36eafdSMike Gerdts /******************************************************************************
2bc36eafdSMike Gerdts *
3bc36eafdSMike Gerdts * Module Name: dttable1.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 *
134*35786f68SRobert Mustacchi * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135*35786f68SRobert Mustacchi * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*35786f68SRobert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137*35786f68SRobert Mustacchi * 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
147bc36eafdSMike Gerdts * GNU General Public License ("GPL") version 2 as published by the Free
148bc36eafdSMike Gerdts * Software Foundation.
149bc36eafdSMike Gerdts *
150*35786f68SRobert Mustacchi *****************************************************************************/
151bc36eafdSMike Gerdts
152bc36eafdSMike Gerdts /* Compile all complex data tables, signatures starting with A-I */
153bc36eafdSMike Gerdts
154bc36eafdSMike Gerdts #include "aslcompiler.h"
155bc36eafdSMike Gerdts
156bc36eafdSMike Gerdts #define _COMPONENT DT_COMPILER
157bc36eafdSMike Gerdts ACPI_MODULE_NAME ("dttable1")
158bc36eafdSMike Gerdts
159bc36eafdSMike Gerdts
160bc36eafdSMike Gerdts static ACPI_DMTABLE_INFO TableInfoAsfAddress[] =
161bc36eafdSMike Gerdts {
162bc36eafdSMike Gerdts {ACPI_DMT_BUFFER, 0, "Addresses", 0},
163bc36eafdSMike Gerdts {ACPI_DMT_EXIT, 0, NULL, 0}
164bc36eafdSMike Gerdts };
165bc36eafdSMike Gerdts
166bc36eafdSMike Gerdts static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] =
167bc36eafdSMike Gerdts {
168bc36eafdSMike Gerdts {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0},
169bc36eafdSMike Gerdts {ACPI_DMT_EXIT, 0, NULL, 0}
170bc36eafdSMike Gerdts };
171bc36eafdSMike Gerdts
172bc36eafdSMike Gerdts
173bc36eafdSMike Gerdts /******************************************************************************
174bc36eafdSMike Gerdts *
175bc36eafdSMike Gerdts * FUNCTION: DtCompileAsf
176bc36eafdSMike Gerdts *
177bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
178bc36eafdSMike Gerdts *
179bc36eafdSMike Gerdts * RETURN: Status
180bc36eafdSMike Gerdts *
181bc36eafdSMike Gerdts * DESCRIPTION: Compile ASF!.
182bc36eafdSMike Gerdts *
183bc36eafdSMike Gerdts *****************************************************************************/
184bc36eafdSMike Gerdts
185bc36eafdSMike Gerdts ACPI_STATUS
DtCompileAsf(void ** List)186bc36eafdSMike Gerdts DtCompileAsf (
187bc36eafdSMike Gerdts void **List)
188bc36eafdSMike Gerdts {
189bc36eafdSMike Gerdts ACPI_ASF_INFO *AsfTable;
190bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
191bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
192bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
193bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *DataInfoTable = NULL;
194bc36eafdSMike Gerdts UINT32 DataCount = 0;
195bc36eafdSMike Gerdts ACPI_STATUS Status;
196bc36eafdSMike Gerdts UINT32 i;
197bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
198bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
199bc36eafdSMike Gerdts
200bc36eafdSMike Gerdts
201bc36eafdSMike Gerdts while (*PFieldList)
202bc36eafdSMike Gerdts {
203bc36eafdSMike Gerdts SubtableStart = *PFieldList;
204bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr,
205*35786f68SRobert Mustacchi &Subtable);
206bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
207bc36eafdSMike Gerdts {
208bc36eafdSMike Gerdts return (Status);
209bc36eafdSMike Gerdts }
210bc36eafdSMike Gerdts
211bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
212bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
213bc36eafdSMike Gerdts DtPushSubtable (Subtable);
214bc36eafdSMike Gerdts
215bc36eafdSMike Gerdts AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer);
216bc36eafdSMike Gerdts
217bc36eafdSMike Gerdts switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
218bc36eafdSMike Gerdts {
219bc36eafdSMike Gerdts case ACPI_ASF_TYPE_INFO:
220bc36eafdSMike Gerdts
221bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoAsf0;
222bc36eafdSMike Gerdts break;
223bc36eafdSMike Gerdts
224bc36eafdSMike Gerdts case ACPI_ASF_TYPE_ALERT:
225bc36eafdSMike Gerdts
226bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoAsf1;
227bc36eafdSMike Gerdts break;
228bc36eafdSMike Gerdts
229bc36eafdSMike Gerdts case ACPI_ASF_TYPE_CONTROL:
230bc36eafdSMike Gerdts
231bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoAsf2;
232bc36eafdSMike Gerdts break;
233bc36eafdSMike Gerdts
234bc36eafdSMike Gerdts case ACPI_ASF_TYPE_BOOT:
235bc36eafdSMike Gerdts
236bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoAsf3;
237bc36eafdSMike Gerdts break;
238bc36eafdSMike Gerdts
239bc36eafdSMike Gerdts case ACPI_ASF_TYPE_ADDRESS:
240bc36eafdSMike Gerdts
241bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoAsf4;
242bc36eafdSMike Gerdts break;
243bc36eafdSMike Gerdts
244bc36eafdSMike Gerdts default:
245bc36eafdSMike Gerdts
246bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
247bc36eafdSMike Gerdts return (AE_ERROR);
248bc36eafdSMike Gerdts }
249bc36eafdSMike Gerdts
250*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
251bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
252bc36eafdSMike Gerdts {
253bc36eafdSMike Gerdts return (Status);
254bc36eafdSMike Gerdts }
255bc36eafdSMike Gerdts
256bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
257bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
258bc36eafdSMike Gerdts
259bc36eafdSMike Gerdts switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
260bc36eafdSMike Gerdts {
261bc36eafdSMike Gerdts case ACPI_ASF_TYPE_INFO:
262bc36eafdSMike Gerdts
263bc36eafdSMike Gerdts DataInfoTable = NULL;
264bc36eafdSMike Gerdts break;
265bc36eafdSMike Gerdts
266bc36eafdSMike Gerdts case ACPI_ASF_TYPE_ALERT:
267bc36eafdSMike Gerdts
268bc36eafdSMike Gerdts DataInfoTable = AcpiDmTableInfoAsf1a;
269bc36eafdSMike Gerdts DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT,
270bc36eafdSMike Gerdts ACPI_SUB_PTR (UINT8, Subtable->Buffer,
271bc36eafdSMike Gerdts sizeof (ACPI_ASF_HEADER)))->Alerts;
272bc36eafdSMike Gerdts break;
273bc36eafdSMike Gerdts
274bc36eafdSMike Gerdts case ACPI_ASF_TYPE_CONTROL:
275bc36eafdSMike Gerdts
276bc36eafdSMike Gerdts DataInfoTable = AcpiDmTableInfoAsf2a;
277bc36eafdSMike Gerdts DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE,
278bc36eafdSMike Gerdts ACPI_SUB_PTR (UINT8, Subtable->Buffer,
279bc36eafdSMike Gerdts sizeof (ACPI_ASF_HEADER)))->Controls;
280bc36eafdSMike Gerdts break;
281bc36eafdSMike Gerdts
282bc36eafdSMike Gerdts case ACPI_ASF_TYPE_BOOT:
283bc36eafdSMike Gerdts
284bc36eafdSMike Gerdts DataInfoTable = NULL;
285bc36eafdSMike Gerdts break;
286bc36eafdSMike Gerdts
287bc36eafdSMike Gerdts case ACPI_ASF_TYPE_ADDRESS:
288bc36eafdSMike Gerdts
289bc36eafdSMike Gerdts DataInfoTable = TableInfoAsfAddress;
290bc36eafdSMike Gerdts DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS,
291bc36eafdSMike Gerdts ACPI_SUB_PTR (UINT8, Subtable->Buffer,
292bc36eafdSMike Gerdts sizeof (ACPI_ASF_HEADER)))->Devices;
293bc36eafdSMike Gerdts break;
294bc36eafdSMike Gerdts
295bc36eafdSMike Gerdts default:
296bc36eafdSMike Gerdts
297bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
298bc36eafdSMike Gerdts return (AE_ERROR);
299bc36eafdSMike Gerdts }
300bc36eafdSMike Gerdts
301bc36eafdSMike Gerdts if (DataInfoTable)
302bc36eafdSMike Gerdts {
303bc36eafdSMike Gerdts switch (AsfTable->Header.Type & 0x7F)
304bc36eafdSMike Gerdts {
305bc36eafdSMike Gerdts case ACPI_ASF_TYPE_ADDRESS:
306bc36eafdSMike Gerdts
307bc36eafdSMike Gerdts while (DataCount > 0)
308bc36eafdSMike Gerdts {
309bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, DataInfoTable,
310*35786f68SRobert Mustacchi &Subtable);
311bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
312bc36eafdSMike Gerdts {
313bc36eafdSMike Gerdts return (Status);
314bc36eafdSMike Gerdts }
315bc36eafdSMike Gerdts
316bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
317bc36eafdSMike Gerdts DataCount = DataCount - Subtable->Length;
318bc36eafdSMike Gerdts }
319bc36eafdSMike Gerdts break;
320bc36eafdSMike Gerdts
321bc36eafdSMike Gerdts default:
322bc36eafdSMike Gerdts
323bc36eafdSMike Gerdts for (i = 0; i < DataCount; i++)
324bc36eafdSMike Gerdts {
325bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, DataInfoTable,
326*35786f68SRobert Mustacchi &Subtable);
327bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
328bc36eafdSMike Gerdts {
329bc36eafdSMike Gerdts return (Status);
330bc36eafdSMike Gerdts }
331bc36eafdSMike Gerdts
332bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
333bc36eafdSMike Gerdts }
334bc36eafdSMike Gerdts break;
335bc36eafdSMike Gerdts }
336bc36eafdSMike Gerdts }
337bc36eafdSMike Gerdts
338bc36eafdSMike Gerdts DtPopSubtable ();
339bc36eafdSMike Gerdts }
340bc36eafdSMike Gerdts
341bc36eafdSMike Gerdts return (AE_OK);
342bc36eafdSMike Gerdts }
343bc36eafdSMike Gerdts
344bc36eafdSMike Gerdts
345bc36eafdSMike Gerdts /******************************************************************************
346bc36eafdSMike Gerdts *
347bc36eafdSMike Gerdts * FUNCTION: DtCompileCpep
348bc36eafdSMike Gerdts *
349bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
350bc36eafdSMike Gerdts *
351bc36eafdSMike Gerdts * RETURN: Status
352bc36eafdSMike Gerdts *
353bc36eafdSMike Gerdts * DESCRIPTION: Compile CPEP.
354bc36eafdSMike Gerdts *
355bc36eafdSMike Gerdts *****************************************************************************/
356bc36eafdSMike Gerdts
357bc36eafdSMike Gerdts ACPI_STATUS
DtCompileCpep(void ** List)358bc36eafdSMike Gerdts DtCompileCpep (
359bc36eafdSMike Gerdts void **List)
360bc36eafdSMike Gerdts {
361bc36eafdSMike Gerdts ACPI_STATUS Status;
362bc36eafdSMike Gerdts
363bc36eafdSMike Gerdts
364bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
365bc36eafdSMike Gerdts AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0);
366bc36eafdSMike Gerdts return (Status);
367bc36eafdSMike Gerdts }
368bc36eafdSMike Gerdts
369bc36eafdSMike Gerdts
370bc36eafdSMike Gerdts /******************************************************************************
371bc36eafdSMike Gerdts *
372bc36eafdSMike Gerdts * FUNCTION: DtCompileCsrt
373bc36eafdSMike Gerdts *
374bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
375bc36eafdSMike Gerdts *
376bc36eafdSMike Gerdts * RETURN: Status
377bc36eafdSMike Gerdts *
378bc36eafdSMike Gerdts * DESCRIPTION: Compile CSRT.
379bc36eafdSMike Gerdts *
380bc36eafdSMike Gerdts *****************************************************************************/
381bc36eafdSMike Gerdts
382bc36eafdSMike Gerdts ACPI_STATUS
DtCompileCsrt(void ** List)383bc36eafdSMike Gerdts DtCompileCsrt (
384bc36eafdSMike Gerdts void **List)
385bc36eafdSMike Gerdts {
386bc36eafdSMike Gerdts ACPI_STATUS Status = AE_OK;
387bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
388bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
389bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
390bc36eafdSMike Gerdts UINT32 DescriptorCount;
391bc36eafdSMike Gerdts UINT32 GroupLength;
392bc36eafdSMike Gerdts
393bc36eafdSMike Gerdts
394bc36eafdSMike Gerdts /* Subtables (Resource Groups) */
395bc36eafdSMike Gerdts
396bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
397bc36eafdSMike Gerdts while (*PFieldList)
398bc36eafdSMike Gerdts {
399bc36eafdSMike Gerdts /* Resource group subtable */
400bc36eafdSMike Gerdts
401bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt0,
402*35786f68SRobert Mustacchi &Subtable);
403bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
404bc36eafdSMike Gerdts {
405bc36eafdSMike Gerdts return (Status);
406bc36eafdSMike Gerdts }
407bc36eafdSMike Gerdts
408bc36eafdSMike Gerdts /* Compute the number of resource descriptors */
409bc36eafdSMike Gerdts
410bc36eafdSMike Gerdts GroupLength =
411bc36eafdSMike Gerdts (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
412bc36eafdSMike Gerdts Subtable->Buffer))->Length -
413bc36eafdSMike Gerdts (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
414bc36eafdSMike Gerdts Subtable->Buffer))->SharedInfoLength -
415bc36eafdSMike Gerdts sizeof (ACPI_CSRT_GROUP);
416bc36eafdSMike Gerdts
417bc36eafdSMike Gerdts DescriptorCount = (GroupLength /
418bc36eafdSMike Gerdts sizeof (ACPI_CSRT_DESCRIPTOR));
419bc36eafdSMike Gerdts
420bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
421bc36eafdSMike Gerdts DtPushSubtable (Subtable);
422bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
423bc36eafdSMike Gerdts
424bc36eafdSMike Gerdts /* Shared info subtable (One per resource group) */
425bc36eafdSMike Gerdts
426bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt1,
427*35786f68SRobert Mustacchi &Subtable);
428bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
429bc36eafdSMike Gerdts {
430bc36eafdSMike Gerdts return (Status);
431bc36eafdSMike Gerdts }
432bc36eafdSMike Gerdts
433bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
434bc36eafdSMike Gerdts
435bc36eafdSMike Gerdts /* Sub-Subtables (Resource Descriptors) */
436bc36eafdSMike Gerdts
437bc36eafdSMike Gerdts while (*PFieldList && DescriptorCount)
438bc36eafdSMike Gerdts {
439bc36eafdSMike Gerdts
440bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2,
441*35786f68SRobert Mustacchi &Subtable);
442bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
443bc36eafdSMike Gerdts {
444bc36eafdSMike Gerdts return (Status);
445bc36eafdSMike Gerdts }
446bc36eafdSMike Gerdts
447bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
448bc36eafdSMike Gerdts
449bc36eafdSMike Gerdts DtPushSubtable (Subtable);
450bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
451bc36eafdSMike Gerdts if (*PFieldList)
452bc36eafdSMike Gerdts {
453bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a,
454*35786f68SRobert Mustacchi &Subtable);
455bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
456bc36eafdSMike Gerdts {
457bc36eafdSMike Gerdts return (Status);
458bc36eafdSMike Gerdts }
459bc36eafdSMike Gerdts if (Subtable)
460bc36eafdSMike Gerdts {
461bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
462bc36eafdSMike Gerdts }
463bc36eafdSMike Gerdts }
464bc36eafdSMike Gerdts
465bc36eafdSMike Gerdts DtPopSubtable ();
466bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
467bc36eafdSMike Gerdts DescriptorCount--;
468bc36eafdSMike Gerdts }
469bc36eafdSMike Gerdts
470bc36eafdSMike Gerdts DtPopSubtable ();
471bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
472bc36eafdSMike Gerdts }
473bc36eafdSMike Gerdts
474bc36eafdSMike Gerdts return (Status);
475bc36eafdSMike Gerdts }
476bc36eafdSMike Gerdts
477bc36eafdSMike Gerdts
478bc36eafdSMike Gerdts /******************************************************************************
479bc36eafdSMike Gerdts *
480bc36eafdSMike Gerdts * FUNCTION: DtCompileDbg2
481bc36eafdSMike Gerdts *
482bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
483bc36eafdSMike Gerdts *
484bc36eafdSMike Gerdts * RETURN: Status
485bc36eafdSMike Gerdts *
486bc36eafdSMike Gerdts * DESCRIPTION: Compile DBG2.
487bc36eafdSMike Gerdts *
488bc36eafdSMike Gerdts *****************************************************************************/
489bc36eafdSMike Gerdts
490bc36eafdSMike Gerdts ACPI_STATUS
DtCompileDbg2(void ** List)491bc36eafdSMike Gerdts DtCompileDbg2 (
492bc36eafdSMike Gerdts void **List)
493bc36eafdSMike Gerdts {
494bc36eafdSMike Gerdts ACPI_STATUS Status;
495bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
496bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
497bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
498bc36eafdSMike Gerdts UINT32 SubtableCount;
499bc36eafdSMike Gerdts ACPI_DBG2_HEADER *Dbg2Header;
500bc36eafdSMike Gerdts ACPI_DBG2_DEVICE *DeviceInfo;
501bc36eafdSMike Gerdts UINT16 CurrentOffset;
502bc36eafdSMike Gerdts UINT32 i;
503bc36eafdSMike Gerdts
504bc36eafdSMike Gerdts
505bc36eafdSMike Gerdts /* Main table */
506bc36eafdSMike Gerdts
507*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2, &Subtable);
508bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
509bc36eafdSMike Gerdts {
510bc36eafdSMike Gerdts return (Status);
511bc36eafdSMike Gerdts }
512bc36eafdSMike Gerdts
513bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
514bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
515bc36eafdSMike Gerdts
516bc36eafdSMike Gerdts /* Main table fields */
517bc36eafdSMike Gerdts
518bc36eafdSMike Gerdts Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
519bc36eafdSMike Gerdts Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
520bc36eafdSMike Gerdts ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
521bc36eafdSMike Gerdts
522bc36eafdSMike Gerdts SubtableCount = Dbg2Header->InfoCount;
523bc36eafdSMike Gerdts DtPushSubtable (Subtable);
524bc36eafdSMike Gerdts
525bc36eafdSMike Gerdts /* Process all Device Information subtables (Count = InfoCount) */
526bc36eafdSMike Gerdts
527bc36eafdSMike Gerdts while (*PFieldList && SubtableCount)
528bc36eafdSMike Gerdts {
529bc36eafdSMike Gerdts /* Subtable: Debug Device Information */
530bc36eafdSMike Gerdts
531bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Device,
532*35786f68SRobert Mustacchi &Subtable);
533bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
534bc36eafdSMike Gerdts {
535bc36eafdSMike Gerdts return (Status);
536bc36eafdSMike Gerdts }
537bc36eafdSMike Gerdts
538bc36eafdSMike Gerdts DeviceInfo = ACPI_CAST_PTR (ACPI_DBG2_DEVICE, Subtable->Buffer);
539bc36eafdSMike Gerdts CurrentOffset = (UINT16) sizeof (ACPI_DBG2_DEVICE);
540bc36eafdSMike Gerdts
541bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
542bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
543bc36eafdSMike Gerdts DtPushSubtable (Subtable);
544bc36eafdSMike Gerdts
545bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
546bc36eafdSMike Gerdts
547bc36eafdSMike Gerdts /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
548bc36eafdSMike Gerdts
549bc36eafdSMike Gerdts DeviceInfo->BaseAddressOffset = CurrentOffset;
550bc36eafdSMike Gerdts for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
551bc36eafdSMike Gerdts {
552bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
553*35786f68SRobert Mustacchi &Subtable);
554bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
555bc36eafdSMike Gerdts {
556bc36eafdSMike Gerdts return (Status);
557bc36eafdSMike Gerdts }
558bc36eafdSMike Gerdts
559bc36eafdSMike Gerdts CurrentOffset += (UINT16) sizeof (ACPI_GENERIC_ADDRESS);
560bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
561bc36eafdSMike Gerdts }
562bc36eafdSMike Gerdts
563bc36eafdSMike Gerdts /* AddressSize array (Required, size = RegisterCount) */
564bc36eafdSMike Gerdts
565bc36eafdSMike Gerdts DeviceInfo->AddressSizeOffset = CurrentOffset;
566bc36eafdSMike Gerdts for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
567bc36eafdSMike Gerdts {
568bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
569*35786f68SRobert Mustacchi &Subtable);
570bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
571bc36eafdSMike Gerdts {
572bc36eafdSMike Gerdts return (Status);
573bc36eafdSMike Gerdts }
574bc36eafdSMike Gerdts
575bc36eafdSMike Gerdts CurrentOffset += (UINT16) sizeof (UINT32);
576bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
577bc36eafdSMike Gerdts }
578bc36eafdSMike Gerdts
579bc36eafdSMike Gerdts /* NamespaceString device identifier (Required, size = NamePathLength) */
580bc36eafdSMike Gerdts
581bc36eafdSMike Gerdts DeviceInfo->NamepathOffset = CurrentOffset;
582bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
583*35786f68SRobert Mustacchi &Subtable);
584bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
585bc36eafdSMike Gerdts {
586bc36eafdSMike Gerdts return (Status);
587bc36eafdSMike Gerdts }
588bc36eafdSMike Gerdts
589bc36eafdSMike Gerdts /* Update the device info header */
590bc36eafdSMike Gerdts
591bc36eafdSMike Gerdts DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
592bc36eafdSMike Gerdts CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
593bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
594bc36eafdSMike Gerdts
595bc36eafdSMike Gerdts /* OemData - Variable-length data (Optional, size = OemDataLength) */
596bc36eafdSMike Gerdts
597bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData,
598*35786f68SRobert Mustacchi &Subtable);
599*35786f68SRobert Mustacchi if (Status == AE_END_OF_TABLE)
600*35786f68SRobert Mustacchi {
601*35786f68SRobert Mustacchi /* optional field was not found and we're at the end of the file */
602*35786f68SRobert Mustacchi
603*35786f68SRobert Mustacchi goto subtableDone;
604*35786f68SRobert Mustacchi }
605*35786f68SRobert Mustacchi else if (ACPI_FAILURE (Status))
606bc36eafdSMike Gerdts {
607bc36eafdSMike Gerdts return (Status);
608bc36eafdSMike Gerdts }
609bc36eafdSMike Gerdts
610bc36eafdSMike Gerdts /* Update the device info header (zeros if no OEM data present) */
611bc36eafdSMike Gerdts
612bc36eafdSMike Gerdts DeviceInfo->OemDataOffset = 0;
613bc36eafdSMike Gerdts DeviceInfo->OemDataLength = 0;
614bc36eafdSMike Gerdts
615bc36eafdSMike Gerdts /* Optional subtable (OemData) */
616bc36eafdSMike Gerdts
617bc36eafdSMike Gerdts if (Subtable && Subtable->Length)
618bc36eafdSMike Gerdts {
619bc36eafdSMike Gerdts DeviceInfo->OemDataOffset = CurrentOffset;
620bc36eafdSMike Gerdts DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
621bc36eafdSMike Gerdts
622bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
623bc36eafdSMike Gerdts }
624*35786f68SRobert Mustacchi subtableDone:
625bc36eafdSMike Gerdts SubtableCount--;
626bc36eafdSMike Gerdts DtPopSubtable (); /* Get next Device Information subtable */
627bc36eafdSMike Gerdts }
628bc36eafdSMike Gerdts
629bc36eafdSMike Gerdts DtPopSubtable ();
630bc36eafdSMike Gerdts return (AE_OK);
631bc36eafdSMike Gerdts }
632bc36eafdSMike Gerdts
633bc36eafdSMike Gerdts
634bc36eafdSMike Gerdts /******************************************************************************
635bc36eafdSMike Gerdts *
636bc36eafdSMike Gerdts * FUNCTION: DtCompileDmar
637bc36eafdSMike Gerdts *
638bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
639bc36eafdSMike Gerdts *
640bc36eafdSMike Gerdts * RETURN: Status
641bc36eafdSMike Gerdts *
642bc36eafdSMike Gerdts * DESCRIPTION: Compile DMAR.
643bc36eafdSMike Gerdts *
644bc36eafdSMike Gerdts *****************************************************************************/
645bc36eafdSMike Gerdts
646bc36eafdSMike Gerdts ACPI_STATUS
DtCompileDmar(void ** List)647bc36eafdSMike Gerdts DtCompileDmar (
648bc36eafdSMike Gerdts void **List)
649bc36eafdSMike Gerdts {
650bc36eafdSMike Gerdts ACPI_STATUS Status;
651bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
652bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
653bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
654bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
655bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
656bc36eafdSMike Gerdts ACPI_DMAR_HEADER *DmarHeader;
657bc36eafdSMike Gerdts ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
658bc36eafdSMike Gerdts UINT32 DeviceScopeLength;
659bc36eafdSMike Gerdts UINT32 PciPathLength;
660bc36eafdSMike Gerdts
661bc36eafdSMike Gerdts
662*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
663bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
664bc36eafdSMike Gerdts {
665bc36eafdSMike Gerdts return (Status);
666bc36eafdSMike Gerdts }
667bc36eafdSMike Gerdts
668bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
669bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
670bc36eafdSMike Gerdts DtPushSubtable (Subtable);
671bc36eafdSMike Gerdts
672bc36eafdSMike Gerdts while (*PFieldList)
673bc36eafdSMike Gerdts {
674bc36eafdSMike Gerdts /* DMAR Header */
675bc36eafdSMike Gerdts
676bc36eafdSMike Gerdts SubtableStart = *PFieldList;
677bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr,
678*35786f68SRobert Mustacchi &Subtable);
679bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
680bc36eafdSMike Gerdts {
681bc36eafdSMike Gerdts return (Status);
682bc36eafdSMike Gerdts }
683bc36eafdSMike Gerdts
684bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
685bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
686bc36eafdSMike Gerdts DtPushSubtable (Subtable);
687bc36eafdSMike Gerdts
688bc36eafdSMike Gerdts DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
689bc36eafdSMike Gerdts
690bc36eafdSMike Gerdts switch (DmarHeader->Type)
691bc36eafdSMike Gerdts {
692bc36eafdSMike Gerdts case ACPI_DMAR_TYPE_HARDWARE_UNIT:
693bc36eafdSMike Gerdts
694bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoDmar0;
695bc36eafdSMike Gerdts break;
696bc36eafdSMike Gerdts
697bc36eafdSMike Gerdts case ACPI_DMAR_TYPE_RESERVED_MEMORY:
698bc36eafdSMike Gerdts
699bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoDmar1;
700bc36eafdSMike Gerdts break;
701bc36eafdSMike Gerdts
702bc36eafdSMike Gerdts case ACPI_DMAR_TYPE_ROOT_ATS:
703bc36eafdSMike Gerdts
704bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoDmar2;
705bc36eafdSMike Gerdts break;
706bc36eafdSMike Gerdts
707bc36eafdSMike Gerdts case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
708bc36eafdSMike Gerdts
709bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoDmar3;
710bc36eafdSMike Gerdts break;
711bc36eafdSMike Gerdts
712bc36eafdSMike Gerdts case ACPI_DMAR_TYPE_NAMESPACE:
713bc36eafdSMike Gerdts
714bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoDmar4;
715bc36eafdSMike Gerdts break;
716bc36eafdSMike Gerdts
717bc36eafdSMike Gerdts default:
718bc36eafdSMike Gerdts
719bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR");
720bc36eafdSMike Gerdts return (AE_ERROR);
721bc36eafdSMike Gerdts }
722bc36eafdSMike Gerdts
723bc36eafdSMike Gerdts /* DMAR Subtable */
724bc36eafdSMike Gerdts
725*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
726bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
727bc36eafdSMike Gerdts {
728bc36eafdSMike Gerdts return (Status);
729bc36eafdSMike Gerdts }
730bc36eafdSMike Gerdts
731bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
732bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
733bc36eafdSMike Gerdts
734bc36eafdSMike Gerdts /*
735bc36eafdSMike Gerdts * Optional Device Scope subtables
736bc36eafdSMike Gerdts */
737bc36eafdSMike Gerdts if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
738bc36eafdSMike Gerdts (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
739bc36eafdSMike Gerdts {
740bc36eafdSMike Gerdts /* These types do not support device scopes */
741bc36eafdSMike Gerdts
742bc36eafdSMike Gerdts DtPopSubtable ();
743bc36eafdSMike Gerdts continue;
744bc36eafdSMike Gerdts }
745bc36eafdSMike Gerdts
746bc36eafdSMike Gerdts DtPushSubtable (Subtable);
747bc36eafdSMike Gerdts DeviceScopeLength = DmarHeader->Length - Subtable->Length -
748bc36eafdSMike Gerdts ParentTable->Length;
749bc36eafdSMike Gerdts while (DeviceScopeLength)
750bc36eafdSMike Gerdts {
751bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
752*35786f68SRobert Mustacchi &Subtable);
753bc36eafdSMike Gerdts if (Status == AE_NOT_FOUND)
754bc36eafdSMike Gerdts {
755bc36eafdSMike Gerdts break;
756bc36eafdSMike Gerdts }
757bc36eafdSMike Gerdts
758bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
759bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
760bc36eafdSMike Gerdts DtPushSubtable (Subtable);
761bc36eafdSMike Gerdts
762bc36eafdSMike Gerdts DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer);
763bc36eafdSMike Gerdts
764bc36eafdSMike Gerdts /* Optional PCI Paths */
765bc36eafdSMike Gerdts
766bc36eafdSMike Gerdts PciPathLength = DmarDeviceScope->Length - Subtable->Length;
767bc36eafdSMike Gerdts while (PciPathLength)
768bc36eafdSMike Gerdts {
769bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
770*35786f68SRobert Mustacchi &Subtable);
771bc36eafdSMike Gerdts if (Status == AE_NOT_FOUND)
772bc36eafdSMike Gerdts {
773bc36eafdSMike Gerdts DtPopSubtable ();
774bc36eafdSMike Gerdts break;
775bc36eafdSMike Gerdts }
776bc36eafdSMike Gerdts
777bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
778bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
779bc36eafdSMike Gerdts PciPathLength -= Subtable->Length;
780bc36eafdSMike Gerdts }
781bc36eafdSMike Gerdts
782bc36eafdSMike Gerdts DtPopSubtable ();
783bc36eafdSMike Gerdts DeviceScopeLength -= DmarDeviceScope->Length;
784bc36eafdSMike Gerdts }
785bc36eafdSMike Gerdts
786bc36eafdSMike Gerdts DtPopSubtable ();
787bc36eafdSMike Gerdts DtPopSubtable ();
788bc36eafdSMike Gerdts }
789bc36eafdSMike Gerdts
790bc36eafdSMike Gerdts return (AE_OK);
791bc36eafdSMike Gerdts }
792bc36eafdSMike Gerdts
793bc36eafdSMike Gerdts
794bc36eafdSMike Gerdts /******************************************************************************
795bc36eafdSMike Gerdts *
796bc36eafdSMike Gerdts * FUNCTION: DtCompileDrtm
797bc36eafdSMike Gerdts *
798bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
799bc36eafdSMike Gerdts *
800bc36eafdSMike Gerdts * RETURN: Status
801bc36eafdSMike Gerdts *
802bc36eafdSMike Gerdts * DESCRIPTION: Compile DRTM.
803bc36eafdSMike Gerdts *
804bc36eafdSMike Gerdts *****************************************************************************/
805bc36eafdSMike Gerdts
806bc36eafdSMike Gerdts ACPI_STATUS
DtCompileDrtm(void ** List)807bc36eafdSMike Gerdts DtCompileDrtm (
808bc36eafdSMike Gerdts void **List)
809bc36eafdSMike Gerdts {
810bc36eafdSMike Gerdts ACPI_STATUS Status;
811bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
812bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
813bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
814bc36eafdSMike Gerdts UINT32 Count;
815bc36eafdSMike Gerdts /* ACPI_TABLE_DRTM *Drtm; */
816bc36eafdSMike Gerdts ACPI_DRTM_VTABLE_LIST *DrtmVtl;
817bc36eafdSMike Gerdts ACPI_DRTM_RESOURCE_LIST *DrtmRl;
818bc36eafdSMike Gerdts /* ACPI_DRTM_DPS_ID *DrtmDps; */
819bc36eafdSMike Gerdts
820bc36eafdSMike Gerdts
821bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
822bc36eafdSMike Gerdts
823bc36eafdSMike Gerdts /* Compile DRTM header */
824bc36eafdSMike Gerdts
825bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm,
826*35786f68SRobert Mustacchi &Subtable);
827bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
828bc36eafdSMike Gerdts {
829bc36eafdSMike Gerdts return (Status);
830bc36eafdSMike Gerdts }
831bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
832bc36eafdSMike Gerdts
833bc36eafdSMike Gerdts /*
834bc36eafdSMike Gerdts * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care
835bc36eafdSMike Gerdts * should be taken to avoid accessing ACPI_TABLE_HADER fields.
836bc36eafdSMike Gerdts */
837bc36eafdSMike Gerdts #if 0
838bc36eafdSMike Gerdts Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM,
839bc36eafdSMike Gerdts Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
840bc36eafdSMike Gerdts #endif
841bc36eafdSMike Gerdts /* Compile VTL */
842bc36eafdSMike Gerdts
843bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0,
844*35786f68SRobert Mustacchi &Subtable);
845bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
846bc36eafdSMike Gerdts {
847bc36eafdSMike Gerdts return (Status);
848bc36eafdSMike Gerdts }
849bc36eafdSMike Gerdts
850bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
851bc36eafdSMike Gerdts DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer);
852bc36eafdSMike Gerdts
853bc36eafdSMike Gerdts DtPushSubtable (Subtable);
854bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
855bc36eafdSMike Gerdts Count = 0;
856bc36eafdSMike Gerdts
857bc36eafdSMike Gerdts while (*PFieldList)
858bc36eafdSMike Gerdts {
859bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a,
860*35786f68SRobert Mustacchi &Subtable);
861bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
862bc36eafdSMike Gerdts {
863bc36eafdSMike Gerdts return (Status);
864bc36eafdSMike Gerdts }
865bc36eafdSMike Gerdts if (!Subtable)
866bc36eafdSMike Gerdts {
867bc36eafdSMike Gerdts break;
868bc36eafdSMike Gerdts }
869bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
870bc36eafdSMike Gerdts Count++;
871bc36eafdSMike Gerdts }
872bc36eafdSMike Gerdts
873bc36eafdSMike Gerdts DrtmVtl->ValidatedTableCount = Count;
874bc36eafdSMike Gerdts DtPopSubtable ();
875bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
876bc36eafdSMike Gerdts
877bc36eafdSMike Gerdts /* Compile RL */
878bc36eafdSMike Gerdts
879bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1,
880*35786f68SRobert Mustacchi &Subtable);
881bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
882bc36eafdSMike Gerdts {
883bc36eafdSMike Gerdts return (Status);
884bc36eafdSMike Gerdts }
885bc36eafdSMike Gerdts
886bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
887bc36eafdSMike Gerdts DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer);
888bc36eafdSMike Gerdts
889bc36eafdSMike Gerdts DtPushSubtable (Subtable);
890bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
891bc36eafdSMike Gerdts Count = 0;
892bc36eafdSMike Gerdts
893bc36eafdSMike Gerdts while (*PFieldList)
894bc36eafdSMike Gerdts {
895bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a,
896*35786f68SRobert Mustacchi &Subtable);
897bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
898bc36eafdSMike Gerdts {
899bc36eafdSMike Gerdts return (Status);
900bc36eafdSMike Gerdts }
901bc36eafdSMike Gerdts
902bc36eafdSMike Gerdts if (!Subtable)
903bc36eafdSMike Gerdts {
904bc36eafdSMike Gerdts break;
905bc36eafdSMike Gerdts }
906bc36eafdSMike Gerdts
907bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
908bc36eafdSMike Gerdts Count++;
909bc36eafdSMike Gerdts }
910bc36eafdSMike Gerdts
911bc36eafdSMike Gerdts DrtmRl->ResourceCount = Count;
912bc36eafdSMike Gerdts DtPopSubtable ();
913bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
914bc36eafdSMike Gerdts
915bc36eafdSMike Gerdts /* Compile DPS */
916bc36eafdSMike Gerdts
917bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2,
918*35786f68SRobert Mustacchi &Subtable);
919bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
920bc36eafdSMike Gerdts {
921bc36eafdSMike Gerdts return (Status);
922bc36eafdSMike Gerdts }
923bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
924bc36eafdSMike Gerdts /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/
925bc36eafdSMike Gerdts
926bc36eafdSMike Gerdts
927bc36eafdSMike Gerdts return (AE_OK);
928bc36eafdSMike Gerdts }
929bc36eafdSMike Gerdts
930bc36eafdSMike Gerdts
931bc36eafdSMike Gerdts /******************************************************************************
932bc36eafdSMike Gerdts *
933bc36eafdSMike Gerdts * FUNCTION: DtCompileEinj
934bc36eafdSMike Gerdts *
935bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
936bc36eafdSMike Gerdts *
937bc36eafdSMike Gerdts * RETURN: Status
938bc36eafdSMike Gerdts *
939bc36eafdSMike Gerdts * DESCRIPTION: Compile EINJ.
940bc36eafdSMike Gerdts *
941bc36eafdSMike Gerdts *****************************************************************************/
942bc36eafdSMike Gerdts
943bc36eafdSMike Gerdts ACPI_STATUS
DtCompileEinj(void ** List)944bc36eafdSMike Gerdts DtCompileEinj (
945bc36eafdSMike Gerdts void **List)
946bc36eafdSMike Gerdts {
947bc36eafdSMike Gerdts ACPI_STATUS Status;
948bc36eafdSMike Gerdts
949bc36eafdSMike Gerdts
950bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
951bc36eafdSMike Gerdts AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0);
952bc36eafdSMike Gerdts return (Status);
953bc36eafdSMike Gerdts }
954bc36eafdSMike Gerdts
955bc36eafdSMike Gerdts
956bc36eafdSMike Gerdts /******************************************************************************
957bc36eafdSMike Gerdts *
958bc36eafdSMike Gerdts * FUNCTION: DtCompileErst
959bc36eafdSMike Gerdts *
960bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
961bc36eafdSMike Gerdts *
962bc36eafdSMike Gerdts * RETURN: Status
963bc36eafdSMike Gerdts *
964bc36eafdSMike Gerdts * DESCRIPTION: Compile ERST.
965bc36eafdSMike Gerdts *
966bc36eafdSMike Gerdts *****************************************************************************/
967bc36eafdSMike Gerdts
968bc36eafdSMike Gerdts ACPI_STATUS
DtCompileErst(void ** List)969bc36eafdSMike Gerdts DtCompileErst (
970bc36eafdSMike Gerdts void **List)
971bc36eafdSMike Gerdts {
972bc36eafdSMike Gerdts ACPI_STATUS Status;
973bc36eafdSMike Gerdts
974bc36eafdSMike Gerdts
975bc36eafdSMike Gerdts Status = DtCompileTwoSubtables (List,
976bc36eafdSMike Gerdts AcpiDmTableInfoErst, AcpiDmTableInfoEinj0);
977bc36eafdSMike Gerdts return (Status);
978bc36eafdSMike Gerdts }
979bc36eafdSMike Gerdts
980bc36eafdSMike Gerdts
981bc36eafdSMike Gerdts /******************************************************************************
982bc36eafdSMike Gerdts *
983bc36eafdSMike Gerdts * FUNCTION: DtCompileGtdt
984bc36eafdSMike Gerdts *
985bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
986bc36eafdSMike Gerdts *
987bc36eafdSMike Gerdts * RETURN: Status
988bc36eafdSMike Gerdts *
989bc36eafdSMike Gerdts * DESCRIPTION: Compile GTDT.
990bc36eafdSMike Gerdts *
991bc36eafdSMike Gerdts *****************************************************************************/
992bc36eafdSMike Gerdts
993bc36eafdSMike Gerdts ACPI_STATUS
DtCompileGtdt(void ** List)994bc36eafdSMike Gerdts DtCompileGtdt (
995bc36eafdSMike Gerdts void **List)
996bc36eafdSMike Gerdts {
997bc36eafdSMike Gerdts ACPI_STATUS Status;
998bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
999bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1000bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1001bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1002bc36eafdSMike Gerdts ACPI_SUBTABLE_HEADER *GtdtHeader;
1003bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
1004bc36eafdSMike Gerdts UINT32 GtCount;
1005bc36eafdSMike Gerdts
1006bc36eafdSMike Gerdts
1007bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt,
1008*35786f68SRobert Mustacchi &Subtable);
1009bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1010bc36eafdSMike Gerdts {
1011bc36eafdSMike Gerdts return (Status);
1012bc36eafdSMike Gerdts }
1013bc36eafdSMike Gerdts
1014bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1015bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1016bc36eafdSMike Gerdts
1017bc36eafdSMike Gerdts while (*PFieldList)
1018bc36eafdSMike Gerdts {
1019bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1020bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdtHdr,
1021*35786f68SRobert Mustacchi &Subtable);
1022bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1023bc36eafdSMike Gerdts {
1024bc36eafdSMike Gerdts return (Status);
1025bc36eafdSMike Gerdts }
1026bc36eafdSMike Gerdts
1027bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1028bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1029bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1030bc36eafdSMike Gerdts
1031bc36eafdSMike Gerdts GtdtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1032bc36eafdSMike Gerdts
1033bc36eafdSMike Gerdts switch (GtdtHeader->Type)
1034bc36eafdSMike Gerdts {
1035bc36eafdSMike Gerdts case ACPI_GTDT_TYPE_TIMER_BLOCK:
1036bc36eafdSMike Gerdts
1037bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoGtdt0;
1038bc36eafdSMike Gerdts break;
1039bc36eafdSMike Gerdts
1040bc36eafdSMike Gerdts case ACPI_GTDT_TYPE_WATCHDOG:
1041bc36eafdSMike Gerdts
1042bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoGtdt1;
1043bc36eafdSMike Gerdts break;
1044bc36eafdSMike Gerdts
1045bc36eafdSMike Gerdts default:
1046bc36eafdSMike Gerdts
1047bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "GTDT");
1048bc36eafdSMike Gerdts return (AE_ERROR);
1049bc36eafdSMike Gerdts }
1050bc36eafdSMike Gerdts
1051*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1052bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1053bc36eafdSMike Gerdts {
1054bc36eafdSMike Gerdts return (Status);
1055bc36eafdSMike Gerdts }
1056bc36eafdSMike Gerdts
1057bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1058bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1059bc36eafdSMike Gerdts
1060bc36eafdSMike Gerdts /*
1061bc36eafdSMike Gerdts * Additional GT block subtable data
1062bc36eafdSMike Gerdts */
1063bc36eafdSMike Gerdts
1064bc36eafdSMike Gerdts switch (GtdtHeader->Type)
1065bc36eafdSMike Gerdts {
1066bc36eafdSMike Gerdts case ACPI_GTDT_TYPE_TIMER_BLOCK:
1067bc36eafdSMike Gerdts
1068bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1069bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1070bc36eafdSMike Gerdts
1071bc36eafdSMike Gerdts GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1072bc36eafdSMike Gerdts Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
1073bc36eafdSMike Gerdts
1074bc36eafdSMike Gerdts while (GtCount)
1075bc36eafdSMike Gerdts {
1076bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt0a,
1077*35786f68SRobert Mustacchi &Subtable);
1078bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1079bc36eafdSMike Gerdts {
1080bc36eafdSMike Gerdts return (Status);
1081bc36eafdSMike Gerdts }
1082bc36eafdSMike Gerdts
1083bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1084bc36eafdSMike Gerdts GtCount--;
1085bc36eafdSMike Gerdts }
1086bc36eafdSMike Gerdts
1087bc36eafdSMike Gerdts DtPopSubtable ();
1088bc36eafdSMike Gerdts break;
1089bc36eafdSMike Gerdts
1090bc36eafdSMike Gerdts default:
1091bc36eafdSMike Gerdts
1092bc36eafdSMike Gerdts break;
1093bc36eafdSMike Gerdts }
1094bc36eafdSMike Gerdts
1095bc36eafdSMike Gerdts DtPopSubtable ();
1096bc36eafdSMike Gerdts }
1097bc36eafdSMike Gerdts
1098bc36eafdSMike Gerdts return (AE_OK);
1099bc36eafdSMike Gerdts }
1100bc36eafdSMike Gerdts
1101bc36eafdSMike Gerdts
1102bc36eafdSMike Gerdts /******************************************************************************
1103bc36eafdSMike Gerdts *
1104bc36eafdSMike Gerdts * FUNCTION: DtCompileFpdt
1105bc36eafdSMike Gerdts *
1106bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1107bc36eafdSMike Gerdts *
1108bc36eafdSMike Gerdts * RETURN: Status
1109bc36eafdSMike Gerdts *
1110bc36eafdSMike Gerdts * DESCRIPTION: Compile FPDT.
1111bc36eafdSMike Gerdts *
1112bc36eafdSMike Gerdts *****************************************************************************/
1113bc36eafdSMike Gerdts
1114bc36eafdSMike Gerdts ACPI_STATUS
DtCompileFpdt(void ** List)1115bc36eafdSMike Gerdts DtCompileFpdt (
1116bc36eafdSMike Gerdts void **List)
1117bc36eafdSMike Gerdts {
1118bc36eafdSMike Gerdts ACPI_STATUS Status;
1119bc36eafdSMike Gerdts ACPI_FPDT_HEADER *FpdtHeader;
1120bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1121bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1122bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
1123bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1124bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1125bc36eafdSMike Gerdts
1126bc36eafdSMike Gerdts
1127bc36eafdSMike Gerdts while (*PFieldList)
1128bc36eafdSMike Gerdts {
1129bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1130bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoFpdtHdr,
1131*35786f68SRobert Mustacchi &Subtable);
1132bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1133bc36eafdSMike Gerdts {
1134bc36eafdSMike Gerdts return (Status);
1135bc36eafdSMike Gerdts }
1136bc36eafdSMike Gerdts
1137bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1138bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1139bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1140bc36eafdSMike Gerdts
1141bc36eafdSMike Gerdts FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1142bc36eafdSMike Gerdts
1143bc36eafdSMike Gerdts switch (FpdtHeader->Type)
1144bc36eafdSMike Gerdts {
1145bc36eafdSMike Gerdts case ACPI_FPDT_TYPE_BOOT:
1146bc36eafdSMike Gerdts
1147bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoFpdt0;
1148bc36eafdSMike Gerdts break;
1149bc36eafdSMike Gerdts
1150bc36eafdSMike Gerdts case ACPI_FPDT_TYPE_S3PERF:
1151bc36eafdSMike Gerdts
1152bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoFpdt1;
1153bc36eafdSMike Gerdts break;
1154bc36eafdSMike Gerdts
1155bc36eafdSMike Gerdts default:
1156bc36eafdSMike Gerdts
1157bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "FPDT");
1158bc36eafdSMike Gerdts return (AE_ERROR);
1159bc36eafdSMike Gerdts break;
1160bc36eafdSMike Gerdts }
1161bc36eafdSMike Gerdts
1162*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1163bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1164bc36eafdSMike Gerdts {
1165bc36eafdSMike Gerdts return (Status);
1166bc36eafdSMike Gerdts }
1167bc36eafdSMike Gerdts
1168bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1169bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1170bc36eafdSMike Gerdts DtPopSubtable ();
1171bc36eafdSMike Gerdts }
1172bc36eafdSMike Gerdts
1173bc36eafdSMike Gerdts return (AE_OK);
1174bc36eafdSMike Gerdts }
1175bc36eafdSMike Gerdts
1176bc36eafdSMike Gerdts
1177bc36eafdSMike Gerdts /******************************************************************************
1178bc36eafdSMike Gerdts *
1179bc36eafdSMike Gerdts * FUNCTION: DtCompileHest
1180bc36eafdSMike Gerdts *
1181bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1182bc36eafdSMike Gerdts *
1183bc36eafdSMike Gerdts * RETURN: Status
1184bc36eafdSMike Gerdts *
1185bc36eafdSMike Gerdts * DESCRIPTION: Compile HEST.
1186bc36eafdSMike Gerdts *
1187bc36eafdSMike Gerdts *****************************************************************************/
1188bc36eafdSMike Gerdts
1189bc36eafdSMike Gerdts ACPI_STATUS
DtCompileHest(void ** List)1190bc36eafdSMike Gerdts DtCompileHest (
1191bc36eafdSMike Gerdts void **List)
1192bc36eafdSMike Gerdts {
1193bc36eafdSMike Gerdts ACPI_STATUS Status;
1194bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1195bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1196bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1197bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1198bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
1199bc36eafdSMike Gerdts UINT16 Type;
1200bc36eafdSMike Gerdts UINT32 BankCount;
1201bc36eafdSMike Gerdts
1202bc36eafdSMike Gerdts
1203bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
1204*35786f68SRobert Mustacchi &Subtable);
1205bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1206bc36eafdSMike Gerdts {
1207bc36eafdSMike Gerdts return (Status);
1208bc36eafdSMike Gerdts }
1209bc36eafdSMike Gerdts
1210bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1211bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1212bc36eafdSMike Gerdts
1213bc36eafdSMike Gerdts while (*PFieldList)
1214bc36eafdSMike Gerdts {
1215bc36eafdSMike Gerdts /* Get subtable type */
1216bc36eafdSMike Gerdts
1217bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1218bc36eafdSMike Gerdts DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
1219bc36eafdSMike Gerdts
1220bc36eafdSMike Gerdts switch (Type)
1221bc36eafdSMike Gerdts {
1222bc36eafdSMike Gerdts case ACPI_HEST_TYPE_IA32_CHECK:
1223bc36eafdSMike Gerdts
1224bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest0;
1225bc36eafdSMike Gerdts break;
1226bc36eafdSMike Gerdts
1227bc36eafdSMike Gerdts case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1228bc36eafdSMike Gerdts
1229bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest1;
1230bc36eafdSMike Gerdts break;
1231bc36eafdSMike Gerdts
1232bc36eafdSMike Gerdts case ACPI_HEST_TYPE_IA32_NMI:
1233bc36eafdSMike Gerdts
1234bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest2;
1235bc36eafdSMike Gerdts break;
1236bc36eafdSMike Gerdts
1237bc36eafdSMike Gerdts case ACPI_HEST_TYPE_AER_ROOT_PORT:
1238bc36eafdSMike Gerdts
1239bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest6;
1240bc36eafdSMike Gerdts break;
1241bc36eafdSMike Gerdts
1242bc36eafdSMike Gerdts case ACPI_HEST_TYPE_AER_ENDPOINT:
1243bc36eafdSMike Gerdts
1244bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest7;
1245bc36eafdSMike Gerdts break;
1246bc36eafdSMike Gerdts
1247bc36eafdSMike Gerdts case ACPI_HEST_TYPE_AER_BRIDGE:
1248bc36eafdSMike Gerdts
1249bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest8;
1250bc36eafdSMike Gerdts break;
1251bc36eafdSMike Gerdts
1252bc36eafdSMike Gerdts case ACPI_HEST_TYPE_GENERIC_ERROR:
1253bc36eafdSMike Gerdts
1254bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoHest9;
1255bc36eafdSMike Gerdts break;
1256bc36eafdSMike Gerdts
1257*35786f68SRobert Mustacchi case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1258*35786f68SRobert Mustacchi
1259*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoHest10;
1260*35786f68SRobert Mustacchi break;
1261*35786f68SRobert Mustacchi
1262*35786f68SRobert Mustacchi case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1263*35786f68SRobert Mustacchi
1264*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoHest11;
1265*35786f68SRobert Mustacchi break;
1266*35786f68SRobert Mustacchi
1267bc36eafdSMike Gerdts default:
1268bc36eafdSMike Gerdts
1269bc36eafdSMike Gerdts /* Cannot continue on unknown type */
1270bc36eafdSMike Gerdts
1271bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST");
1272bc36eafdSMike Gerdts return (AE_ERROR);
1273bc36eafdSMike Gerdts }
1274bc36eafdSMike Gerdts
1275*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1276bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1277bc36eafdSMike Gerdts {
1278bc36eafdSMike Gerdts return (Status);
1279bc36eafdSMike Gerdts }
1280bc36eafdSMike Gerdts
1281bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1282bc36eafdSMike Gerdts
1283bc36eafdSMike Gerdts /*
1284bc36eafdSMike Gerdts * Additional subtable data - IA32 Error Bank(s)
1285bc36eafdSMike Gerdts */
1286bc36eafdSMike Gerdts BankCount = 0;
1287bc36eafdSMike Gerdts switch (Type)
1288bc36eafdSMike Gerdts {
1289bc36eafdSMike Gerdts case ACPI_HEST_TYPE_IA32_CHECK:
1290bc36eafdSMike Gerdts
1291bc36eafdSMike Gerdts BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1292bc36eafdSMike Gerdts Subtable->Buffer))->NumHardwareBanks;
1293bc36eafdSMike Gerdts break;
1294bc36eafdSMike Gerdts
1295bc36eafdSMike Gerdts case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1296bc36eafdSMike Gerdts
1297bc36eafdSMike Gerdts BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1298bc36eafdSMike Gerdts Subtable->Buffer))->NumHardwareBanks;
1299bc36eafdSMike Gerdts break;
1300bc36eafdSMike Gerdts
1301*35786f68SRobert Mustacchi case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1302*35786f68SRobert Mustacchi
1303*35786f68SRobert Mustacchi BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK,
1304*35786f68SRobert Mustacchi Subtable->Buffer))->NumHardwareBanks;
1305*35786f68SRobert Mustacchi break;
1306*35786f68SRobert Mustacchi
1307bc36eafdSMike Gerdts default:
1308bc36eafdSMike Gerdts
1309bc36eafdSMike Gerdts break;
1310bc36eafdSMike Gerdts }
1311bc36eafdSMike Gerdts
1312bc36eafdSMike Gerdts while (BankCount)
1313bc36eafdSMike Gerdts {
1314bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank,
1315*35786f68SRobert Mustacchi &Subtable);
1316bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1317bc36eafdSMike Gerdts {
1318bc36eafdSMike Gerdts return (Status);
1319bc36eafdSMike Gerdts }
1320bc36eafdSMike Gerdts
1321bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1322bc36eafdSMike Gerdts BankCount--;
1323bc36eafdSMike Gerdts }
1324bc36eafdSMike Gerdts }
1325bc36eafdSMike Gerdts
1326bc36eafdSMike Gerdts return (AE_OK);
1327bc36eafdSMike Gerdts }
1328bc36eafdSMike Gerdts
1329bc36eafdSMike Gerdts
1330bc36eafdSMike Gerdts /******************************************************************************
1331bc36eafdSMike Gerdts *
1332*35786f68SRobert Mustacchi * FUNCTION: DtCompileHmat
1333*35786f68SRobert Mustacchi *
1334*35786f68SRobert Mustacchi * PARAMETERS: List - Current field list pointer
1335*35786f68SRobert Mustacchi *
1336*35786f68SRobert Mustacchi * RETURN: Status
1337*35786f68SRobert Mustacchi *
1338*35786f68SRobert Mustacchi * DESCRIPTION: Compile HMAT.
1339*35786f68SRobert Mustacchi *
1340*35786f68SRobert Mustacchi *****************************************************************************/
1341*35786f68SRobert Mustacchi
1342*35786f68SRobert Mustacchi ACPI_STATUS
DtCompileHmat(void ** List)1343*35786f68SRobert Mustacchi DtCompileHmat (
1344*35786f68SRobert Mustacchi void **List)
1345*35786f68SRobert Mustacchi {
1346*35786f68SRobert Mustacchi ACPI_STATUS Status;
1347*35786f68SRobert Mustacchi DT_SUBTABLE *Subtable;
1348*35786f68SRobert Mustacchi DT_SUBTABLE *ParentTable;
1349*35786f68SRobert Mustacchi DT_FIELD **PFieldList = (DT_FIELD **) List;
1350*35786f68SRobert Mustacchi DT_FIELD *SubtableStart;
1351*35786f68SRobert Mustacchi DT_FIELD *EntryStart;
1352*35786f68SRobert Mustacchi ACPI_HMAT_STRUCTURE *HmatStruct;
1353*35786f68SRobert Mustacchi ACPI_HMAT_LOCALITY *HmatLocality;
1354*35786f68SRobert Mustacchi ACPI_HMAT_CACHE *HmatCache;
1355*35786f68SRobert Mustacchi ACPI_DMTABLE_INFO *InfoTable;
1356*35786f68SRobert Mustacchi UINT32 IntPDNumber;
1357*35786f68SRobert Mustacchi UINT32 TgtPDNumber;
1358*35786f68SRobert Mustacchi UINT64 EntryNumber;
1359*35786f68SRobert Mustacchi UINT16 SMBIOSHandleNumber;
1360*35786f68SRobert Mustacchi
1361*35786f68SRobert Mustacchi
1362*35786f68SRobert Mustacchi ParentTable = DtPeekSubtable ();
1363*35786f68SRobert Mustacchi
1364*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmat,
1365*35786f68SRobert Mustacchi &Subtable);
1366*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1367*35786f68SRobert Mustacchi {
1368*35786f68SRobert Mustacchi return (Status);
1369*35786f68SRobert Mustacchi }
1370*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1371*35786f68SRobert Mustacchi
1372*35786f68SRobert Mustacchi while (*PFieldList)
1373*35786f68SRobert Mustacchi {
1374*35786f68SRobert Mustacchi /* Compile HMAT structure header */
1375*35786f68SRobert Mustacchi
1376*35786f68SRobert Mustacchi SubtableStart = *PFieldList;
1377*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmatHdr,
1378*35786f68SRobert Mustacchi &Subtable);
1379*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1380*35786f68SRobert Mustacchi {
1381*35786f68SRobert Mustacchi return (Status);
1382*35786f68SRobert Mustacchi }
1383*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1384*35786f68SRobert Mustacchi
1385*35786f68SRobert Mustacchi HmatStruct = ACPI_CAST_PTR (ACPI_HMAT_STRUCTURE, Subtable->Buffer);
1386*35786f68SRobert Mustacchi HmatStruct->Length = Subtable->Length;
1387*35786f68SRobert Mustacchi
1388*35786f68SRobert Mustacchi /* Compile HMAT structure body */
1389*35786f68SRobert Mustacchi
1390*35786f68SRobert Mustacchi switch (HmatStruct->Type)
1391*35786f68SRobert Mustacchi {
1392*35786f68SRobert Mustacchi case ACPI_HMAT_TYPE_ADDRESS_RANGE:
1393*35786f68SRobert Mustacchi
1394*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoHmat0;
1395*35786f68SRobert Mustacchi break;
1396*35786f68SRobert Mustacchi
1397*35786f68SRobert Mustacchi case ACPI_HMAT_TYPE_LOCALITY:
1398*35786f68SRobert Mustacchi
1399*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoHmat1;
1400*35786f68SRobert Mustacchi break;
1401*35786f68SRobert Mustacchi
1402*35786f68SRobert Mustacchi case ACPI_HMAT_TYPE_CACHE:
1403*35786f68SRobert Mustacchi
1404*35786f68SRobert Mustacchi InfoTable = AcpiDmTableInfoHmat2;
1405*35786f68SRobert Mustacchi break;
1406*35786f68SRobert Mustacchi
1407*35786f68SRobert Mustacchi default:
1408*35786f68SRobert Mustacchi
1409*35786f68SRobert Mustacchi DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HMAT");
1410*35786f68SRobert Mustacchi return (AE_ERROR);
1411*35786f68SRobert Mustacchi }
1412*35786f68SRobert Mustacchi
1413*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1414*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1415*35786f68SRobert Mustacchi {
1416*35786f68SRobert Mustacchi return (Status);
1417*35786f68SRobert Mustacchi }
1418*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1419*35786f68SRobert Mustacchi HmatStruct->Length += Subtable->Length;
1420*35786f68SRobert Mustacchi
1421*35786f68SRobert Mustacchi /* Compile HMAT structure additionals */
1422*35786f68SRobert Mustacchi
1423*35786f68SRobert Mustacchi switch (HmatStruct->Type)
1424*35786f68SRobert Mustacchi {
1425*35786f68SRobert Mustacchi case ACPI_HMAT_TYPE_LOCALITY:
1426*35786f68SRobert Mustacchi
1427*35786f68SRobert Mustacchi HmatLocality = ACPI_SUB_PTR (ACPI_HMAT_LOCALITY,
1428*35786f68SRobert Mustacchi Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE));
1429*35786f68SRobert Mustacchi
1430*35786f68SRobert Mustacchi /* Compile initiator proximity domain list */
1431*35786f68SRobert Mustacchi
1432*35786f68SRobert Mustacchi IntPDNumber = 0;
1433*35786f68SRobert Mustacchi while (*PFieldList)
1434*35786f68SRobert Mustacchi {
1435*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList,
1436*35786f68SRobert Mustacchi AcpiDmTableInfoHmat1a, &Subtable);
1437*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1438*35786f68SRobert Mustacchi {
1439*35786f68SRobert Mustacchi return (Status);
1440*35786f68SRobert Mustacchi }
1441*35786f68SRobert Mustacchi if (!Subtable)
1442*35786f68SRobert Mustacchi {
1443*35786f68SRobert Mustacchi break;
1444*35786f68SRobert Mustacchi }
1445*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1446*35786f68SRobert Mustacchi HmatStruct->Length += Subtable->Length;
1447*35786f68SRobert Mustacchi IntPDNumber++;
1448*35786f68SRobert Mustacchi }
1449*35786f68SRobert Mustacchi HmatLocality->NumberOfInitiatorPDs = IntPDNumber;
1450*35786f68SRobert Mustacchi
1451*35786f68SRobert Mustacchi /* Compile target proximity domain list */
1452*35786f68SRobert Mustacchi
1453*35786f68SRobert Mustacchi TgtPDNumber = 0;
1454*35786f68SRobert Mustacchi while (*PFieldList)
1455*35786f68SRobert Mustacchi {
1456*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList,
1457*35786f68SRobert Mustacchi AcpiDmTableInfoHmat1b, &Subtable);
1458*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1459*35786f68SRobert Mustacchi {
1460*35786f68SRobert Mustacchi return (Status);
1461*35786f68SRobert Mustacchi }
1462*35786f68SRobert Mustacchi if (!Subtable)
1463*35786f68SRobert Mustacchi {
1464*35786f68SRobert Mustacchi break;
1465*35786f68SRobert Mustacchi }
1466*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1467*35786f68SRobert Mustacchi HmatStruct->Length += Subtable->Length;
1468*35786f68SRobert Mustacchi TgtPDNumber++;
1469*35786f68SRobert Mustacchi }
1470*35786f68SRobert Mustacchi HmatLocality->NumberOfTargetPDs = TgtPDNumber;
1471*35786f68SRobert Mustacchi
1472*35786f68SRobert Mustacchi /* Save start of the entries for reporting errors */
1473*35786f68SRobert Mustacchi
1474*35786f68SRobert Mustacchi EntryStart = *PFieldList;
1475*35786f68SRobert Mustacchi
1476*35786f68SRobert Mustacchi /* Compile latency/bandwidth entries */
1477*35786f68SRobert Mustacchi
1478*35786f68SRobert Mustacchi EntryNumber = 0;
1479*35786f68SRobert Mustacchi while (*PFieldList)
1480*35786f68SRobert Mustacchi {
1481*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList,
1482*35786f68SRobert Mustacchi AcpiDmTableInfoHmat1c, &Subtable);
1483*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1484*35786f68SRobert Mustacchi {
1485*35786f68SRobert Mustacchi return (Status);
1486*35786f68SRobert Mustacchi }
1487*35786f68SRobert Mustacchi if (!Subtable)
1488*35786f68SRobert Mustacchi {
1489*35786f68SRobert Mustacchi break;
1490*35786f68SRobert Mustacchi }
1491*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1492*35786f68SRobert Mustacchi HmatStruct->Length += Subtable->Length;
1493*35786f68SRobert Mustacchi EntryNumber++;
1494*35786f68SRobert Mustacchi }
1495*35786f68SRobert Mustacchi
1496*35786f68SRobert Mustacchi /* Validate number of entries */
1497*35786f68SRobert Mustacchi
1498*35786f68SRobert Mustacchi if (EntryNumber !=
1499*35786f68SRobert Mustacchi ((UINT64)IntPDNumber * (UINT64)TgtPDNumber))
1500*35786f68SRobert Mustacchi {
1501*35786f68SRobert Mustacchi DtFatal (ASL_MSG_INVALID_EXPRESSION, EntryStart, "HMAT");
1502*35786f68SRobert Mustacchi return (AE_ERROR);
1503*35786f68SRobert Mustacchi }
1504*35786f68SRobert Mustacchi break;
1505*35786f68SRobert Mustacchi
1506*35786f68SRobert Mustacchi case ACPI_HMAT_TYPE_CACHE:
1507*35786f68SRobert Mustacchi
1508*35786f68SRobert Mustacchi /* Compile SMBIOS handles */
1509*35786f68SRobert Mustacchi
1510*35786f68SRobert Mustacchi HmatCache = ACPI_SUB_PTR (ACPI_HMAT_CACHE,
1511*35786f68SRobert Mustacchi Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE));
1512*35786f68SRobert Mustacchi SMBIOSHandleNumber = 0;
1513*35786f68SRobert Mustacchi while (*PFieldList)
1514*35786f68SRobert Mustacchi {
1515*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList,
1516*35786f68SRobert Mustacchi AcpiDmTableInfoHmat2a, &Subtable);
1517*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1518*35786f68SRobert Mustacchi {
1519*35786f68SRobert Mustacchi return (Status);
1520*35786f68SRobert Mustacchi }
1521*35786f68SRobert Mustacchi if (!Subtable)
1522*35786f68SRobert Mustacchi {
1523*35786f68SRobert Mustacchi break;
1524*35786f68SRobert Mustacchi }
1525*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1526*35786f68SRobert Mustacchi HmatStruct->Length += Subtable->Length;
1527*35786f68SRobert Mustacchi SMBIOSHandleNumber++;
1528*35786f68SRobert Mustacchi }
1529*35786f68SRobert Mustacchi HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber;
1530*35786f68SRobert Mustacchi break;
1531*35786f68SRobert Mustacchi
1532*35786f68SRobert Mustacchi default:
1533*35786f68SRobert Mustacchi
1534*35786f68SRobert Mustacchi break;
1535*35786f68SRobert Mustacchi }
1536*35786f68SRobert Mustacchi }
1537*35786f68SRobert Mustacchi
1538*35786f68SRobert Mustacchi return (AE_OK);
1539*35786f68SRobert Mustacchi }
1540*35786f68SRobert Mustacchi
1541*35786f68SRobert Mustacchi
1542*35786f68SRobert Mustacchi /******************************************************************************
1543*35786f68SRobert Mustacchi *
1544bc36eafdSMike Gerdts * FUNCTION: DtCompileIort
1545bc36eafdSMike Gerdts *
1546bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1547bc36eafdSMike Gerdts *
1548bc36eafdSMike Gerdts * RETURN: Status
1549bc36eafdSMike Gerdts *
1550bc36eafdSMike Gerdts * DESCRIPTION: Compile IORT.
1551bc36eafdSMike Gerdts *
1552bc36eafdSMike Gerdts *****************************************************************************/
1553bc36eafdSMike Gerdts
1554bc36eafdSMike Gerdts ACPI_STATUS
DtCompileIort(void ** List)1555bc36eafdSMike Gerdts DtCompileIort (
1556bc36eafdSMike Gerdts void **List)
1557bc36eafdSMike Gerdts {
1558bc36eafdSMike Gerdts ACPI_STATUS Status;
1559bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1560bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1561bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1562bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1563bc36eafdSMike Gerdts ACPI_TABLE_IORT *Iort;
1564bc36eafdSMike Gerdts ACPI_IORT_NODE *IortNode;
1565bc36eafdSMike Gerdts ACPI_IORT_ITS_GROUP *IortItsGroup;
1566bc36eafdSMike Gerdts ACPI_IORT_SMMU *IortSmmu;
1567bc36eafdSMike Gerdts UINT32 NodeNumber;
1568bc36eafdSMike Gerdts UINT32 NodeLength;
1569bc36eafdSMike Gerdts UINT32 IdMappingNumber;
1570bc36eafdSMike Gerdts UINT32 ItsNumber;
1571bc36eafdSMike Gerdts UINT32 ContextIrptNumber;
1572bc36eafdSMike Gerdts UINT32 PmuIrptNumber;
1573bc36eafdSMike Gerdts UINT32 PaddingLength;
1574bc36eafdSMike Gerdts
1575bc36eafdSMike Gerdts
1576bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1577bc36eafdSMike Gerdts
1578bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort,
1579*35786f68SRobert Mustacchi &Subtable);
1580bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1581bc36eafdSMike Gerdts {
1582bc36eafdSMike Gerdts return (Status);
1583bc36eafdSMike Gerdts }
1584bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1585bc36eafdSMike Gerdts
1586bc36eafdSMike Gerdts /*
1587bc36eafdSMike Gerdts * Using ACPI_SUB_PTR, We needn't define a separate structure. Care
1588bc36eafdSMike Gerdts * should be taken to avoid accessing ACPI_TABLE_HEADER fields.
1589bc36eafdSMike Gerdts */
1590bc36eafdSMike Gerdts Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT,
1591bc36eafdSMike Gerdts Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
1592bc36eafdSMike Gerdts
1593bc36eafdSMike Gerdts /*
1594bc36eafdSMike Gerdts * OptionalPadding - Variable-length data
1595bc36eafdSMike Gerdts * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT))
1596bc36eafdSMike Gerdts * Optionally allows the generic data types to be used for filling
1597bc36eafdSMike Gerdts * this field.
1598bc36eafdSMike Gerdts */
1599bc36eafdSMike Gerdts Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
1600bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
1601*35786f68SRobert Mustacchi &Subtable);
1602bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1603bc36eafdSMike Gerdts {
1604bc36eafdSMike Gerdts return (Status);
1605bc36eafdSMike Gerdts }
1606bc36eafdSMike Gerdts if (Subtable)
1607bc36eafdSMike Gerdts {
1608bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1609bc36eafdSMike Gerdts Iort->NodeOffset += Subtable->Length;
1610bc36eafdSMike Gerdts }
1611bc36eafdSMike Gerdts else
1612bc36eafdSMike Gerdts {
1613bc36eafdSMike Gerdts Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList),
1614bc36eafdSMike Gerdts AcpiDmTableInfoIortHdr[0].Name, &PaddingLength);
1615bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1616bc36eafdSMike Gerdts {
1617bc36eafdSMike Gerdts return (Status);
1618bc36eafdSMike Gerdts }
1619bc36eafdSMike Gerdts Iort->NodeOffset += PaddingLength;
1620bc36eafdSMike Gerdts }
1621bc36eafdSMike Gerdts
1622bc36eafdSMike Gerdts NodeNumber = 0;
1623bc36eafdSMike Gerdts while (*PFieldList)
1624bc36eafdSMike Gerdts {
1625bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1626bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr,
1627*35786f68SRobert Mustacchi &Subtable);
1628bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1629bc36eafdSMike Gerdts {
1630bc36eafdSMike Gerdts return (Status);
1631bc36eafdSMike Gerdts }
1632bc36eafdSMike Gerdts
1633bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1634bc36eafdSMike Gerdts IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer);
1635bc36eafdSMike Gerdts NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
1636bc36eafdSMike Gerdts
1637bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1638bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1639bc36eafdSMike Gerdts
1640bc36eafdSMike Gerdts switch (IortNode->Type)
1641bc36eafdSMike Gerdts {
1642bc36eafdSMike Gerdts case ACPI_IORT_NODE_ITS_GROUP:
1643bc36eafdSMike Gerdts
1644bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0,
1645*35786f68SRobert Mustacchi &Subtable);
1646bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1647bc36eafdSMike Gerdts {
1648bc36eafdSMike Gerdts return (Status);
1649bc36eafdSMike Gerdts }
1650bc36eafdSMike Gerdts
1651bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1652bc36eafdSMike Gerdts IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer);
1653bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1654bc36eafdSMike Gerdts
1655bc36eafdSMike Gerdts ItsNumber = 0;
1656bc36eafdSMike Gerdts while (*PFieldList)
1657bc36eafdSMike Gerdts {
1658bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a,
1659*35786f68SRobert Mustacchi &Subtable);
1660bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1661bc36eafdSMike Gerdts {
1662bc36eafdSMike Gerdts return (Status);
1663bc36eafdSMike Gerdts }
1664bc36eafdSMike Gerdts if (!Subtable)
1665bc36eafdSMike Gerdts {
1666bc36eafdSMike Gerdts break;
1667bc36eafdSMike Gerdts }
1668bc36eafdSMike Gerdts
1669bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1670bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1671bc36eafdSMike Gerdts ItsNumber++;
1672bc36eafdSMike Gerdts }
1673bc36eafdSMike Gerdts
1674bc36eafdSMike Gerdts IortItsGroup->ItsCount = ItsNumber;
1675bc36eafdSMike Gerdts break;
1676bc36eafdSMike Gerdts
1677bc36eafdSMike Gerdts case ACPI_IORT_NODE_NAMED_COMPONENT:
1678bc36eafdSMike Gerdts
1679bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1,
1680*35786f68SRobert Mustacchi &Subtable);
1681bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1682bc36eafdSMike Gerdts {
1683bc36eafdSMike Gerdts return (Status);
1684bc36eafdSMike Gerdts }
1685bc36eafdSMike Gerdts
1686bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1687bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1688bc36eafdSMike Gerdts
1689bc36eafdSMike Gerdts /*
1690bc36eafdSMike Gerdts * Padding - Variable-length data
1691bc36eafdSMike Gerdts * Optionally allows the offset of the ID mappings to be used
1692bc36eafdSMike Gerdts * for filling this field.
1693bc36eafdSMike Gerdts */
1694bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a,
1695*35786f68SRobert Mustacchi &Subtable);
1696bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1697bc36eafdSMike Gerdts {
1698bc36eafdSMike Gerdts return (Status);
1699bc36eafdSMike Gerdts }
1700bc36eafdSMike Gerdts
1701bc36eafdSMike Gerdts if (Subtable)
1702bc36eafdSMike Gerdts {
1703bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1704bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1705bc36eafdSMike Gerdts }
1706bc36eafdSMike Gerdts else
1707bc36eafdSMike Gerdts {
1708bc36eafdSMike Gerdts if (NodeLength > IortNode->MappingOffset)
1709bc36eafdSMike Gerdts {
1710bc36eafdSMike Gerdts return (AE_BAD_DATA);
1711bc36eafdSMike Gerdts }
1712bc36eafdSMike Gerdts
1713bc36eafdSMike Gerdts if (NodeLength < IortNode->MappingOffset)
1714bc36eafdSMike Gerdts {
1715bc36eafdSMike Gerdts Status = DtCompilePadding (
1716bc36eafdSMike Gerdts IortNode->MappingOffset - NodeLength,
1717bc36eafdSMike Gerdts &Subtable);
1718bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1719bc36eafdSMike Gerdts {
1720bc36eafdSMike Gerdts return (Status);
1721bc36eafdSMike Gerdts }
1722bc36eafdSMike Gerdts
1723bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1724bc36eafdSMike Gerdts NodeLength = IortNode->MappingOffset;
1725bc36eafdSMike Gerdts }
1726bc36eafdSMike Gerdts }
1727bc36eafdSMike Gerdts break;
1728bc36eafdSMike Gerdts
1729bc36eafdSMike Gerdts case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
1730bc36eafdSMike Gerdts
1731bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2,
1732*35786f68SRobert Mustacchi &Subtable);
1733bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1734bc36eafdSMike Gerdts {
1735bc36eafdSMike Gerdts return (Status);
1736bc36eafdSMike Gerdts }
1737bc36eafdSMike Gerdts
1738bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1739bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1740bc36eafdSMike Gerdts break;
1741bc36eafdSMike Gerdts
1742bc36eafdSMike Gerdts case ACPI_IORT_NODE_SMMU:
1743bc36eafdSMike Gerdts
1744bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3,
1745*35786f68SRobert Mustacchi &Subtable);
1746bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1747bc36eafdSMike Gerdts {
1748bc36eafdSMike Gerdts return (Status);
1749bc36eafdSMike Gerdts }
1750bc36eafdSMike Gerdts
1751bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1752bc36eafdSMike Gerdts IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer);
1753bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1754bc36eafdSMike Gerdts
1755bc36eafdSMike Gerdts /* Compile global interrupt array */
1756bc36eafdSMike Gerdts
1757bc36eafdSMike Gerdts IortSmmu->GlobalInterruptOffset = NodeLength;
1758bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
1759*35786f68SRobert Mustacchi &Subtable);
1760bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1761bc36eafdSMike Gerdts {
1762bc36eafdSMike Gerdts return (Status);
1763bc36eafdSMike Gerdts }
1764bc36eafdSMike Gerdts
1765bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1766bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1767bc36eafdSMike Gerdts
1768bc36eafdSMike Gerdts /* Compile context interrupt array */
1769bc36eafdSMike Gerdts
1770bc36eafdSMike Gerdts ContextIrptNumber = 0;
1771bc36eafdSMike Gerdts IortSmmu->ContextInterruptOffset = NodeLength;
1772bc36eafdSMike Gerdts while (*PFieldList)
1773bc36eafdSMike Gerdts {
1774bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
1775*35786f68SRobert Mustacchi &Subtable);
1776bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1777bc36eafdSMike Gerdts {
1778bc36eafdSMike Gerdts return (Status);
1779bc36eafdSMike Gerdts }
1780bc36eafdSMike Gerdts
1781bc36eafdSMike Gerdts if (!Subtable)
1782bc36eafdSMike Gerdts {
1783bc36eafdSMike Gerdts break;
1784bc36eafdSMike Gerdts }
1785bc36eafdSMike Gerdts
1786bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1787bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1788bc36eafdSMike Gerdts ContextIrptNumber++;
1789bc36eafdSMike Gerdts }
1790bc36eafdSMike Gerdts
1791bc36eafdSMike Gerdts IortSmmu->ContextInterruptCount = ContextIrptNumber;
1792bc36eafdSMike Gerdts
1793bc36eafdSMike Gerdts /* Compile PMU interrupt array */
1794bc36eafdSMike Gerdts
1795bc36eafdSMike Gerdts PmuIrptNumber = 0;
1796bc36eafdSMike Gerdts IortSmmu->PmuInterruptOffset = NodeLength;
1797bc36eafdSMike Gerdts while (*PFieldList)
1798bc36eafdSMike Gerdts {
1799bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
1800*35786f68SRobert Mustacchi &Subtable);
1801bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1802bc36eafdSMike Gerdts {
1803bc36eafdSMike Gerdts return (Status);
1804bc36eafdSMike Gerdts }
1805bc36eafdSMike Gerdts
1806bc36eafdSMike Gerdts if (!Subtable)
1807bc36eafdSMike Gerdts {
1808bc36eafdSMike Gerdts break;
1809bc36eafdSMike Gerdts }
1810bc36eafdSMike Gerdts
1811bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1812bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1813bc36eafdSMike Gerdts PmuIrptNumber++;
1814bc36eafdSMike Gerdts }
1815bc36eafdSMike Gerdts
1816bc36eafdSMike Gerdts IortSmmu->PmuInterruptCount = PmuIrptNumber;
1817bc36eafdSMike Gerdts break;
1818bc36eafdSMike Gerdts
1819bc36eafdSMike Gerdts case ACPI_IORT_NODE_SMMU_V3:
1820bc36eafdSMike Gerdts
1821bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort4,
1822*35786f68SRobert Mustacchi &Subtable);
1823*35786f68SRobert Mustacchi if (ACPI_FAILURE (Status))
1824*35786f68SRobert Mustacchi {
1825*35786f68SRobert Mustacchi return (Status);
1826*35786f68SRobert Mustacchi }
1827*35786f68SRobert Mustacchi
1828*35786f68SRobert Mustacchi DtInsertSubtable (ParentTable, Subtable);
1829*35786f68SRobert Mustacchi NodeLength += Subtable->Length;
1830*35786f68SRobert Mustacchi break;
1831*35786f68SRobert Mustacchi
1832*35786f68SRobert Mustacchi case ACPI_IORT_NODE_PMCG:
1833*35786f68SRobert Mustacchi
1834*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort5,
1835*35786f68SRobert Mustacchi &Subtable);
1836bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1837bc36eafdSMike Gerdts {
1838bc36eafdSMike Gerdts return (Status);
1839bc36eafdSMike Gerdts }
1840bc36eafdSMike Gerdts
1841bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1842bc36eafdSMike Gerdts NodeLength += Subtable->Length;
1843bc36eafdSMike Gerdts break;
1844bc36eafdSMike Gerdts
1845bc36eafdSMike Gerdts default:
1846bc36eafdSMike Gerdts
1847bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT");
1848bc36eafdSMike Gerdts return (AE_ERROR);
1849bc36eafdSMike Gerdts }
1850bc36eafdSMike Gerdts
1851bc36eafdSMike Gerdts /* Compile Array of ID mappings */
1852bc36eafdSMike Gerdts
1853bc36eafdSMike Gerdts IortNode->MappingOffset = NodeLength;
1854bc36eafdSMike Gerdts IdMappingNumber = 0;
1855bc36eafdSMike Gerdts while (*PFieldList)
1856bc36eafdSMike Gerdts {
1857bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap,
1858*35786f68SRobert Mustacchi &Subtable);
1859bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1860bc36eafdSMike Gerdts {
1861bc36eafdSMike Gerdts return (Status);
1862bc36eafdSMike Gerdts }
1863bc36eafdSMike Gerdts
1864bc36eafdSMike Gerdts if (!Subtable)
1865bc36eafdSMike Gerdts {
1866bc36eafdSMike Gerdts break;
1867bc36eafdSMike Gerdts }
1868bc36eafdSMike Gerdts
1869bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1870bc36eafdSMike Gerdts NodeLength += sizeof (ACPI_IORT_ID_MAPPING);
1871bc36eafdSMike Gerdts IdMappingNumber++;
1872bc36eafdSMike Gerdts }
1873bc36eafdSMike Gerdts
1874bc36eafdSMike Gerdts IortNode->MappingCount = IdMappingNumber;
1875*35786f68SRobert Mustacchi if (!IdMappingNumber)
1876*35786f68SRobert Mustacchi {
1877*35786f68SRobert Mustacchi IortNode->MappingOffset = 0;
1878*35786f68SRobert Mustacchi }
1879bc36eafdSMike Gerdts
1880bc36eafdSMike Gerdts /*
1881bc36eafdSMike Gerdts * Node length can be determined by DT_LENGTH option
1882bc36eafdSMike Gerdts * IortNode->Length = NodeLength;
1883bc36eafdSMike Gerdts */
1884bc36eafdSMike Gerdts DtPopSubtable ();
1885bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1886bc36eafdSMike Gerdts NodeNumber++;
1887bc36eafdSMike Gerdts }
1888bc36eafdSMike Gerdts
1889bc36eafdSMike Gerdts Iort->NodeCount = NodeNumber;
1890bc36eafdSMike Gerdts return (AE_OK);
1891bc36eafdSMike Gerdts }
1892bc36eafdSMike Gerdts
1893bc36eafdSMike Gerdts
1894bc36eafdSMike Gerdts /******************************************************************************
1895bc36eafdSMike Gerdts *
1896bc36eafdSMike Gerdts * FUNCTION: DtCompileIvrs
1897bc36eafdSMike Gerdts *
1898bc36eafdSMike Gerdts * PARAMETERS: List - Current field list pointer
1899bc36eafdSMike Gerdts *
1900bc36eafdSMike Gerdts * RETURN: Status
1901bc36eafdSMike Gerdts *
1902bc36eafdSMike Gerdts * DESCRIPTION: Compile IVRS.
1903bc36eafdSMike Gerdts *
1904bc36eafdSMike Gerdts *****************************************************************************/
1905bc36eafdSMike Gerdts
1906bc36eafdSMike Gerdts ACPI_STATUS
DtCompileIvrs(void ** List)1907bc36eafdSMike Gerdts DtCompileIvrs (
1908bc36eafdSMike Gerdts void **List)
1909bc36eafdSMike Gerdts {
1910bc36eafdSMike Gerdts ACPI_STATUS Status;
1911bc36eafdSMike Gerdts DT_SUBTABLE *Subtable;
1912bc36eafdSMike Gerdts DT_SUBTABLE *ParentTable;
1913bc36eafdSMike Gerdts DT_FIELD **PFieldList = (DT_FIELD **) List;
1914bc36eafdSMike Gerdts DT_FIELD *SubtableStart;
1915bc36eafdSMike Gerdts ACPI_DMTABLE_INFO *InfoTable;
1916bc36eafdSMike Gerdts ACPI_IVRS_HEADER *IvrsHeader;
1917bc36eafdSMike Gerdts UINT8 EntryType;
1918bc36eafdSMike Gerdts
1919bc36eafdSMike Gerdts
1920bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs,
1921*35786f68SRobert Mustacchi &Subtable);
1922bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1923bc36eafdSMike Gerdts {
1924bc36eafdSMike Gerdts return (Status);
1925bc36eafdSMike Gerdts }
1926bc36eafdSMike Gerdts
1927bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1928bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1929bc36eafdSMike Gerdts
1930bc36eafdSMike Gerdts while (*PFieldList)
1931bc36eafdSMike Gerdts {
1932bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1933bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr,
1934*35786f68SRobert Mustacchi &Subtable);
1935bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1936bc36eafdSMike Gerdts {
1937bc36eafdSMike Gerdts return (Status);
1938bc36eafdSMike Gerdts }
1939bc36eafdSMike Gerdts
1940bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1941bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1942bc36eafdSMike Gerdts DtPushSubtable (Subtable);
1943bc36eafdSMike Gerdts
1944bc36eafdSMike Gerdts IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer);
1945bc36eafdSMike Gerdts
1946bc36eafdSMike Gerdts switch (IvrsHeader->Type)
1947bc36eafdSMike Gerdts {
1948bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_HARDWARE:
1949bc36eafdSMike Gerdts
1950bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoIvrs0;
1951bc36eafdSMike Gerdts break;
1952bc36eafdSMike Gerdts
1953bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_MEMORY1:
1954bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_MEMORY2:
1955bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_MEMORY3:
1956bc36eafdSMike Gerdts
1957bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoIvrs1;
1958bc36eafdSMike Gerdts break;
1959bc36eafdSMike Gerdts
1960bc36eafdSMike Gerdts default:
1961bc36eafdSMike Gerdts
1962bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS");
1963bc36eafdSMike Gerdts return (AE_ERROR);
1964bc36eafdSMike Gerdts }
1965bc36eafdSMike Gerdts
1966*35786f68SRobert Mustacchi Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1967bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
1968bc36eafdSMike Gerdts {
1969bc36eafdSMike Gerdts return (Status);
1970bc36eafdSMike Gerdts }
1971bc36eafdSMike Gerdts
1972bc36eafdSMike Gerdts ParentTable = DtPeekSubtable ();
1973bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
1974bc36eafdSMike Gerdts
1975bc36eafdSMike Gerdts if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE)
1976bc36eafdSMike Gerdts {
1977bc36eafdSMike Gerdts while (*PFieldList &&
1978bc36eafdSMike Gerdts !strcmp ((*PFieldList)->Name, "Entry Type"))
1979bc36eafdSMike Gerdts {
1980bc36eafdSMike Gerdts SubtableStart = *PFieldList;
1981bc36eafdSMike Gerdts DtCompileInteger (&EntryType, *PFieldList, 1, 0);
1982bc36eafdSMike Gerdts
1983bc36eafdSMike Gerdts switch (EntryType)
1984bc36eafdSMike Gerdts {
1985bc36eafdSMike Gerdts /* 4-byte device entries */
1986bc36eafdSMike Gerdts
1987bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_PAD4:
1988bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_ALL:
1989bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_SELECT:
1990bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_START:
1991bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_END:
1992bc36eafdSMike Gerdts
1993bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoIvrs4;
1994bc36eafdSMike Gerdts break;
1995bc36eafdSMike Gerdts
1996bc36eafdSMike Gerdts /* 8-byte entries, type A */
1997bc36eafdSMike Gerdts
1998bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_ALIAS_SELECT:
1999bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_ALIAS_START:
2000bc36eafdSMike Gerdts
2001bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoIvrs8a;
2002bc36eafdSMike Gerdts break;
2003bc36eafdSMike Gerdts
2004bc36eafdSMike Gerdts /* 8-byte entries, type B */
2005bc36eafdSMike Gerdts
2006bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_PAD8:
2007bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_EXT_SELECT:
2008bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_EXT_START:
2009bc36eafdSMike Gerdts
2010bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoIvrs8b;
2011bc36eafdSMike Gerdts break;
2012bc36eafdSMike Gerdts
2013bc36eafdSMike Gerdts /* 8-byte entries, type C */
2014bc36eafdSMike Gerdts
2015bc36eafdSMike Gerdts case ACPI_IVRS_TYPE_SPECIAL:
2016bc36eafdSMike Gerdts
2017bc36eafdSMike Gerdts InfoTable = AcpiDmTableInfoIvrs8c;
2018bc36eafdSMike Gerdts break;
2019bc36eafdSMike Gerdts
2020bc36eafdSMike Gerdts default:
2021bc36eafdSMike Gerdts
2022bc36eafdSMike Gerdts DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart,
2023bc36eafdSMike Gerdts "IVRS Device Entry");
2024bc36eafdSMike Gerdts return (AE_ERROR);
2025bc36eafdSMike Gerdts }
2026bc36eafdSMike Gerdts
2027bc36eafdSMike Gerdts Status = DtCompileTable (PFieldList, InfoTable,
2028*35786f68SRobert Mustacchi &Subtable);
2029bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
2030bc36eafdSMike Gerdts {
2031bc36eafdSMike Gerdts return (Status);
2032bc36eafdSMike Gerdts }
2033bc36eafdSMike Gerdts
2034bc36eafdSMike Gerdts DtInsertSubtable (ParentTable, Subtable);
2035bc36eafdSMike Gerdts }
2036bc36eafdSMike Gerdts }
2037bc36eafdSMike Gerdts
2038bc36eafdSMike Gerdts DtPopSubtable ();
2039bc36eafdSMike Gerdts }
2040bc36eafdSMike Gerdts
2041bc36eafdSMike Gerdts return (AE_OK);
2042bc36eafdSMike Gerdts }
2043