asllength.c revision 1.1.1.2.2.2 1 1.1.1.2.2.2 bouyer
2 1.1.1.2.2.2 bouyer /******************************************************************************
3 1.1.1.2.2.2 bouyer *
4 1.1.1.2.2.2 bouyer * Module Name: asllength - Tree walk to determine package and opcode lengths
5 1.1.1.2.2.2 bouyer *
6 1.1.1.2.2.2 bouyer *****************************************************************************/
7 1.1.1.2.2.2 bouyer
8 1.1.1.2.2.2 bouyer /*
9 1.1.1.2.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
10 1.1.1.2.2.2 bouyer * All rights reserved.
11 1.1.1.2.2.2 bouyer *
12 1.1.1.2.2.2 bouyer * Redistribution and use in source and binary forms, with or without
13 1.1.1.2.2.2 bouyer * modification, are permitted provided that the following conditions
14 1.1.1.2.2.2 bouyer * are met:
15 1.1.1.2.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
16 1.1.1.2.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
17 1.1.1.2.2.2 bouyer * without modification.
18 1.1.1.2.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.1.1.2.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
20 1.1.1.2.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
21 1.1.1.2.2.2 bouyer * including a substantially similar Disclaimer requirement for further
22 1.1.1.2.2.2 bouyer * binary redistribution.
23 1.1.1.2.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
24 1.1.1.2.2.2 bouyer * of any contributors may be used to endorse or promote products derived
25 1.1.1.2.2.2 bouyer * from this software without specific prior written permission.
26 1.1.1.2.2.2 bouyer *
27 1.1.1.2.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
28 1.1.1.2.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
29 1.1.1.2.2.2 bouyer * Software Foundation.
30 1.1.1.2.2.2 bouyer *
31 1.1.1.2.2.2 bouyer * NO WARRANTY
32 1.1.1.2.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.1.1.2.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.1.1.2.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.1.1.2.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.1.1.2.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.1.1.2.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.1.1.2.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.1.1.2.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.1.1.2.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.1.1.2.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.1.1.2.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
43 1.1.1.2.2.2 bouyer */
44 1.1.1.2.2.2 bouyer
45 1.1.1.2.2.2 bouyer
46 1.1.1.2.2.2 bouyer #include "aslcompiler.h"
47 1.1.1.2.2.2 bouyer #include "aslcompiler.y.h"
48 1.1.1.2.2.2 bouyer #include "amlcode.h"
49 1.1.1.2.2.2 bouyer
50 1.1.1.2.2.2 bouyer
51 1.1.1.2.2.2 bouyer #define _COMPONENT ACPI_COMPILER
52 1.1.1.2.2.2 bouyer ACPI_MODULE_NAME ("asllength")
53 1.1.1.2.2.2 bouyer
54 1.1.1.2.2.2 bouyer /* Local prototypes */
55 1.1.1.2.2.2 bouyer
56 1.1.1.2.2.2 bouyer static UINT8
57 1.1.1.2.2.2 bouyer CgGetPackageLenByteCount (
58 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
59 1.1.1.2.2.2 bouyer UINT32 PackageLength);
60 1.1.1.2.2.2 bouyer
61 1.1.1.2.2.2 bouyer static void
62 1.1.1.2.2.2 bouyer CgGenerateAmlOpcodeLength (
63 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op);
64 1.1.1.2.2.2 bouyer
65 1.1.1.2.2.2 bouyer
66 1.1.1.2.2.2 bouyer #ifdef ACPI_OBSOLETE_FUNCTIONS
67 1.1.1.2.2.2 bouyer void
68 1.1.1.2.2.2 bouyer LnAdjustLengthToRoot (
69 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
70 1.1.1.2.2.2 bouyer UINT32 LengthDelta);
71 1.1.1.2.2.2 bouyer #endif
72 1.1.1.2.2.2 bouyer
73 1.1.1.2.2.2 bouyer
74 1.1.1.2.2.2 bouyer /*******************************************************************************
75 1.1.1.2.2.2 bouyer *
76 1.1.1.2.2.2 bouyer * FUNCTION: LnInitLengthsWalk
77 1.1.1.2.2.2 bouyer *
78 1.1.1.2.2.2 bouyer * PARAMETERS: ASL_WALK_CALLBACK
79 1.1.1.2.2.2 bouyer *
80 1.1.1.2.2.2 bouyer * RETURN: Status
81 1.1.1.2.2.2 bouyer *
82 1.1.1.2.2.2 bouyer * DESCRIPTION: Walk callback to initialize (and re-initialize) the node
83 1.1.1.2.2.2 bouyer * subtree length(s) to zero. The Subtree lengths are bubbled
84 1.1.1.2.2.2 bouyer * up to the root node in order to get a total AML length.
85 1.1.1.2.2.2 bouyer *
86 1.1.1.2.2.2 bouyer ******************************************************************************/
87 1.1.1.2.2.2 bouyer
88 1.1.1.2.2.2 bouyer ACPI_STATUS
89 1.1.1.2.2.2 bouyer LnInitLengthsWalk (
90 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
91 1.1.1.2.2.2 bouyer UINT32 Level,
92 1.1.1.2.2.2 bouyer void *Context)
93 1.1.1.2.2.2 bouyer {
94 1.1.1.2.2.2 bouyer
95 1.1.1.2.2.2 bouyer Op->Asl.AmlSubtreeLength = 0;
96 1.1.1.2.2.2 bouyer return (AE_OK);
97 1.1.1.2.2.2 bouyer }
98 1.1.1.2.2.2 bouyer
99 1.1.1.2.2.2 bouyer
100 1.1.1.2.2.2 bouyer /*******************************************************************************
101 1.1.1.2.2.2 bouyer *
102 1.1.1.2.2.2 bouyer * FUNCTION: LnPackageLengthWalk
103 1.1.1.2.2.2 bouyer *
104 1.1.1.2.2.2 bouyer * PARAMETERS: ASL_WALK_CALLBACK
105 1.1.1.2.2.2 bouyer *
106 1.1.1.2.2.2 bouyer * RETURN: Status
107 1.1.1.2.2.2 bouyer *
108 1.1.1.2.2.2 bouyer * DESCRIPTION: Walk callback to calculate the total AML length.
109 1.1.1.2.2.2 bouyer * 1) Calculate the AML lengths (opcode, package length, etc.) for
110 1.1.1.2.2.2 bouyer * THIS node.
111 1.1.1.2.2.2 bouyer * 2) Bubbble up all of these lengths to the parent node by summing
112 1.1.1.2.2.2 bouyer * them all into the parent subtree length.
113 1.1.1.2.2.2 bouyer *
114 1.1.1.2.2.2 bouyer * Note: The SubtreeLength represents the total AML length of all child nodes
115 1.1.1.2.2.2 bouyer * in all subtrees under a given node. Therefore, once this walk is
116 1.1.1.2.2.2 bouyer * complete, the Root Node subtree length is the AML length of the entire
117 1.1.1.2.2.2 bouyer * tree (and thus, the entire ACPI table)
118 1.1.1.2.2.2 bouyer *
119 1.1.1.2.2.2 bouyer ******************************************************************************/
120 1.1.1.2.2.2 bouyer
121 1.1.1.2.2.2 bouyer ACPI_STATUS
122 1.1.1.2.2.2 bouyer LnPackageLengthWalk (
123 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
124 1.1.1.2.2.2 bouyer UINT32 Level,
125 1.1.1.2.2.2 bouyer void *Context)
126 1.1.1.2.2.2 bouyer {
127 1.1.1.2.2.2 bouyer
128 1.1.1.2.2.2 bouyer /* Generate the AML lengths for this node */
129 1.1.1.2.2.2 bouyer
130 1.1.1.2.2.2 bouyer CgGenerateAmlLengths (Op);
131 1.1.1.2.2.2 bouyer
132 1.1.1.2.2.2 bouyer /* Bubble up all lengths (this node and all below it) to the parent */
133 1.1.1.2.2.2 bouyer
134 1.1.1.2.2.2 bouyer if ((Op->Asl.Parent) &&
135 1.1.1.2.2.2 bouyer (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
136 1.1.1.2.2.2 bouyer {
137 1.1.1.2.2.2 bouyer Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength +
138 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength +
139 1.1.1.2.2.2 bouyer Op->Asl.AmlPkgLenBytes +
140 1.1.1.2.2.2 bouyer Op->Asl.AmlSubtreeLength);
141 1.1.1.2.2.2 bouyer }
142 1.1.1.2.2.2 bouyer return (AE_OK);
143 1.1.1.2.2.2 bouyer }
144 1.1.1.2.2.2 bouyer
145 1.1.1.2.2.2 bouyer
146 1.1.1.2.2.2 bouyer /*******************************************************************************
147 1.1.1.2.2.2 bouyer *
148 1.1.1.2.2.2 bouyer * FUNCTION: CgGetPackageLenByteCount
149 1.1.1.2.2.2 bouyer *
150 1.1.1.2.2.2 bouyer * PARAMETERS: Op - Parse node
151 1.1.1.2.2.2 bouyer * PackageLength - Length to be encoded
152 1.1.1.2.2.2 bouyer *
153 1.1.1.2.2.2 bouyer * RETURN: Required length of the package length encoding
154 1.1.1.2.2.2 bouyer *
155 1.1.1.2.2.2 bouyer * DESCRIPTION: Calculate the number of bytes required to encode the given
156 1.1.1.2.2.2 bouyer * package length.
157 1.1.1.2.2.2 bouyer *
158 1.1.1.2.2.2 bouyer ******************************************************************************/
159 1.1.1.2.2.2 bouyer
160 1.1.1.2.2.2 bouyer static UINT8
161 1.1.1.2.2.2 bouyer CgGetPackageLenByteCount (
162 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
163 1.1.1.2.2.2 bouyer UINT32 PackageLength)
164 1.1.1.2.2.2 bouyer {
165 1.1.1.2.2.2 bouyer
166 1.1.1.2.2.2 bouyer /*
167 1.1.1.2.2.2 bouyer * Determine the number of bytes required to encode the package length
168 1.1.1.2.2.2 bouyer * Note: the package length includes the number of bytes used to encode
169 1.1.1.2.2.2 bouyer * the package length, so we must account for this also.
170 1.1.1.2.2.2 bouyer */
171 1.1.1.2.2.2 bouyer if (PackageLength <= (0x0000003F - 1))
172 1.1.1.2.2.2 bouyer {
173 1.1.1.2.2.2 bouyer return (1);
174 1.1.1.2.2.2 bouyer }
175 1.1.1.2.2.2 bouyer else if (PackageLength <= (0x00000FFF - 2))
176 1.1.1.2.2.2 bouyer {
177 1.1.1.2.2.2 bouyer return (2);
178 1.1.1.2.2.2 bouyer }
179 1.1.1.2.2.2 bouyer else if (PackageLength <= (0x000FFFFF - 3))
180 1.1.1.2.2.2 bouyer {
181 1.1.1.2.2.2 bouyer return (3);
182 1.1.1.2.2.2 bouyer }
183 1.1.1.2.2.2 bouyer else if (PackageLength <= (0x0FFFFFFF - 4))
184 1.1.1.2.2.2 bouyer {
185 1.1.1.2.2.2 bouyer return (4);
186 1.1.1.2.2.2 bouyer }
187 1.1.1.2.2.2 bouyer else
188 1.1.1.2.2.2 bouyer {
189 1.1.1.2.2.2 bouyer /* Fatal error - the package length is too large to encode */
190 1.1.1.2.2.2 bouyer
191 1.1.1.2.2.2 bouyer AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL);
192 1.1.1.2.2.2 bouyer }
193 1.1.1.2.2.2 bouyer
194 1.1.1.2.2.2 bouyer return (0);
195 1.1.1.2.2.2 bouyer }
196 1.1.1.2.2.2 bouyer
197 1.1.1.2.2.2 bouyer
198 1.1.1.2.2.2 bouyer /*******************************************************************************
199 1.1.1.2.2.2 bouyer *
200 1.1.1.2.2.2 bouyer * FUNCTION: CgGenerateAmlOpcodeLength
201 1.1.1.2.2.2 bouyer *
202 1.1.1.2.2.2 bouyer * PARAMETERS: Op - Parse node whose AML opcode lengths will be
203 1.1.1.2.2.2 bouyer * calculated
204 1.1.1.2.2.2 bouyer *
205 1.1.1.2.2.2 bouyer * RETURN: None.
206 1.1.1.2.2.2 bouyer *
207 1.1.1.2.2.2 bouyer * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength
208 1.1.1.2.2.2 bouyer * fields for this node.
209 1.1.1.2.2.2 bouyer *
210 1.1.1.2.2.2 bouyer ******************************************************************************/
211 1.1.1.2.2.2 bouyer
212 1.1.1.2.2.2 bouyer static void
213 1.1.1.2.2.2 bouyer CgGenerateAmlOpcodeLength (
214 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op)
215 1.1.1.2.2.2 bouyer {
216 1.1.1.2.2.2 bouyer
217 1.1.1.2.2.2 bouyer /* Check for two-byte opcode */
218 1.1.1.2.2.2 bouyer
219 1.1.1.2.2.2 bouyer if (Op->Asl.AmlOpcode > 0x00FF)
220 1.1.1.2.2.2 bouyer {
221 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 2;
222 1.1.1.2.2.2 bouyer }
223 1.1.1.2.2.2 bouyer else
224 1.1.1.2.2.2 bouyer {
225 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 1;
226 1.1.1.2.2.2 bouyer }
227 1.1.1.2.2.2 bouyer
228 1.1.1.2.2.2 bouyer /* Does this opcode have an associated "PackageLength" field? */
229 1.1.1.2.2.2 bouyer
230 1.1.1.2.2.2 bouyer Op->Asl.AmlPkgLenBytes = 0;
231 1.1.1.2.2.2 bouyer if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
232 1.1.1.2.2.2 bouyer {
233 1.1.1.2.2.2 bouyer Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (
234 1.1.1.2.2.2 bouyer Op, Op->Asl.AmlSubtreeLength);
235 1.1.1.2.2.2 bouyer }
236 1.1.1.2.2.2 bouyer
237 1.1.1.2.2.2 bouyer /* Data opcode lengths are easy */
238 1.1.1.2.2.2 bouyer
239 1.1.1.2.2.2 bouyer switch (Op->Asl.AmlOpcode)
240 1.1.1.2.2.2 bouyer {
241 1.1.1.2.2.2 bouyer case AML_BYTE_OP:
242 1.1.1.2.2.2 bouyer
243 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 1;
244 1.1.1.2.2.2 bouyer break;
245 1.1.1.2.2.2 bouyer
246 1.1.1.2.2.2 bouyer case AML_WORD_OP:
247 1.1.1.2.2.2 bouyer
248 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 2;
249 1.1.1.2.2.2 bouyer break;
250 1.1.1.2.2.2 bouyer
251 1.1.1.2.2.2 bouyer case AML_DWORD_OP:
252 1.1.1.2.2.2 bouyer
253 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 4;
254 1.1.1.2.2.2 bouyer break;
255 1.1.1.2.2.2 bouyer
256 1.1.1.2.2.2 bouyer case AML_QWORD_OP:
257 1.1.1.2.2.2 bouyer
258 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 8;
259 1.1.1.2.2.2 bouyer break;
260 1.1.1.2.2.2 bouyer
261 1.1.1.2.2.2 bouyer default:
262 1.1.1.2.2.2 bouyer /* All data opcodes must be above */
263 1.1.1.2.2.2 bouyer break;
264 1.1.1.2.2.2 bouyer }
265 1.1.1.2.2.2 bouyer }
266 1.1.1.2.2.2 bouyer
267 1.1.1.2.2.2 bouyer
268 1.1.1.2.2.2 bouyer /*******************************************************************************
269 1.1.1.2.2.2 bouyer *
270 1.1.1.2.2.2 bouyer * FUNCTION: CgGenerateAmlLengths
271 1.1.1.2.2.2 bouyer *
272 1.1.1.2.2.2 bouyer * PARAMETERS: Op - Parse node
273 1.1.1.2.2.2 bouyer *
274 1.1.1.2.2.2 bouyer * RETURN: None.
275 1.1.1.2.2.2 bouyer *
276 1.1.1.2.2.2 bouyer * DESCRIPTION: Generate internal length fields based on the AML opcode or
277 1.1.1.2.2.2 bouyer * parse opcode.
278 1.1.1.2.2.2 bouyer *
279 1.1.1.2.2.2 bouyer ******************************************************************************/
280 1.1.1.2.2.2 bouyer
281 1.1.1.2.2.2 bouyer void
282 1.1.1.2.2.2 bouyer CgGenerateAmlLengths (
283 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op)
284 1.1.1.2.2.2 bouyer {
285 1.1.1.2.2.2 bouyer char *Buffer;
286 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
287 1.1.1.2.2.2 bouyer
288 1.1.1.2.2.2 bouyer
289 1.1.1.2.2.2 bouyer switch (Op->Asl.AmlOpcode)
290 1.1.1.2.2.2 bouyer {
291 1.1.1.2.2.2 bouyer case AML_RAW_DATA_BYTE:
292 1.1.1.2.2.2 bouyer
293 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
294 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 1;
295 1.1.1.2.2.2 bouyer return;
296 1.1.1.2.2.2 bouyer
297 1.1.1.2.2.2 bouyer case AML_RAW_DATA_WORD:
298 1.1.1.2.2.2 bouyer
299 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
300 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 2;
301 1.1.1.2.2.2 bouyer return;
302 1.1.1.2.2.2 bouyer
303 1.1.1.2.2.2 bouyer case AML_RAW_DATA_DWORD:
304 1.1.1.2.2.2 bouyer
305 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
306 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 4;
307 1.1.1.2.2.2 bouyer return;
308 1.1.1.2.2.2 bouyer
309 1.1.1.2.2.2 bouyer case AML_RAW_DATA_QWORD:
310 1.1.1.2.2.2 bouyer
311 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
312 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 8;
313 1.1.1.2.2.2 bouyer return;
314 1.1.1.2.2.2 bouyer
315 1.1.1.2.2.2 bouyer case AML_RAW_DATA_BUFFER:
316 1.1.1.2.2.2 bouyer
317 1.1.1.2.2.2 bouyer /* Aml length is/was set by creator */
318 1.1.1.2.2.2 bouyer
319 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
320 1.1.1.2.2.2 bouyer return;
321 1.1.1.2.2.2 bouyer
322 1.1.1.2.2.2 bouyer case AML_RAW_DATA_CHAIN:
323 1.1.1.2.2.2 bouyer
324 1.1.1.2.2.2 bouyer /* Aml length is/was set by creator */
325 1.1.1.2.2.2 bouyer
326 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
327 1.1.1.2.2.2 bouyer return;
328 1.1.1.2.2.2 bouyer
329 1.1.1.2.2.2 bouyer default:
330 1.1.1.2.2.2 bouyer break;
331 1.1.1.2.2.2 bouyer }
332 1.1.1.2.2.2 bouyer
333 1.1.1.2.2.2 bouyer switch (Op->Asl.ParseOpcode)
334 1.1.1.2.2.2 bouyer {
335 1.1.1.2.2.2 bouyer case PARSEOP_DEFINITIONBLOCK:
336 1.1.1.2.2.2 bouyer
337 1.1.1.2.2.2 bouyer Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) +
338 1.1.1.2.2.2 bouyer Op->Asl.AmlSubtreeLength;
339 1.1.1.2.2.2 bouyer break;
340 1.1.1.2.2.2 bouyer
341 1.1.1.2.2.2 bouyer case PARSEOP_NAMESEG:
342 1.1.1.2.2.2 bouyer
343 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
344 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 4;
345 1.1.1.2.2.2 bouyer Op->Asl.ExternalName = Op->Asl.Value.String;
346 1.1.1.2.2.2 bouyer break;
347 1.1.1.2.2.2 bouyer
348 1.1.1.2.2.2 bouyer case PARSEOP_NAMESTRING:
349 1.1.1.2.2.2 bouyer case PARSEOP_METHODCALL:
350 1.1.1.2.2.2 bouyer
351 1.1.1.2.2.2 bouyer if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED)
352 1.1.1.2.2.2 bouyer {
353 1.1.1.2.2.2 bouyer break;
354 1.1.1.2.2.2 bouyer }
355 1.1.1.2.2.2 bouyer
356 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
357 1.1.1.2.2.2 bouyer Status = UtInternalizeName (Op->Asl.Value.String, &Buffer);
358 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
359 1.1.1.2.2.2 bouyer {
360 1.1.1.2.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
361 1.1.1.2.2.2 bouyer "Failure from internalize name %X\n", Status);
362 1.1.1.2.2.2 bouyer break;
363 1.1.1.2.2.2 bouyer }
364 1.1.1.2.2.2 bouyer
365 1.1.1.2.2.2 bouyer Op->Asl.ExternalName = Op->Asl.Value.String;
366 1.1.1.2.2.2 bouyer Op->Asl.Value.String = Buffer;
367 1.1.1.2.2.2 bouyer Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED;
368 1.1.1.2.2.2 bouyer
369 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = strlen (Buffer);
370 1.1.1.2.2.2 bouyer
371 1.1.1.2.2.2 bouyer /*
372 1.1.1.2.2.2 bouyer * Check for single backslash reference to root,
373 1.1.1.2.2.2 bouyer * make it a null terminated string in the AML
374 1.1.1.2.2.2 bouyer */
375 1.1.1.2.2.2 bouyer if (Op->Asl.AmlLength == 1)
376 1.1.1.2.2.2 bouyer {
377 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = 2;
378 1.1.1.2.2.2 bouyer }
379 1.1.1.2.2.2 bouyer break;
380 1.1.1.2.2.2 bouyer
381 1.1.1.2.2.2 bouyer case PARSEOP_STRING_LITERAL:
382 1.1.1.2.2.2 bouyer
383 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 1;
384 1.1.1.2.2.2 bouyer
385 1.1.1.2.2.2 bouyer /* Get null terminator */
386 1.1.1.2.2.2 bouyer
387 1.1.1.2.2.2 bouyer Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1;
388 1.1.1.2.2.2 bouyer break;
389 1.1.1.2.2.2 bouyer
390 1.1.1.2.2.2 bouyer case PARSEOP_PACKAGE_LENGTH:
391 1.1.1.2.2.2 bouyer
392 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
393 1.1.1.2.2.2 bouyer Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op,
394 1.1.1.2.2.2 bouyer (UINT32) Op->Asl.Value.Integer);
395 1.1.1.2.2.2 bouyer break;
396 1.1.1.2.2.2 bouyer
397 1.1.1.2.2.2 bouyer case PARSEOP_RAW_DATA:
398 1.1.1.2.2.2 bouyer
399 1.1.1.2.2.2 bouyer Op->Asl.AmlOpcodeLength = 0;
400 1.1.1.2.2.2 bouyer break;
401 1.1.1.2.2.2 bouyer
402 1.1.1.2.2.2 bouyer case PARSEOP_DEFAULT_ARG:
403 1.1.1.2.2.2 bouyer case PARSEOP_EXTERNAL:
404 1.1.1.2.2.2 bouyer case PARSEOP_INCLUDE:
405 1.1.1.2.2.2 bouyer case PARSEOP_INCLUDE_END:
406 1.1.1.2.2.2 bouyer
407 1.1.1.2.2.2 bouyer /* Ignore the "default arg" nodes, they are extraneous at this point */
408 1.1.1.2.2.2 bouyer
409 1.1.1.2.2.2 bouyer break;
410 1.1.1.2.2.2 bouyer
411 1.1.1.2.2.2 bouyer default:
412 1.1.1.2.2.2 bouyer
413 1.1.1.2.2.2 bouyer CgGenerateAmlOpcodeLength (Op);
414 1.1.1.2.2.2 bouyer break;
415 1.1.1.2.2.2 bouyer }
416 1.1.1.2.2.2 bouyer }
417 1.1.1.2.2.2 bouyer
418 1.1.1.2.2.2 bouyer
419 1.1.1.2.2.2 bouyer #ifdef ACPI_OBSOLETE_FUNCTIONS
420 1.1.1.2.2.2 bouyer /*******************************************************************************
421 1.1.1.2.2.2 bouyer *
422 1.1.1.2.2.2 bouyer * FUNCTION: LnAdjustLengthToRoot
423 1.1.1.2.2.2 bouyer *
424 1.1.1.2.2.2 bouyer * PARAMETERS: Op - Node whose Length was changed
425 1.1.1.2.2.2 bouyer *
426 1.1.1.2.2.2 bouyer * RETURN: None.
427 1.1.1.2.2.2 bouyer *
428 1.1.1.2.2.2 bouyer * DESCRIPTION: Change the Subtree length of the given node, and bubble the
429 1.1.1.2.2.2 bouyer * change all the way up to the root node. This allows for
430 1.1.1.2.2.2 bouyer * last second changes to a package length (for example, if the
431 1.1.1.2.2.2 bouyer * package length encoding gets shorter or longer.)
432 1.1.1.2.2.2 bouyer *
433 1.1.1.2.2.2 bouyer ******************************************************************************/
434 1.1.1.2.2.2 bouyer
435 1.1.1.2.2.2 bouyer void
436 1.1.1.2.2.2 bouyer LnAdjustLengthToRoot (
437 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *SubtreeOp,
438 1.1.1.2.2.2 bouyer UINT32 LengthDelta)
439 1.1.1.2.2.2 bouyer {
440 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op;
441 1.1.1.2.2.2 bouyer
442 1.1.1.2.2.2 bouyer
443 1.1.1.2.2.2 bouyer /* Adjust all subtree lengths up to the root */
444 1.1.1.2.2.2 bouyer
445 1.1.1.2.2.2 bouyer Op = SubtreeOp->Asl.Parent;
446 1.1.1.2.2.2 bouyer while (Op)
447 1.1.1.2.2.2 bouyer {
448 1.1.1.2.2.2 bouyer Op->Asl.AmlSubtreeLength -= LengthDelta;
449 1.1.1.2.2.2 bouyer Op = Op->Asl.Parent;
450 1.1.1.2.2.2 bouyer }
451 1.1.1.2.2.2 bouyer
452 1.1.1.2.2.2 bouyer /* Adjust the global table length */
453 1.1.1.2.2.2 bouyer
454 1.1.1.2.2.2 bouyer Gbl_TableLength -= LengthDelta;
455 1.1.1.2.2.2 bouyer }
456 1.1.1.2.2.2 bouyer #endif
457 1.1.1.2.2.2 bouyer
458 1.1.1.2.2.2 bouyer
459