asllookup.c revision 1.1 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: asllookup- Namespace lookup
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1 jruoho /******************************************************************************
8 1.1 jruoho *
9 1.1 jruoho * 1. Copyright Notice
10 1.1 jruoho *
11 1.1 jruoho * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12 1.1 jruoho * All rights reserved.
13 1.1 jruoho *
14 1.1 jruoho * 2. License
15 1.1 jruoho *
16 1.1 jruoho * 2.1. This is your license from Intel Corp. under its intellectual property
17 1.1 jruoho * rights. You may have additional license terms from the party that provided
18 1.1 jruoho * you this software, covering your right to use that party's intellectual
19 1.1 jruoho * property rights.
20 1.1 jruoho *
21 1.1 jruoho * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 1.1 jruoho * copy of the source code appearing in this file ("Covered Code") an
23 1.1 jruoho * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 1.1 jruoho * base code distributed originally by Intel ("Original Intel Code") to copy,
25 1.1 jruoho * make derivatives, distribute, use and display any portion of the Covered
26 1.1 jruoho * Code in any form, with the right to sublicense such rights; and
27 1.1 jruoho *
28 1.1 jruoho * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 1.1 jruoho * license (with the right to sublicense), under only those claims of Intel
30 1.1 jruoho * patents that are infringed by the Original Intel Code, to make, use, sell,
31 1.1 jruoho * offer to sell, and import the Covered Code and derivative works thereof
32 1.1 jruoho * solely to the minimum extent necessary to exercise the above copyright
33 1.1 jruoho * license, and in no event shall the patent license extend to any additions
34 1.1 jruoho * to or modifications of the Original Intel Code. No other license or right
35 1.1 jruoho * is granted directly or by implication, estoppel or otherwise;
36 1.1 jruoho *
37 1.1 jruoho * The above copyright and patent license is granted only if the following
38 1.1 jruoho * conditions are met:
39 1.1 jruoho *
40 1.1 jruoho * 3. Conditions
41 1.1 jruoho *
42 1.1 jruoho * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 1.1 jruoho * Redistribution of source code of any substantial portion of the Covered
44 1.1 jruoho * Code or modification with rights to further distribute source must include
45 1.1 jruoho * the above Copyright Notice, the above License, this list of Conditions,
46 1.1 jruoho * and the following Disclaimer and Export Compliance provision. In addition,
47 1.1 jruoho * Licensee must cause all Covered Code to which Licensee contributes to
48 1.1 jruoho * contain a file documenting the changes Licensee made to create that Covered
49 1.1 jruoho * Code and the date of any change. Licensee must include in that file the
50 1.1 jruoho * documentation of any changes made by any predecessor Licensee. Licensee
51 1.1 jruoho * must include a prominent statement that the modification is derived,
52 1.1 jruoho * directly or indirectly, from Original Intel Code.
53 1.1 jruoho *
54 1.1 jruoho * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 1.1 jruoho * Redistribution of source code of any substantial portion of the Covered
56 1.1 jruoho * Code or modification without rights to further distribute source must
57 1.1 jruoho * include the following Disclaimer and Export Compliance provision in the
58 1.1 jruoho * documentation and/or other materials provided with distribution. In
59 1.1 jruoho * addition, Licensee may not authorize further sublicense of source of any
60 1.1 jruoho * portion of the Covered Code, and must include terms to the effect that the
61 1.1 jruoho * license from Licensee to its licensee is limited to the intellectual
62 1.1 jruoho * property embodied in the software Licensee provides to its licensee, and
63 1.1 jruoho * not to intellectual property embodied in modifications its licensee may
64 1.1 jruoho * make.
65 1.1 jruoho *
66 1.1 jruoho * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 1.1 jruoho * substantial portion of the Covered Code or modification must reproduce the
68 1.1 jruoho * above Copyright Notice, and the following Disclaimer and Export Compliance
69 1.1 jruoho * provision in the documentation and/or other materials provided with the
70 1.1 jruoho * distribution.
71 1.1 jruoho *
72 1.1 jruoho * 3.4. Intel retains all right, title, and interest in and to the Original
73 1.1 jruoho * Intel Code.
74 1.1 jruoho *
75 1.1 jruoho * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 1.1 jruoho * Intel shall be used in advertising or otherwise to promote the sale, use or
77 1.1 jruoho * other dealings in products derived from or relating to the Covered Code
78 1.1 jruoho * without prior written authorization from Intel.
79 1.1 jruoho *
80 1.1 jruoho * 4. Disclaimer and Export Compliance
81 1.1 jruoho *
82 1.1 jruoho * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 1.1 jruoho * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 1.1 jruoho * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 1.1 jruoho * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 1.1 jruoho * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 1.1 jruoho * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 1.1 jruoho * PARTICULAR PURPOSE.
89 1.1 jruoho *
90 1.1 jruoho * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 1.1 jruoho * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 1.1 jruoho * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 1.1 jruoho * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 1.1 jruoho * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 1.1 jruoho * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 1.1 jruoho * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 1.1 jruoho * LIMITED REMEDY.
98 1.1 jruoho *
99 1.1 jruoho * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 1.1 jruoho * software or system incorporating such software without first obtaining any
101 1.1 jruoho * required license or other approval from the U. S. Department of Commerce or
102 1.1 jruoho * any other agency or department of the United States Government. In the
103 1.1 jruoho * event Licensee exports any such software from the United States or
104 1.1 jruoho * re-exports any such software from a foreign destination, Licensee shall
105 1.1 jruoho * ensure that the distribution and export/re-export of the software is in
106 1.1 jruoho * compliance with all laws, regulations, orders, or other restrictions of the
107 1.1 jruoho * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 1.1 jruoho * any of its subsidiaries will export/re-export any technical data, process,
109 1.1 jruoho * software, or service, directly or indirectly, to any country for which the
110 1.1 jruoho * United States government or any agency thereof requires an export license,
111 1.1 jruoho * other governmental approval, or letter of assurance, without first obtaining
112 1.1 jruoho * such license, approval or letter.
113 1.1 jruoho *
114 1.1 jruoho *****************************************************************************/
115 1.1 jruoho
116 1.1 jruoho
117 1.1 jruoho #include "aslcompiler.h"
118 1.1 jruoho #include "aslcompiler.y.h"
119 1.1 jruoho
120 1.1 jruoho #include "acparser.h"
121 1.1 jruoho #include "amlcode.h"
122 1.1 jruoho #include "acnamesp.h"
123 1.1 jruoho #include "acdispat.h"
124 1.1 jruoho
125 1.1 jruoho
126 1.1 jruoho #define _COMPONENT ACPI_COMPILER
127 1.1 jruoho ACPI_MODULE_NAME ("asllookup")
128 1.1 jruoho
129 1.1 jruoho /* Local prototypes */
130 1.1 jruoho
131 1.1 jruoho static ACPI_STATUS
132 1.1 jruoho LsCompareOneNamespaceObject (
133 1.1 jruoho ACPI_HANDLE ObjHandle,
134 1.1 jruoho UINT32 Level,
135 1.1 jruoho void *Context,
136 1.1 jruoho void **ReturnValue);
137 1.1 jruoho
138 1.1 jruoho static ACPI_STATUS
139 1.1 jruoho LsDoOneNamespaceObject (
140 1.1 jruoho ACPI_HANDLE ObjHandle,
141 1.1 jruoho UINT32 Level,
142 1.1 jruoho void *Context,
143 1.1 jruoho void **ReturnValue);
144 1.1 jruoho
145 1.1 jruoho static BOOLEAN
146 1.1 jruoho LkObjectExists (
147 1.1 jruoho char *Name);
148 1.1 jruoho
149 1.1 jruoho static void
150 1.1 jruoho LkCheckFieldRange (
151 1.1 jruoho ACPI_PARSE_OBJECT *Op,
152 1.1 jruoho UINT32 RegionBitLength,
153 1.1 jruoho UINT32 FieldBitOffset,
154 1.1 jruoho UINT32 FieldBitLength,
155 1.1 jruoho UINT32 AccessBitWidth);
156 1.1 jruoho
157 1.1 jruoho static ACPI_STATUS
158 1.1 jruoho LkNamespaceLocateBegin (
159 1.1 jruoho ACPI_PARSE_OBJECT *Op,
160 1.1 jruoho UINT32 Level,
161 1.1 jruoho void *Context);
162 1.1 jruoho
163 1.1 jruoho static ACPI_STATUS
164 1.1 jruoho LkNamespaceLocateEnd (
165 1.1 jruoho ACPI_PARSE_OBJECT *Op,
166 1.1 jruoho UINT32 Level,
167 1.1 jruoho void *Context);
168 1.1 jruoho
169 1.1 jruoho static ACPI_STATUS
170 1.1 jruoho LkIsObjectUsed (
171 1.1 jruoho ACPI_HANDLE ObjHandle,
172 1.1 jruoho UINT32 Level,
173 1.1 jruoho void *Context,
174 1.1 jruoho void **ReturnValue);
175 1.1 jruoho
176 1.1 jruoho static ACPI_STATUS
177 1.1 jruoho LsDoOnePathname (
178 1.1 jruoho ACPI_HANDLE ObjHandle,
179 1.1 jruoho UINT32 Level,
180 1.1 jruoho void *Context,
181 1.1 jruoho void **ReturnValue);
182 1.1 jruoho
183 1.1 jruoho void
184 1.1 jruoho LsSetupNsList (
185 1.1 jruoho void *Handle);
186 1.1 jruoho
187 1.1 jruoho ACPI_PARSE_OBJECT *
188 1.1 jruoho LkGetNameOp (
189 1.1 jruoho ACPI_PARSE_OBJECT *Op);
190 1.1 jruoho
191 1.1 jruoho
192 1.1 jruoho /*******************************************************************************
193 1.1 jruoho *
194 1.1 jruoho * FUNCTION: LsDoOneNamespaceObject
195 1.1 jruoho *
196 1.1 jruoho * PARAMETERS: ACPI_WALK_CALLBACK
197 1.1 jruoho *
198 1.1 jruoho * RETURN: Status
199 1.1 jruoho *
200 1.1 jruoho * DESCRIPTION: Dump a namespace object to the namespace output file.
201 1.1 jruoho * Called during the walk of the namespace to dump all objects.
202 1.1 jruoho *
203 1.1 jruoho ******************************************************************************/
204 1.1 jruoho
205 1.1 jruoho static ACPI_STATUS
206 1.1 jruoho LsDoOneNamespaceObject (
207 1.1 jruoho ACPI_HANDLE ObjHandle,
208 1.1 jruoho UINT32 Level,
209 1.1 jruoho void *Context,
210 1.1 jruoho void **ReturnValue)
211 1.1 jruoho {
212 1.1 jruoho ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
213 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
214 1.1 jruoho ACPI_PARSE_OBJECT *Op;
215 1.1 jruoho
216 1.1 jruoho
217 1.1 jruoho Gbl_NumNamespaceObjects++;
218 1.1 jruoho
219 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
220 1.1 jruoho Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
221 1.1 jruoho &Node->Name,
222 1.1 jruoho AcpiUtGetTypeName (Node->Type));
223 1.1 jruoho
224 1.1 jruoho Op = Node->Op;
225 1.1 jruoho ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
226 1.1 jruoho
227 1.1 jruoho if (!Op)
228 1.1 jruoho {
229 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
230 1.1 jruoho return (AE_OK);
231 1.1 jruoho }
232 1.1 jruoho
233 1.1 jruoho
234 1.1 jruoho if ((ObjDesc) &&
235 1.1 jruoho (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND))
236 1.1 jruoho {
237 1.1 jruoho switch (Node->Type)
238 1.1 jruoho {
239 1.1 jruoho case ACPI_TYPE_INTEGER:
240 1.1 jruoho
241 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
242 1.1 jruoho " [Initial Value 0x%8.8X%8.8X]",
243 1.1 jruoho ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
244 1.1 jruoho break;
245 1.1 jruoho
246 1.1 jruoho
247 1.1 jruoho case ACPI_TYPE_STRING:
248 1.1 jruoho
249 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
250 1.1 jruoho " [Initial Value \"%s\"]",
251 1.1 jruoho ObjDesc->String.Pointer);
252 1.1 jruoho break;
253 1.1 jruoho
254 1.1 jruoho default:
255 1.1 jruoho /* Nothing to do for other types */
256 1.1 jruoho break;
257 1.1 jruoho }
258 1.1 jruoho
259 1.1 jruoho }
260 1.1 jruoho else
261 1.1 jruoho {
262 1.1 jruoho switch (Node->Type)
263 1.1 jruoho {
264 1.1 jruoho case ACPI_TYPE_INTEGER:
265 1.1 jruoho
266 1.1 jruoho if (Op->Asl.ParseOpcode == PARSEOP_NAME)
267 1.1 jruoho {
268 1.1 jruoho Op = Op->Asl.Child;
269 1.1 jruoho }
270 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
271 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
272 1.1 jruoho {
273 1.1 jruoho Op = Op->Asl.Next;
274 1.1 jruoho }
275 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
276 1.1 jruoho " [Initial Value 0x%8.8X%8.8X]",
277 1.1 jruoho ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
278 1.1 jruoho break;
279 1.1 jruoho
280 1.1 jruoho
281 1.1 jruoho case ACPI_TYPE_STRING:
282 1.1 jruoho
283 1.1 jruoho if (Op->Asl.ParseOpcode == PARSEOP_NAME)
284 1.1 jruoho {
285 1.1 jruoho Op = Op->Asl.Child;
286 1.1 jruoho }
287 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
288 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
289 1.1 jruoho {
290 1.1 jruoho Op = Op->Asl.Next;
291 1.1 jruoho }
292 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
293 1.1 jruoho " [Initial Value \"%s\"]",
294 1.1 jruoho Op->Asl.Value.String);
295 1.1 jruoho break;
296 1.1 jruoho
297 1.1 jruoho
298 1.1 jruoho case ACPI_TYPE_LOCAL_REGION_FIELD:
299 1.1 jruoho
300 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
301 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
302 1.1 jruoho {
303 1.1 jruoho Op = Op->Asl.Child;
304 1.1 jruoho }
305 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
306 1.1 jruoho " [Offset 0x%04X Length 0x%04X bits]",
307 1.1 jruoho Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
308 1.1 jruoho break;
309 1.1 jruoho
310 1.1 jruoho
311 1.1 jruoho case ACPI_TYPE_BUFFER_FIELD:
312 1.1 jruoho
313 1.1 jruoho switch (Op->Asl.ParseOpcode)
314 1.1 jruoho {
315 1.1 jruoho case PARSEOP_CREATEBYTEFIELD:
316 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]");
317 1.1 jruoho break;
318 1.1 jruoho
319 1.1 jruoho case PARSEOP_CREATEDWORDFIELD:
320 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]");
321 1.1 jruoho break;
322 1.1 jruoho
323 1.1 jruoho case PARSEOP_CREATEQWORDFIELD:
324 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]");
325 1.1 jruoho break;
326 1.1 jruoho
327 1.1 jruoho case PARSEOP_CREATEWORDFIELD:
328 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]");
329 1.1 jruoho break;
330 1.1 jruoho
331 1.1 jruoho case PARSEOP_CREATEBITFIELD:
332 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]");
333 1.1 jruoho break;
334 1.1 jruoho
335 1.1 jruoho case PARSEOP_CREATEFIELD:
336 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]");
337 1.1 jruoho break;
338 1.1 jruoho
339 1.1 jruoho default:
340 1.1 jruoho break;
341 1.1 jruoho
342 1.1 jruoho }
343 1.1 jruoho break;
344 1.1 jruoho
345 1.1 jruoho
346 1.1 jruoho case ACPI_TYPE_PACKAGE:
347 1.1 jruoho
348 1.1 jruoho if (Op->Asl.ParseOpcode == PARSEOP_NAME)
349 1.1 jruoho {
350 1.1 jruoho Op = Op->Asl.Child;
351 1.1 jruoho }
352 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
353 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
354 1.1 jruoho {
355 1.1 jruoho Op = Op->Asl.Next;
356 1.1 jruoho }
357 1.1 jruoho Op = Op->Asl.Child;
358 1.1 jruoho
359 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
360 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA))
361 1.1 jruoho {
362 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
363 1.1 jruoho " [Initial Length 0x%.2X elements]",
364 1.1 jruoho Op->Asl.Value.Integer);
365 1.1 jruoho }
366 1.1 jruoho break;
367 1.1 jruoho
368 1.1 jruoho
369 1.1 jruoho case ACPI_TYPE_BUFFER:
370 1.1 jruoho
371 1.1 jruoho if (Op->Asl.ParseOpcode == PARSEOP_NAME)
372 1.1 jruoho {
373 1.1 jruoho Op = Op->Asl.Child;
374 1.1 jruoho }
375 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
376 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
377 1.1 jruoho {
378 1.1 jruoho Op = Op->Asl.Next;
379 1.1 jruoho }
380 1.1 jruoho Op = Op->Asl.Child;
381 1.1 jruoho
382 1.1 jruoho if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
383 1.1 jruoho {
384 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
385 1.1 jruoho " [Initial Length 0x%.2X bytes]",
386 1.1 jruoho Op->Asl.Value.Integer);
387 1.1 jruoho }
388 1.1 jruoho break;
389 1.1 jruoho
390 1.1 jruoho
391 1.1 jruoho case ACPI_TYPE_METHOD:
392 1.1 jruoho
393 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
394 1.1 jruoho " [Code Length 0x%.4X bytes]",
395 1.1 jruoho Op->Asl.AmlSubtreeLength);
396 1.1 jruoho break;
397 1.1 jruoho
398 1.1 jruoho
399 1.1 jruoho case ACPI_TYPE_LOCAL_RESOURCE:
400 1.1 jruoho
401 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
402 1.1 jruoho " [Desc Offset 0x%.4X Bytes]", Node->Value);
403 1.1 jruoho break;
404 1.1 jruoho
405 1.1 jruoho
406 1.1 jruoho case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
407 1.1 jruoho
408 1.1 jruoho if (Node->Flags & 0x80)
409 1.1 jruoho {
410 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
411 1.1 jruoho " [Field Offset 0x%.4X Bits 0x%.4X Bytes]",
412 1.1 jruoho Node->Value, Node->Value / 8);
413 1.1 jruoho }
414 1.1 jruoho else
415 1.1 jruoho {
416 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
417 1.1 jruoho " [Field Offset 0x%.4X Bytes]", Node->Value);
418 1.1 jruoho }
419 1.1 jruoho break;
420 1.1 jruoho
421 1.1 jruoho
422 1.1 jruoho default:
423 1.1 jruoho /* Nothing to do for other types */
424 1.1 jruoho break;
425 1.1 jruoho }
426 1.1 jruoho }
427 1.1 jruoho
428 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
429 1.1 jruoho return (AE_OK);
430 1.1 jruoho }
431 1.1 jruoho
432 1.1 jruoho
433 1.1 jruoho /*******************************************************************************
434 1.1 jruoho *
435 1.1 jruoho * FUNCTION: LsSetupNsList
436 1.1 jruoho *
437 1.1 jruoho * PARAMETERS: Handle - local file handle
438 1.1 jruoho *
439 1.1 jruoho * RETURN: None
440 1.1 jruoho *
441 1.1 jruoho * DESCRIPTION: Set the namespace output file to the input handle
442 1.1 jruoho *
443 1.1 jruoho ******************************************************************************/
444 1.1 jruoho
445 1.1 jruoho void
446 1.1 jruoho LsSetupNsList (
447 1.1 jruoho void *Handle)
448 1.1 jruoho {
449 1.1 jruoho
450 1.1 jruoho Gbl_NsOutputFlag = TRUE;
451 1.1 jruoho Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle;
452 1.1 jruoho }
453 1.1 jruoho
454 1.1 jruoho
455 1.1 jruoho /*******************************************************************************
456 1.1 jruoho *
457 1.1 jruoho * FUNCTION: LsDoOnePathname
458 1.1 jruoho *
459 1.1 jruoho * PARAMETERS: ACPI_WALK_CALLBACK
460 1.1 jruoho *
461 1.1 jruoho * RETURN: Status
462 1.1 jruoho *
463 1.1 jruoho * DESCRIPTION: Print the full pathname for a namespace node.
464 1.1 jruoho *
465 1.1 jruoho ******************************************************************************/
466 1.1 jruoho
467 1.1 jruoho static ACPI_STATUS
468 1.1 jruoho LsDoOnePathname (
469 1.1 jruoho ACPI_HANDLE ObjHandle,
470 1.1 jruoho UINT32 Level,
471 1.1 jruoho void *Context,
472 1.1 jruoho void **ReturnValue)
473 1.1 jruoho {
474 1.1 jruoho ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
475 1.1 jruoho ACPI_STATUS Status;
476 1.1 jruoho ACPI_BUFFER TargetPath;
477 1.1 jruoho
478 1.1 jruoho
479 1.1 jruoho TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
480 1.1 jruoho Status = AcpiNsHandleToPathname (Node, &TargetPath);
481 1.1 jruoho if (ACPI_FAILURE (Status))
482 1.1 jruoho {
483 1.1 jruoho return (Status);
484 1.1 jruoho }
485 1.1 jruoho
486 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
487 1.1 jruoho ACPI_FREE (TargetPath.Pointer);
488 1.1 jruoho
489 1.1 jruoho return (AE_OK);
490 1.1 jruoho }
491 1.1 jruoho
492 1.1 jruoho
493 1.1 jruoho /*******************************************************************************
494 1.1 jruoho *
495 1.1 jruoho * FUNCTION: LsDisplayNamespace
496 1.1 jruoho *
497 1.1 jruoho * PARAMETERS: None
498 1.1 jruoho *
499 1.1 jruoho * RETURN: Status
500 1.1 jruoho *
501 1.1 jruoho * DESCRIPTION: Walk the namespace an display information about each node
502 1.1 jruoho * in the tree. Information is written to the optional
503 1.1 jruoho * namespace output file.
504 1.1 jruoho *
505 1.1 jruoho ******************************************************************************/
506 1.1 jruoho
507 1.1 jruoho ACPI_STATUS
508 1.1 jruoho LsDisplayNamespace (
509 1.1 jruoho void)
510 1.1 jruoho {
511 1.1 jruoho ACPI_STATUS Status;
512 1.1 jruoho
513 1.1 jruoho
514 1.1 jruoho if (!Gbl_NsOutputFlag)
515 1.1 jruoho {
516 1.1 jruoho return (AE_OK);
517 1.1 jruoho }
518 1.1 jruoho
519 1.1 jruoho Gbl_NumNamespaceObjects = 0;
520 1.1 jruoho
521 1.1 jruoho /* File header */
522 1.1 jruoho
523 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
524 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n");
525 1.1 jruoho
526 1.1 jruoho /* Walk entire namespace from the root */
527 1.1 jruoho
528 1.1 jruoho Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
529 1.1 jruoho ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL,
530 1.1 jruoho NULL, NULL);
531 1.1 jruoho
532 1.1 jruoho /* Print the full pathname for each namespace node */
533 1.1 jruoho
534 1.1 jruoho FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
535 1.1 jruoho
536 1.1 jruoho Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
537 1.1 jruoho ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL,
538 1.1 jruoho NULL, NULL);
539 1.1 jruoho
540 1.1 jruoho return (Status);
541 1.1 jruoho }
542 1.1 jruoho
543 1.1 jruoho
544 1.1 jruoho /*******************************************************************************
545 1.1 jruoho *
546 1.1 jruoho * FUNCTION: LsCompareOneNamespaceObject
547 1.1 jruoho *
548 1.1 jruoho * PARAMETERS: ACPI_WALK_CALLBACK
549 1.1 jruoho *
550 1.1 jruoho * RETURN: Status
551 1.1 jruoho *
552 1.1 jruoho * DESCRIPTION: Compare name of one object.
553 1.1 jruoho *
554 1.1 jruoho ******************************************************************************/
555 1.1 jruoho
556 1.1 jruoho static ACPI_STATUS
557 1.1 jruoho LsCompareOneNamespaceObject (
558 1.1 jruoho ACPI_HANDLE ObjHandle,
559 1.1 jruoho UINT32 Level,
560 1.1 jruoho void *Context,
561 1.1 jruoho void **ReturnValue)
562 1.1 jruoho {
563 1.1 jruoho ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
564 1.1 jruoho
565 1.1 jruoho
566 1.1 jruoho /* Simply check the name */
567 1.1 jruoho
568 1.1 jruoho if (*((UINT32 *) (Context)) == Node->Name.Integer)
569 1.1 jruoho {
570 1.1 jruoho /* Abort walk if we found one instance */
571 1.1 jruoho
572 1.1 jruoho return (AE_CTRL_TRUE);
573 1.1 jruoho }
574 1.1 jruoho
575 1.1 jruoho return (AE_OK);
576 1.1 jruoho }
577 1.1 jruoho
578 1.1 jruoho
579 1.1 jruoho /*******************************************************************************
580 1.1 jruoho *
581 1.1 jruoho * FUNCTION: LkObjectExists
582 1.1 jruoho *
583 1.1 jruoho * PARAMETERS: Name - 4 char ACPI name
584 1.1 jruoho *
585 1.1 jruoho * RETURN: TRUE if name exists in namespace
586 1.1 jruoho *
587 1.1 jruoho * DESCRIPTION: Walk the namespace to find an object
588 1.1 jruoho *
589 1.1 jruoho ******************************************************************************/
590 1.1 jruoho
591 1.1 jruoho static BOOLEAN
592 1.1 jruoho LkObjectExists (
593 1.1 jruoho char *Name)
594 1.1 jruoho {
595 1.1 jruoho ACPI_STATUS Status;
596 1.1 jruoho
597 1.1 jruoho
598 1.1 jruoho /* Walk entire namespace from the supplied root */
599 1.1 jruoho
600 1.1 jruoho Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
601 1.1 jruoho ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL,
602 1.1 jruoho Name, NULL);
603 1.1 jruoho if (Status == AE_CTRL_TRUE)
604 1.1 jruoho {
605 1.1 jruoho /* At least one instance of the name was found */
606 1.1 jruoho
607 1.1 jruoho return (TRUE);
608 1.1 jruoho }
609 1.1 jruoho
610 1.1 jruoho return (FALSE);
611 1.1 jruoho }
612 1.1 jruoho
613 1.1 jruoho
614 1.1 jruoho /*******************************************************************************
615 1.1 jruoho *
616 1.1 jruoho * FUNCTION: LkGetNameOp
617 1.1 jruoho *
618 1.1 jruoho * PARAMETERS: Op - Current Op
619 1.1 jruoho *
620 1.1 jruoho * RETURN: NameOp associated with the input op
621 1.1 jruoho *
622 1.1 jruoho * DESCRIPTION: Find the name declaration op associated with the operator
623 1.1 jruoho *
624 1.1 jruoho ******************************************************************************/
625 1.1 jruoho
626 1.1 jruoho ACPI_PARSE_OBJECT *
627 1.1 jruoho LkGetNameOp (
628 1.1 jruoho ACPI_PARSE_OBJECT *Op)
629 1.1 jruoho {
630 1.1 jruoho const ACPI_OPCODE_INFO *OpInfo;
631 1.1 jruoho ACPI_PARSE_OBJECT *NameOp = Op;
632 1.1 jruoho
633 1.1 jruoho
634 1.1 jruoho OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
635 1.1 jruoho
636 1.1 jruoho
637 1.1 jruoho /* Get the NamePath from the appropriate place */
638 1.1 jruoho
639 1.1 jruoho if (OpInfo->Flags & AML_NAMED)
640 1.1 jruoho {
641 1.1 jruoho /* For nearly all NAMED operators, the name reference is the first child */
642 1.1 jruoho
643 1.1 jruoho NameOp = Op->Asl.Child;
644 1.1 jruoho if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
645 1.1 jruoho {
646 1.1 jruoho /*
647 1.1 jruoho * ALIAS is the only oddball opcode, the name declaration
648 1.1 jruoho * (alias name) is the second operand
649 1.1 jruoho */
650 1.1 jruoho NameOp = Op->Asl.Child->Asl.Next;
651 1.1 jruoho }
652 1.1 jruoho }
653 1.1 jruoho else if (OpInfo->Flags & AML_CREATE)
654 1.1 jruoho {
655 1.1 jruoho /* Name must appear as the last parameter */
656 1.1 jruoho
657 1.1 jruoho NameOp = Op->Asl.Child;
658 1.1 jruoho while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
659 1.1 jruoho {
660 1.1 jruoho NameOp = NameOp->Asl.Next;
661 1.1 jruoho }
662 1.1 jruoho }
663 1.1 jruoho
664 1.1 jruoho return (NameOp);
665 1.1 jruoho }
666 1.1 jruoho
667 1.1 jruoho
668 1.1 jruoho /*******************************************************************************
669 1.1 jruoho *
670 1.1 jruoho * FUNCTION: LkIsObjectUsed
671 1.1 jruoho *
672 1.1 jruoho * PARAMETERS: ACPI_WALK_CALLBACK
673 1.1 jruoho *
674 1.1 jruoho * RETURN: Status
675 1.1 jruoho *
676 1.1 jruoho * DESCRIPTION: Check for an unreferenced namespace object and emit a warning.
677 1.1 jruoho * We have to be careful, because some types and names are
678 1.1 jruoho * typically or always unreferenced, we don't want to issue
679 1.1 jruoho * excessive warnings.
680 1.1 jruoho *
681 1.1 jruoho ******************************************************************************/
682 1.1 jruoho
683 1.1 jruoho static ACPI_STATUS
684 1.1 jruoho LkIsObjectUsed (
685 1.1 jruoho ACPI_HANDLE ObjHandle,
686 1.1 jruoho UINT32 Level,
687 1.1 jruoho void *Context,
688 1.1 jruoho void **ReturnValue)
689 1.1 jruoho {
690 1.1 jruoho ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
691 1.1 jruoho
692 1.1 jruoho
693 1.1 jruoho /* Referenced flag is set during the namespace xref */
694 1.1 jruoho
695 1.1 jruoho if (Node->Flags & ANOBJ_IS_REFERENCED)
696 1.1 jruoho {
697 1.1 jruoho return (AE_OK);
698 1.1 jruoho }
699 1.1 jruoho
700 1.1 jruoho /*
701 1.1 jruoho * Ignore names that start with an underscore,
702 1.1 jruoho * these are the reserved ACPI names and are typically not referenced,
703 1.1 jruoho * they are called by the host OS.
704 1.1 jruoho */
705 1.1 jruoho if (Node->Name.Ascii[0] == '_')
706 1.1 jruoho {
707 1.1 jruoho return (AE_OK);
708 1.1 jruoho }
709 1.1 jruoho
710 1.1 jruoho /* There are some types that are typically not referenced, ignore them */
711 1.1 jruoho
712 1.1 jruoho switch (Node->Type)
713 1.1 jruoho {
714 1.1 jruoho case ACPI_TYPE_DEVICE:
715 1.1 jruoho case ACPI_TYPE_PROCESSOR:
716 1.1 jruoho case ACPI_TYPE_POWER:
717 1.1 jruoho case ACPI_TYPE_LOCAL_RESOURCE:
718 1.1 jruoho return (AE_OK);
719 1.1 jruoho
720 1.1 jruoho default:
721 1.1 jruoho break;
722 1.1 jruoho }
723 1.1 jruoho
724 1.1 jruoho /* All others are valid unreferenced namespace objects */
725 1.1 jruoho
726 1.1 jruoho if (Node->Op)
727 1.1 jruoho {
728 1.1 jruoho AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL);
729 1.1 jruoho }
730 1.1 jruoho return (AE_OK);
731 1.1 jruoho }
732 1.1 jruoho
733 1.1 jruoho
734 1.1 jruoho /*******************************************************************************
735 1.1 jruoho *
736 1.1 jruoho * FUNCTION: LkFindUnreferencedObjects
737 1.1 jruoho *
738 1.1 jruoho * PARAMETERS: None
739 1.1 jruoho *
740 1.1 jruoho * RETURN: None
741 1.1 jruoho *
742 1.1 jruoho * DESCRIPTION: Namespace walk to find objects that are not referenced in any
743 1.1 jruoho * way. Must be called after the namespace has been cross
744 1.1 jruoho * referenced.
745 1.1 jruoho *
746 1.1 jruoho ******************************************************************************/
747 1.1 jruoho
748 1.1 jruoho void
749 1.1 jruoho LkFindUnreferencedObjects (
750 1.1 jruoho void)
751 1.1 jruoho {
752 1.1 jruoho
753 1.1 jruoho /* Walk entire namespace from the supplied root */
754 1.1 jruoho
755 1.1 jruoho (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
756 1.1 jruoho ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL,
757 1.1 jruoho NULL, NULL);
758 1.1 jruoho }
759 1.1 jruoho
760 1.1 jruoho
761 1.1 jruoho /*******************************************************************************
762 1.1 jruoho *
763 1.1 jruoho * FUNCTION: LkCrossReferenceNamespace
764 1.1 jruoho *
765 1.1 jruoho * PARAMETERS: None
766 1.1 jruoho *
767 1.1 jruoho * RETURN: Status
768 1.1 jruoho *
769 1.1 jruoho * DESCRIPTION: Perform a cross reference check of the parse tree against the
770 1.1 jruoho * namespace. Every named referenced within the parse tree
771 1.1 jruoho * should be get resolved with a namespace lookup. If not, the
772 1.1 jruoho * original reference in the ASL code is invalid -- i.e., refers
773 1.1 jruoho * to a non-existent object.
774 1.1 jruoho *
775 1.1 jruoho * NOTE: The ASL "External" operator causes the name to be inserted into the
776 1.1 jruoho * namespace so that references to the external name will be resolved
777 1.1 jruoho * correctly here.
778 1.1 jruoho *
779 1.1 jruoho ******************************************************************************/
780 1.1 jruoho
781 1.1 jruoho ACPI_STATUS
782 1.1 jruoho LkCrossReferenceNamespace (
783 1.1 jruoho void)
784 1.1 jruoho {
785 1.1 jruoho ACPI_WALK_STATE *WalkState;
786 1.1 jruoho
787 1.1 jruoho
788 1.1 jruoho DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
789 1.1 jruoho
790 1.1 jruoho /*
791 1.1 jruoho * Create a new walk state for use when looking up names
792 1.1 jruoho * within the namespace (Passed as context to the callbacks)
793 1.1 jruoho */
794 1.1 jruoho WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
795 1.1 jruoho if (!WalkState)
796 1.1 jruoho {
797 1.1 jruoho return AE_NO_MEMORY;
798 1.1 jruoho }
799 1.1 jruoho
800 1.1 jruoho /* Walk the entire parse tree */
801 1.1 jruoho
802 1.1 jruoho TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin,
803 1.1 jruoho LkNamespaceLocateEnd, WalkState);
804 1.1 jruoho return AE_OK;
805 1.1 jruoho }
806 1.1 jruoho
807 1.1 jruoho
808 1.1 jruoho /*******************************************************************************
809 1.1 jruoho *
810 1.1 jruoho * FUNCTION: LkCheckFieldRange
811 1.1 jruoho *
812 1.1 jruoho * PARAMETERS: RegionBitLength - Length of entire parent region
813 1.1 jruoho * FieldBitOffset - Start of the field unit (within region)
814 1.1 jruoho * FieldBitLength - Entire length of field unit
815 1.1 jruoho * AccessBitWidth - Access width of the field unit
816 1.1 jruoho *
817 1.1 jruoho * RETURN: None
818 1.1 jruoho *
819 1.1 jruoho * DESCRIPTION: Check one field unit to make sure it fits in the parent
820 1.1 jruoho * op region.
821 1.1 jruoho *
822 1.1 jruoho * Note: AccessBitWidth must be either 8,16,32, or 64
823 1.1 jruoho *
824 1.1 jruoho ******************************************************************************/
825 1.1 jruoho
826 1.1 jruoho static void
827 1.1 jruoho LkCheckFieldRange (
828 1.1 jruoho ACPI_PARSE_OBJECT *Op,
829 1.1 jruoho UINT32 RegionBitLength,
830 1.1 jruoho UINT32 FieldBitOffset,
831 1.1 jruoho UINT32 FieldBitLength,
832 1.1 jruoho UINT32 AccessBitWidth)
833 1.1 jruoho {
834 1.1 jruoho UINT32 FieldEndBitOffset;
835 1.1 jruoho
836 1.1 jruoho
837 1.1 jruoho /*
838 1.1 jruoho * Check each field unit against the region size. The entire
839 1.1 jruoho * field unit (start offset plus length) must fit within the
840 1.1 jruoho * region.
841 1.1 jruoho */
842 1.1 jruoho FieldEndBitOffset = FieldBitOffset + FieldBitLength;
843 1.1 jruoho
844 1.1 jruoho if (FieldEndBitOffset > RegionBitLength)
845 1.1 jruoho {
846 1.1 jruoho /* Field definition itself is beyond the end-of-region */
847 1.1 jruoho
848 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL);
849 1.1 jruoho return;
850 1.1 jruoho }
851 1.1 jruoho
852 1.1 jruoho /*
853 1.1 jruoho * Now check that the field plus AccessWidth doesn't go beyond
854 1.1 jruoho * the end-of-region. Assumes AccessBitWidth is a power of 2
855 1.1 jruoho */
856 1.1 jruoho FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
857 1.1 jruoho
858 1.1 jruoho if (FieldEndBitOffset > RegionBitLength)
859 1.1 jruoho {
860 1.1 jruoho /* Field definition combined with the access is beyond EOR */
861 1.1 jruoho
862 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL);
863 1.1 jruoho }
864 1.1 jruoho }
865 1.1 jruoho
866 1.1 jruoho /*******************************************************************************
867 1.1 jruoho *
868 1.1 jruoho * FUNCTION: LkNamespaceLocateBegin
869 1.1 jruoho *
870 1.1 jruoho * PARAMETERS: ASL_WALK_CALLBACK
871 1.1 jruoho *
872 1.1 jruoho * RETURN: Status
873 1.1 jruoho *
874 1.1 jruoho * DESCRIPTION: Descending callback used during cross-reference. For named
875 1.1 jruoho * object references, attempt to locate the name in the
876 1.1 jruoho * namespace.
877 1.1 jruoho *
878 1.1 jruoho * NOTE: ASL references to named fields within resource descriptors are
879 1.1 jruoho * resolved to integer values here. Therefore, this step is an
880 1.1 jruoho * important part of the code generation. We don't know that the
881 1.1 jruoho * name refers to a resource descriptor until now.
882 1.1 jruoho *
883 1.1 jruoho ******************************************************************************/
884 1.1 jruoho
885 1.1 jruoho static ACPI_STATUS
886 1.1 jruoho LkNamespaceLocateBegin (
887 1.1 jruoho ACPI_PARSE_OBJECT *Op,
888 1.1 jruoho UINT32 Level,
889 1.1 jruoho void *Context)
890 1.1 jruoho {
891 1.1 jruoho ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
892 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
893 1.1 jruoho ACPI_STATUS Status;
894 1.1 jruoho ACPI_OBJECT_TYPE ObjectType;
895 1.1 jruoho char *Path;
896 1.1 jruoho UINT8 PassedArgs;
897 1.1 jruoho ACPI_PARSE_OBJECT *NextOp;
898 1.1 jruoho ACPI_PARSE_OBJECT *OwningOp;
899 1.1 jruoho ACPI_PARSE_OBJECT *SpaceIdOp;
900 1.1 jruoho UINT32 MinimumLength;
901 1.1 jruoho UINT32 Temp;
902 1.1 jruoho const ACPI_OPCODE_INFO *OpInfo;
903 1.1 jruoho UINT32 Flags;
904 1.1 jruoho
905 1.1 jruoho
906 1.1 jruoho ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op);
907 1.1 jruoho
908 1.1 jruoho /*
909 1.1 jruoho * If this node is the actual declaration of a name
910 1.1 jruoho * [such as the XXXX name in "Method (XXXX)"],
911 1.1 jruoho * we are not interested in it here. We only care about names that are
912 1.1 jruoho * references to other objects within the namespace and the parent objects
913 1.1 jruoho * of name declarations
914 1.1 jruoho */
915 1.1 jruoho if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
916 1.1 jruoho {
917 1.1 jruoho return (AE_OK);
918 1.1 jruoho }
919 1.1 jruoho
920 1.1 jruoho /* We are only interested in opcodes that have an associated name */
921 1.1 jruoho
922 1.1 jruoho OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
923 1.1 jruoho
924 1.1 jruoho if ((!(OpInfo->Flags & AML_NAMED)) &&
925 1.1 jruoho (!(OpInfo->Flags & AML_CREATE)) &&
926 1.1 jruoho (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
927 1.1 jruoho (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
928 1.1 jruoho (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
929 1.1 jruoho {
930 1.1 jruoho return (AE_OK);
931 1.1 jruoho }
932 1.1 jruoho
933 1.1 jruoho /*
934 1.1 jruoho * One special case: CondRefOf operator - we don't care if the name exists
935 1.1 jruoho * or not at this point, just ignore it, the point of the operator is to
936 1.1 jruoho * determine if the name exists at runtime.
937 1.1 jruoho */
938 1.1 jruoho if ((Op->Asl.Parent) &&
939 1.1 jruoho (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
940 1.1 jruoho {
941 1.1 jruoho return (AE_OK);
942 1.1 jruoho }
943 1.1 jruoho
944 1.1 jruoho /*
945 1.1 jruoho * We must enable the "search-to-root" for single NameSegs, but
946 1.1 jruoho * we have to be very careful about opening up scopes
947 1.1 jruoho */
948 1.1 jruoho Flags = ACPI_NS_SEARCH_PARENT;
949 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
950 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
951 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
952 1.1 jruoho {
953 1.1 jruoho /*
954 1.1 jruoho * These are name references, do not push the scope stack
955 1.1 jruoho * for them.
956 1.1 jruoho */
957 1.1 jruoho Flags |= ACPI_NS_DONT_OPEN_SCOPE;
958 1.1 jruoho }
959 1.1 jruoho
960 1.1 jruoho /* Get the NamePath from the appropriate place */
961 1.1 jruoho
962 1.1 jruoho if (OpInfo->Flags & AML_NAMED)
963 1.1 jruoho {
964 1.1 jruoho /* For nearly all NAMED operators, the name reference is the first child */
965 1.1 jruoho
966 1.1 jruoho Path = Op->Asl.Child->Asl.Value.String;
967 1.1 jruoho if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
968 1.1 jruoho {
969 1.1 jruoho /*
970 1.1 jruoho * ALIAS is the only oddball opcode, the name declaration
971 1.1 jruoho * (alias name) is the second operand
972 1.1 jruoho */
973 1.1 jruoho Path = Op->Asl.Child->Asl.Next->Asl.Value.String;
974 1.1 jruoho }
975 1.1 jruoho }
976 1.1 jruoho else if (OpInfo->Flags & AML_CREATE)
977 1.1 jruoho {
978 1.1 jruoho /* Name must appear as the last parameter */
979 1.1 jruoho
980 1.1 jruoho NextOp = Op->Asl.Child;
981 1.1 jruoho while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
982 1.1 jruoho {
983 1.1 jruoho NextOp = NextOp->Asl.Next;
984 1.1 jruoho }
985 1.1 jruoho Path = NextOp->Asl.Value.String;
986 1.1 jruoho }
987 1.1 jruoho else
988 1.1 jruoho {
989 1.1 jruoho Path = Op->Asl.Value.String;
990 1.1 jruoho }
991 1.1 jruoho
992 1.1 jruoho ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
993 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
994 1.1 jruoho "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
995 1.1 jruoho
996 1.1 jruoho /*
997 1.1 jruoho * Lookup the name in the namespace. Name must exist at this point, or it
998 1.1 jruoho * is an invalid reference.
999 1.1 jruoho *
1000 1.1 jruoho * The namespace is also used as a lookup table for references to resource
1001 1.1 jruoho * descriptors and the fields within them.
1002 1.1 jruoho */
1003 1.1 jruoho Gbl_NsLookupCount++;
1004 1.1 jruoho
1005 1.1 jruoho Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
1006 1.1 jruoho ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
1007 1.1 jruoho if (ACPI_FAILURE (Status))
1008 1.1 jruoho {
1009 1.1 jruoho if (Status == AE_NOT_FOUND)
1010 1.1 jruoho {
1011 1.1 jruoho /*
1012 1.1 jruoho * We didn't find the name reference by path -- we can qualify this
1013 1.1 jruoho * a little better before we print an error message
1014 1.1 jruoho */
1015 1.1 jruoho if (strlen (Path) == ACPI_NAME_SIZE)
1016 1.1 jruoho {
1017 1.1 jruoho /* A simple, one-segment ACPI name */
1018 1.1 jruoho
1019 1.1 jruoho if (LkObjectExists (Path))
1020 1.1 jruoho {
1021 1.1 jruoho /*
1022 1.1 jruoho * There exists such a name, but we couldn't get to it
1023 1.1 jruoho * from this scope
1024 1.1 jruoho */
1025 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op,
1026 1.1 jruoho Op->Asl.ExternalName);
1027 1.1 jruoho }
1028 1.1 jruoho else
1029 1.1 jruoho {
1030 1.1 jruoho /* The name doesn't exist, period */
1031 1.1 jruoho
1032 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
1033 1.1 jruoho Op, Op->Asl.ExternalName);
1034 1.1 jruoho }
1035 1.1 jruoho }
1036 1.1 jruoho else
1037 1.1 jruoho {
1038 1.1 jruoho /* Check for a fully qualified path */
1039 1.1 jruoho
1040 1.1 jruoho if (Path[0] == AML_ROOT_PREFIX)
1041 1.1 jruoho {
1042 1.1 jruoho /* Gave full path, the object does not exist */
1043 1.1 jruoho
1044 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
1045 1.1 jruoho Op->Asl.ExternalName);
1046 1.1 jruoho }
1047 1.1 jruoho else
1048 1.1 jruoho {
1049 1.1 jruoho /*
1050 1.1 jruoho * We can't tell whether it doesn't exist or just
1051 1.1 jruoho * can't be reached.
1052 1.1 jruoho */
1053 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
1054 1.1 jruoho Op->Asl.ExternalName);
1055 1.1 jruoho }
1056 1.1 jruoho }
1057 1.1 jruoho
1058 1.1 jruoho Status = AE_OK;
1059 1.1 jruoho }
1060 1.1 jruoho return (Status);
1061 1.1 jruoho }
1062 1.1 jruoho
1063 1.1 jruoho /* Check for a reference vs. name declaration */
1064 1.1 jruoho
1065 1.1 jruoho if (!(OpInfo->Flags & AML_NAMED) &&
1066 1.1 jruoho !(OpInfo->Flags & AML_CREATE))
1067 1.1 jruoho {
1068 1.1 jruoho /* This node has been referenced, mark it for reference check */
1069 1.1 jruoho
1070 1.1 jruoho Node->Flags |= ANOBJ_IS_REFERENCED;
1071 1.1 jruoho }
1072 1.1 jruoho
1073 1.1 jruoho /* Attempt to optimize the NamePath */
1074 1.1 jruoho
1075 1.1 jruoho OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
1076 1.1 jruoho
1077 1.1 jruoho /*
1078 1.1 jruoho * 1) Dereference an alias (A name reference that is an alias)
1079 1.1 jruoho * Aliases are not nested, the alias always points to the final object
1080 1.1 jruoho */
1081 1.1 jruoho if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) &&
1082 1.1 jruoho (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
1083 1.1 jruoho {
1084 1.1 jruoho /* This node points back to the original PARSEOP_ALIAS */
1085 1.1 jruoho
1086 1.1 jruoho NextOp = Node->Op;
1087 1.1 jruoho
1088 1.1 jruoho /* The first child is the alias target op */
1089 1.1 jruoho
1090 1.1 jruoho NextOp = NextOp->Asl.Child;
1091 1.1 jruoho
1092 1.1 jruoho /* That in turn points back to original target alias node */
1093 1.1 jruoho
1094 1.1 jruoho if (NextOp->Asl.Node)
1095 1.1 jruoho {
1096 1.1 jruoho Node = NextOp->Asl.Node;
1097 1.1 jruoho }
1098 1.1 jruoho
1099 1.1 jruoho /* Else - forward reference to alias, will be resolved later */
1100 1.1 jruoho }
1101 1.1 jruoho
1102 1.1 jruoho /* 2) Check for a reference to a resource descriptor */
1103 1.1 jruoho
1104 1.1 jruoho if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
1105 1.1 jruoho (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
1106 1.1 jruoho {
1107 1.1 jruoho /*
1108 1.1 jruoho * This was a reference to a field within a resource descriptor. Extract
1109 1.1 jruoho * the associated field offset (either a bit or byte offset depending on
1110 1.1 jruoho * the field type) and change the named reference into an integer for
1111 1.1 jruoho * AML code generation
1112 1.1 jruoho */
1113 1.1 jruoho Temp = Node->Value;
1114 1.1 jruoho if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
1115 1.1 jruoho {
1116 1.1 jruoho Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
1117 1.1 jruoho }
1118 1.1 jruoho
1119 1.1 jruoho /* Perform BitOffset <--> ByteOffset conversion if necessary */
1120 1.1 jruoho
1121 1.1 jruoho switch (Op->Asl.Parent->Asl.AmlOpcode)
1122 1.1 jruoho {
1123 1.1 jruoho case AML_CREATE_FIELD_OP:
1124 1.1 jruoho
1125 1.1 jruoho /* We allow a Byte offset to Bit Offset conversion for this op */
1126 1.1 jruoho
1127 1.1 jruoho if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
1128 1.1 jruoho {
1129 1.1 jruoho /* Simply multiply byte offset times 8 to get bit offset */
1130 1.1 jruoho
1131 1.1 jruoho Temp = ACPI_MUL_8 (Temp);
1132 1.1 jruoho }
1133 1.1 jruoho break;
1134 1.1 jruoho
1135 1.1 jruoho
1136 1.1 jruoho case AML_CREATE_BIT_FIELD_OP:
1137 1.1 jruoho
1138 1.1 jruoho /* This op requires a Bit Offset */
1139 1.1 jruoho
1140 1.1 jruoho if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
1141 1.1 jruoho {
1142 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL);
1143 1.1 jruoho }
1144 1.1 jruoho break;
1145 1.1 jruoho
1146 1.1 jruoho
1147 1.1 jruoho case AML_CREATE_BYTE_FIELD_OP:
1148 1.1 jruoho case AML_CREATE_WORD_FIELD_OP:
1149 1.1 jruoho case AML_CREATE_DWORD_FIELD_OP:
1150 1.1 jruoho case AML_CREATE_QWORD_FIELD_OP:
1151 1.1 jruoho case AML_INDEX_OP:
1152 1.1 jruoho
1153 1.1 jruoho /* These Ops require Byte offsets */
1154 1.1 jruoho
1155 1.1 jruoho if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
1156 1.1 jruoho {
1157 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL);
1158 1.1 jruoho }
1159 1.1 jruoho break;
1160 1.1 jruoho
1161 1.1 jruoho
1162 1.1 jruoho default:
1163 1.1 jruoho /* Nothing to do for other opcodes */
1164 1.1 jruoho break;
1165 1.1 jruoho }
1166 1.1 jruoho
1167 1.1 jruoho /* Now convert this node to an integer whose value is the field offset */
1168 1.1 jruoho
1169 1.1 jruoho Op->Asl.AmlLength = 0;
1170 1.1 jruoho Op->Asl.ParseOpcode = PARSEOP_INTEGER;
1171 1.1 jruoho Op->Asl.Value.Integer = (UINT64) Temp;
1172 1.1 jruoho Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
1173 1.1 jruoho
1174 1.1 jruoho OpcGenerateAmlOpcode (Op);
1175 1.1 jruoho }
1176 1.1 jruoho
1177 1.1 jruoho /* 3) Check for a method invocation */
1178 1.1 jruoho
1179 1.1 jruoho else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
1180 1.1 jruoho (Node->Type == ACPI_TYPE_METHOD) &&
1181 1.1 jruoho (Op->Asl.Parent) &&
1182 1.1 jruoho (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) ||
1183 1.1 jruoho
1184 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
1185 1.1 jruoho {
1186 1.1 jruoho
1187 1.1 jruoho /*
1188 1.1 jruoho * A reference to a method within one of these opcodes is not an
1189 1.1 jruoho * invocation of the method, it is simply a reference to the method.
1190 1.1 jruoho */
1191 1.1 jruoho if ((Op->Asl.Parent) &&
1192 1.1 jruoho ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) ||
1193 1.1 jruoho (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) ||
1194 1.1 jruoho (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
1195 1.1 jruoho {
1196 1.1 jruoho return (AE_OK);
1197 1.1 jruoho }
1198 1.1 jruoho /*
1199 1.1 jruoho * There are two types of method invocation:
1200 1.1 jruoho * 1) Invocation with arguments -- the parser recognizes this
1201 1.1 jruoho * as a METHODCALL.
1202 1.1 jruoho * 2) Invocation with no arguments --the parser cannot determine that
1203 1.1 jruoho * this is a method invocation, therefore we have to figure it out
1204 1.1 jruoho * here.
1205 1.1 jruoho */
1206 1.1 jruoho if (Node->Type != ACPI_TYPE_METHOD)
1207 1.1 jruoho {
1208 1.1 jruoho sprintf (MsgBuffer, "%s is a %s",
1209 1.1 jruoho Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
1210 1.1 jruoho
1211 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
1212 1.1 jruoho return (AE_OK);
1213 1.1 jruoho }
1214 1.1 jruoho
1215 1.1 jruoho /* Save the method node in the caller's op */
1216 1.1 jruoho
1217 1.1 jruoho Op->Asl.Node = Node;
1218 1.1 jruoho if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)
1219 1.1 jruoho {
1220 1.1 jruoho return (AE_OK);
1221 1.1 jruoho }
1222 1.1 jruoho
1223 1.1 jruoho /*
1224 1.1 jruoho * This is a method invocation, with or without arguments.
1225 1.1 jruoho * Count the number of arguments, each appears as a child
1226 1.1 jruoho * under the parent node
1227 1.1 jruoho */
1228 1.1 jruoho Op->Asl.ParseOpcode = PARSEOP_METHODCALL;
1229 1.1 jruoho UtSetParseOpName (Op);
1230 1.1 jruoho
1231 1.1 jruoho PassedArgs = 0;
1232 1.1 jruoho NextOp = Op->Asl.Child;
1233 1.1 jruoho
1234 1.1 jruoho while (NextOp)
1235 1.1 jruoho {
1236 1.1 jruoho PassedArgs++;
1237 1.1 jruoho NextOp = NextOp->Asl.Next;
1238 1.1 jruoho }
1239 1.1 jruoho
1240 1.1 jruoho if (Node->Value != ASL_EXTERNAL_METHOD)
1241 1.1 jruoho {
1242 1.1 jruoho /*
1243 1.1 jruoho * Check the parsed arguments with the number expected by the
1244 1.1 jruoho * method declaration itself
1245 1.1 jruoho */
1246 1.1 jruoho if (PassedArgs != Node->Value)
1247 1.1 jruoho {
1248 1.1 jruoho sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
1249 1.1 jruoho Node->Value);
1250 1.1 jruoho
1251 1.1 jruoho if (PassedArgs < Node->Value)
1252 1.1 jruoho {
1253 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
1254 1.1 jruoho }
1255 1.1 jruoho else
1256 1.1 jruoho {
1257 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
1258 1.1 jruoho }
1259 1.1 jruoho }
1260 1.1 jruoho }
1261 1.1 jruoho }
1262 1.1 jruoho
1263 1.1 jruoho /* 4) Check for an ASL Field definition */
1264 1.1 jruoho
1265 1.1 jruoho else if ((Op->Asl.Parent) &&
1266 1.1 jruoho ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) ||
1267 1.1 jruoho (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
1268 1.1 jruoho {
1269 1.1 jruoho /*
1270 1.1 jruoho * Offset checking for fields. If the parent operation region has a
1271 1.1 jruoho * constant length (known at compile time), we can check fields
1272 1.1 jruoho * defined in that region against the region length. This will catch
1273 1.1 jruoho * fields and field units that cannot possibly fit within the region.
1274 1.1 jruoho *
1275 1.1 jruoho * Note: Index fields do not directly reference an operation region,
1276 1.1 jruoho * thus they are not included in this check.
1277 1.1 jruoho */
1278 1.1 jruoho if (Op == Op->Asl.Parent->Asl.Child)
1279 1.1 jruoho {
1280 1.1 jruoho /*
1281 1.1 jruoho * This is the first child of the field node, which is
1282 1.1 jruoho * the name of the region. Get the parse node for the
1283 1.1 jruoho * region -- which contains the length of the region.
1284 1.1 jruoho */
1285 1.1 jruoho OwningOp = Node->Op;
1286 1.1 jruoho Op->Asl.Parent->Asl.ExtraValue =
1287 1.1 jruoho ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
1288 1.1 jruoho
1289 1.1 jruoho /* Examine the field access width */
1290 1.1 jruoho
1291 1.1 jruoho switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer)
1292 1.1 jruoho {
1293 1.1 jruoho case AML_FIELD_ACCESS_ANY:
1294 1.1 jruoho case AML_FIELD_ACCESS_BYTE:
1295 1.1 jruoho case AML_FIELD_ACCESS_BUFFER:
1296 1.1 jruoho default:
1297 1.1 jruoho MinimumLength = 1;
1298 1.1 jruoho break;
1299 1.1 jruoho
1300 1.1 jruoho case AML_FIELD_ACCESS_WORD:
1301 1.1 jruoho MinimumLength = 2;
1302 1.1 jruoho break;
1303 1.1 jruoho
1304 1.1 jruoho case AML_FIELD_ACCESS_DWORD:
1305 1.1 jruoho MinimumLength = 4;
1306 1.1 jruoho break;
1307 1.1 jruoho
1308 1.1 jruoho case AML_FIELD_ACCESS_QWORD:
1309 1.1 jruoho MinimumLength = 8;
1310 1.1 jruoho break;
1311 1.1 jruoho }
1312 1.1 jruoho
1313 1.1 jruoho /*
1314 1.1 jruoho * Is the region at least as big as the access width?
1315 1.1 jruoho * Note: DataTableRegions have 0 length
1316 1.1 jruoho */
1317 1.1 jruoho if (((UINT32) OwningOp->Asl.Value.Integer) &&
1318 1.1 jruoho ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength))
1319 1.1 jruoho {
1320 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL);
1321 1.1 jruoho }
1322 1.1 jruoho
1323 1.1 jruoho /*
1324 1.1 jruoho * Check EC/CMOS/SMBUS fields to make sure that the correct
1325 1.1 jruoho * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS)
1326 1.1 jruoho */
1327 1.1 jruoho SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
1328 1.1 jruoho switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
1329 1.1 jruoho {
1330 1.1 jruoho case REGION_EC:
1331 1.1 jruoho case REGION_CMOS:
1332 1.1 jruoho
1333 1.1 jruoho if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
1334 1.1 jruoho {
1335 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
1336 1.1 jruoho }
1337 1.1 jruoho break;
1338 1.1 jruoho
1339 1.1 jruoho case REGION_SMBUS:
1340 1.1 jruoho case REGION_IPMI:
1341 1.1 jruoho
1342 1.1 jruoho if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
1343 1.1 jruoho {
1344 1.1 jruoho AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
1345 1.1 jruoho }
1346 1.1 jruoho break;
1347 1.1 jruoho
1348 1.1 jruoho default:
1349 1.1 jruoho
1350 1.1 jruoho /* Nothing to do for other address spaces */
1351 1.1 jruoho break;
1352 1.1 jruoho }
1353 1.1 jruoho }
1354 1.1 jruoho else
1355 1.1 jruoho {
1356 1.1 jruoho /*
1357 1.1 jruoho * This is one element of the field list. Check to make sure
1358 1.1 jruoho * that it does not go beyond the end of the parent operation region.
1359 1.1 jruoho *
1360 1.1 jruoho * In the code below:
1361 1.1 jruoho * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits)
1362 1.1 jruoho * Op->Asl.ExtraValue - Field start offset (bits)
1363 1.1 jruoho * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits)
1364 1.1 jruoho * Op->Asl.Child->Asl.ExtraValue - Field access width (bits)
1365 1.1 jruoho */
1366 1.1 jruoho if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
1367 1.1 jruoho {
1368 1.1 jruoho LkCheckFieldRange (Op,
1369 1.1 jruoho Op->Asl.Parent->Asl.ExtraValue,
1370 1.1 jruoho Op->Asl.ExtraValue,
1371 1.1 jruoho (UINT32) Op->Asl.Child->Asl.Value.Integer,
1372 1.1 jruoho Op->Asl.Child->Asl.ExtraValue);
1373 1.1 jruoho }
1374 1.1 jruoho }
1375 1.1 jruoho }
1376 1.1 jruoho
1377 1.1 jruoho Op->Asl.Node = Node;
1378 1.1 jruoho return (Status);
1379 1.1 jruoho }
1380 1.1 jruoho
1381 1.1 jruoho
1382 1.1 jruoho /*******************************************************************************
1383 1.1 jruoho *
1384 1.1 jruoho * FUNCTION: LkNamespaceLocateEnd
1385 1.1 jruoho *
1386 1.1 jruoho * PARAMETERS: ASL_WALK_CALLBACK
1387 1.1 jruoho *
1388 1.1 jruoho * RETURN: Status
1389 1.1 jruoho *
1390 1.1 jruoho * DESCRIPTION: Ascending callback used during cross reference. We only
1391 1.1 jruoho * need to worry about scope management here.
1392 1.1 jruoho *
1393 1.1 jruoho ******************************************************************************/
1394 1.1 jruoho
1395 1.1 jruoho static ACPI_STATUS
1396 1.1 jruoho LkNamespaceLocateEnd (
1397 1.1 jruoho ACPI_PARSE_OBJECT *Op,
1398 1.1 jruoho UINT32 Level,
1399 1.1 jruoho void *Context)
1400 1.1 jruoho {
1401 1.1 jruoho ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
1402 1.1 jruoho const ACPI_OPCODE_INFO *OpInfo;
1403 1.1 jruoho
1404 1.1 jruoho
1405 1.1 jruoho ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd);
1406 1.1 jruoho
1407 1.1 jruoho
1408 1.1 jruoho /* We are only interested in opcodes that have an associated name */
1409 1.1 jruoho
1410 1.1 jruoho OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
1411 1.1 jruoho if (!(OpInfo->Flags & AML_NAMED))
1412 1.1 jruoho {
1413 1.1 jruoho return (AE_OK);
1414 1.1 jruoho }
1415 1.1 jruoho
1416 1.1 jruoho /* Not interested in name references, we did not open a scope for them */
1417 1.1 jruoho
1418 1.1 jruoho if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
1419 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
1420 1.1 jruoho (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
1421 1.1 jruoho {
1422 1.1 jruoho return (AE_OK);
1423 1.1 jruoho }
1424 1.1 jruoho
1425 1.1 jruoho /* Pop the scope stack if necessary */
1426 1.1 jruoho
1427 1.1 jruoho if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))
1428 1.1 jruoho {
1429 1.1 jruoho
1430 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1431 1.1 jruoho "%s: Popping scope for Op %p\n",
1432 1.1 jruoho AcpiUtGetTypeName (OpInfo->ObjectType), Op));
1433 1.1 jruoho
1434 1.1 jruoho (void) AcpiDsScopeStackPop (WalkState);
1435 1.1 jruoho }
1436 1.1 jruoho
1437 1.1 jruoho return (AE_OK);
1438 1.1 jruoho }
1439 1.1 jruoho
1440 1.1 jruoho
1441