nssearch.c revision 83174
167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: nssearch - Namespace search
483174Smsmith *              $Revision: 74 $
567754Smsmith *
667754Smsmith ******************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1271867Smsmith * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
1370243Smsmith * All rights reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2767754Smsmith * Code in any form, with the right to sublicense such rights; and
2867754Smsmith *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3067754Smsmith * license (with the right to sublicense), under only those claims of Intel
3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3467754Smsmith * license, and in no event shall the patent license extend to any additions
3567754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3667754Smsmith * is granted directly or by implication, estoppel or otherwise;
3767754Smsmith *
3867754Smsmith * The above copyright and patent license is granted only if the following
3967754Smsmith * conditions are met:
4067754Smsmith *
4167754Smsmith * 3. Conditions
4267754Smsmith *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4467754Smsmith * Redistribution of source code of any substantial portion of the Covered
4567754Smsmith * Code or modification with rights to further distribute source must include
4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
5167754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5267754Smsmith * must include a prominent statement that the modification is derived,
5367754Smsmith * directly or indirectly, from Original Intel Code.
5467754Smsmith *
5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5667754Smsmith * Redistribution of source code of any substantial portion of the Covered
5767754Smsmith * Code or modification without rights to further distribute source must
5867754Smsmith * include the following Disclaimer and Export Compliance provision in the
5967754Smsmith * documentation and/or other materials provided with distribution.  In
6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6267754Smsmith * license from Licensee to its licensee is limited to the intellectual
6367754Smsmith * property embodied in the software Licensee provides to its licensee, and
6467754Smsmith * not to intellectual property embodied in modifications its licensee may
6567754Smsmith * make.
6667754Smsmith *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7067754Smsmith * provision in the documentation and/or other materials provided with the
7167754Smsmith * distribution.
7267754Smsmith *
7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7467754Smsmith * Intel Code.
7567754Smsmith *
7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7867754Smsmith * other dealings in products derived from or relating to the Covered Code
7967754Smsmith * without prior written authorization from Intel.
8067754Smsmith *
8167754Smsmith * 4. Disclaimer and Export Compliance
8267754Smsmith *
8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8467754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8967754Smsmith * PARTICULAR PURPOSE.
9067754Smsmith *
9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9867754Smsmith * LIMITED REMEDY.
9967754Smsmith *
10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10167754Smsmith * software or system incorporating such software without first obtaining any
10267754Smsmith * required license or other approval from the U. S. Department of Commerce or
10367754Smsmith * any other agency or department of the United States Government.  In the
10467754Smsmith * event Licensee exports any such software from the United States or
10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10667754Smsmith * ensure that the distribution and export/re-export of the software is in
10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11067754Smsmith * software, or service, directly or indirectly, to any country for which the
11167754Smsmith * United States government or any agency thereof requires an export license,
11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11367754Smsmith * such license, approval or letter.
11467754Smsmith *
11567754Smsmith *****************************************************************************/
11667754Smsmith
11767754Smsmith#define __NSSEARCH_C__
11867754Smsmith
11967754Smsmith#include "acpi.h"
12067754Smsmith#include "amlcode.h"
12167754Smsmith#include "acinterp.h"
12267754Smsmith#include "acnamesp.h"
12367754Smsmith
12467754Smsmith
12577424Smsmith#define _COMPONENT          ACPI_NAMESPACE
12667754Smsmith        MODULE_NAME         ("nssearch")
12767754Smsmith
12867754Smsmith
12967754Smsmith/*******************************************************************************
13067754Smsmith *
13167754Smsmith * FUNCTION:    AcpiNsSearchNode
13267754Smsmith *
13367754Smsmith * PARAMETERS:  *TargetName         - Ascii ACPI name to search for
13477424Smsmith *              *Node               - Starting table where search will begin
13567754Smsmith *              Type                - Object type to match
13677424Smsmith *              **ReturnNode        - Where the matched Named obj is returned
13767754Smsmith *
13867754Smsmith * RETURN:      Status
13967754Smsmith *
14067754Smsmith * DESCRIPTION: Search a single namespace table.  Performs a simple search,
14167754Smsmith *              does not add entries or search parents.
14267754Smsmith *
14367754Smsmith *
14467754Smsmith *      Named object lists are built (and subsequently dumped) in the
14567754Smsmith *      order in which the names are encountered during the namespace load;
14667754Smsmith *
14767754Smsmith *      All namespace searching is linear in this implementation, but
14867754Smsmith *      could be easily modified to support any improved search
14967754Smsmith *      algorithm.  However, the linear search was chosen for simplicity
15067754Smsmith *      and because the trees are small and the other interpreter
15167754Smsmith *      execution overhead is relatively high.
15267754Smsmith *
15367754Smsmith ******************************************************************************/
15467754Smsmith
15567754SmsmithACPI_STATUS
15667754SmsmithAcpiNsSearchNode (
15767754Smsmith    UINT32                  TargetName,
15867754Smsmith    ACPI_NAMESPACE_NODE     *Node,
15977424Smsmith    ACPI_OBJECT_TYPE8       Type,
16067754Smsmith    ACPI_NAMESPACE_NODE     **ReturnNode)
16167754Smsmith{
16267754Smsmith    ACPI_NAMESPACE_NODE     *NextNode;
16367754Smsmith
16467754Smsmith
16567754Smsmith    FUNCTION_TRACE ("NsSearchNode");
16667754Smsmith
16771867Smsmith
16871867Smsmith#ifdef ACPI_DEBUG
16982367Smsmith    if (ACPI_LV_NAMES & AcpiDbgLevel)
17067754Smsmith    {
17171867Smsmith        NATIVE_CHAR         *ScopeName;
17277424Smsmith
17371867Smsmith        ScopeName = AcpiNsGetTablePathname (Node);
17471867Smsmith        if (ScopeName)
17571867Smsmith        {
17682367Smsmith            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %X)\n",
17777424Smsmith                ScopeName, Node, &TargetName, Type));
17871867Smsmith
17980062Smsmith            ACPI_MEM_FREE (ScopeName);
18071867Smsmith        }
18167754Smsmith    }
18271867Smsmith#endif
18367754Smsmith
18467754Smsmith
18567754Smsmith    /*
18667754Smsmith     * Search for name in this table, which is to say that we must search
18767754Smsmith     * for the name among the children of this object
18867754Smsmith     */
18967754Smsmith    NextNode = Node->Child;
19067754Smsmith    while (NextNode)
19167754Smsmith    {
19267754Smsmith        /* Check for match against the name */
19367754Smsmith
19467754Smsmith        if (NextNode->Name == TargetName)
19567754Smsmith        {
19667754Smsmith            /*
19777424Smsmith             * Found matching entry.  Capture the type if appropriate, before
19877424Smsmith             * returning the entry.
19977424Smsmith             *
20077424Smsmith             * The DefFieldDefn and BankFieldDefn cases are actually looking up
20177424Smsmith             * the Region in which the field will be defined
20267754Smsmith             */
20377424Smsmith            if ((INTERNAL_TYPE_FIELD_DEFN == Type) ||
20467754Smsmith                (INTERNAL_TYPE_BANK_FIELD_DEFN == Type))
20567754Smsmith            {
20667754Smsmith                Type = ACPI_TYPE_REGION;
20767754Smsmith            }
20867754Smsmith
20967754Smsmith            /*
21077424Smsmith             * Scope, DefAny, and IndexFieldDefn are bogus "types" which do not
21177424Smsmith             * actually have anything to do with the type of the name being
21277424Smsmith             * looked up.  For any other value of Type, if the type stored in
21377424Smsmith             * the entry is Any (i.e. unknown), save the actual type.
21467754Smsmith             */
21567754Smsmith            if (Type != INTERNAL_TYPE_SCOPE &&
21667754Smsmith                Type != INTERNAL_TYPE_DEF_ANY &&
21767754Smsmith                Type != INTERNAL_TYPE_INDEX_FIELD_DEFN &&
21867754Smsmith                NextNode->Type == ACPI_TYPE_ANY)
21967754Smsmith            {
22067754Smsmith                NextNode->Type = (UINT8) Type;
22167754Smsmith            }
22267754Smsmith
22383174Smsmith            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
22482367Smsmith                "Name %4.4s (actual type %X) found at %p\n",
22567754Smsmith                &TargetName, NextNode->Type, NextNode));
22667754Smsmith
22767754Smsmith            *ReturnNode = NextNode;
22867754Smsmith            return_ACPI_STATUS (AE_OK);
22967754Smsmith        }
23067754Smsmith
23167754Smsmith
23267754Smsmith        /*
23367754Smsmith         * The last entry in the list points back to the parent,
23467754Smsmith         * so a flag is used to indicate the end-of-list
23567754Smsmith         */
23667754Smsmith        if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
23767754Smsmith        {
23867754Smsmith            /* Searched entire list, we are done */
23967754Smsmith
24067754Smsmith            break;
24167754Smsmith        }
24267754Smsmith
24367754Smsmith        /* Didn't match name, move on to the next peer object */
24467754Smsmith
24567754Smsmith        NextNode = NextNode->Peer;
24667754Smsmith    }
24767754Smsmith
24867754Smsmith
24967754Smsmith    /* Searched entire table, not found */
25067754Smsmith
25182367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (type %X) not found at %p\n",
25267754Smsmith        &TargetName, Type, NextNode));
25367754Smsmith
25467754Smsmith    return_ACPI_STATUS (AE_NOT_FOUND);
25567754Smsmith}
25667754Smsmith
25767754Smsmith
25867754Smsmith/*******************************************************************************
25967754Smsmith *
26067754Smsmith * FUNCTION:    AcpiNsSearchParentTree
26167754Smsmith *
26267754Smsmith * PARAMETERS:  *TargetName         - Ascii ACPI name to search for
26377424Smsmith *              *Node               - Starting table where search will begin
26467754Smsmith *              Type                - Object type to match
26577424Smsmith *              **ReturnNode        - Where the matched Named Obj is returned
26667754Smsmith *
26767754Smsmith * RETURN:      Status
26867754Smsmith *
26967754Smsmith * DESCRIPTION: Called when a name has not been found in the current namespace
27067754Smsmith *              table.  Before adding it or giving up, ACPI scope rules require
27167754Smsmith *              searching enclosing scopes in cases identified by AcpiNsLocal().
27267754Smsmith *
27367754Smsmith *              "A name is located by finding the matching name in the current
27467754Smsmith *              name space, and then in the parent name space. If the parent
27567754Smsmith *              name space does not contain the name, the search continues
27667754Smsmith *              recursively until either the name is found or the name space
27767754Smsmith *              does not have a parent (the root of the name space).  This
27867754Smsmith *              indicates that the name is not found" (From ACPI Specification,
27967754Smsmith *              section 5.3)
28067754Smsmith *
28167754Smsmith ******************************************************************************/
28267754Smsmith
28369450Smsmithstatic ACPI_STATUS
28467754SmsmithAcpiNsSearchParentTree (
28567754Smsmith    UINT32                  TargetName,
28667754Smsmith    ACPI_NAMESPACE_NODE     *Node,
28777424Smsmith    ACPI_OBJECT_TYPE8       Type,
28867754Smsmith    ACPI_NAMESPACE_NODE     **ReturnNode)
28967754Smsmith{
29067754Smsmith    ACPI_STATUS             Status;
29167754Smsmith    ACPI_NAMESPACE_NODE     *ParentNode;
29267754Smsmith
29367754Smsmith
29467754Smsmith    FUNCTION_TRACE ("NsSearchParentTree");
29567754Smsmith
29667754Smsmith
29767754Smsmith    ParentNode = AcpiNsGetParentObject (Node);
29867754Smsmith
29967754Smsmith    /*
30067754Smsmith     * If there is no parent (at the root) or type is "local", we won't be
30167754Smsmith     * searching the parent tree.
30267754Smsmith     */
30377424Smsmith    if ((AcpiNsLocal (Type)) ||
30467754Smsmith        (!ParentNode))
30567754Smsmith    {
30667754Smsmith        if (!ParentNode)
30767754Smsmith        {
30882367Smsmith            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
30967754Smsmith                &TargetName));
31067754Smsmith        }
31167754Smsmith
31267754Smsmith        if (AcpiNsLocal (Type))
31367754Smsmith        {
31483174Smsmith            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type %X is local(no search)\n",
31567754Smsmith                &TargetName, Type));
31667754Smsmith        }
31767754Smsmith
31867754Smsmith        return_ACPI_STATUS (AE_NOT_FOUND);
31967754Smsmith    }
32067754Smsmith
32167754Smsmith
32267754Smsmith    /* Search the parent tree */
32367754Smsmith
32482367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", &TargetName));
32567754Smsmith
32667754Smsmith    /*
32767754Smsmith     * Search parents until found the target or we have backed up to
32867754Smsmith     * the root
32967754Smsmith     */
33067754Smsmith    while (ParentNode)
33167754Smsmith    {
33267754Smsmith        /* Search parent scope */
33367754Smsmith        /* TBD: [Investigate] Why ACPI_TYPE_ANY? */
33467754Smsmith
33567754Smsmith        Status = AcpiNsSearchNode (TargetName, ParentNode,
33667754Smsmith                                        ACPI_TYPE_ANY, ReturnNode);
33767754Smsmith
33867754Smsmith        if (ACPI_SUCCESS (Status))
33967754Smsmith        {
34067754Smsmith            return_ACPI_STATUS (Status);
34167754Smsmith        }
34267754Smsmith
34367754Smsmith        /*
34467754Smsmith         * Not found here, go up another level
34567754Smsmith         * (until we reach the root)
34667754Smsmith         */
34767754Smsmith        ParentNode = AcpiNsGetParentObject (ParentNode);
34867754Smsmith    }
34967754Smsmith
35067754Smsmith
35167754Smsmith    /* Not found in parent tree */
35267754Smsmith
35367754Smsmith    return_ACPI_STATUS (AE_NOT_FOUND);
35467754Smsmith}
35567754Smsmith
35667754Smsmith
35767754Smsmith/*******************************************************************************
35867754Smsmith *
35967754Smsmith * FUNCTION:    AcpiNsSearchAndEnter
36067754Smsmith *
36167754Smsmith * PARAMETERS:  TargetName          - Ascii ACPI name to search for (4 chars)
36267754Smsmith *              WalkState           - Current state of the walk
36377424Smsmith *              *Node               - Starting table where search will begin
36467754Smsmith *              InterpreterMode     - Add names only in MODE_LoadPassX.
36567754Smsmith *                                    Otherwise,search only.
36667754Smsmith *              Type                - Object type to match
36767754Smsmith *              Flags               - Flags describing the search restrictions
36877424Smsmith *              **ReturnNode        - Where the Node is returned
36967754Smsmith *
37067754Smsmith * RETURN:      Status
37167754Smsmith *
37267754Smsmith * DESCRIPTION: Search for a name segment in a single name table,
37367754Smsmith *              optionally adding it if it is not found.  If the passed
37467754Smsmith *              Type is not Any and the type previously stored in the
37567754Smsmith *              entry was Any (i.e. unknown), update the stored type.
37667754Smsmith *
37767754Smsmith *              In IMODE_EXECUTE, search only.
37867754Smsmith *              In other modes, search and add if not found.
37967754Smsmith *
38067754Smsmith ******************************************************************************/
38167754Smsmith
38267754SmsmithACPI_STATUS
38367754SmsmithAcpiNsSearchAndEnter (
38467754Smsmith    UINT32                  TargetName,
38567754Smsmith    ACPI_WALK_STATE         *WalkState,
38667754Smsmith    ACPI_NAMESPACE_NODE     *Node,
38767754Smsmith    OPERATING_MODE          InterpreterMode,
38877424Smsmith    ACPI_OBJECT_TYPE8       Type,
38967754Smsmith    UINT32                  Flags,
39067754Smsmith    ACPI_NAMESPACE_NODE     **ReturnNode)
39167754Smsmith{
39267754Smsmith    ACPI_STATUS             Status;
39367754Smsmith    ACPI_NAMESPACE_NODE     *NewNode;
39467754Smsmith
39567754Smsmith
39667754Smsmith    FUNCTION_TRACE ("NsSearchAndEnter");
39767754Smsmith
39867754Smsmith
39967754Smsmith    /* Parameter validation */
40067754Smsmith
40167754Smsmith    if (!Node || !TargetName || !ReturnNode)
40267754Smsmith    {
40382367Smsmith        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param-  Table %p Name %p Return %p\n",
40467754Smsmith            Node, TargetName, ReturnNode));
40567754Smsmith
40667754Smsmith        REPORT_ERROR (("NsSearchAndEnter: bad (null) parameter\n"));
40767754Smsmith        return_ACPI_STATUS (AE_BAD_PARAMETER);
40867754Smsmith    }
40967754Smsmith
41067754Smsmith
41167754Smsmith    /* Name must consist of printable characters */
41267754Smsmith
41377424Smsmith    if (!AcpiUtValidAcpiName (TargetName))
41467754Smsmith    {
41582367Smsmith        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08lx *** \n",
41667754Smsmith            TargetName));
41767754Smsmith
41867754Smsmith        REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name\n"));
41967754Smsmith        return_ACPI_STATUS (AE_BAD_CHARACTER);
42067754Smsmith    }
42167754Smsmith
42267754Smsmith
42367754Smsmith    /* Try to find the name in the table specified by the caller */
42467754Smsmith
42567754Smsmith    *ReturnNode = ENTRY_NOT_FOUND;
42677424Smsmith    Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode);
42767754Smsmith    if (Status != AE_NOT_FOUND)
42867754Smsmith    {
42967754Smsmith        /*
43077424Smsmith         * If we found it AND the request specifies that a find is an error,
43177424Smsmith         * return the error
43271867Smsmith         */
43371867Smsmith        if ((Status == AE_OK) &&
43471867Smsmith            (Flags & NS_ERROR_IF_FOUND))
43571867Smsmith        {
43671867Smsmith            Status = AE_EXIST;
43771867Smsmith        }
43871867Smsmith
43971867Smsmith        /*
44067754Smsmith         * Either found it or there was an error
44167754Smsmith         * -- finished either way
44267754Smsmith         */
44367754Smsmith        return_ACPI_STATUS (Status);
44467754Smsmith    }
44567754Smsmith
44667754Smsmith
44767754Smsmith    /*
44867754Smsmith     * Not found in the table.  If we are NOT performing the
44967754Smsmith     * first pass (name entry) of loading the namespace, search
45067754Smsmith     * the parent tree (all the way to the root if necessary.)
45167754Smsmith     * We don't want to perform the parent search when the
45267754Smsmith     * namespace is actually being loaded.  We want to perform
45367754Smsmith     * the search when namespace references are being resolved
45467754Smsmith     * (load pass 2) and during the execution phase.
45567754Smsmith     */
45667754Smsmith    if ((InterpreterMode != IMODE_LOAD_PASS1) &&
45767754Smsmith        (Flags & NS_SEARCH_PARENT))
45867754Smsmith    {
45967754Smsmith        /*
46067754Smsmith         * Not found in table - search parent tree according
46167754Smsmith         * to ACPI specification
46267754Smsmith         */
46367754Smsmith        Status = AcpiNsSearchParentTree (TargetName, Node,
46467754Smsmith                                            Type, ReturnNode);
46567754Smsmith        if (ACPI_SUCCESS (Status))
46667754Smsmith        {
46767754Smsmith            return_ACPI_STATUS (Status);
46867754Smsmith        }
46967754Smsmith    }
47067754Smsmith
47167754Smsmith
47267754Smsmith    /*
47367754Smsmith     * In execute mode, just search, never add names.  Exit now.
47467754Smsmith     */
47567754Smsmith    if (InterpreterMode == IMODE_EXECUTE)
47667754Smsmith    {
47782367Smsmith        ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
47867754Smsmith            &TargetName, Node));
47967754Smsmith
48067754Smsmith        return_ACPI_STATUS (AE_NOT_FOUND);
48167754Smsmith    }
48267754Smsmith
48367754Smsmith
48467754Smsmith    /* Create the new named object */
48567754Smsmith
48667754Smsmith    NewNode = AcpiNsCreateNode (TargetName);
48767754Smsmith    if (!NewNode)
48867754Smsmith    {
48967754Smsmith        return_ACPI_STATUS (AE_NO_MEMORY);
49067754Smsmith    }
49167754Smsmith
49267754Smsmith    /* Install the new object into the parent's list of children */
49367754Smsmith
49467754Smsmith    AcpiNsInstallNode (WalkState, Node, NewNode, Type);
49567754Smsmith    *ReturnNode = NewNode;
49667754Smsmith
49767754Smsmith    return_ACPI_STATUS (AE_OK);
49867754Smsmith}
49967754Smsmith
500