xref: /onnv-gate/usr/src/uts/intel/io/acpica/namespace/nssearch.c (revision 7851:e828bbb1689c)
13446Smrj /*******************************************************************************
23446Smrj  *
33446Smrj  * Module Name: nssearch - Namespace search
4*7851SDana.Myers@Sun.COM  *              $Revision: 1.123 $
53446Smrj  *
63446Smrj  ******************************************************************************/
73446Smrj 
83446Smrj /******************************************************************************
93446Smrj  *
103446Smrj  * 1. Copyright Notice
113446Smrj  *
12*7851SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
133446Smrj  * All rights reserved.
143446Smrj  *
153446Smrj  * 2. License
163446Smrj  *
173446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
183446Smrj  * rights.  You may have additional license terms from the party that provided
193446Smrj  * you this software, covering your right to use that party's intellectual
203446Smrj  * property rights.
213446Smrj  *
223446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
233446Smrj  * copy of the source code appearing in this file ("Covered Code") an
243446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
253446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
263446Smrj  * make derivatives, distribute, use and display any portion of the Covered
273446Smrj  * Code in any form, with the right to sublicense such rights; and
283446Smrj  *
293446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
303446Smrj  * license (with the right to sublicense), under only those claims of Intel
313446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
323446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
333446Smrj  * solely to the minimum extent necessary to exercise the above copyright
343446Smrj  * license, and in no event shall the patent license extend to any additions
353446Smrj  * to or modifications of the Original Intel Code.  No other license or right
363446Smrj  * is granted directly or by implication, estoppel or otherwise;
373446Smrj  *
383446Smrj  * The above copyright and patent license is granted only if the following
393446Smrj  * conditions are met:
403446Smrj  *
413446Smrj  * 3. Conditions
423446Smrj  *
433446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
443446Smrj  * Redistribution of source code of any substantial portion of the Covered
453446Smrj  * Code or modification with rights to further distribute source must include
463446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
473446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
483446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
493446Smrj  * contain a file documenting the changes Licensee made to create that Covered
503446Smrj  * Code and the date of any change.  Licensee must include in that file the
513446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
523446Smrj  * must include a prominent statement that the modification is derived,
533446Smrj  * directly or indirectly, from Original Intel Code.
543446Smrj  *
553446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
563446Smrj  * Redistribution of source code of any substantial portion of the Covered
573446Smrj  * Code or modification without rights to further distribute source must
583446Smrj  * include the following Disclaimer and Export Compliance provision in the
593446Smrj  * documentation and/or other materials provided with distribution.  In
603446Smrj  * addition, Licensee may not authorize further sublicense of source of any
613446Smrj  * portion of the Covered Code, and must include terms to the effect that the
623446Smrj  * license from Licensee to its licensee is limited to the intellectual
633446Smrj  * property embodied in the software Licensee provides to its licensee, and
643446Smrj  * not to intellectual property embodied in modifications its licensee may
653446Smrj  * make.
663446Smrj  *
673446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
683446Smrj  * substantial portion of the Covered Code or modification must reproduce the
693446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
703446Smrj  * provision in the documentation and/or other materials provided with the
713446Smrj  * distribution.
723446Smrj  *
733446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
743446Smrj  * Intel Code.
753446Smrj  *
763446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
773446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
783446Smrj  * other dealings in products derived from or relating to the Covered Code
793446Smrj  * without prior written authorization from Intel.
803446Smrj  *
813446Smrj  * 4. Disclaimer and Export Compliance
823446Smrj  *
833446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
843446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
853446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
863446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
873446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
883446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
893446Smrj  * PARTICULAR PURPOSE.
903446Smrj  *
913446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
923446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
933446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
943446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
953446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
963446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
973446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
983446Smrj  * LIMITED REMEDY.
993446Smrj  *
1003446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1013446Smrj  * software or system incorporating such software without first obtaining any
1023446Smrj  * required license or other approval from the U. S. Department of Commerce or
1033446Smrj  * any other agency or department of the United States Government.  In the
1043446Smrj  * event Licensee exports any such software from the United States or
1053446Smrj  * re-exports any such software from a foreign destination, Licensee shall
1063446Smrj  * ensure that the distribution and export/re-export of the software is in
1073446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
1083446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1093446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
1103446Smrj  * software, or service, directly or indirectly, to any country for which the
1113446Smrj  * United States government or any agency thereof requires an export license,
1123446Smrj  * other governmental approval, or letter of assurance, without first obtaining
1133446Smrj  * such license, approval or letter.
1143446Smrj  *
1153446Smrj  *****************************************************************************/
1163446Smrj 
1173446Smrj #define __NSSEARCH_C__
1183446Smrj 
1193446Smrj #include "acpi.h"
1203446Smrj #include "acnamesp.h"
1213446Smrj 
1223446Smrj 
1233446Smrj #define _COMPONENT          ACPI_NAMESPACE
1243446Smrj         ACPI_MODULE_NAME    ("nssearch")
1253446Smrj 
1263446Smrj /* Local prototypes */
1273446Smrj 
1283446Smrj static ACPI_STATUS
1293446Smrj AcpiNsSearchParentTree (
1303446Smrj     UINT32                  TargetName,
1313446Smrj     ACPI_NAMESPACE_NODE     *Node,
1323446Smrj     ACPI_OBJECT_TYPE        Type,
1333446Smrj     ACPI_NAMESPACE_NODE     **ReturnNode);
1343446Smrj 
1353446Smrj 
1363446Smrj /*******************************************************************************
1373446Smrj  *
1383446Smrj  * FUNCTION:    AcpiNsSearchOneScope
1393446Smrj  *
1403446Smrj  * PARAMETERS:  TargetName      - Ascii ACPI name to search for
1413446Smrj  *              ParentNode      - Starting node where search will begin
1423446Smrj  *              Type            - Object type to match
1433446Smrj  *              ReturnNode      - Where the matched Named obj is returned
1443446Smrj  *
1453446Smrj  * RETURN:      Status
1463446Smrj  *
1473446Smrj  * DESCRIPTION: Search a single level of the namespace. Performs a
1483446Smrj  *              simple search of the specified level, and does not add
1493446Smrj  *              entries or search parents.
1503446Smrj  *
1513446Smrj  *
1523446Smrj  *      Named object lists are built (and subsequently dumped) in the
1533446Smrj  *      order in which the names are encountered during the namespace load;
1543446Smrj  *
1553446Smrj  *      All namespace searching is linear in this implementation, but
1563446Smrj  *      could be easily modified to support any improved search
1573446Smrj  *      algorithm. However, the linear search was chosen for simplicity
1583446Smrj  *      and because the trees are small and the other interpreter
1593446Smrj  *      execution overhead is relatively high.
1603446Smrj  *
1613446Smrj  *      Note: CPU execution analysis has shown that the AML interpreter spends
1623446Smrj  *      a very small percentage of its time searching the namespace. Therefore,
1633446Smrj  *      the linear search seems to be sufficient, as there would seem to be
1643446Smrj  *      little value in improving the search.
1653446Smrj  *
1663446Smrj  ******************************************************************************/
1673446Smrj 
1683446Smrj ACPI_STATUS
1693446Smrj AcpiNsSearchOneScope (
1703446Smrj     UINT32                  TargetName,
1713446Smrj     ACPI_NAMESPACE_NODE     *ParentNode,
1723446Smrj     ACPI_OBJECT_TYPE        Type,
1733446Smrj     ACPI_NAMESPACE_NODE     **ReturnNode)
1743446Smrj {
1753446Smrj     ACPI_NAMESPACE_NODE     *Node;
1763446Smrj 
1773446Smrj 
1783446Smrj     ACPI_FUNCTION_TRACE (NsSearchOneScope);
1793446Smrj 
1803446Smrj 
1813446Smrj #ifdef ACPI_DEBUG_OUTPUT
1823446Smrj     if (ACPI_LV_NAMES & AcpiDbgLevel)
1833446Smrj     {
1843446Smrj         char                *ScopeName;
1853446Smrj 
1863446Smrj         ScopeName = AcpiNsGetExternalPathname (ParentNode);
1873446Smrj         if (ScopeName)
1883446Smrj         {
1893446Smrj             ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
1903446Smrj                 "Searching %s (%p) For [%4.4s] (%s)\n",
1913446Smrj                 ScopeName, ParentNode, ACPI_CAST_PTR (char, &TargetName),
1923446Smrj                 AcpiUtGetTypeName (Type)));
1933446Smrj 
1943446Smrj             ACPI_FREE (ScopeName);
1953446Smrj         }
1963446Smrj     }
1973446Smrj #endif
1983446Smrj 
1993446Smrj     /*
2003446Smrj      * Search for name at this namespace level, which is to say that we
2013446Smrj      * must search for the name among the children of this object
2023446Smrj      */
2033446Smrj     Node = ParentNode->Child;
2043446Smrj     while (Node)
2053446Smrj     {
2063446Smrj         /* Check for match against the name */
2073446Smrj 
2083446Smrj         if (Node->Name.Integer == TargetName)
2093446Smrj         {
2103446Smrj             /* Resolve a control method alias if any */
2113446Smrj 
2123446Smrj             if (AcpiNsGetType (Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
2133446Smrj             {
2143446Smrj                 Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);
2153446Smrj             }
2163446Smrj 
2173446Smrj             /* Found matching entry */
2183446Smrj 
2193446Smrj             ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
2203446Smrj                 "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
2213446Smrj                 ACPI_CAST_PTR (char, &TargetName),
2223446Smrj                 AcpiUtGetTypeName (Node->Type),
2233446Smrj                 Node, AcpiUtGetNodeName (ParentNode), ParentNode));
2243446Smrj 
2253446Smrj             *ReturnNode = Node;
2263446Smrj             return_ACPI_STATUS (AE_OK);
2273446Smrj         }
2283446Smrj 
2293446Smrj         /*
2303446Smrj          * The last entry in the list points back to the parent,
2313446Smrj          * so a flag is used to indicate the end-of-list
2323446Smrj          */
2333446Smrj         if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
2343446Smrj         {
2353446Smrj             /* Searched entire list, we are done */
2363446Smrj 
2373446Smrj             break;
2383446Smrj         }
2393446Smrj 
2403446Smrj         /* Didn't match name, move on to the next peer object */
2413446Smrj 
2423446Smrj         Node = Node->Peer;
2433446Smrj     }
2443446Smrj 
2453446Smrj     /* Searched entire namespace level, not found */
2463446Smrj 
2473446Smrj     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
2483446Smrj         "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
2493446Smrj         ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type),
2503446Smrj         AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child));
2513446Smrj 
2523446Smrj     return_ACPI_STATUS (AE_NOT_FOUND);
2533446Smrj }
2543446Smrj 
2553446Smrj 
2563446Smrj /*******************************************************************************
2573446Smrj  *
2583446Smrj  * FUNCTION:    AcpiNsSearchParentTree
2593446Smrj  *
2603446Smrj  * PARAMETERS:  TargetName      - Ascii ACPI name to search for
2613446Smrj  *              Node            - Starting node where search will begin
2623446Smrj  *              Type            - Object type to match
2633446Smrj  *              ReturnNode      - Where the matched Node is returned
2643446Smrj  *
2653446Smrj  * RETURN:      Status
2663446Smrj  *
2673446Smrj  * DESCRIPTION: Called when a name has not been found in the current namespace
2683446Smrj  *              level. Before adding it or giving up, ACPI scope rules require
2693446Smrj  *              searching enclosing scopes in cases identified by AcpiNsLocal().
2703446Smrj  *
2713446Smrj  *              "A name is located by finding the matching name in the current
2723446Smrj  *              name space, and then in the parent name space. If the parent
2733446Smrj  *              name space does not contain the name, the search continues
2743446Smrj  *              recursively until either the name is found or the name space
2753446Smrj  *              does not have a parent (the root of the name space). This
2763446Smrj  *              indicates that the name is not found" (From ACPI Specification,
2773446Smrj  *              section 5.3)
2783446Smrj  *
2793446Smrj  ******************************************************************************/
2803446Smrj 
2813446Smrj static ACPI_STATUS
2823446Smrj AcpiNsSearchParentTree (
2833446Smrj     UINT32                  TargetName,
2843446Smrj     ACPI_NAMESPACE_NODE     *Node,
2853446Smrj     ACPI_OBJECT_TYPE        Type,
2863446Smrj     ACPI_NAMESPACE_NODE     **ReturnNode)
2873446Smrj {
2883446Smrj     ACPI_STATUS             Status;
2893446Smrj     ACPI_NAMESPACE_NODE     *ParentNode;
2903446Smrj 
2913446Smrj 
2923446Smrj     ACPI_FUNCTION_TRACE (NsSearchParentTree);
2933446Smrj 
2943446Smrj 
2953446Smrj     ParentNode = AcpiNsGetParentNode (Node);
2963446Smrj 
2973446Smrj     /*
2983446Smrj      * If there is no parent (i.e., we are at the root) or type is "local",
2993446Smrj      * we won't be searching the parent tree.
3003446Smrj      */
3013446Smrj     if (!ParentNode)
3023446Smrj     {
3033446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
3043446Smrj             ACPI_CAST_PTR (char, &TargetName)));
3053446Smrj         return_ACPI_STATUS (AE_NOT_FOUND);
3063446Smrj     }
3073446Smrj 
3083446Smrj     if (AcpiNsLocal (Type))
3093446Smrj     {
3103446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
3113446Smrj             "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
3123446Smrj             ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type)));
3133446Smrj         return_ACPI_STATUS (AE_NOT_FOUND);
3143446Smrj     }
3153446Smrj 
3163446Smrj     /* Search the parent tree */
3173446Smrj 
3183446Smrj     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
3193446Smrj         "Searching parent [%4.4s] for [%4.4s]\n",
3203446Smrj         AcpiUtGetNodeName (ParentNode), ACPI_CAST_PTR (char, &TargetName)));
3213446Smrj 
3223446Smrj     /*
3233446Smrj      * Search parents until target is found or we have backed up to the root
3243446Smrj      */
3253446Smrj     while (ParentNode)
3263446Smrj     {
3273446Smrj         /*
3283446Smrj          * Search parent scope. Use TYPE_ANY because we don't care about the
3293446Smrj          * object type at this point, we only care about the existence of
3303446Smrj          * the actual name we are searching for. Typechecking comes later.
3313446Smrj          */
3323446Smrj         Status = AcpiNsSearchOneScope (
3333446Smrj                     TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode);
3343446Smrj         if (ACPI_SUCCESS (Status))
3353446Smrj         {
3363446Smrj             return_ACPI_STATUS (Status);
3373446Smrj         }
3383446Smrj 
3393446Smrj         /* Not found here, go up another level (until we reach the root) */
3403446Smrj 
3413446Smrj         ParentNode = AcpiNsGetParentNode (ParentNode);
3423446Smrj     }
3433446Smrj 
3443446Smrj     /* Not found in parent tree */
3453446Smrj 
3463446Smrj     return_ACPI_STATUS (AE_NOT_FOUND);
3473446Smrj }
3483446Smrj 
3493446Smrj 
3503446Smrj /*******************************************************************************
3513446Smrj  *
3523446Smrj  * FUNCTION:    AcpiNsSearchAndEnter
3533446Smrj  *
3543446Smrj  * PARAMETERS:  TargetName          - Ascii ACPI name to search for (4 chars)
3553446Smrj  *              WalkState           - Current state of the walk
3563446Smrj  *              Node                - Starting node where search will begin
3573446Smrj  *              InterpreterMode     - Add names only in ACPI_MODE_LOAD_PASS_x.
3583446Smrj  *                                    Otherwise,search only.
3593446Smrj  *              Type                - Object type to match
3603446Smrj  *              Flags               - Flags describing the search restrictions
3613446Smrj  *              ReturnNode          - Where the Node is returned
3623446Smrj  *
3633446Smrj  * RETURN:      Status
3643446Smrj  *
3653446Smrj  * DESCRIPTION: Search for a name segment in a single namespace level,
3663446Smrj  *              optionally adding it if it is not found. If the passed
3673446Smrj  *              Type is not Any and the type previously stored in the
3683446Smrj  *              entry was Any (i.e. unknown), update the stored type.
3693446Smrj  *
3703446Smrj  *              In ACPI_IMODE_EXECUTE, search only.
3713446Smrj  *              In other modes, search and add if not found.
3723446Smrj  *
3733446Smrj  ******************************************************************************/
3743446Smrj 
3753446Smrj ACPI_STATUS
3763446Smrj AcpiNsSearchAndEnter (
3773446Smrj     UINT32                  TargetName,
3783446Smrj     ACPI_WALK_STATE         *WalkState,
3793446Smrj     ACPI_NAMESPACE_NODE     *Node,
3803446Smrj     ACPI_INTERPRETER_MODE   InterpreterMode,
3813446Smrj     ACPI_OBJECT_TYPE        Type,
3823446Smrj     UINT32                  Flags,
3833446Smrj     ACPI_NAMESPACE_NODE     **ReturnNode)
3843446Smrj {
3853446Smrj     ACPI_STATUS             Status;
3863446Smrj     ACPI_NAMESPACE_NODE     *NewNode;
3873446Smrj 
3883446Smrj 
3893446Smrj     ACPI_FUNCTION_TRACE (NsSearchAndEnter);
3903446Smrj 
3913446Smrj 
3923446Smrj     /* Parameter validation */
3933446Smrj 
3943446Smrj     if (!Node || !TargetName || !ReturnNode)
3953446Smrj     {
3963446Smrj         ACPI_ERROR ((AE_INFO,
3973446Smrj             "Null parameter: Node %p Name %X ReturnNode %p",
3983446Smrj             Node, TargetName, ReturnNode));
3993446Smrj         return_ACPI_STATUS (AE_BAD_PARAMETER);
4003446Smrj     }
4013446Smrj 
4023446Smrj     /*
4033446Smrj      * Name must consist of valid ACPI characters. We will repair the name if
4043446Smrj      * necessary because we don't want to abort because of this, but we want
4053446Smrj      * all namespace names to be printable. A warning message is appropriate.
4063446Smrj      *
4073446Smrj      * This issue came up because there are in fact machines that exhibit
4083446Smrj      * this problem, and we want to be able to enable ACPI support for them,
4093446Smrj      * even though there are a few bad names.
4103446Smrj      */
411*7851SDana.Myers@Sun.COM     AcpiUtRepairName (ACPI_CAST_PTR (char, &TargetName));
4123446Smrj 
4133446Smrj     /* Try to find the name in the namespace level specified by the caller */
4143446Smrj 
4153446Smrj     *ReturnNode = ACPI_ENTRY_NOT_FOUND;
4163446Smrj     Status = AcpiNsSearchOneScope (TargetName, Node, Type, ReturnNode);
4173446Smrj     if (Status != AE_NOT_FOUND)
4183446Smrj     {
4193446Smrj         /*
4203446Smrj          * If we found it AND the request specifies that a find is an error,
4213446Smrj          * return the error
4223446Smrj          */
4233446Smrj         if ((Status == AE_OK) &&
4243446Smrj             (Flags & ACPI_NS_ERROR_IF_FOUND))
4253446Smrj         {
4263446Smrj             Status = AE_ALREADY_EXISTS;
4273446Smrj         }
4283446Smrj 
4293446Smrj         /* Either found it or there was an error: finished either way */
4303446Smrj 
4313446Smrj         return_ACPI_STATUS (Status);
4323446Smrj     }
4333446Smrj 
4343446Smrj     /*
4353446Smrj      * The name was not found. If we are NOT performing the first pass
4363446Smrj      * (name entry) of loading the namespace, search the parent tree (all the
4373446Smrj      * way to the root if necessary.) We don't want to perform the parent
4383446Smrj      * search when the namespace is actually being loaded. We want to perform
4393446Smrj      * the search when namespace references are being resolved (load pass 2)
4403446Smrj      * and during the execution phase.
4413446Smrj      */
4423446Smrj     if ((InterpreterMode != ACPI_IMODE_LOAD_PASS1) &&
4433446Smrj         (Flags & ACPI_NS_SEARCH_PARENT))
4443446Smrj     {
4453446Smrj         /*
4463446Smrj          * Not found at this level - search parent tree according to the
4473446Smrj          * ACPI specification
4483446Smrj          */
4493446Smrj         Status = AcpiNsSearchParentTree (TargetName, Node, Type, ReturnNode);
4503446Smrj         if (ACPI_SUCCESS (Status))
4513446Smrj         {
4523446Smrj             return_ACPI_STATUS (Status);
4533446Smrj         }
4543446Smrj     }
4553446Smrj 
4563446Smrj     /* In execute mode, just search, never add names. Exit now */
4573446Smrj 
4583446Smrj     if (InterpreterMode == ACPI_IMODE_EXECUTE)
4593446Smrj     {
4603446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
4613446Smrj             "%4.4s Not found in %p [Not adding]\n",
4623446Smrj             ACPI_CAST_PTR (char, &TargetName), Node));
4633446Smrj 
4643446Smrj         return_ACPI_STATUS (AE_NOT_FOUND);
4653446Smrj     }
4663446Smrj 
4673446Smrj     /* Create the new named object */
4683446Smrj 
4693446Smrj     NewNode = AcpiNsCreateNode (TargetName);
4703446Smrj     if (!NewNode)
4713446Smrj     {
4723446Smrj         return_ACPI_STATUS (AE_NO_MEMORY);
4733446Smrj     }
4743446Smrj 
4753446Smrj #ifdef ACPI_ASL_COMPILER
4763446Smrj     /*
4773446Smrj      * Node is an object defined by an External() statement
4783446Smrj      */
4793446Smrj     if (Flags & ACPI_NS_EXTERNAL)
4803446Smrj     {
4813446Smrj         NewNode->Flags |= ANOBJ_IS_EXTERNAL;
4823446Smrj     }
4833446Smrj #endif
4843446Smrj 
485*7851SDana.Myers@Sun.COM     if (Flags & ACPI_NS_TEMPORARY)
486*7851SDana.Myers@Sun.COM     {
487*7851SDana.Myers@Sun.COM         NewNode->Flags |= ANOBJ_TEMPORARY;
488*7851SDana.Myers@Sun.COM     }
489*7851SDana.Myers@Sun.COM 
4903446Smrj     /* Install the new object into the parent's list of children */
4913446Smrj 
4923446Smrj     AcpiNsInstallNode (WalkState, Node, NewNode, Type);
4933446Smrj     *ReturnNode = NewNode;
4943446Smrj     return_ACPI_STATUS (AE_OK);
4953446Smrj }
4963446Smrj 
497