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