dtcompile.c revision 1.1.1.23 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: dtcompile.c - Front-end for data table compiler
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.22 christos /******************************************************************************
8 1.1.1.22 christos *
9 1.1.1.22 christos * 1. Copyright Notice
10 1.1.1.22 christos *
11 1.1.1.23 christos * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12 1.1 jruoho * All rights reserved.
13 1.1 jruoho *
14 1.1.1.22 christos * 2. License
15 1.1.1.22 christos *
16 1.1.1.22 christos * 2.1. This is your license from Intel Corp. under its intellectual property
17 1.1.1.22 christos * rights. You may have additional license terms from the party that provided
18 1.1.1.22 christos * you this software, covering your right to use that party's intellectual
19 1.1.1.22 christos * property rights.
20 1.1.1.22 christos *
21 1.1.1.22 christos * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 1.1.1.22 christos * copy of the source code appearing in this file ("Covered Code") an
23 1.1.1.22 christos * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 1.1.1.22 christos * base code distributed originally by Intel ("Original Intel Code") to copy,
25 1.1.1.22 christos * make derivatives, distribute, use and display any portion of the Covered
26 1.1.1.22 christos * Code in any form, with the right to sublicense such rights; and
27 1.1.1.22 christos *
28 1.1.1.22 christos * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 1.1.1.22 christos * license (with the right to sublicense), under only those claims of Intel
30 1.1.1.22 christos * patents that are infringed by the Original Intel Code, to make, use, sell,
31 1.1.1.22 christos * offer to sell, and import the Covered Code and derivative works thereof
32 1.1.1.22 christos * solely to the minimum extent necessary to exercise the above copyright
33 1.1.1.22 christos * license, and in no event shall the patent license extend to any additions
34 1.1.1.22 christos * to or modifications of the Original Intel Code. No other license or right
35 1.1.1.22 christos * is granted directly or by implication, estoppel or otherwise;
36 1.1.1.22 christos *
37 1.1.1.22 christos * The above copyright and patent license is granted only if the following
38 1.1.1.22 christos * conditions are met:
39 1.1.1.22 christos *
40 1.1.1.22 christos * 3. Conditions
41 1.1.1.22 christos *
42 1.1.1.22 christos * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 1.1.1.22 christos * Redistribution of source code of any substantial portion of the Covered
44 1.1.1.22 christos * Code or modification with rights to further distribute source must include
45 1.1.1.22 christos * the above Copyright Notice, the above License, this list of Conditions,
46 1.1.1.22 christos * and the following Disclaimer and Export Compliance provision. In addition,
47 1.1.1.22 christos * Licensee must cause all Covered Code to which Licensee contributes to
48 1.1.1.22 christos * contain a file documenting the changes Licensee made to create that Covered
49 1.1.1.22 christos * Code and the date of any change. Licensee must include in that file the
50 1.1.1.22 christos * documentation of any changes made by any predecessor Licensee. Licensee
51 1.1.1.22 christos * must include a prominent statement that the modification is derived,
52 1.1.1.22 christos * directly or indirectly, from Original Intel Code.
53 1.1.1.22 christos *
54 1.1.1.22 christos * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 1.1.1.22 christos * Redistribution of source code of any substantial portion of the Covered
56 1.1.1.22 christos * Code or modification without rights to further distribute source must
57 1.1.1.22 christos * include the following Disclaimer and Export Compliance provision in the
58 1.1.1.22 christos * documentation and/or other materials provided with distribution. In
59 1.1.1.22 christos * addition, Licensee may not authorize further sublicense of source of any
60 1.1.1.22 christos * portion of the Covered Code, and must include terms to the effect that the
61 1.1.1.22 christos * license from Licensee to its licensee is limited to the intellectual
62 1.1.1.22 christos * property embodied in the software Licensee provides to its licensee, and
63 1.1.1.22 christos * not to intellectual property embodied in modifications its licensee may
64 1.1.1.22 christos * make.
65 1.1.1.22 christos *
66 1.1.1.22 christos * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 1.1.1.22 christos * substantial portion of the Covered Code or modification must reproduce the
68 1.1.1.22 christos * above Copyright Notice, and the following Disclaimer and Export Compliance
69 1.1.1.22 christos * provision in the documentation and/or other materials provided with the
70 1.1.1.22 christos * distribution.
71 1.1.1.22 christos *
72 1.1.1.22 christos * 3.4. Intel retains all right, title, and interest in and to the Original
73 1.1.1.22 christos * Intel Code.
74 1.1.1.22 christos *
75 1.1.1.22 christos * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 1.1.1.22 christos * Intel shall be used in advertising or otherwise to promote the sale, use or
77 1.1.1.22 christos * other dealings in products derived from or relating to the Covered Code
78 1.1.1.22 christos * without prior written authorization from Intel.
79 1.1.1.22 christos *
80 1.1.1.22 christos * 4. Disclaimer and Export Compliance
81 1.1.1.22 christos *
82 1.1.1.22 christos * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 1.1.1.22 christos * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 1.1.1.22 christos * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 1.1.1.22 christos * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 1.1.1.22 christos * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 1.1.1.22 christos * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 1.1.1.22 christos * PARTICULAR PURPOSE.
89 1.1.1.22 christos *
90 1.1.1.22 christos * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 1.1.1.22 christos * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 1.1.1.22 christos * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 1.1.1.22 christos * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 1.1.1.22 christos * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 1.1.1.22 christos * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 1.1.1.22 christos * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 1.1.1.22 christos * LIMITED REMEDY.
98 1.1.1.22 christos *
99 1.1.1.22 christos * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 1.1.1.22 christos * software or system incorporating such software without first obtaining any
101 1.1.1.22 christos * required license or other approval from the U. S. Department of Commerce or
102 1.1.1.22 christos * any other agency or department of the United States Government. In the
103 1.1.1.22 christos * event Licensee exports any such software from the United States or
104 1.1.1.22 christos * re-exports any such software from a foreign destination, Licensee shall
105 1.1.1.22 christos * ensure that the distribution and export/re-export of the software is in
106 1.1.1.22 christos * compliance with all laws, regulations, orders, or other restrictions of the
107 1.1.1.22 christos * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 1.1.1.22 christos * any of its subsidiaries will export/re-export any technical data, process,
109 1.1.1.22 christos * software, or service, directly or indirectly, to any country for which the
110 1.1.1.22 christos * United States government or any agency thereof requires an export license,
111 1.1.1.22 christos * other governmental approval, or letter of assurance, without first obtaining
112 1.1.1.22 christos * such license, approval or letter.
113 1.1.1.22 christos *
114 1.1.1.22 christos *****************************************************************************
115 1.1.1.22 christos *
116 1.1.1.22 christos * Alternatively, you may choose to be licensed under the terms of the
117 1.1.1.22 christos * following license:
118 1.1.1.22 christos *
119 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
120 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
121 1.1.1.2 jruoho * are met:
122 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
123 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
124 1.1.1.2 jruoho * without modification.
125 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
127 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
128 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
129 1.1.1.2 jruoho * binary redistribution.
130 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
131 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
132 1.1.1.2 jruoho * from this software without specific prior written permission.
133 1.1.1.2 jruoho *
134 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 1.1.1.18 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 1.1.1.22 christos * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 1.1.1.22 christos * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 1.1.1.22 christos * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 1.1.1.22 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 1.1.1.22 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 1.1.1.22 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 1.1.1.22 christos * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 1.1.1.22 christos *
146 1.1.1.22 christos * Alternatively, you may choose to be licensed under the terms of the
147 1.1.1.22 christos * GNU General Public License ("GPL") version 2 as published by the Free
148 1.1.1.22 christos * Software Foundation.
149 1.1.1.22 christos *
150 1.1.1.22 christos *****************************************************************************/
151 1.1 jruoho
152 1.1 jruoho #define _DECLARE_DT_GLOBALS
153 1.1 jruoho
154 1.1 jruoho #include "aslcompiler.h"
155 1.1 jruoho
156 1.1 jruoho #define _COMPONENT DT_COMPILER
157 1.1 jruoho ACPI_MODULE_NAME ("dtcompile")
158 1.1 jruoho
159 1.1 jruoho static char VersionString[9];
160 1.1 jruoho
161 1.1 jruoho
162 1.1 jruoho /* Local prototypes */
163 1.1 jruoho
164 1.1.1.15 christos void
165 1.1 jruoho DtInitialize (
166 1.1 jruoho void);
167 1.1 jruoho
168 1.1 jruoho static ACPI_STATUS
169 1.1 jruoho DtCompileDataTable (
170 1.1 jruoho DT_FIELD **Field);
171 1.1 jruoho
172 1.1 jruoho static void
173 1.1 jruoho DtInsertCompilerIds (
174 1.1 jruoho DT_FIELD *FieldList);
175 1.1 jruoho
176 1.1 jruoho
177 1.1 jruoho /******************************************************************************
178 1.1 jruoho *
179 1.1 jruoho * FUNCTION: DtDoCompile
180 1.1 jruoho *
181 1.1 jruoho * PARAMETERS: None
182 1.1 jruoho *
183 1.1 jruoho * RETURN: Status
184 1.1 jruoho *
185 1.1 jruoho * DESCRIPTION: Main entry point for the data table compiler.
186 1.1 jruoho *
187 1.1.1.13 christos * Note: Assumes AslGbl_Files[ASL_FILE_INPUT] is initialized and the file is
188 1.1 jruoho * open at seek offset zero.
189 1.1 jruoho *
190 1.1 jruoho *****************************************************************************/
191 1.1 jruoho
192 1.1 jruoho ACPI_STATUS
193 1.1 jruoho DtDoCompile (
194 1.1 jruoho void)
195 1.1 jruoho {
196 1.1 jruoho ACPI_STATUS Status;
197 1.1 jruoho UINT8 Event;
198 1.1 jruoho DT_FIELD *FieldList;
199 1.1.1.15 christos ASL_GLOBAL_FILE_NODE *FileNode;
200 1.1 jruoho
201 1.1 jruoho
202 1.1 jruoho /* Initialize globals */
203 1.1 jruoho
204 1.1.1.15 christos DtInitialize ();
205 1.1 jruoho
206 1.1.1.4 christos /* Preprocessor */
207 1.1.1.4 christos
208 1.1.1.13 christos if (AslGbl_PreprocessFlag)
209 1.1.1.4 christos {
210 1.1.1.6 christos /* Preprocessor */
211 1.1.1.6 christos
212 1.1.1.6 christos Event = UtBeginEvent ("Preprocess input file");
213 1.1.1.6 christos PrDoPreprocess ();
214 1.1.1.6 christos UtEndEvent (Event);
215 1.1.1.6 christos
216 1.1.1.13 christos if (AslGbl_PreprocessOnly)
217 1.1.1.6 christos {
218 1.1.1.6 christos return (AE_OK);
219 1.1.1.6 christos }
220 1.1.1.4 christos }
221 1.1.1.4 christos
222 1.1.1.15 christos /* Compile the parse tree */
223 1.1.1.15 christos
224 1.1.1.15 christos if (AslGbl_DtLexBisonPrototype)
225 1.1.1.15 christos {
226 1.1.1.15 christos Event = UtBeginEvent ("Parse data table in prototype mode");
227 1.1.1.15 christos
228 1.1.1.15 christos DtCompilerInitLexer (AslGbl_Files[ASL_FILE_INPUT].Handle);
229 1.1.1.15 christos DtCompilerParserparse ();
230 1.1.1.15 christos FieldList = AslGbl_FieldList;
231 1.1.1.15 christos DtCompilerTerminateLexer ();
232 1.1.1.15 christos
233 1.1.1.15 christos UtEndEvent (Event);
234 1.1.1.15 christos }
235 1.1.1.15 christos else
236 1.1.1.15 christos {
237 1.1.1.15 christos /*
238 1.1.1.15 christos * Scan the input file (file is already open) and
239 1.1.1.15 christos * build the parse tree
240 1.1.1.15 christos */
241 1.1.1.15 christos Event = UtBeginEvent ("Scan and parse input file");
242 1.1.1.15 christos FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
243 1.1.1.15 christos UtEndEvent (Event);
244 1.1.1.15 christos }
245 1.1 jruoho
246 1.1 jruoho /* Did the parse tree get successfully constructed? */
247 1.1 jruoho
248 1.1 jruoho if (!FieldList)
249 1.1 jruoho {
250 1.1 jruoho /* TBD: temporary error message. Msgs should come from function above */
251 1.1 jruoho
252 1.1 jruoho DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
253 1.1.1.2 jruoho "Input file does not appear to be an ASL or data table source file");
254 1.1.1.2 jruoho
255 1.1.1.14 christos return (AE_ERROR);
256 1.1 jruoho }
257 1.1 jruoho
258 1.1 jruoho Event = UtBeginEvent ("Compile parse tree");
259 1.1 jruoho
260 1.1 jruoho Status = DtCompileDataTable (&FieldList);
261 1.1 jruoho UtEndEvent (Event);
262 1.1 jruoho
263 1.1.1.15 christos FileNode = FlGetCurrentFileNode ();
264 1.1.1.16 christos
265 1.1.1.16 christos FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
266 1.1.1.16 christos FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
267 1.1.1.16 christos DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
268 1.1.1.16 christos FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
269 1.1.1.15 christos
270 1.1 jruoho if (ACPI_FAILURE (Status))
271 1.1 jruoho {
272 1.1.1.15 christos FileNode->ParserErrorDetected = TRUE;
273 1.1.1.15 christos
274 1.1 jruoho /* TBD: temporary error message. Msgs should come from function above */
275 1.1 jruoho
276 1.1 jruoho DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
277 1.1 jruoho "Could not compile input file");
278 1.1.1.2 jruoho
279 1.1.1.14 christos return (Status);
280 1.1 jruoho }
281 1.1 jruoho
282 1.1 jruoho /* Create/open the binary output file */
283 1.1 jruoho
284 1.1.1.13 christos AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
285 1.1.1.13 christos Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
286 1.1 jruoho if (ACPI_FAILURE (Status))
287 1.1 jruoho {
288 1.1.1.14 christos return (Status);
289 1.1 jruoho }
290 1.1 jruoho
291 1.1 jruoho /* Write the binary, then the optional hex file */
292 1.1 jruoho
293 1.1.1.13 christos DtOutputBinary (AslGbl_RootTable);
294 1.1.1.4 christos HxDoHexOutput ();
295 1.1.1.2 jruoho DtWriteTableToListing ();
296 1.1 jruoho
297 1.1.1.15 christos /* Save the compile time statistics to the current file node */
298 1.1.1.15 christos
299 1.1.1.16 christos FileNode->TotalFields = AslGbl_InputFieldCount;
300 1.1.1.16 christos FileNode->OutputByteLength = AslGbl_TableLength;
301 1.1.1.15 christos
302 1.1 jruoho return (Status);
303 1.1 jruoho }
304 1.1 jruoho
305 1.1 jruoho
306 1.1 jruoho /******************************************************************************
307 1.1 jruoho *
308 1.1 jruoho * FUNCTION: DtInitialize
309 1.1 jruoho *
310 1.1 jruoho * PARAMETERS: None
311 1.1 jruoho *
312 1.1.1.2 jruoho * RETURN: Status
313 1.1 jruoho *
314 1.1 jruoho * DESCRIPTION: Initialize data table compiler globals. Enables multiple
315 1.1 jruoho * compiles per invocation.
316 1.1 jruoho *
317 1.1 jruoho *****************************************************************************/
318 1.1 jruoho
319 1.1.1.15 christos void
320 1.1 jruoho DtInitialize (
321 1.1 jruoho void)
322 1.1 jruoho {
323 1.1.1.2 jruoho
324 1.1.1.2 jruoho
325 1.1.1.10 christos AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */
326 1.1.1.10 christos
327 1.1.1.13 christos AslGbl_FieldList = NULL;
328 1.1.1.13 christos AslGbl_RootTable = NULL;
329 1.1.1.13 christos AslGbl_SubtableStack = NULL;
330 1.1 jruoho
331 1.1 jruoho sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
332 1.1.1.15 christos return;
333 1.1 jruoho }
334 1.1 jruoho
335 1.1 jruoho
336 1.1 jruoho /******************************************************************************
337 1.1 jruoho *
338 1.1 jruoho * FUNCTION: DtInsertCompilerIds
339 1.1 jruoho *
340 1.1 jruoho * PARAMETERS: FieldList - Current field list pointer
341 1.1 jruoho *
342 1.1 jruoho * RETURN: None
343 1.1 jruoho *
344 1.1 jruoho * DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into
345 1.1 jruoho * the original ACPI table header.
346 1.1 jruoho *
347 1.1 jruoho *****************************************************************************/
348 1.1 jruoho
349 1.1 jruoho static void
350 1.1 jruoho DtInsertCompilerIds (
351 1.1 jruoho DT_FIELD *FieldList)
352 1.1 jruoho {
353 1.1 jruoho DT_FIELD *Next;
354 1.1 jruoho UINT32 i;
355 1.1 jruoho
356 1.1 jruoho
357 1.1 jruoho /*
358 1.1 jruoho * Don't insert current compiler ID if requested. Used for compiler
359 1.1 jruoho * debug/validation only.
360 1.1 jruoho */
361 1.1.1.13 christos if (AslGbl_UseOriginalCompilerId)
362 1.1 jruoho {
363 1.1 jruoho return;
364 1.1 jruoho }
365 1.1 jruoho
366 1.1 jruoho /* Walk to the Compiler fields at the end of the header */
367 1.1 jruoho
368 1.1 jruoho Next = FieldList;
369 1.1 jruoho for (i = 0; i < 7; i++)
370 1.1 jruoho {
371 1.1 jruoho Next = Next->Next;
372 1.1 jruoho }
373 1.1 jruoho
374 1.1.1.2 jruoho Next->Value = ASL_CREATOR_ID;
375 1.1 jruoho Next->Flags = DT_FIELD_NOT_ALLOCATED;
376 1.1 jruoho
377 1.1 jruoho Next = Next->Next;
378 1.1 jruoho Next->Value = VersionString;
379 1.1 jruoho Next->Flags = DT_FIELD_NOT_ALLOCATED;
380 1.1 jruoho }
381 1.1 jruoho
382 1.1 jruoho
383 1.1 jruoho /******************************************************************************
384 1.1 jruoho *
385 1.1 jruoho * FUNCTION: DtCompileDataTable
386 1.1 jruoho *
387 1.1 jruoho * PARAMETERS: FieldList - Current field list pointer
388 1.1 jruoho *
389 1.1 jruoho * RETURN: Status
390 1.1 jruoho *
391 1.1 jruoho * DESCRIPTION: Entry point to compile one data table
392 1.1 jruoho *
393 1.1 jruoho *****************************************************************************/
394 1.1 jruoho
395 1.1 jruoho static ACPI_STATUS
396 1.1 jruoho DtCompileDataTable (
397 1.1 jruoho DT_FIELD **FieldList)
398 1.1 jruoho {
399 1.1.1.7 christos const ACPI_DMTABLE_DATA *TableData;
400 1.1 jruoho DT_SUBTABLE *Subtable;
401 1.1 jruoho char *Signature;
402 1.1 jruoho ACPI_TABLE_HEADER *AcpiTableHeader;
403 1.1 jruoho ACPI_STATUS Status;
404 1.1.1.4 christos DT_FIELD *RootField = *FieldList;
405 1.1 jruoho
406 1.1 jruoho
407 1.1 jruoho /* Verify that we at least have a table signature and save it */
408 1.1 jruoho
409 1.1.1.3 jruoho Signature = DtGetFieldValue (*FieldList);
410 1.1 jruoho if (!Signature)
411 1.1 jruoho {
412 1.1.1.13 christos sprintf (AslGbl_MsgBuffer, "Expected \"%s\"", "Signature");
413 1.1.1.2 jruoho DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
414 1.1.1.13 christos *FieldList, AslGbl_MsgBuffer);
415 1.1 jruoho return (AE_ERROR);
416 1.1 jruoho }
417 1.1 jruoho
418 1.1.1.13 christos AslGbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1);
419 1.1.1.13 christos strcpy (AslGbl_Signature, Signature);
420 1.1 jruoho
421 1.1 jruoho /*
422 1.1 jruoho * Handle tables that don't use the common ACPI table header structure.
423 1.1 jruoho * Currently, these are the FACS and RSDP. Also check for an OEMx table,
424 1.1 jruoho * these tables have user-defined contents.
425 1.1 jruoho */
426 1.1.1.14 christos if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_FACS))
427 1.1 jruoho {
428 1.1 jruoho Status = DtCompileFacs (FieldList);
429 1.1 jruoho if (ACPI_FAILURE (Status))
430 1.1 jruoho {
431 1.1 jruoho return (Status);
432 1.1 jruoho }
433 1.1 jruoho
434 1.1 jruoho DtSetTableLength ();
435 1.1 jruoho return (Status);
436 1.1 jruoho }
437 1.1.1.4 christos else if (ACPI_VALIDATE_RSDP_SIG (Signature))
438 1.1 jruoho {
439 1.1 jruoho Status = DtCompileRsdp (FieldList);
440 1.1 jruoho return (Status);
441 1.1 jruoho }
442 1.1.1.14 christos else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_S3PT))
443 1.1.1.4 christos {
444 1.1.1.4 christos Status = DtCompileS3pt (FieldList);
445 1.1.1.4 christos if (ACPI_FAILURE (Status))
446 1.1.1.4 christos {
447 1.1.1.4 christos return (Status);
448 1.1.1.4 christos }
449 1.1.1.4 christos
450 1.1.1.4 christos DtSetTableLength ();
451 1.1.1.4 christos return (Status);
452 1.1.1.4 christos }
453 1.1.1.2 jruoho
454 1.1 jruoho /*
455 1.1.1.20 christos * If the first field is named "CDAT Table Length" (not "Signature"),
456 1.1.1.20 christos * assume that we have a CDAT table (whose table header does not have
457 1.1.1.20 christos * a signature). Instead, the TableLength field is where the
458 1.1.1.20 christos * signature would (normally) be.
459 1.1.1.20 christos */
460 1.1.1.20 christos else if (!strcmp ((*FieldList)->Name, "CDAT Table Length"))
461 1.1.1.20 christos {
462 1.1.1.20 christos /* No longer true: (However, use this technique in the disassembler)
463 1.1.1.20 christos * We are assuming that there
464 1.1.1.20 christos * should be at least one non-ASCII byte in the 4-character
465 1.1.1.20 christos * Signature field, (At least the high-order byte should be zero).
466 1.1.1.20 christos */
467 1.1.1.20 christos Status = DtCompileTable (FieldList, AcpiDmTableInfoCdatTableHdr,
468 1.1.1.20 christos &AslGbl_RootTable);
469 1.1.1.20 christos if (ACPI_FAILURE (Status))
470 1.1.1.20 christos {
471 1.1.1.20 christos return (Status);
472 1.1.1.20 christos }
473 1.1.1.20 christos
474 1.1.1.20 christos /* Compile the CDAT */
475 1.1.1.20 christos
476 1.1.1.20 christos DtPushSubtable (AslGbl_RootTable);
477 1.1.1.20 christos Status = DtCompileCdat ((void **) FieldList);
478 1.1.1.20 christos if (ACPI_FAILURE (Status))
479 1.1.1.20 christos {
480 1.1.1.20 christos return (Status);
481 1.1.1.20 christos }
482 1.1.1.20 christos
483 1.1.1.20 christos /*
484 1.1.1.20 christos * Set the overall table length and the table checksum.
485 1.1.1.20 christos * The entire compiled table (including the CDAT table header with
486 1.1.1.20 christos * the table length and checksum) is in AslGbl_RootTable->Buffer.
487 1.1.1.20 christos */
488 1.1.1.20 christos DtSetTableLength ();
489 1.1.1.20 christos DtSetTableChecksum (&ACPI_CAST_PTR (ACPI_TABLE_CDAT, AslGbl_RootTable->Buffer)->Checksum);
490 1.1.1.20 christos
491 1.1.1.20 christos DtDumpFieldList (RootField);
492 1.1.1.20 christos DtDumpSubtableList ();
493 1.1.1.20 christos return (AE_OK);
494 1.1.1.20 christos }
495 1.1.1.20 christos
496 1.1.1.20 christos /*
497 1.1 jruoho * All other tables must use the common ACPI table header. Insert the
498 1.1 jruoho * current iASL IDs (name, version), and compile the header now.
499 1.1 jruoho */
500 1.1 jruoho DtInsertCompilerIds (*FieldList);
501 1.1 jruoho
502 1.1 jruoho Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
503 1.1.1.13 christos &AslGbl_RootTable);
504 1.1 jruoho if (ACPI_FAILURE (Status))
505 1.1 jruoho {
506 1.1 jruoho return (Status);
507 1.1 jruoho }
508 1.1 jruoho
509 1.1.1.13 christos DtPushSubtable (AslGbl_RootTable);
510 1.1 jruoho
511 1.1.1.3 jruoho /* Validate the signature via the ACPI table list */
512 1.1.1.3 jruoho
513 1.1.1.3 jruoho TableData = AcpiDmGetTableData (Signature);
514 1.1.1.13 christos if (!TableData || AslGbl_CompileGeneric)
515 1.1.1.3 jruoho {
516 1.1.1.7 christos /* Unknown table signature and/or force generic compile */
517 1.1.1.7 christos
518 1.1.1.7 christos DtCompileGeneric ((void **) FieldList, NULL, NULL);
519 1.1.1.4 christos goto FinishHeader;
520 1.1.1.3 jruoho }
521 1.1.1.3 jruoho
522 1.1.1.2 jruoho /* Dispatch to per-table compile */
523 1.1 jruoho
524 1.1 jruoho if (TableData->CmTableHandler)
525 1.1 jruoho {
526 1.1 jruoho /* Complex table, has a handler */
527 1.1 jruoho
528 1.1 jruoho Status = TableData->CmTableHandler ((void **) FieldList);
529 1.1 jruoho if (ACPI_FAILURE (Status))
530 1.1 jruoho {
531 1.1 jruoho return (Status);
532 1.1 jruoho }
533 1.1 jruoho }
534 1.1 jruoho else if (TableData->TableInfo)
535 1.1 jruoho {
536 1.1.1.10 christos /* Simple table, just walk the info table, unless its empty */
537 1.1 jruoho
538 1.1.1.10 christos if (FieldList && *FieldList)
539 1.1 jruoho {
540 1.1.1.10 christos Subtable = NULL;
541 1.1.1.10 christos Status = DtCompileTable (FieldList, TableData->TableInfo,
542 1.1.1.12 christos &Subtable);
543 1.1.1.10 christos if (ACPI_FAILURE (Status))
544 1.1.1.10 christos {
545 1.1.1.10 christos return (Status);
546 1.1.1.10 christos }
547 1.1 jruoho
548 1.1.1.13 christos DtInsertSubtable (AslGbl_RootTable, Subtable);
549 1.1.1.10 christos DtPopSubtable ();
550 1.1.1.10 christos }
551 1.1 jruoho }
552 1.1 jruoho else
553 1.1 jruoho {
554 1.1 jruoho DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList,
555 1.1 jruoho "Missing table dispatch info");
556 1.1 jruoho return (AE_ERROR);
557 1.1 jruoho }
558 1.1 jruoho
559 1.1.1.4 christos FinishHeader:
560 1.1.1.4 christos
561 1.1 jruoho /* Set the final table length and then the checksum */
562 1.1 jruoho
563 1.1 jruoho DtSetTableLength ();
564 1.1 jruoho AcpiTableHeader = ACPI_CAST_PTR (
565 1.1.1.13 christos ACPI_TABLE_HEADER, AslGbl_RootTable->Buffer);
566 1.1 jruoho DtSetTableChecksum (&AcpiTableHeader->Checksum);
567 1.1 jruoho
568 1.1.1.4 christos DtDumpFieldList (RootField);
569 1.1.1.4 christos DtDumpSubtableList ();
570 1.1 jruoho return (AE_OK);
571 1.1 jruoho }
572 1.1 jruoho
573 1.1 jruoho
574 1.1 jruoho /******************************************************************************
575 1.1 jruoho *
576 1.1 jruoho * FUNCTION: DtCompileTable
577 1.1 jruoho *
578 1.1 jruoho * PARAMETERS: Field - Current field list pointer
579 1.1 jruoho * Info - Info table for this ACPI table
580 1.1 jruoho * RetSubtable - Compile result of table
581 1.1 jruoho *
582 1.1 jruoho * RETURN: Status
583 1.1 jruoho *
584 1.1 jruoho * DESCRIPTION: Compile a subtable
585 1.1 jruoho *
586 1.1 jruoho *****************************************************************************/
587 1.1 jruoho
588 1.1 jruoho ACPI_STATUS
589 1.1 jruoho DtCompileTable (
590 1.1 jruoho DT_FIELD **Field,
591 1.1 jruoho ACPI_DMTABLE_INFO *Info,
592 1.1.1.12 christos DT_SUBTABLE **RetSubtable)
593 1.1 jruoho {
594 1.1 jruoho DT_FIELD *LocalField;
595 1.1 jruoho UINT32 Length;
596 1.1 jruoho DT_SUBTABLE *Subtable;
597 1.1.1.7 christos DT_SUBTABLE *InlineSubtable = NULL;
598 1.1 jruoho UINT32 FieldLength = 0;
599 1.1 jruoho UINT8 FieldType;
600 1.1 jruoho UINT8 *Buffer;
601 1.1 jruoho UINT8 *FlagBuffer = NULL;
602 1.1.1.5 christos char *String;
603 1.1.1.4 christos UINT32 CurrentFlagByteOffset = 0;
604 1.1.1.7 christos ACPI_STATUS Status = AE_OK;
605 1.1 jruoho
606 1.1 jruoho
607 1.1.1.16 christos if (!Field || !Info)
608 1.1 jruoho {
609 1.1 jruoho return (AE_BAD_PARAMETER);
610 1.1 jruoho }
611 1.1.1.12 christos if (!*Field)
612 1.1.1.12 christos {
613 1.1.1.12 christos /*
614 1.1.1.12 christos * The field list is empty, this means that we are out of fields to
615 1.1.1.12 christos * parse. In other words, we are at the end of the table.
616 1.1.1.12 christos */
617 1.1.1.12 christos return (AE_END_OF_TABLE);
618 1.1.1.12 christos }
619 1.1 jruoho
620 1.1.1.4 christos /* Ignore optional subtable if name does not match */
621 1.1.1.4 christos
622 1.1.1.4 christos if ((Info->Flags & DT_OPTIONAL) &&
623 1.1.1.7 christos strcmp ((*Field)->Name, Info->Name))
624 1.1.1.4 christos {
625 1.1.1.4 christos *RetSubtable = NULL;
626 1.1.1.4 christos return (AE_OK);
627 1.1.1.4 christos }
628 1.1.1.4 christos
629 1.1 jruoho Length = DtGetSubtableLength (*Field, Info);
630 1.1.1.3 jruoho if (Length == ASL_EOF)
631 1.1.1.3 jruoho {
632 1.1.1.3 jruoho return (AE_ERROR);
633 1.1.1.3 jruoho }
634 1.1.1.3 jruoho
635 1.1.1.5 christos Subtable = UtSubtableCacheCalloc ();
636 1.1 jruoho
637 1.1.1.2 jruoho if (Length > 0)
638 1.1.1.2 jruoho {
639 1.1.1.11 christos String = UtLocalCacheCalloc (Length);
640 1.1.1.5 christos Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
641 1.1.1.2 jruoho }
642 1.1.1.5 christos
643 1.1 jruoho Subtable->Length = Length;
644 1.1 jruoho Subtable->TotalLength = Length;
645 1.1 jruoho Buffer = Subtable->Buffer;
646 1.1 jruoho
647 1.1 jruoho LocalField = *Field;
648 1.1.1.7 christos Subtable->Name = LocalField->Name;
649 1.1 jruoho
650 1.1 jruoho /*
651 1.1 jruoho * Main loop walks the info table for this ACPI table or subtable
652 1.1 jruoho */
653 1.1 jruoho for (; Info->Name; Info++)
654 1.1 jruoho {
655 1.1.1.4 christos if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
656 1.1.1.4 christos {
657 1.1.1.4 christos continue;
658 1.1.1.4 christos }
659 1.1.1.4 christos
660 1.1 jruoho if (!LocalField)
661 1.1 jruoho {
662 1.1.1.13 christos sprintf (AslGbl_MsgBuffer, "Found NULL field - Field name \"%s\" needed",
663 1.1 jruoho Info->Name);
664 1.1.1.13 christos DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer);
665 1.1 jruoho Status = AE_BAD_DATA;
666 1.1 jruoho goto Error;
667 1.1 jruoho }
668 1.1 jruoho
669 1.1.1.2 jruoho /* Maintain table offsets */
670 1.1.1.2 jruoho
671 1.1.1.13 christos LocalField->TableOffset = AslGbl_CurrentTableOffset;
672 1.1 jruoho FieldLength = DtGetFieldLength (LocalField, Info);
673 1.1.1.13 christos AslGbl_CurrentTableOffset += FieldLength;
674 1.1.1.2 jruoho
675 1.1 jruoho FieldType = DtGetFieldType (Info);
676 1.1.1.13 christos AslGbl_InputFieldCount++;
677 1.1 jruoho
678 1.1.1.16 christos if (FieldType != DT_FIELD_TYPE_INLINE_SUBTABLE &&
679 1.1.1.16 christos strcmp (Info->Name, LocalField->Name))
680 1.1.1.16 christos {
681 1.1.1.16 christos sprintf (AslGbl_MsgBuffer, "found \"%s\" expected \"%s\"",
682 1.1.1.16 christos LocalField->Name, Info->Name);
683 1.1.1.16 christos DtError (ASL_ERROR, ASL_MSG_INVALID_LABEL, LocalField, AslGbl_MsgBuffer);
684 1.1.1.16 christos }
685 1.1.1.16 christos
686 1.1 jruoho switch (FieldType)
687 1.1 jruoho {
688 1.1 jruoho case DT_FIELD_TYPE_FLAGS_INTEGER:
689 1.1 jruoho /*
690 1.1 jruoho * Start of the definition of a flags field.
691 1.1 jruoho * This master flags integer starts at value zero, in preparation
692 1.1 jruoho * to compile and insert the flag fields from the individual bits
693 1.1 jruoho */
694 1.1 jruoho LocalField = LocalField->Next;
695 1.1 jruoho *Field = LocalField;
696 1.1 jruoho
697 1.1 jruoho FlagBuffer = Buffer;
698 1.1.1.4 christos CurrentFlagByteOffset = Info->Offset;
699 1.1 jruoho break;
700 1.1 jruoho
701 1.1 jruoho case DT_FIELD_TYPE_FLAG:
702 1.1 jruoho
703 1.1 jruoho /* Individual Flag field, can be multiple bits */
704 1.1 jruoho
705 1.1 jruoho if (FlagBuffer)
706 1.1 jruoho {
707 1.1.1.4 christos /*
708 1.1.1.4 christos * We must increment the FlagBuffer when we have crossed
709 1.1.1.4 christos * into the next flags byte within the flags field
710 1.1.1.4 christos * of type DT_FIELD_TYPE_FLAGS_INTEGER.
711 1.1.1.4 christos */
712 1.1.1.4 christos FlagBuffer += (Info->Offset - CurrentFlagByteOffset);
713 1.1.1.4 christos CurrentFlagByteOffset = Info->Offset;
714 1.1.1.4 christos
715 1.1.1.2 jruoho DtCompileFlag (FlagBuffer, LocalField, Info);
716 1.1 jruoho }
717 1.1 jruoho else
718 1.1 jruoho {
719 1.1 jruoho /* TBD - this is an internal error */
720 1.1 jruoho }
721 1.1 jruoho
722 1.1 jruoho LocalField = LocalField->Next;
723 1.1 jruoho *Field = LocalField;
724 1.1 jruoho break;
725 1.1 jruoho
726 1.1 jruoho case DT_FIELD_TYPE_INLINE_SUBTABLE:
727 1.1 jruoho /*
728 1.1 jruoho * Recursion (one level max): compile GAS (Generic Address)
729 1.1 jruoho * or Notify in-line subtable
730 1.1 jruoho */
731 1.1 jruoho *Field = LocalField;
732 1.1 jruoho
733 1.1.1.7 christos switch (Info->Opcode)
734 1.1 jruoho {
735 1.1.1.7 christos case ACPI_DMT_GAS:
736 1.1.1.7 christos
737 1.1 jruoho Status = DtCompileTable (Field, AcpiDmTableInfoGas,
738 1.1.1.12 christos &InlineSubtable);
739 1.1.1.7 christos break;
740 1.1.1.7 christos
741 1.1.1.7 christos case ACPI_DMT_HESTNTFY:
742 1.1.1.7 christos
743 1.1 jruoho Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify,
744 1.1.1.12 christos &InlineSubtable);
745 1.1.1.7 christos break;
746 1.1.1.7 christos
747 1.1.1.7 christos case ACPI_DMT_IORTMEM:
748 1.1.1.7 christos
749 1.1.1.7 christos Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc,
750 1.1.1.12 christos &InlineSubtable);
751 1.1.1.7 christos break;
752 1.1.1.7 christos
753 1.1.1.7 christos default:
754 1.1.1.13 christos sprintf (AslGbl_MsgBuffer, "Invalid DMT opcode: 0x%.2X",
755 1.1.1.7 christos Info->Opcode);
756 1.1.1.13 christos DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer);
757 1.1.1.7 christos Status = AE_BAD_DATA;
758 1.1.1.7 christos break;
759 1.1 jruoho }
760 1.1 jruoho
761 1.1 jruoho if (ACPI_FAILURE (Status))
762 1.1 jruoho {
763 1.1 jruoho goto Error;
764 1.1 jruoho }
765 1.1 jruoho
766 1.1.1.2 jruoho DtSetSubtableLength (InlineSubtable);
767 1.1.1.2 jruoho
768 1.1.1.7 christos memcpy (Buffer, InlineSubtable->Buffer, FieldLength);
769 1.1 jruoho LocalField = *Field;
770 1.1 jruoho break;
771 1.1 jruoho
772 1.1.1.2 jruoho case DT_FIELD_TYPE_LABEL:
773 1.1.1.2 jruoho
774 1.1.1.2 jruoho DtWriteFieldToListing (Buffer, LocalField, 0);
775 1.1.1.2 jruoho LocalField = LocalField->Next;
776 1.1.1.2 jruoho break;
777 1.1.1.2 jruoho
778 1.1 jruoho default:
779 1.1 jruoho
780 1.1 jruoho /* Normal case for most field types (Integer, String, etc.) */
781 1.1 jruoho
782 1.1 jruoho DtCompileOneField (Buffer, LocalField,
783 1.1 jruoho FieldLength, FieldType, Info->Flags);
784 1.1.1.2 jruoho
785 1.1.1.2 jruoho DtWriteFieldToListing (Buffer, LocalField, FieldLength);
786 1.1 jruoho LocalField = LocalField->Next;
787 1.1 jruoho
788 1.1 jruoho if (Info->Flags & DT_LENGTH)
789 1.1 jruoho {
790 1.1 jruoho /* Field is an Integer that will contain a subtable length */
791 1.1 jruoho
792 1.1 jruoho Subtable->LengthField = Buffer;
793 1.1 jruoho Subtable->SizeOfLengthField = FieldLength;
794 1.1 jruoho }
795 1.1 jruoho break;
796 1.1 jruoho }
797 1.1 jruoho
798 1.1 jruoho Buffer += FieldLength;
799 1.1 jruoho }
800 1.1 jruoho
801 1.1 jruoho *Field = LocalField;
802 1.1 jruoho *RetSubtable = Subtable;
803 1.1 jruoho return (AE_OK);
804 1.1 jruoho
805 1.1 jruoho Error:
806 1.1 jruoho ACPI_FREE (Subtable->Buffer);
807 1.1 jruoho ACPI_FREE (Subtable);
808 1.1 jruoho return (Status);
809 1.1 jruoho }
810 1.1.1.7 christos
811 1.1.1.7 christos
812 1.1.1.7 christos /******************************************************************************
813 1.1.1.7 christos *
814 1.1.1.8 christos * FUNCTION: DtCompileTwoSubtables
815 1.1.1.8 christos *
816 1.1.1.8 christos * PARAMETERS: List - Current field list pointer
817 1.1.1.8 christos * TableInfo1 - Info table 1
818 1.1.1.8 christos * TableInfo1 - Info table 2
819 1.1.1.8 christos *
820 1.1.1.8 christos * RETURN: Status
821 1.1.1.8 christos *
822 1.1.1.8 christos * DESCRIPTION: Compile tables with a header and one or more same subtables.
823 1.1.1.8 christos * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT
824 1.1.1.8 christos *
825 1.1.1.8 christos *****************************************************************************/
826 1.1.1.8 christos
827 1.1.1.8 christos ACPI_STATUS
828 1.1.1.8 christos DtCompileTwoSubtables (
829 1.1.1.8 christos void **List,
830 1.1.1.8 christos ACPI_DMTABLE_INFO *TableInfo1,
831 1.1.1.8 christos ACPI_DMTABLE_INFO *TableInfo2)
832 1.1.1.8 christos {
833 1.1.1.8 christos ACPI_STATUS Status;
834 1.1.1.8 christos DT_SUBTABLE *Subtable;
835 1.1.1.8 christos DT_SUBTABLE *ParentTable;
836 1.1.1.8 christos DT_FIELD **PFieldList = (DT_FIELD **) List;
837 1.1.1.8 christos
838 1.1.1.8 christos
839 1.1.1.12 christos Status = DtCompileTable (PFieldList, TableInfo1, &Subtable);
840 1.1.1.8 christos if (ACPI_FAILURE (Status))
841 1.1.1.8 christos {
842 1.1.1.8 christos return (Status);
843 1.1.1.8 christos }
844 1.1.1.8 christos
845 1.1.1.8 christos ParentTable = DtPeekSubtable ();
846 1.1.1.8 christos DtInsertSubtable (ParentTable, Subtable);
847 1.1.1.8 christos
848 1.1.1.8 christos while (*PFieldList)
849 1.1.1.8 christos {
850 1.1.1.12 christos Status = DtCompileTable (PFieldList, TableInfo2, &Subtable);
851 1.1.1.8 christos if (ACPI_FAILURE (Status))
852 1.1.1.8 christos {
853 1.1.1.8 christos return (Status);
854 1.1.1.8 christos }
855 1.1.1.8 christos
856 1.1.1.8 christos DtInsertSubtable (ParentTable, Subtable);
857 1.1.1.8 christos }
858 1.1.1.8 christos
859 1.1.1.8 christos return (AE_OK);
860 1.1.1.8 christos }
861 1.1.1.8 christos
862 1.1.1.8 christos
863 1.1.1.8 christos /******************************************************************************
864 1.1.1.8 christos *
865 1.1.1.7 christos * FUNCTION: DtCompilePadding
866 1.1.1.7 christos *
867 1.1.1.7 christos * PARAMETERS: Length - Padding field size
868 1.1.1.7 christos * RetSubtable - Compile result of table
869 1.1.1.7 christos *
870 1.1.1.7 christos * RETURN: Status
871 1.1.1.7 christos *
872 1.1.1.7 christos * DESCRIPTION: Compile a subtable for padding purpose
873 1.1.1.7 christos *
874 1.1.1.7 christos *****************************************************************************/
875 1.1.1.7 christos
876 1.1.1.7 christos ACPI_STATUS
877 1.1.1.7 christos DtCompilePadding (
878 1.1.1.7 christos UINT32 Length,
879 1.1.1.7 christos DT_SUBTABLE **RetSubtable)
880 1.1.1.7 christos {
881 1.1.1.7 christos DT_SUBTABLE *Subtable;
882 1.1.1.7 christos /* UINT8 *Buffer; */
883 1.1.1.7 christos char *String;
884 1.1.1.7 christos
885 1.1.1.7 christos
886 1.1.1.7 christos Subtable = UtSubtableCacheCalloc ();
887 1.1.1.7 christos
888 1.1.1.7 christos if (Length > 0)
889 1.1.1.7 christos {
890 1.1.1.11 christos String = UtLocalCacheCalloc (Length);
891 1.1.1.7 christos Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
892 1.1.1.7 christos }
893 1.1.1.7 christos
894 1.1.1.7 christos Subtable->Length = Length;
895 1.1.1.7 christos Subtable->TotalLength = Length;
896 1.1.1.7 christos /* Buffer = Subtable->Buffer; */
897 1.1.1.7 christos
898 1.1.1.7 christos *RetSubtable = Subtable;
899 1.1.1.7 christos return (AE_OK);
900 1.1.1.7 christos }
901