nssearch.c revision 117521
1246149Ssjg/*******************************************************************************
2246149Ssjg *
3246149Ssjg * Module Name: nssearch - Namespace search
4246149Ssjg *              $Revision: 97 $
5246149Ssjg *
6246149Ssjg ******************************************************************************/
7246149Ssjg
8246149Ssjg/******************************************************************************
9246149Ssjg *
10246149Ssjg * 1. Copyright Notice
11246149Ssjg *
12246149Ssjg * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13246149Ssjg * All rights reserved.
14246149Ssjg *
15246149Ssjg * 2. License
16246149Ssjg *
17246149Ssjg * 2.1. This is your license from Intel Corp. under its intellectual property
18246149Ssjg * rights.  You may have additional license terms from the party that provided
19246149Ssjg * you this software, covering your right to use that party's intellectual
20246149Ssjg * property rights.
21246149Ssjg *
22246149Ssjg * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23246149Ssjg * copy of the source code appearing in this file ("Covered Code") an
24246149Ssjg * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25246149Ssjg * base code distributed originally by Intel ("Original Intel Code") to copy,
26246149Ssjg * make derivatives, distribute, use and display any portion of the Covered
27246149Ssjg * Code in any form, with the right to sublicense such rights; and
28246149Ssjg *
29246149Ssjg * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30246149Ssjg * license (with the right to sublicense), under only those claims of Intel
31246149Ssjg * patents that are infringed by the Original Intel Code, to make, use, sell,
32246149Ssjg * offer to sell, and import the Covered Code and derivative works thereof
33246149Ssjg * solely to the minimum extent necessary to exercise the above copyright
34246149Ssjg * license, and in no event shall the patent license extend to any additions
35246149Ssjg * to or modifications of the Original Intel Code.  No other license or right
36246149Ssjg * is granted directly or by implication, estoppel or otherwise;
37246149Ssjg *
38249033Ssjg * The above copyright and patent license is granted only if the following
39246149Ssjg * conditions are met:
40249033Ssjg *
41249033Ssjg * 3. Conditions
42246149Ssjg *
43246149Ssjg * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44246149Ssjg * Redistribution of source code of any substantial portion of the Covered
45246149Ssjg * Code or modification with rights to further distribute source must include
46246149Ssjg * the above Copyright Notice, the above License, this list of Conditions,
47246149Ssjg * and the following Disclaimer and Export Compliance provision.  In addition,
48246149Ssjg * Licensee must cause all Covered Code to which Licensee contributes to
49246149Ssjg * contain a file documenting the changes Licensee made to create that Covered
50246149Ssjg * Code and the date of any change.  Licensee must include in that file the
51246149Ssjg * documentation of any changes made by any predecessor Licensee.  Licensee
52246149Ssjg * must include a prominent statement that the modification is derived,
53246149Ssjg * directly or indirectly, from Original Intel Code.
54246149Ssjg *
55246149Ssjg * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56246149Ssjg * Redistribution of source code of any substantial portion of the Covered
57246149Ssjg * Code or modification without rights to further distribute source must
58246149Ssjg * include the following Disclaimer and Export Compliance provision in the
59246149Ssjg * documentation and/or other materials provided with distribution.  In
60246149Ssjg * addition, Licensee may not authorize further sublicense of source of any
61246149Ssjg * portion of the Covered Code, and must include terms to the effect that the
62246149Ssjg * license from Licensee to its licensee is limited to the intellectual
63246149Ssjg * property embodied in the software Licensee provides to its licensee, and
64246149Ssjg * not to intellectual property embodied in modifications its licensee may
65246149Ssjg * make.
66246149Ssjg *
67246149Ssjg * 3.3. Redistribution of Executable. Redistribution in executable form of any
68246149Ssjg * substantial portion of the Covered Code or modification must reproduce the
69246149Ssjg * above Copyright Notice, and the following Disclaimer and Export Compliance
70246149Ssjg * provision in the documentation and/or other materials provided with the
71246149Ssjg * distribution.
72246149Ssjg *
73246149Ssjg * 3.4. Intel retains all right, title, and interest in and to the Original
74246149Ssjg * Intel Code.
75246149Ssjg *
76246149Ssjg * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77246149Ssjg * Intel shall be used in advertising or otherwise to promote the sale, use or
78246149Ssjg * other dealings in products derived from or relating to the Covered Code
79246149Ssjg * without prior written authorization from Intel.
80246149Ssjg *
81246149Ssjg * 4. Disclaimer and Export Compliance
82246149Ssjg *
83246149Ssjg * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84246149Ssjg * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85246149Ssjg * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86246149Ssjg * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87246149Ssjg * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88246149Ssjg * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89246149Ssjg * PARTICULAR PURPOSE.
90246149Ssjg *
91246149Ssjg * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92246149Ssjg * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93246149Ssjg * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94246149Ssjg * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95246149Ssjg * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96246149Ssjg * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97246149Ssjg * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98246149Ssjg * LIMITED REMEDY.
99246149Ssjg *
100246149Ssjg * 4.3. Licensee shall not export, either directly or indirectly, any of this
101246149Ssjg * software or system incorporating such software without first obtaining any
102246149Ssjg * required license or other approval from the U. S. Department of Commerce or
103246149Ssjg * any other agency or department of the United States Government.  In the
104246149Ssjg * event Licensee exports any such software from the United States or
105246149Ssjg * re-exports any such software from a foreign destination, Licensee shall
106246149Ssjg * ensure that the distribution and export/re-export of the software is in
107246149Ssjg * compliance with all laws, regulations, orders, or other restrictions of the
108246149Ssjg * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109246149Ssjg * any of its subsidiaries will export/re-export any technical data, process,
110246149Ssjg * software, or service, directly or indirectly, to any country for which the
111246149Ssjg * United States government or any agency thereof requires an export license,
112246149Ssjg * other governmental approval, or letter of assurance, without first obtaining
113246149Ssjg * such license, approval or letter.
114246149Ssjg *
115246149Ssjg *****************************************************************************/
116246149Ssjg
117246149Ssjg#define __NSSEARCH_C__
118246149Ssjg
119246149Ssjg#include "acpi.h"
120246149Ssjg#include "acnamesp.h"
121246149Ssjg
122246149Ssjg
123246149Ssjg#define _COMPONENT          ACPI_NAMESPACE
124246149Ssjg        ACPI_MODULE_NAME    ("nssearch")
125246149Ssjg
126246149Ssjg
127246149Ssjg/*******************************************************************************
128246149Ssjg *
129246149Ssjg * FUNCTION:    AcpiNsSearchNode
130246149Ssjg *
131246149Ssjg * PARAMETERS:  *TargetName         - Ascii ACPI name to search for
132246149Ssjg *              *Node               - Starting node where search will begin
133246149Ssjg *              Type                - Object type to match
134246149Ssjg *              **ReturnNode        - Where the matched Named obj is returned
135246149Ssjg *
136246149Ssjg * RETURN:      Status
137246149Ssjg *
138246149Ssjg * DESCRIPTION: Search a single level of the namespace.  Performs a
139246149Ssjg *              simple search of the specified level, and does not add
140246149Ssjg *              entries or search parents.
141246149Ssjg *
142246149Ssjg *
143246149Ssjg *      Named object lists are built (and subsequently dumped) in the
144246149Ssjg *      order in which the names are encountered during the namespace load;
145246149Ssjg *
146246149Ssjg *      All namespace searching is linear in this implementation, but
147246149Ssjg *      could be easily modified to support any improved search
148246149Ssjg *      algorithm.  However, the linear search was chosen for simplicity
149246149Ssjg *      and because the trees are small and the other interpreter
150246149Ssjg *      execution overhead is relatively high.
151246149Ssjg *
152246149Ssjg ******************************************************************************/
153249033Ssjg
154246149SsjgACPI_STATUS
155246149SsjgAcpiNsSearchNode (
156246149Ssjg    UINT32                  TargetName,
157246149Ssjg    ACPI_NAMESPACE_NODE     *Node,
158246149Ssjg    ACPI_OBJECT_TYPE        Type,
159246149Ssjg    ACPI_NAMESPACE_NODE     **ReturnNode)
160246149Ssjg{
161246149Ssjg    ACPI_NAMESPACE_NODE     *NextNode;
162246149Ssjg
163246149Ssjg
164246149Ssjg    ACPI_FUNCTION_TRACE ("NsSearchNode");
165246149Ssjg
166246149Ssjg
167246149Ssjg#ifdef ACPI_DEBUG_OUTPUT
168246149Ssjg    if (ACPI_LV_NAMES & AcpiDbgLevel)
169246149Ssjg    {
170246149Ssjg        char                *ScopeName;
171246149Ssjg
172246149Ssjg        ScopeName = AcpiNsGetExternalPathname (Node);
173246149Ssjg        if (ScopeName)
174246149Ssjg        {
175246149Ssjg            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (%s)\n",
176246149Ssjg                ScopeName, Node, (char *) &TargetName, AcpiUtGetTypeName (Type)));
177246149Ssjg
178246149Ssjg            ACPI_MEM_FREE (ScopeName);
179249033Ssjg        }
180249033Ssjg    }
181249033Ssjg#endif
182249033Ssjg
183249033Ssjg    /*
184246149Ssjg     * Search for name at this namespace level, which is to say that we
185246149Ssjg     * must search for the name among the children of this object
186246149Ssjg     */
187246149Ssjg    NextNode = Node->Child;
188246149Ssjg    while (NextNode)
189246149Ssjg    {
190246149Ssjg        /* Check for match against the name */
191246149Ssjg
192246149Ssjg        if (NextNode->Name.Integer == TargetName)
193246149Ssjg        {
194246149Ssjg            /*
195246149Ssjg             * Found matching entry.
196246149Ssjg             */
197246149Ssjg            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
198246149Ssjg                "Name %4.4s Type [%s] found in scope [%4.4s] %p\n",
199249033Ssjg                (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type),
200249033Ssjg                NextNode->Name.Ascii, NextNode));
201249033Ssjg
202249033Ssjg            *ReturnNode = NextNode;
203249033Ssjg            return_ACPI_STATUS (AE_OK);
204249033Ssjg        }
205249033Ssjg
206249033Ssjg        /*
207249033Ssjg         * The last entry in the list points back to the parent,
208249033Ssjg         * so a flag is used to indicate the end-of-list
209249033Ssjg         */
210246149Ssjg        if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
211249033Ssjg        {
212249033Ssjg            /* Searched entire list, we are done */
213249033Ssjg
214249033Ssjg            break;
215249033Ssjg        }
216249033Ssjg
217246149Ssjg        /* Didn't match name, move on to the next peer object */
218246149Ssjg
219246149Ssjg        NextNode = NextNode->Peer;
220246149Ssjg    }
221246149Ssjg
222246149Ssjg    /* Searched entire namespace level, not found */
223246149Ssjg
224246149Ssjg    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
225249033Ssjg        "Name %4.4s Type [%s] not found in search in scope [%4.4s] %p first child %p\n",
226249033Ssjg        (char *) &TargetName, AcpiUtGetTypeName (Type),
227249033Ssjg        Node->Name.Ascii, Node, Node->Child));
228249033Ssjg
229246149Ssjg    return_ACPI_STATUS (AE_NOT_FOUND);
230246149Ssjg}
231246149Ssjg
232246149Ssjg
233246149Ssjg/*******************************************************************************
234246149Ssjg *
235246149Ssjg * FUNCTION:    AcpiNsSearchParentTree
236246149Ssjg *
237246149Ssjg * PARAMETERS:  *TargetName         - Ascii ACPI name to search for
238246149Ssjg *              *Node               - Starting node where search will begin
239246149Ssjg *              Type                - Object type to match
240246149Ssjg *              **ReturnNode        - Where the matched Named Obj is returned
241246149Ssjg *
242246149Ssjg * RETURN:      Status
243246149Ssjg *
244246149Ssjg * DESCRIPTION: Called when a name has not been found in the current namespace
245246149Ssjg *              level.  Before adding it or giving up, ACPI scope rules require
246246149Ssjg *              searching enclosing scopes in cases identified by AcpiNsLocal().
247246149Ssjg *
248249033Ssjg *              "A name is located by finding the matching name in the current
249249033Ssjg *              name space, and then in the parent name space. If the parent
250246149Ssjg *              name space does not contain the name, the search continues
251246149Ssjg *              recursively until either the name is found or the name space
252246149Ssjg *              does not have a parent (the root of the name space).  This
253246149Ssjg *              indicates that the name is not found" (From ACPI Specification,
254246149Ssjg *              section 5.3)
255246149Ssjg *
256246149Ssjg ******************************************************************************/
257246149Ssjg
258246149Ssjgstatic ACPI_STATUS
259246149SsjgAcpiNsSearchParentTree (
260246149Ssjg    UINT32                  TargetName,
261246149Ssjg    ACPI_NAMESPACE_NODE     *Node,
262246149Ssjg    ACPI_OBJECT_TYPE        Type,
263246149Ssjg    ACPI_NAMESPACE_NODE     **ReturnNode)
264246149Ssjg{
265246149Ssjg    ACPI_STATUS             Status;
266246149Ssjg    ACPI_NAMESPACE_NODE     *ParentNode;
267246149Ssjg
268246149Ssjg
269246149Ssjg    ACPI_FUNCTION_TRACE ("NsSearchParentTree");
270246149Ssjg
271246149Ssjg
272246149Ssjg    ParentNode = AcpiNsGetParentNode (Node);
273246149Ssjg
274246149Ssjg    /*
275246149Ssjg     * If there is no parent (i.e., we are at the root) or
276246149Ssjg     * type is "local", we won't be searching the parent tree.
277246149Ssjg     */
278246149Ssjg    if (!ParentNode)
279246149Ssjg    {
280246149Ssjg        ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
281246149Ssjg            (char *) &TargetName));
282246149Ssjg         return_ACPI_STATUS (AE_NOT_FOUND);
283246149Ssjg    }
284246149Ssjg
285246149Ssjg    if (AcpiNsLocal (Type))
286246149Ssjg    {
287246149Ssjg        ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
288246149Ssjg            "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
289246149Ssjg            (char *) &TargetName, AcpiUtGetTypeName (Type)));
290246149Ssjg        return_ACPI_STATUS (AE_NOT_FOUND);
291246149Ssjg    }
292246149Ssjg
293246149Ssjg    /* Search the parent tree */
294246149Ssjg
295246149Ssjg    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char *) &TargetName));
296246149Ssjg
297246149Ssjg    /*
298246149Ssjg     * Search parents until found the target or we have backed up to
299246149Ssjg     * the root
300246149Ssjg     */
301246149Ssjg    while (ParentNode)
302246149Ssjg    {
303246149Ssjg        /*
304246149Ssjg         * Search parent scope.  Use TYPE_ANY because we don't care about the
305246149Ssjg         * object type at this point, we only care about the existence of
306246149Ssjg         * the actual name we are searching for.  Typechecking comes later.
307246149Ssjg         */
308246149Ssjg        Status = AcpiNsSearchNode (TargetName, ParentNode,
309246149Ssjg                                        ACPI_TYPE_ANY, ReturnNode);
310246149Ssjg        if (ACPI_SUCCESS (Status))
311246149Ssjg        {
312246149Ssjg            return_ACPI_STATUS (Status);
313246149Ssjg        }
314246149Ssjg
315246149Ssjg        /*
316246149Ssjg         * Not found here, go up another level
317246149Ssjg         * (until we reach the root)
318246149Ssjg         */
319246149Ssjg        ParentNode = AcpiNsGetParentNode (ParentNode);
320246149Ssjg    }
321246149Ssjg
322246149Ssjg    /* Not found in parent tree */
323246149Ssjg
324246149Ssjg    return_ACPI_STATUS (AE_NOT_FOUND);
325246149Ssjg}
326246149Ssjg
327246149Ssjg
328246149Ssjg/*******************************************************************************
329246149Ssjg *
330246149Ssjg * FUNCTION:    AcpiNsSearchAndEnter
331246149Ssjg *
332246149Ssjg * PARAMETERS:  TargetName          - Ascii ACPI name to search for (4 chars)
333246149Ssjg *              WalkState           - Current state of the walk
334246149Ssjg *              *Node               - Starting node where search will begin
335246149Ssjg *              InterpreterMode     - Add names only in ACPI_MODE_LOAD_PASS_x.
336246149Ssjg *                                    Otherwise,search only.
337246149Ssjg *              Type                - Object type to match
338246149Ssjg *              Flags               - Flags describing the search restrictions
339246149Ssjg *              **ReturnNode        - Where the Node is returned
340246149Ssjg *
341246149Ssjg * RETURN:      Status
342246149Ssjg *
343246149Ssjg * DESCRIPTION: Search for a name segment in a single namespace level,
344246149Ssjg *              optionally adding it if it is not found.  If the passed
345246149Ssjg *              Type is not Any and the type previously stored in the
346246149Ssjg *              entry was Any (i.e. unknown), update the stored type.
347246149Ssjg *
348246149Ssjg *              In ACPI_IMODE_EXECUTE, search only.
349246149Ssjg *              In other modes, search and add if not found.
350246149Ssjg *
351246149Ssjg ******************************************************************************/
352246149Ssjg
353246149SsjgACPI_STATUS
354246149SsjgAcpiNsSearchAndEnter (
355246149Ssjg    UINT32                  TargetName,
356246149Ssjg    ACPI_WALK_STATE         *WalkState,
357246149Ssjg    ACPI_NAMESPACE_NODE     *Node,
358246149Ssjg    ACPI_INTERPRETER_MODE   InterpreterMode,
359246149Ssjg    ACPI_OBJECT_TYPE        Type,
360246149Ssjg    UINT32                  Flags,
361246149Ssjg    ACPI_NAMESPACE_NODE     **ReturnNode)
362246149Ssjg{
363246149Ssjg    ACPI_STATUS             Status;
364246149Ssjg    ACPI_NAMESPACE_NODE     *NewNode;
365246149Ssjg
366246149Ssjg
367246149Ssjg    ACPI_FUNCTION_TRACE ("NsSearchAndEnter");
368246149Ssjg
369246149Ssjg
370246149Ssjg    /* Parameter validation */
371246149Ssjg
372246149Ssjg    if (!Node || !TargetName || !ReturnNode)
373246149Ssjg    {
374246149Ssjg        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param: Node %p Name %X ReturnNode %p\n",
375246149Ssjg            Node, TargetName, ReturnNode));
376246149Ssjg
377246149Ssjg        ACPI_REPORT_ERROR (("NsSearchAndEnter: Null parameter\n"));
378246149Ssjg        return_ACPI_STATUS (AE_BAD_PARAMETER);
379246149Ssjg    }
380246149Ssjg
381246149Ssjg    /* Name must consist of printable characters */
382246149Ssjg
383246149Ssjg    if (!AcpiUtValidAcpiName (TargetName))
384246149Ssjg    {
385246149Ssjg        ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name: %X\n",
386246149Ssjg            TargetName));
387246149Ssjg        return_ACPI_STATUS (AE_BAD_CHARACTER);
388246149Ssjg    }
389246149Ssjg
390246149Ssjg    /* Try to find the name in the namespace level specified by the caller */
391246149Ssjg
392246149Ssjg    *ReturnNode = ACPI_ENTRY_NOT_FOUND;
393246149Ssjg    Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode);
394246149Ssjg    if (Status != AE_NOT_FOUND)
395246149Ssjg    {
396246149Ssjg        /*
397246149Ssjg         * If we found it AND the request specifies that a find is an error,
398246149Ssjg         * return the error
399246149Ssjg         */
400246149Ssjg        if ((Status == AE_OK) &&
401246149Ssjg            (Flags & ACPI_NS_ERROR_IF_FOUND))
402246149Ssjg        {
403246149Ssjg            Status = AE_ALREADY_EXISTS;
404246149Ssjg        }
405246149Ssjg
406246149Ssjg        /*
407246149Ssjg         * Either found it or there was an error
408246149Ssjg         * -- finished either way
409246149Ssjg         */
410246149Ssjg        return_ACPI_STATUS (Status);
411246149Ssjg    }
412246149Ssjg
413246149Ssjg    /*
414246149Ssjg     * The name was not found.  If we are NOT performing the
415246149Ssjg     * first pass (name entry) of loading the namespace, search
416246149Ssjg     * the parent tree (all the way to the root if necessary.)
417246149Ssjg     * We don't want to perform the parent search when the
418246149Ssjg     * namespace is actually being loaded.  We want to perform
419246149Ssjg     * the search when namespace references are being resolved
420246149Ssjg     * (load pass 2) and during the execution phase.
421246149Ssjg     */
422246149Ssjg    if ((InterpreterMode != ACPI_IMODE_LOAD_PASS1) &&
423246149Ssjg        (Flags & ACPI_NS_SEARCH_PARENT))
424246149Ssjg    {
425246149Ssjg        /*
426246149Ssjg         * Not found at this level - search parent tree according
427246149Ssjg         * to ACPI specification
428246149Ssjg         */
429246149Ssjg        Status = AcpiNsSearchParentTree (TargetName, Node,
430246149Ssjg                                            Type, ReturnNode);
431246149Ssjg        if (ACPI_SUCCESS (Status))
432246149Ssjg        {
433246149Ssjg            return_ACPI_STATUS (Status);
434246149Ssjg        }
435246149Ssjg    }
436246149Ssjg
437246149Ssjg    /*
438246149Ssjg     * In execute mode, just search, never add names.  Exit now.
439246149Ssjg     */
440246149Ssjg    if (InterpreterMode == ACPI_IMODE_EXECUTE)
441246149Ssjg    {
442246149Ssjg        ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
443246149Ssjg            (char *) &TargetName, Node));
444246149Ssjg
445246149Ssjg        return_ACPI_STATUS (AE_NOT_FOUND);
446246149Ssjg    }
447246149Ssjg
448246149Ssjg    /* Create the new named object */
449246149Ssjg
450246149Ssjg    NewNode = AcpiNsCreateNode (TargetName);
451246149Ssjg    if (!NewNode)
452246149Ssjg    {
453246149Ssjg        return_ACPI_STATUS (AE_NO_MEMORY);
454246149Ssjg    }
455246149Ssjg
456246149Ssjg    /* Install the new object into the parent's list of children */
457246149Ssjg
458246149Ssjg    AcpiNsInstallNode (WalkState, Node, NewNode, Type);
459246149Ssjg    *ReturnNode = NewNode;
460246149Ssjg
461246149Ssjg    return_ACPI_STATUS (AE_OK);
462246149Ssjg}
463246149Ssjg
464246149Ssjg