1 /******************************************************************************
3 * Module Name: dswload - Dispatcher namespace load callbacks
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
116 #define __ASLLOAD_C__
118 #include "aslcompiler.h"
120 #include "acdispat.h"
121 #include "acnamesp.h"
123 #include "aslcompiler.y.h"
125 #define _COMPONENT ACPI_COMPILER
126 ACPI_MODULE_NAME ("aslload")
128 /* Local prototypes */
131 LdLoadFieldElements (
132 ACPI_PARSE_OBJECT
*Op
,
133 ACPI_WALK_STATE
*WalkState
);
136 LdLoadResourceElements (
137 ACPI_PARSE_OBJECT
*Op
,
138 ACPI_WALK_STATE
*WalkState
);
142 ACPI_PARSE_OBJECT
*Op
,
148 ACPI_PARSE_OBJECT
*Op
,
153 LdCommonNamespaceEnd (
154 ACPI_PARSE_OBJECT
*Op
,
159 /*******************************************************************************
161 * FUNCTION: LdLoadNamespace
163 * PARAMETERS: RootOp - Root of the parse tree
167 * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
168 * named ASL/AML objects into the namespace. The namespace is
169 * constructed in order to resolve named references and references
170 * to named fields within resource templates/descriptors.
172 ******************************************************************************/
176 ACPI_PARSE_OBJECT
*RootOp
)
178 ACPI_WALK_STATE
*WalkState
;
181 DbgPrint (ASL_DEBUG_OUTPUT
, "\nCreating namespace\n\n");
183 /* Create a new walk state */
185 WalkState
= AcpiDsCreateWalkState (0, NULL
, NULL
, NULL
);
191 /* Walk the entire parse tree, first pass */
193 TrWalkParseTree (RootOp
, ASL_WALK_VISIT_TWICE
, LdNamespace1Begin
,
194 LdCommonNamespaceEnd
, WalkState
);
196 /* Second pass to handle forward references */
198 TrWalkParseTree (RootOp
, ASL_WALK_VISIT_TWICE
, LdNamespace2Begin
,
199 LdCommonNamespaceEnd
, WalkState
);
201 /* Dump the namespace if debug is enabled */
203 AcpiNsDumpTables (ACPI_NS_ALL
, ACPI_UINT32_MAX
);
208 /*******************************************************************************
210 * FUNCTION: LdLoadFieldElements
212 * PARAMETERS: Op - Parent node (Field)
213 * WalkState - Current walk state
217 * DESCRIPTION: Enter the named elements of the field (children of the parent)
218 * into the namespace.
220 ******************************************************************************/
223 LdLoadFieldElements (
224 ACPI_PARSE_OBJECT
*Op
,
225 ACPI_WALK_STATE
*WalkState
)
227 ACPI_PARSE_OBJECT
*Child
= NULL
;
228 ACPI_NAMESPACE_NODE
*Node
;
232 /* Get the first named field element */
234 switch (Op
->Asl
.AmlOpcode
)
236 case AML_BANK_FIELD_OP
:
238 Child
= UtGetArg (Op
, 6);
241 case AML_INDEX_FIELD_OP
:
243 Child
= UtGetArg (Op
, 5);
248 Child
= UtGetArg (Op
, 4);
252 /* No other opcodes should arrive here */
253 return (AE_BAD_PARAMETER
);
256 /* Enter all elements into the namespace */
260 switch (Child
->Asl
.AmlOpcode
)
262 case AML_INT_RESERVEDFIELD_OP
:
263 case AML_INT_ACCESSFIELD_OP
:
269 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
270 Child
->Asl
.Value
.String
,
271 ACPI_TYPE_LOCAL_REGION_FIELD
,
272 ACPI_IMODE_LOAD_PASS1
,
273 ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
274 ACPI_NS_ERROR_IF_FOUND
,
276 if (ACPI_FAILURE (Status
))
278 if (Status
!= AE_ALREADY_EXISTS
)
280 AslError (ASL_ERROR
, ASL_MSG_CORE_EXCEPTION
, Child
,
281 Child
->Asl
.Value
.String
);
286 * The name already exists in this scope
287 * But continue processing the elements
289 AslError (ASL_ERROR
, ASL_MSG_NAME_EXISTS
, Child
,
290 Child
->Asl
.Value
.String
);
294 Child
->Asl
.Node
= Node
;
299 Child
= Child
->Asl
.Next
;
305 /*******************************************************************************
307 * FUNCTION: LdLoadResourceElements
309 * PARAMETERS: Op - Parent node (Resource Descriptor)
310 * WalkState - Current walk state
314 * DESCRIPTION: Enter the named elements of the resource descriptor (children
315 * of the parent) into the namespace.
317 * NOTE: In the real AML namespace, these named elements never exist. But
318 * we simply use the namespace here as a symbol table so we can look
319 * them up as they are referenced.
321 ******************************************************************************/
324 LdLoadResourceElements (
325 ACPI_PARSE_OBJECT
*Op
,
326 ACPI_WALK_STATE
*WalkState
)
328 ACPI_PARSE_OBJECT
*InitializerOp
= NULL
;
329 ACPI_NAMESPACE_NODE
*Node
;
334 * Enter the resource name into the namespace. Name must not already exist.
335 * This opens a scope, so later field names are guaranteed to be new/unique.
337 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Op
->Asl
.Namepath
,
338 ACPI_TYPE_LOCAL_RESOURCE
, ACPI_IMODE_LOAD_PASS1
,
339 ACPI_NS_NO_UPSEARCH
| ACPI_NS_ERROR_IF_FOUND
,
341 if (ACPI_FAILURE (Status
))
343 if (Status
== AE_ALREADY_EXISTS
)
345 /* Actual node causing the error was saved in ParentMethod */
347 AslError (ASL_ERROR
, ASL_MSG_NAME_EXISTS
,
348 (ACPI_PARSE_OBJECT
*) Op
->Asl
.ParentMethod
, Op
->Asl
.Namepath
);
354 Node
->Value
= (UINT32
) Op
->Asl
.Value
.Integer
;
358 * Now enter the predefined fields, for easy lookup when referenced
361 InitializerOp
= ASL_GET_CHILD_NODE (Op
);
362 while (InitializerOp
)
365 if (InitializerOp
->Asl
.ExternalName
)
367 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
368 InitializerOp
->Asl
.ExternalName
,
369 ACPI_TYPE_LOCAL_RESOURCE_FIELD
,
370 ACPI_IMODE_LOAD_PASS1
,
371 ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
,
373 if (ACPI_FAILURE (Status
))
379 * Store the field offset in the namespace node so it
380 * can be used when the field is referenced
382 Node
->Value
= (UINT32
) InitializerOp
->Asl
.Value
.Integer
;
383 InitializerOp
->Asl
.Node
= Node
;
384 Node
->Op
= InitializerOp
;
386 /* Pass thru the field type (Bitfield or Bytefield) */
388 if (InitializerOp
->Asl
.CompileFlags
& NODE_IS_BIT_OFFSET
)
390 Node
->Flags
|= ANOBJ_IS_BIT_OFFSET
;
393 InitializerOp
= ASL_GET_PEER_NODE (InitializerOp
);
400 /*******************************************************************************
402 * FUNCTION: LdNamespace1Begin
404 * PARAMETERS: ASL_WALK_CALLBACK
408 * DESCRIPTION: Descending callback used during the parse tree walk. If this
409 * is a named AML opcode, enter into the namespace
411 ******************************************************************************/
415 ACPI_PARSE_OBJECT
*Op
,
419 ACPI_WALK_STATE
*WalkState
= (ACPI_WALK_STATE
*) Context
;
420 ACPI_NAMESPACE_NODE
*Node
;
422 ACPI_OBJECT_TYPE ObjectType
;
423 ACPI_OBJECT_TYPE ActualObjectType
= ACPI_TYPE_ANY
;
425 UINT32 Flags
= ACPI_NS_NO_UPSEARCH
;
426 ACPI_PARSE_OBJECT
*Arg
;
428 BOOLEAN ForceNewScope
= FALSE
;
431 ACPI_FUNCTION_NAME (LdNamespace1Begin
);
432 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
, "Op %p [%s]\n",
433 Op
, Op
->Asl
.ParseOpName
));
437 * We are only interested in opcodes that have an associated name
438 * (or multiple names)
440 switch (Op
->Asl
.AmlOpcode
)
442 case AML_BANK_FIELD_OP
:
443 case AML_INDEX_FIELD_OP
:
446 Status
= LdLoadFieldElements (Op
, WalkState
);
451 /* All other opcodes go below */
455 /* Check if this object has already been installed in the namespace */
462 Path
= Op
->Asl
.Namepath
;
468 /* Map the raw opcode into an internal object type */
470 switch (Op
->Asl
.ParseOpcode
)
474 Arg
= Op
->Asl
.Child
; /* Get the NameSeg/NameString node */
475 Arg
= Arg
->Asl
.Next
; /* First peer is the object to be associated with the name */
478 * If this name refers to a ResourceTemplate, we will need to open
479 * a new scope so that the resource subfield names can be entered into
480 * the namespace underneath this name
482 if (Op
->Asl
.CompileFlags
& NODE_IS_RESOURCE_DESC
)
484 ForceNewScope
= TRUE
;
487 /* Get the data type associated with the named object, not the name itself */
489 /* Log2 loop to convert from Btype (binary) to Etype (encoded) */
492 for (i
= 1; i
< Arg
->Asl
.AcpiBtype
; i
*= 2)
499 case PARSEOP_EXTERNAL
:
502 * "External" simply enters a name and type into the namespace.
503 * We must be careful to not open a new scope, however, no matter
504 * what type the external name refers to (e.g., a method)
506 * first child is name, next child is ObjectType
508 ActualObjectType
= (UINT8
) Op
->Asl
.Child
->Asl
.Next
->Asl
.Value
.Integer
;
509 ObjectType
= ACPI_TYPE_ANY
;
512 * We will mark every new node along the path as "External". This
513 * allows some or all of the nodes to be created later in the ASL
514 * code. Handles cases like this:
516 * External (\_SB_.PCI0.ABCD, IntObj)
525 * Store (\_SB_.PCI0.ABCD, Local0)
528 Flags
|= ACPI_NS_EXTERNAL
;
531 case PARSEOP_DEFAULT_ARG
:
533 if (Op
->Asl
.CompileFlags
== NODE_IS_RESOURCE_DESC
)
535 Status
= LdLoadResourceElements (Op
, WalkState
);
539 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
546 * The name referenced by Scope(Name) must already exist at this point.
547 * In other words, forward references for Scope() are not supported.
548 * The only real reason for this is that the MS interpreter cannot
549 * handle this case. Perhaps someday this case can go away.
551 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_ANY
,
552 ACPI_IMODE_EXECUTE
, ACPI_NS_SEARCH_PARENT
,
554 if (ACPI_FAILURE (Status
))
556 if (Status
== AE_NOT_FOUND
)
558 /* The name was not found, go ahead and create it */
560 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
,
561 ACPI_TYPE_LOCAL_SCOPE
,
562 ACPI_IMODE_LOAD_PASS1
, Flags
,
566 * However, this is an error -- primarily because the MS
567 * interpreter can't handle a forward reference from the
570 AslError (ASL_ERROR
, ASL_MSG_NOT_FOUND
, Op
,
571 Op
->Asl
.ExternalName
);
572 AslError (ASL_ERROR
, ASL_MSG_SCOPE_FWD_REF
, Op
,
573 Op
->Asl
.ExternalName
);
577 AslCoreSubsystemError (Op
, Status
, "Failure from lookup\n", FALSE
);
581 /* We found a node with this name, now check the type */
585 case ACPI_TYPE_LOCAL_SCOPE
:
586 case ACPI_TYPE_DEVICE
:
587 case ACPI_TYPE_POWER
:
588 case ACPI_TYPE_PROCESSOR
:
589 case ACPI_TYPE_THERMAL
:
591 /* These are acceptable types - they all open a new scope */
594 case ACPI_TYPE_INTEGER
:
595 case ACPI_TYPE_STRING
:
596 case ACPI_TYPE_BUFFER
:
599 * These types we will allow, but we will change the type.
600 * This enables some existing code of the form:
603 * Scope (DEB) { ... }
605 * Which is used to workaround the fact that the MS interpreter
606 * does not allow Scope() forward references.
608 sprintf (MsgBuffer
, "%s [%s], changing type to [Scope]",
609 Op
->Asl
.ExternalName
, AcpiUtGetTypeName (Node
->Type
));
610 AslError (ASL_REMARK
, ASL_MSG_SCOPE_TYPE
, Op
, MsgBuffer
);
612 /* Switch the type to scope, open the new scope */
614 Node
->Type
= ACPI_TYPE_LOCAL_SCOPE
;
615 Status
= AcpiDsScopeStackPush (Node
, ACPI_TYPE_LOCAL_SCOPE
,
617 if (ACPI_FAILURE (Status
))
619 return_ACPI_STATUS (Status
);
625 /* All other types are an error */
627 sprintf (MsgBuffer
, "%s [%s]", Op
->Asl
.ExternalName
,
628 AcpiUtGetTypeName (Node
->Type
));
629 AslError (ASL_ERROR
, ASL_MSG_SCOPE_TYPE
, Op
, MsgBuffer
);
632 * However, switch the type to be an actual scope so
633 * that compilation can continue without generating a whole
634 * cascade of additional errors. Open the new scope.
636 Node
->Type
= ACPI_TYPE_LOCAL_SCOPE
;
637 Status
= AcpiDsScopeStackPush (Node
, ACPI_TYPE_LOCAL_SCOPE
,
639 if (ACPI_FAILURE (Status
))
641 return_ACPI_STATUS (Status
);
652 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
657 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
, "Loading name: %s, (%s)\n",
658 Op
->Asl
.ExternalName
, AcpiUtGetTypeName (ObjectType
)));
660 /* The name must not already exist */
662 Flags
|= ACPI_NS_ERROR_IF_FOUND
;
665 * Enter the named type into the internal namespace. We enter the name
666 * as we go downward in the parse tree. Any necessary subobjects that
667 * involve arguments to the opcode must be created as we go back up the
670 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ObjectType
,
671 ACPI_IMODE_LOAD_PASS1
, Flags
, WalkState
, &Node
);
672 if (ACPI_FAILURE (Status
))
674 if (Status
== AE_ALREADY_EXISTS
)
676 /* The name already exists in this scope */
678 if (Node
->Type
== ACPI_TYPE_LOCAL_SCOPE
)
680 /* Allow multiple references to the same scope */
682 Node
->Type
= (UINT8
) ObjectType
;
685 else if ((Node
->Flags
& ANOBJ_IS_EXTERNAL
) &&
686 (Op
->Asl
.ParseOpcode
!= PARSEOP_EXTERNAL
))
689 * Allow one create on an object or segment that was
690 * previously declared External
692 Node
->Flags
&= ~ANOBJ_IS_EXTERNAL
;
693 Node
->Type
= (UINT8
) ObjectType
;
695 /* Just retyped a node, probably will need to open a scope */
697 if (AcpiNsOpensScope (ObjectType
))
699 Status
= AcpiDsScopeStackPush (Node
, ObjectType
, WalkState
);
700 if (ACPI_FAILURE (Status
))
702 return_ACPI_STATUS (Status
);
709 /* Valid error, object already exists */
711 AslError (ASL_ERROR
, ASL_MSG_NAME_EXISTS
, Op
,
712 Op
->Asl
.ExternalName
);
719 AslCoreSubsystemError (Op
, Status
,
720 "Failure from lookup %s\n", FALSE
);
727 Status
= AcpiDsScopeStackPush (Node
, ObjectType
, WalkState
);
728 if (ACPI_FAILURE (Status
))
730 return_ACPI_STATUS (Status
);
736 * Point the parse node to the new namespace node, and point
737 * the Node back to the original Parse node
742 /* Set the actual data type if appropriate (EXTERNAL term only) */
744 if (ActualObjectType
!= ACPI_TYPE_ANY
)
746 Node
->Type
= (UINT8
) ActualObjectType
;
747 Node
->Value
= ASL_EXTERNAL_METHOD
;
750 if (Op
->Asl
.ParseOpcode
== PARSEOP_METHOD
)
753 * Get the method argument count from "Extra" and save
754 * it in the namespace node
756 Node
->Value
= (UINT32
) Op
->Asl
.Extra
;
764 /*******************************************************************************
766 * FUNCTION: LdNamespace2Begin
768 * PARAMETERS: ASL_WALK_CALLBACK
772 * DESCRIPTION: Descending callback used during the pass 2 parse tree walk.
773 * Second pass resolves some forward references.
776 * Currently only needs to handle the Alias operator.
777 * Could be used to allow forward references from the Scope() operator, but
778 * the MS interpreter does not allow this, so this compiler does not either.
780 ******************************************************************************/
784 ACPI_PARSE_OBJECT
*Op
,
788 ACPI_WALK_STATE
*WalkState
= (ACPI_WALK_STATE
*) Context
;
790 ACPI_NAMESPACE_NODE
*Node
;
791 ACPI_OBJECT_TYPE ObjectType
;
792 BOOLEAN ForceNewScope
= FALSE
;
793 ACPI_PARSE_OBJECT
*Arg
;
795 ACPI_NAMESPACE_NODE
*TargetNode
;
798 ACPI_FUNCTION_NAME (LdNamespace2Begin
);
799 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
, "Op %p [%s]\n",
800 Op
, Op
->Asl
.ParseOpName
));
803 /* Ignore Ops with no namespace node */
811 /* Get the type to determine if we should push the scope */
813 if ((Op
->Asl
.ParseOpcode
== PARSEOP_DEFAULT_ARG
) &&
814 (Op
->Asl
.CompileFlags
== NODE_IS_RESOURCE_DESC
))
816 ObjectType
= ACPI_TYPE_LOCAL_RESOURCE
;
820 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
823 /* Push scope for Resource Templates */
825 if (Op
->Asl
.ParseOpcode
== PARSEOP_NAME
)
827 if (Op
->Asl
.CompileFlags
& NODE_IS_RESOURCE_DESC
)
829 ForceNewScope
= TRUE
;
833 /* Push the scope stack */
835 if (ForceNewScope
|| AcpiNsOpensScope (ObjectType
))
837 Status
= AcpiDsScopeStackPush (Node
, ObjectType
, WalkState
);
838 if (ACPI_FAILURE (Status
))
840 return_ACPI_STATUS (Status
);
844 if (Op
->Asl
.ParseOpcode
== PARSEOP_ALIAS
)
846 /* Complete the alias node by getting and saving the target node */
848 /* First child is the alias target */
852 /* Get the target pathname */
854 Path
= Arg
->Asl
.Namepath
;
857 Status
= UtInternalizeName (Arg
->Asl
.ExternalName
, &Path
);
858 if (ACPI_FAILURE (Status
))
864 /* Get the NS node associated with the target. It must exist. */
866 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_ANY
,
867 ACPI_IMODE_EXECUTE
, ACPI_NS_SEARCH_PARENT
| ACPI_NS_DONT_OPEN_SCOPE
,
868 WalkState
, &TargetNode
);
869 if (ACPI_FAILURE (Status
))
871 if (Status
== AE_NOT_FOUND
)
873 AslError (ASL_ERROR
, ASL_MSG_NOT_FOUND
, Op
,
874 Op
->Asl
.ExternalName
);
877 * The name was not found, go ahead and create it.
878 * This prevents more errors later.
880 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
,
882 ACPI_IMODE_LOAD_PASS1
, ACPI_NS_NO_UPSEARCH
,
887 AslCoreSubsystemError (Op
, Status
, "Failure from lookup\n", FALSE
);
891 /* Save the target node within the alias node */
893 Node
->Object
= ACPI_CAST_PTR (ACPI_OPERAND_OBJECT
, TargetNode
);
900 /*******************************************************************************
902 * FUNCTION: LdCommonNamespaceEnd
904 * PARAMETERS: ASL_WALK_CALLBACK
908 * DESCRIPTION: Ascending callback used during the loading of the namespace,
909 * We only need to worry about managing the scope stack here.
911 ******************************************************************************/
914 LdCommonNamespaceEnd (
915 ACPI_PARSE_OBJECT
*Op
,
919 ACPI_WALK_STATE
*WalkState
= (ACPI_WALK_STATE
*) Context
;
920 ACPI_OBJECT_TYPE ObjectType
;
921 BOOLEAN ForceNewScope
= FALSE
;
924 ACPI_FUNCTION_NAME (LdCommonNamespaceEnd
);
927 /* We are only interested in opcodes that have an associated name */
929 if (!Op
->Asl
.Namepath
)
934 /* Get the type to determine if we should pop the scope */
936 if ((Op
->Asl
.ParseOpcode
== PARSEOP_DEFAULT_ARG
) &&
937 (Op
->Asl
.CompileFlags
== NODE_IS_RESOURCE_DESC
))
939 /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */
941 ObjectType
= ACPI_TYPE_LOCAL_RESOURCE
;
945 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
948 /* Pop scope that was pushed for Resource Templates */
950 if (Op
->Asl
.ParseOpcode
== PARSEOP_NAME
)
952 if (Op
->Asl
.CompileFlags
& NODE_IS_RESOURCE_DESC
)
954 ForceNewScope
= TRUE
;
958 /* Pop the scope stack */
960 if (ForceNewScope
|| AcpiNsOpensScope (ObjectType
))
962 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
963 "(%s): Popping scope for Op [%s] %p\n",
964 AcpiUtGetTypeName (ObjectType
), Op
->Asl
.ParseOpName
, Op
));
966 (void) AcpiDsScopeStackPop (WalkState
);