1 /******************************************************************************
3 * Module Name: dswload - Dispatcher namespace load callbacks
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2016, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <contrib/dev/acpica/compiler/aslcompiler.h>
45 #include <contrib/dev/acpica/include/amlcode.h>
46 #include <contrib/dev/acpica/include/acdispat.h>
47 #include <contrib/dev/acpica/include/acnamesp.h>
49 #include "aslcompiler.y.h"
51 #define _COMPONENT ACPI_COMPILER
52 ACPI_MODULE_NAME ("aslload")
54 /* Local prototypes */
58 ACPI_PARSE_OBJECT *Op,
59 ACPI_WALK_STATE *WalkState);
62 LdLoadResourceElements (
63 ACPI_PARSE_OBJECT *Op,
64 ACPI_WALK_STATE *WalkState);
68 ACPI_PARSE_OBJECT *Op,
74 ACPI_PARSE_OBJECT *Op,
79 LdCommonNamespaceEnd (
80 ACPI_PARSE_OBJECT *Op,
85 /*******************************************************************************
87 * FUNCTION: LdLoadNamespace
89 * PARAMETERS: RootOp - Root of the parse tree
93 * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
94 * named ASL/AML objects into the namespace. The namespace is
95 * constructed in order to resolve named references and references
96 * to named fields within resource templates/descriptors.
98 ******************************************************************************/
102 ACPI_PARSE_OBJECT *RootOp)
104 ACPI_WALK_STATE *WalkState;
107 /* Create a new walk state */
109 WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
112 return (AE_NO_MEMORY);
115 /* Walk the entire parse tree, first pass */
117 TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
118 LdCommonNamespaceEnd, WalkState);
120 /* Second pass to handle forward references */
122 TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace2Begin,
123 LdCommonNamespaceEnd, WalkState);
125 /* Dump the namespace if debug is enabled */
127 AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX);
128 ACPI_FREE (WalkState);
133 /*******************************************************************************
135 * FUNCTION: LdLoadFieldElements
137 * PARAMETERS: Op - Parent node (Field)
138 * WalkState - Current walk state
142 * DESCRIPTION: Enter the named elements of the field (children of the parent)
143 * into the namespace.
145 ******************************************************************************/
148 LdLoadFieldElements (
149 ACPI_PARSE_OBJECT *Op,
150 ACPI_WALK_STATE *WalkState)
152 ACPI_PARSE_OBJECT *Child = NULL;
153 ACPI_NAMESPACE_NODE *Node;
157 /* Get the first named field element */
159 switch (Op->Asl.AmlOpcode)
161 case AML_BANK_FIELD_OP:
163 Child = UtGetArg (Op, 6);
166 case AML_INDEX_FIELD_OP:
168 Child = UtGetArg (Op, 5);
173 Child = UtGetArg (Op, 4);
178 /* No other opcodes should arrive here */
180 return (AE_BAD_PARAMETER);
183 /* Enter all elements into the namespace */
187 switch (Child->Asl.AmlOpcode)
189 case AML_INT_RESERVEDFIELD_OP:
190 case AML_INT_ACCESSFIELD_OP:
191 case AML_INT_CONNECTION_OP:
196 Status = AcpiNsLookup (WalkState->ScopeInfo,
197 Child->Asl.Value.String,
198 ACPI_TYPE_LOCAL_REGION_FIELD,
199 ACPI_IMODE_LOAD_PASS1,
200 ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
201 ACPI_NS_ERROR_IF_FOUND, NULL, &Node);
202 if (ACPI_FAILURE (Status))
204 if (Status != AE_ALREADY_EXISTS)
206 AslError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Child,
207 Child->Asl.Value.String);
212 * The name already exists in this scope
213 * But continue processing the elements
215 AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
216 Child->Asl.Value.String);
220 Child->Asl.Node = Node;
226 Child = Child->Asl.Next;
233 /*******************************************************************************
235 * FUNCTION: LdLoadResourceElements
237 * PARAMETERS: Op - Parent node (Resource Descriptor)
238 * WalkState - Current walk state
242 * DESCRIPTION: Enter the named elements of the resource descriptor (children
243 * of the parent) into the namespace.
245 * NOTE: In the real AML namespace, these named elements never exist. But
246 * we simply use the namespace here as a symbol table so we can look
247 * them up as they are referenced.
249 ******************************************************************************/
252 LdLoadResourceElements (
253 ACPI_PARSE_OBJECT *Op,
254 ACPI_WALK_STATE *WalkState)
256 ACPI_PARSE_OBJECT *InitializerOp = NULL;
257 ACPI_NAMESPACE_NODE *Node;
262 * Enter the resource name into the namespace. Name must not already exist.
263 * This opens a scope, so later field names are guaranteed to be new/unique.
265 Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
266 ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
267 ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
269 if (ACPI_FAILURE (Status))
271 if (Status == AE_ALREADY_EXISTS)
273 /* Actual node causing the error was saved in ParentMethod */
275 AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS,
276 (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath);
282 Node->Value = (UINT32) Op->Asl.Value.Integer;
287 * Now enter the predefined fields, for easy lookup when referenced
290 InitializerOp = ASL_GET_CHILD_NODE (Op);
291 while (InitializerOp)
293 if (InitializerOp->Asl.ExternalName)
295 Status = AcpiNsLookup (WalkState->ScopeInfo,
296 InitializerOp->Asl.ExternalName,
297 ACPI_TYPE_LOCAL_RESOURCE_FIELD,
298 ACPI_IMODE_LOAD_PASS1,
299 ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
301 if (ACPI_FAILURE (Status))
307 * Store the field offset and length in the namespace node
308 * so it can be used when the field is referenced
310 Node->Value = InitializerOp->Asl.Value.Tag.BitOffset;
311 Node->Length = InitializerOp->Asl.Value.Tag.BitLength;
312 InitializerOp->Asl.Node = Node;
313 Node->Op = InitializerOp;
316 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
323 /*******************************************************************************
325 * FUNCTION: LdNamespace1Begin
327 * PARAMETERS: ASL_WALK_CALLBACK
331 * DESCRIPTION: Descending callback used during the parse tree walk. If this
332 * is a named AML opcode, enter into the namespace
334 ******************************************************************************/
338 ACPI_PARSE_OBJECT *Op,
342 ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
343 ACPI_NAMESPACE_NODE *Node;
344 ACPI_PARSE_OBJECT *MethodOp;
346 ACPI_OBJECT_TYPE ObjectType;
347 ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY;
349 UINT32 Flags = ACPI_NS_NO_UPSEARCH;
350 ACPI_PARSE_OBJECT *Arg;
352 BOOLEAN ForceNewScope = FALSE;
355 ACPI_FUNCTION_NAME (LdNamespace1Begin);
356 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
357 Op, Op->Asl.ParseOpName));
360 * We are only interested in opcodes that have an associated name
361 * (or multiple names)
363 switch (Op->Asl.AmlOpcode)
365 case AML_BANK_FIELD_OP:
366 case AML_INDEX_FIELD_OP:
369 Status = LdLoadFieldElements (Op, WalkState);
372 case AML_INT_CONNECTION_OP:
375 if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
381 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName,
382 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
384 if (ACPI_FAILURE (Status))
389 if (Node->Type == ACPI_TYPE_BUFFER)
391 Arg->Asl.Node = Node;
393 Arg = Node->Op->Asl.Child; /* Get namepath */
394 Arg = Arg->Asl.Next; /* Get actual buffer */
395 Arg = Arg->Asl.Child; /* Buffer length */
396 Arg = Arg->Asl.Next; /* RAW_DATA buffer */
402 /* All other opcodes go below */
407 /* Check if this object has already been installed in the namespace */
414 Path = Op->Asl.Namepath;
420 /* Map the raw opcode into an internal object type */
422 switch (Op->Asl.ParseOpcode)
426 Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */
427 Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */
430 * If this name refers to a ResourceTemplate, we will need to open
431 * a new scope so that the resource subfield names can be entered into
432 * the namespace underneath this name
434 if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
436 ForceNewScope = TRUE;
439 /* Get the data type associated with the named object, not the name itself */
441 /* Log2 loop to convert from Btype (binary) to Etype (encoded) */
444 for (i = 1; i < Arg->Asl.AcpiBtype; i *= 2)
451 case PARSEOP_EXTERNAL:
453 * "External" simply enters a name and type into the namespace.
454 * We must be careful to not open a new scope, however, no matter
455 * what type the external name refers to (e.g., a method)
457 * first child is name, next child is ObjectType
459 ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer;
460 ObjectType = ACPI_TYPE_ANY;
463 * We will mark every new node along the path as "External". This
464 * allows some or all of the nodes to be created later in the ASL
465 * code. Handles cases like this:
467 * External (\_SB_.PCI0.ABCD, IntObj)
476 * Store (\_SB_.PCI0.ABCD, Local0)
479 Flags |= ACPI_NS_EXTERNAL;
482 case PARSEOP_DEFAULT_ARG:
484 if (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
486 Status = LdLoadResourceElements (Op, WalkState);
487 return_ACPI_STATUS (Status);
490 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
495 * The name referenced by Scope(Name) must already exist at this point.
496 * In other words, forward references for Scope() are not supported.
497 * The only real reason for this is that the MS interpreter cannot
498 * handle this case. Perhaps someday this case can go away.
500 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
501 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
503 if (ACPI_FAILURE (Status))
505 if (Status == AE_NOT_FOUND)
507 /* The name was not found, go ahead and create it */
509 Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
510 ACPI_TYPE_LOCAL_SCOPE,
511 ACPI_IMODE_LOAD_PASS1, Flags,
513 if (ACPI_FAILURE (Status))
515 return_ACPI_STATUS (Status);
519 * However, this is an error -- primarily because the MS
520 * interpreter can't handle a forward reference from the
523 AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
524 Op->Asl.ExternalName);
525 AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op,
526 Op->Asl.ExternalName);
530 AslCoreSubsystemError (Op, Status,
531 "Failure from namespace lookup", FALSE);
533 return_ACPI_STATUS (Status);
535 else /* Status AE_OK */
538 * Do not allow references to external scopes from the DSDT.
539 * This is because the DSDT is always loaded first, and the
540 * external reference cannot be resolved -- causing a runtime
541 * error because Scope() must be resolved immediately.
544 if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
545 (ACPI_COMPARE_NAME (Gbl_TableSignature, "DSDT")))
547 /* However, allowed if the reference is within a method */
549 MethodOp = Op->Asl.Parent;
551 (MethodOp->Asl.ParseOpcode != PARSEOP_METHOD))
553 MethodOp = MethodOp->Asl.Parent;
558 /* Not in a control method, error */
560 AslError (ASL_ERROR, ASL_MSG_CROSS_TABLE_SCOPE, Op, NULL);
565 /* We found a node with this name, now check the type */
569 case ACPI_TYPE_LOCAL_SCOPE:
570 case ACPI_TYPE_DEVICE:
571 case ACPI_TYPE_POWER:
572 case ACPI_TYPE_PROCESSOR:
573 case ACPI_TYPE_THERMAL:
575 /* These are acceptable types - they all open a new scope */
578 case ACPI_TYPE_INTEGER:
579 case ACPI_TYPE_STRING:
580 case ACPI_TYPE_BUFFER:
582 * These types we will allow, but we will change the type.
583 * This enables some existing code of the form:
586 * Scope (DEB) { ... }
588 * Which is used to workaround the fact that the MS interpreter
589 * does not allow Scope() forward references.
591 sprintf (MsgBuffer, "%s [%s], changing type to [Scope]",
592 Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
593 AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
595 /* Switch the type to scope, open the new scope */
597 Node->Type = ACPI_TYPE_LOCAL_SCOPE;
598 Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
600 if (ACPI_FAILURE (Status))
602 return_ACPI_STATUS (Status);
608 /* All other types are an error */
610 sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
611 AcpiUtGetTypeName (Node->Type));
612 AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
615 * However, switch the type to be an actual scope so
616 * that compilation can continue without generating a whole
617 * cascade of additional errors. Open the new scope.
619 Node->Type = ACPI_TYPE_LOCAL_SCOPE;
620 Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
622 if (ACPI_FAILURE (Status))
624 return_ACPI_STATUS (Status);
635 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
640 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
641 Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
643 /* The name must not already exist */
645 Flags |= ACPI_NS_ERROR_IF_FOUND;
648 * Enter the named type into the internal namespace. We enter the name
649 * as we go downward in the parse tree. Any necessary subobjects that
650 * involve arguments to the opcode must be created as we go back up the
653 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
654 ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
655 if (ACPI_FAILURE (Status))
657 if (Status == AE_ALREADY_EXISTS)
659 /* The name already exists in this scope */
661 if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
663 /* Allow multiple references to the same scope */
665 Node->Type = (UINT8) ObjectType;
668 else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
669 (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL))
672 * Allow one create on an object or segment that was
673 * previously declared External
675 Node->Flags &= ~ANOBJ_IS_EXTERNAL;
676 Node->Type = (UINT8) ObjectType;
678 /* Just retyped a node, probably will need to open a scope */
680 if (AcpiNsOpensScope (ObjectType))
682 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
683 if (ACPI_FAILURE (Status))
685 return_ACPI_STATUS (Status);
691 else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
692 (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
695 * Allow externals in same scope as the definition of the
696 * actual object. Similar to C. Allows multiple definition
697 * blocks that refer to each other in the same file.
701 else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
702 (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
703 (ObjectType == ACPI_TYPE_ANY))
705 /* Allow update of externals of unknown type. */
707 if (AcpiNsOpensScope (ActualObjectType))
709 Node->Type = (UINT8) ActualObjectType;
714 sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
715 AcpiUtGetTypeName (Node->Type));
716 AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
717 return_ACPI_STATUS (AE_OK);
722 /* Valid error, object already exists */
724 AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
725 Op->Asl.ExternalName);
726 return_ACPI_STATUS (AE_OK);
731 AslCoreSubsystemError (Op, Status,
732 "Failure from namespace lookup", FALSE);
733 return_ACPI_STATUS (Status);
739 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
740 if (ACPI_FAILURE (Status))
742 return_ACPI_STATUS (Status);
748 * Point the parse node to the new namespace node, and point
749 * the Node back to the original Parse node
754 /* Set the actual data type if appropriate (EXTERNAL term only) */
756 if (ActualObjectType != ACPI_TYPE_ANY)
758 Node->Type = (UINT8) ActualObjectType;
759 Node->Value = ASL_EXTERNAL_METHOD;
762 if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
765 * Get the method argument count from "Extra" and save
766 * it in the namespace node
768 Node->Value = (UINT32) Op->Asl.Extra;
771 return_ACPI_STATUS (Status);
775 /*******************************************************************************
777 * FUNCTION: LdNamespace2Begin
779 * PARAMETERS: ASL_WALK_CALLBACK
783 * DESCRIPTION: Descending callback used during the pass 2 parse tree walk.
784 * Second pass resolves some forward references.
787 * Currently only needs to handle the Alias operator.
788 * Could be used to allow forward references from the Scope() operator, but
789 * the MS interpreter does not allow this, so this compiler does not either.
791 ******************************************************************************/
795 ACPI_PARSE_OBJECT *Op,
799 ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
801 ACPI_NAMESPACE_NODE *Node;
802 ACPI_OBJECT_TYPE ObjectType;
803 BOOLEAN ForceNewScope = FALSE;
804 ACPI_PARSE_OBJECT *Arg;
806 ACPI_NAMESPACE_NODE *TargetNode;
809 ACPI_FUNCTION_NAME (LdNamespace2Begin);
810 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
811 Op, Op->Asl.ParseOpName));
814 /* Ignore Ops with no namespace node */
822 /* Get the type to determine if we should push the scope */
824 if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&
825 (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC))
827 ObjectType = ACPI_TYPE_LOCAL_RESOURCE;
831 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
834 /* Push scope for Resource Templates */
836 if (Op->Asl.ParseOpcode == PARSEOP_NAME)
838 if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
840 ForceNewScope = TRUE;
844 /* Push the scope stack */
846 if (ForceNewScope || AcpiNsOpensScope (ObjectType))
848 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
849 if (ACPI_FAILURE (Status))
851 return_ACPI_STATUS (Status);
855 if (Op->Asl.ParseOpcode == PARSEOP_ALIAS)
857 /* Complete the alias node by getting and saving the target node */
859 /* First child is the alias target */
863 /* Get the target pathname */
865 Path = Arg->Asl.Namepath;
868 Status = UtInternalizeName (Arg->Asl.ExternalName, &Path);
869 if (ACPI_FAILURE (Status))
875 /* Get the NS node associated with the target. It must exist. */
877 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
878 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
879 WalkState, &TargetNode);
880 if (ACPI_FAILURE (Status))
882 if (Status == AE_NOT_FOUND)
884 AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
885 Op->Asl.ExternalName);
888 * The name was not found, go ahead and create it.
889 * This prevents more errors later.
891 Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
893 ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
898 AslCoreSubsystemError (Op, Status,
899 "Failure from namespace lookup", FALSE);
903 /* Save the target node within the alias node */
905 Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
912 /*******************************************************************************
914 * FUNCTION: LdCommonNamespaceEnd
916 * PARAMETERS: ASL_WALK_CALLBACK
920 * DESCRIPTION: Ascending callback used during the loading of the namespace,
921 * We only need to worry about managing the scope stack here.
923 ******************************************************************************/
926 LdCommonNamespaceEnd (
927 ACPI_PARSE_OBJECT *Op,
931 ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
932 ACPI_OBJECT_TYPE ObjectType;
933 BOOLEAN ForceNewScope = FALSE;
936 ACPI_FUNCTION_NAME (LdCommonNamespaceEnd);
939 /* We are only interested in opcodes that have an associated name */
941 if (!Op->Asl.Namepath)
946 /* Get the type to determine if we should pop the scope */
948 if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&
949 (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC))
951 /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */
953 ObjectType = ACPI_TYPE_LOCAL_RESOURCE;
957 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
960 /* Pop scope that was pushed for Resource Templates */
962 if (Op->Asl.ParseOpcode == PARSEOP_NAME)
964 if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
966 ForceNewScope = TRUE;
970 /* Pop the scope stack */
972 if (ForceNewScope || AcpiNsOpensScope (ObjectType))
974 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
975 "(%s): Popping scope for Op [%s] %p\n",
976 AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op));
978 (void) AcpiDsScopeStackPop (WalkState);