13446Smrj /******************************************************************************
23446Smrj *
33446Smrj * Module Name: nswalk - Functions for walking the ACPI namespace
43446Smrj *
53446Smrj *****************************************************************************/
63446Smrj
73446Smrj /******************************************************************************
83446Smrj *
93446Smrj * 1. Copyright Notice
103446Smrj *
119980SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
123446Smrj * All rights reserved.
133446Smrj *
143446Smrj * 2. License
153446Smrj *
163446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property
173446Smrj * rights. You may have additional license terms from the party that provided
183446Smrj * you this software, covering your right to use that party's intellectual
193446Smrj * property rights.
203446Smrj *
213446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
223446Smrj * copy of the source code appearing in this file ("Covered Code") an
233446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the
243446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy,
253446Smrj * make derivatives, distribute, use and display any portion of the Covered
263446Smrj * Code in any form, with the right to sublicense such rights; and
273446Smrj *
283446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
293446Smrj * license (with the right to sublicense), under only those claims of Intel
303446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell,
313446Smrj * offer to sell, and import the Covered Code and derivative works thereof
323446Smrj * solely to the minimum extent necessary to exercise the above copyright
333446Smrj * license, and in no event shall the patent license extend to any additions
343446Smrj * to or modifications of the Original Intel Code. No other license or right
353446Smrj * is granted directly or by implication, estoppel or otherwise;
363446Smrj *
373446Smrj * The above copyright and patent license is granted only if the following
383446Smrj * conditions are met:
393446Smrj *
403446Smrj * 3. Conditions
413446Smrj *
423446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source.
433446Smrj * Redistribution of source code of any substantial portion of the Covered
443446Smrj * Code or modification with rights to further distribute source must include
453446Smrj * the above Copyright Notice, the above License, this list of Conditions,
463446Smrj * and the following Disclaimer and Export Compliance provision. In addition,
473446Smrj * Licensee must cause all Covered Code to which Licensee contributes to
483446Smrj * contain a file documenting the changes Licensee made to create that Covered
493446Smrj * Code and the date of any change. Licensee must include in that file the
503446Smrj * documentation of any changes made by any predecessor Licensee. Licensee
513446Smrj * must include a prominent statement that the modification is derived,
523446Smrj * directly or indirectly, from Original Intel Code.
533446Smrj *
543446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
553446Smrj * Redistribution of source code of any substantial portion of the Covered
563446Smrj * Code or modification without rights to further distribute source must
573446Smrj * include the following Disclaimer and Export Compliance provision in the
583446Smrj * documentation and/or other materials provided with distribution. In
593446Smrj * addition, Licensee may not authorize further sublicense of source of any
603446Smrj * portion of the Covered Code, and must include terms to the effect that the
613446Smrj * license from Licensee to its licensee is limited to the intellectual
623446Smrj * property embodied in the software Licensee provides to its licensee, and
633446Smrj * not to intellectual property embodied in modifications its licensee may
643446Smrj * make.
653446Smrj *
663446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any
673446Smrj * substantial portion of the Covered Code or modification must reproduce the
683446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance
693446Smrj * provision in the documentation and/or other materials provided with the
703446Smrj * distribution.
713446Smrj *
723446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original
733446Smrj * Intel Code.
743446Smrj *
753446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by
763446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or
773446Smrj * other dealings in products derived from or relating to the Covered Code
783446Smrj * without prior written authorization from Intel.
793446Smrj *
803446Smrj * 4. Disclaimer and Export Compliance
813446Smrj *
823446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
833446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
843446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
853446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
863446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
873446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
883446Smrj * PARTICULAR PURPOSE.
893446Smrj *
903446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
913446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
923446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
933446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
943446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
953446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
963446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
973446Smrj * LIMITED REMEDY.
983446Smrj *
993446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this
1003446Smrj * software or system incorporating such software without first obtaining any
1013446Smrj * required license or other approval from the U. S. Department of Commerce or
1023446Smrj * any other agency or department of the United States Government. In the
1033446Smrj * event Licensee exports any such software from the United States or
1043446Smrj * re-exports any such software from a foreign destination, Licensee shall
1053446Smrj * ensure that the distribution and export/re-export of the software is in
1063446Smrj * compliance with all laws, regulations, orders, or other restrictions of the
1073446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1083446Smrj * any of its subsidiaries will export/re-export any technical data, process,
1093446Smrj * software, or service, directly or indirectly, to any country for which the
1103446Smrj * United States government or any agency thereof requires an export license,
1113446Smrj * other governmental approval, or letter of assurance, without first obtaining
1123446Smrj * such license, approval or letter.
1133446Smrj *
1143446Smrj *****************************************************************************/
1153446Smrj
1163446Smrj
1173446Smrj #define __NSWALK_C__
1183446Smrj
1193446Smrj #include "acpi.h"
1209980SDana.Myers@Sun.COM #include "accommon.h"
1213446Smrj #include "acnamesp.h"
1223446Smrj
1233446Smrj
1243446Smrj #define _COMPONENT ACPI_NAMESPACE
1253446Smrj ACPI_MODULE_NAME ("nswalk")
1263446Smrj
1273446Smrj
1283446Smrj /*******************************************************************************
1293446Smrj *
1303446Smrj * FUNCTION: AcpiNsGetNextNode
1313446Smrj *
1329980SDana.Myers@Sun.COM * PARAMETERS: ParentNode - Parent node whose children we are
1339980SDana.Myers@Sun.COM * getting
1349980SDana.Myers@Sun.COM * ChildNode - Previous child that was found.
1359980SDana.Myers@Sun.COM * The NEXT child will be returned
1369980SDana.Myers@Sun.COM *
1379980SDana.Myers@Sun.COM * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
1389980SDana.Myers@Sun.COM * none is found.
1399980SDana.Myers@Sun.COM *
1409980SDana.Myers@Sun.COM * DESCRIPTION: Return the next peer node within the namespace. If Handle
1419980SDana.Myers@Sun.COM * is valid, Scope is ignored. Otherwise, the first node
1429980SDana.Myers@Sun.COM * within Scope is returned.
1439980SDana.Myers@Sun.COM *
1449980SDana.Myers@Sun.COM ******************************************************************************/
1459980SDana.Myers@Sun.COM
1469980SDana.Myers@Sun.COM ACPI_NAMESPACE_NODE *
AcpiNsGetNextNode(ACPI_NAMESPACE_NODE * ParentNode,ACPI_NAMESPACE_NODE * ChildNode)1479980SDana.Myers@Sun.COM AcpiNsGetNextNode (
1489980SDana.Myers@Sun.COM ACPI_NAMESPACE_NODE *ParentNode,
1499980SDana.Myers@Sun.COM ACPI_NAMESPACE_NODE *ChildNode)
1509980SDana.Myers@Sun.COM {
1519980SDana.Myers@Sun.COM ACPI_FUNCTION_ENTRY ();
1529980SDana.Myers@Sun.COM
1539980SDana.Myers@Sun.COM
1549980SDana.Myers@Sun.COM if (!ChildNode)
1559980SDana.Myers@Sun.COM {
1569980SDana.Myers@Sun.COM /* It's really the parent's _scope_ that we want */
1579980SDana.Myers@Sun.COM
1589980SDana.Myers@Sun.COM return (ParentNode->Child);
1599980SDana.Myers@Sun.COM }
1609980SDana.Myers@Sun.COM
1619980SDana.Myers@Sun.COM /*
1629980SDana.Myers@Sun.COM * Get the next node.
1639980SDana.Myers@Sun.COM *
1649980SDana.Myers@Sun.COM * If we are at the end of this peer list, return NULL
1659980SDana.Myers@Sun.COM */
1669980SDana.Myers@Sun.COM if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)
1679980SDana.Myers@Sun.COM {
1689980SDana.Myers@Sun.COM return NULL;
1699980SDana.Myers@Sun.COM }
1709980SDana.Myers@Sun.COM
1719980SDana.Myers@Sun.COM /* Otherwise just return the next peer */
1729980SDana.Myers@Sun.COM
1739980SDana.Myers@Sun.COM return (ChildNode->Peer);
1749980SDana.Myers@Sun.COM }
1759980SDana.Myers@Sun.COM
1769980SDana.Myers@Sun.COM
1779980SDana.Myers@Sun.COM /*******************************************************************************
1789980SDana.Myers@Sun.COM *
1799980SDana.Myers@Sun.COM * FUNCTION: AcpiNsGetNextNodeTyped
1809980SDana.Myers@Sun.COM *
1813446Smrj * PARAMETERS: Type - Type of node to be searched for
1823446Smrj * ParentNode - Parent node whose children we are
1833446Smrj * getting
1843446Smrj * ChildNode - Previous child that was found.
1853446Smrj * The NEXT child will be returned
1863446Smrj *
1873446Smrj * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
1883446Smrj * none is found.
1893446Smrj *
1903446Smrj * DESCRIPTION: Return the next peer node within the namespace. If Handle
1913446Smrj * is valid, Scope is ignored. Otherwise, the first node
1923446Smrj * within Scope is returned.
1933446Smrj *
1943446Smrj ******************************************************************************/
1953446Smrj
1963446Smrj ACPI_NAMESPACE_NODE *
AcpiNsGetNextNodeTyped(ACPI_OBJECT_TYPE Type,ACPI_NAMESPACE_NODE * ParentNode,ACPI_NAMESPACE_NODE * ChildNode)1979980SDana.Myers@Sun.COM AcpiNsGetNextNodeTyped (
1983446Smrj ACPI_OBJECT_TYPE Type,
1993446Smrj ACPI_NAMESPACE_NODE *ParentNode,
2003446Smrj ACPI_NAMESPACE_NODE *ChildNode)
2013446Smrj {
2023446Smrj ACPI_NAMESPACE_NODE *NextNode = NULL;
2033446Smrj
2043446Smrj
2053446Smrj ACPI_FUNCTION_ENTRY ();
2063446Smrj
2073446Smrj
2089980SDana.Myers@Sun.COM NextNode = AcpiNsGetNextNode (ParentNode, ChildNode);
2093446Smrj
2103446Smrj /* If any type is OK, we are done */
2113446Smrj
2123446Smrj if (Type == ACPI_TYPE_ANY)
2133446Smrj {
2143446Smrj /* NextNode is NULL if we are at the end-of-list */
2153446Smrj
2163446Smrj return (NextNode);
2173446Smrj }
2183446Smrj
2193446Smrj /* Must search for the node -- but within this scope only */
2203446Smrj
2213446Smrj while (NextNode)
2223446Smrj {
2233446Smrj /* If type matches, we are done */
2243446Smrj
2253446Smrj if (NextNode->Type == Type)
2263446Smrj {
2273446Smrj return (NextNode);
2283446Smrj }
2293446Smrj
2303446Smrj /* Otherwise, move on to the next node */
2313446Smrj
2323446Smrj NextNode = AcpiNsGetNextValidNode (NextNode);
2333446Smrj }
2343446Smrj
2353446Smrj /* Not found */
2363446Smrj
2373446Smrj return (NULL);
2383446Smrj }
2393446Smrj
2403446Smrj
2413446Smrj /*******************************************************************************
2423446Smrj *
2433446Smrj * FUNCTION: AcpiNsWalkNamespace
2443446Smrj *
2453446Smrj * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
2463446Smrj * StartNode - Handle in namespace where search begins
2473446Smrj * MaxDepth - Depth to which search is to reach
2487851SDana.Myers@Sun.COM * Flags - Whether to unlock the NS before invoking
2493446Smrj * the callback routine
250*11225SDana.Myers@Sun.COM * PreOrderVisit - Called during tree pre-order visit
251*11225SDana.Myers@Sun.COM * when an object of "Type" is found
252*11225SDana.Myers@Sun.COM * PostOrderVisit - Called during tree post-order visit
253*11225SDana.Myers@Sun.COM * when an object of "Type" is found
254*11225SDana.Myers@Sun.COM * Context - Passed to user function(s) above
255*11225SDana.Myers@Sun.COM * ReturnValue - from the UserFunction if terminated
256*11225SDana.Myers@Sun.COM * early. Otherwise, returns NULL.
2573446Smrj * RETURNS: Status
2583446Smrj *
2593446Smrj * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
2603446Smrj * starting (and ending) at the node specified by StartHandle.
261*11225SDana.Myers@Sun.COM * The callback function is called whenever a node that matches
262*11225SDana.Myers@Sun.COM * the type parameter is found. If the callback function returns
2639980SDana.Myers@Sun.COM * a non-zero value, the search is terminated immediately and
2649980SDana.Myers@Sun.COM * this value is returned to the caller.
2653446Smrj *
2663446Smrj * The point of this procedure is to provide a generic namespace
2673446Smrj * walk routine that can be called from multiple places to
268*11225SDana.Myers@Sun.COM * provide multiple services; the callback function(s) can be
269*11225SDana.Myers@Sun.COM * tailored to each task, whether it is a print function,
270*11225SDana.Myers@Sun.COM * a compare function, etc.
2713446Smrj *
2723446Smrj ******************************************************************************/
2733446Smrj
2743446Smrj ACPI_STATUS
AcpiNsWalkNamespace(ACPI_OBJECT_TYPE Type,ACPI_HANDLE StartNode,UINT32 MaxDepth,UINT32 Flags,ACPI_WALK_CALLBACK PreOrderVisit,ACPI_WALK_CALLBACK PostOrderVisit,void * Context,void ** ReturnValue)2753446Smrj AcpiNsWalkNamespace (
2763446Smrj ACPI_OBJECT_TYPE Type,
2773446Smrj ACPI_HANDLE StartNode,
2783446Smrj UINT32 MaxDepth,
2797851SDana.Myers@Sun.COM UINT32 Flags,
280*11225SDana.Myers@Sun.COM ACPI_WALK_CALLBACK PreOrderVisit,
281*11225SDana.Myers@Sun.COM ACPI_WALK_CALLBACK PostOrderVisit,
2823446Smrj void *Context,
2833446Smrj void **ReturnValue)
2843446Smrj {
2853446Smrj ACPI_STATUS Status;
2863446Smrj ACPI_STATUS MutexStatus;
2873446Smrj ACPI_NAMESPACE_NODE *ChildNode;
2883446Smrj ACPI_NAMESPACE_NODE *ParentNode;
2893446Smrj ACPI_OBJECT_TYPE ChildType;
2903446Smrj UINT32 Level;
291*11225SDana.Myers@Sun.COM BOOLEAN NodePreviouslyVisited = FALSE;
2923446Smrj
2933446Smrj
2943446Smrj ACPI_FUNCTION_TRACE (NsWalkNamespace);
2953446Smrj
2963446Smrj
2973446Smrj /* Special case for the namespace Root Node */
2983446Smrj
2993446Smrj if (StartNode == ACPI_ROOT_OBJECT)
3003446Smrj {
3013446Smrj StartNode = AcpiGbl_RootNode;
3023446Smrj }
3033446Smrj
3043446Smrj /* Null child means "get first node" */
3053446Smrj
3063446Smrj ParentNode = StartNode;
307*11225SDana.Myers@Sun.COM ChildNode = AcpiNsGetNextNode (ParentNode, NULL);
3083446Smrj ChildType = ACPI_TYPE_ANY;
3093446Smrj Level = 1;
3103446Smrj
3113446Smrj /*
3123446Smrj * Traverse the tree of nodes until we bubble back up to where we
3133446Smrj * started. When Level is zero, the loop is done because we have
3143446Smrj * bubbled up to (and passed) the original parent handle (StartEntry)
3153446Smrj */
316*11225SDana.Myers@Sun.COM while (Level > 0 && ChildNode)
3173446Smrj {
318*11225SDana.Myers@Sun.COM Status = AE_OK;
3193446Smrj
320*11225SDana.Myers@Sun.COM /* Found next child, get the type if we are not searching for ANY */
321*11225SDana.Myers@Sun.COM
322*11225SDana.Myers@Sun.COM if (Type != ACPI_TYPE_ANY)
3233446Smrj {
324*11225SDana.Myers@Sun.COM ChildType = ChildNode->Type;
325*11225SDana.Myers@Sun.COM }
3267851SDana.Myers@Sun.COM
327*11225SDana.Myers@Sun.COM /*
328*11225SDana.Myers@Sun.COM * Ignore all temporary namespace nodes (created during control
329*11225SDana.Myers@Sun.COM * method execution) unless told otherwise. These temporary nodes
330*11225SDana.Myers@Sun.COM * can cause a race condition because they can be deleted during
331*11225SDana.Myers@Sun.COM * the execution of the user function (if the namespace is
332*11225SDana.Myers@Sun.COM * unlocked before invocation of the user function.) Only the
333*11225SDana.Myers@Sun.COM * debugger namespace dump will examine the temporary nodes.
334*11225SDana.Myers@Sun.COM */
335*11225SDana.Myers@Sun.COM if ((ChildNode->Flags & ANOBJ_TEMPORARY) &&
336*11225SDana.Myers@Sun.COM !(Flags & ACPI_NS_WALK_TEMP_NODES))
337*11225SDana.Myers@Sun.COM {
338*11225SDana.Myers@Sun.COM Status = AE_CTRL_DEPTH;
339*11225SDana.Myers@Sun.COM }
3403446Smrj
341*11225SDana.Myers@Sun.COM /* Type must match requested type */
342*11225SDana.Myers@Sun.COM
343*11225SDana.Myers@Sun.COM else if (ChildType == Type)
344*11225SDana.Myers@Sun.COM {
3457851SDana.Myers@Sun.COM /*
346*11225SDana.Myers@Sun.COM * Found a matching node, invoke the user callback function.
347*11225SDana.Myers@Sun.COM * Unlock the namespace if flag is set.
3487851SDana.Myers@Sun.COM */
349*11225SDana.Myers@Sun.COM if (Flags & ACPI_NS_WALK_UNLOCK)
3503446Smrj {
351*11225SDana.Myers@Sun.COM MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
352*11225SDana.Myers@Sun.COM if (ACPI_FAILURE (MutexStatus))
3533446Smrj {
354*11225SDana.Myers@Sun.COM return_ACPI_STATUS (MutexStatus);
3553446Smrj }
3563446Smrj }
3573446Smrj
3583446Smrj /*
359*11225SDana.Myers@Sun.COM * Invoke the user function, either pre-order or post-order
360*11225SDana.Myers@Sun.COM * or both.
3613446Smrj */
362*11225SDana.Myers@Sun.COM if (!NodePreviouslyVisited)
363*11225SDana.Myers@Sun.COM {
364*11225SDana.Myers@Sun.COM if (PreOrderVisit)
365*11225SDana.Myers@Sun.COM {
366*11225SDana.Myers@Sun.COM Status = PreOrderVisit (ChildNode, Level,
367*11225SDana.Myers@Sun.COM Context, ReturnValue);
368*11225SDana.Myers@Sun.COM }
369*11225SDana.Myers@Sun.COM }
370*11225SDana.Myers@Sun.COM else
3713446Smrj {
372*11225SDana.Myers@Sun.COM if (PostOrderVisit)
3733446Smrj {
374*11225SDana.Myers@Sun.COM Status = PostOrderVisit (ChildNode, Level,
375*11225SDana.Myers@Sun.COM Context, ReturnValue);
376*11225SDana.Myers@Sun.COM }
377*11225SDana.Myers@Sun.COM }
3787851SDana.Myers@Sun.COM
379*11225SDana.Myers@Sun.COM if (Flags & ACPI_NS_WALK_UNLOCK)
380*11225SDana.Myers@Sun.COM {
381*11225SDana.Myers@Sun.COM MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
382*11225SDana.Myers@Sun.COM if (ACPI_FAILURE (MutexStatus))
383*11225SDana.Myers@Sun.COM {
384*11225SDana.Myers@Sun.COM return_ACPI_STATUS (MutexStatus);
3853446Smrj }
3863446Smrj }
387*11225SDana.Myers@Sun.COM
388*11225SDana.Myers@Sun.COM switch (Status)
389*11225SDana.Myers@Sun.COM {
390*11225SDana.Myers@Sun.COM case AE_OK:
391*11225SDana.Myers@Sun.COM case AE_CTRL_DEPTH:
392*11225SDana.Myers@Sun.COM
393*11225SDana.Myers@Sun.COM /* Just keep going */
394*11225SDana.Myers@Sun.COM break;
395*11225SDana.Myers@Sun.COM
396*11225SDana.Myers@Sun.COM case AE_CTRL_TERMINATE:
397*11225SDana.Myers@Sun.COM
398*11225SDana.Myers@Sun.COM /* Exit now, with OK status */
399*11225SDana.Myers@Sun.COM
400*11225SDana.Myers@Sun.COM return_ACPI_STATUS (AE_OK);
401*11225SDana.Myers@Sun.COM
402*11225SDana.Myers@Sun.COM default:
403*11225SDana.Myers@Sun.COM
404*11225SDana.Myers@Sun.COM /* All others are valid exceptions */
405*11225SDana.Myers@Sun.COM
406*11225SDana.Myers@Sun.COM return_ACPI_STATUS (Status);
407*11225SDana.Myers@Sun.COM }
4083446Smrj }
409*11225SDana.Myers@Sun.COM
410*11225SDana.Myers@Sun.COM /*
411*11225SDana.Myers@Sun.COM * Depth first search: Attempt to go down another level in the
412*11225SDana.Myers@Sun.COM * namespace if we are allowed to. Don't go any further if we have
413*11225SDana.Myers@Sun.COM * reached the caller specified maximum depth or if the user
414*11225SDana.Myers@Sun.COM * function has specified that the maximum depth has been reached.
415*11225SDana.Myers@Sun.COM */
416*11225SDana.Myers@Sun.COM if (!NodePreviouslyVisited &&
417*11225SDana.Myers@Sun.COM (Level < MaxDepth) &&
418*11225SDana.Myers@Sun.COM (Status != AE_CTRL_DEPTH))
419*11225SDana.Myers@Sun.COM {
420*11225SDana.Myers@Sun.COM if (ChildNode->Child)
421*11225SDana.Myers@Sun.COM {
422*11225SDana.Myers@Sun.COM /* There is at least one child of this node, visit it */
423*11225SDana.Myers@Sun.COM
424*11225SDana.Myers@Sun.COM Level++;
425*11225SDana.Myers@Sun.COM ParentNode = ChildNode;
426*11225SDana.Myers@Sun.COM ChildNode = AcpiNsGetNextNode (ParentNode, NULL);
427*11225SDana.Myers@Sun.COM continue;
428*11225SDana.Myers@Sun.COM }
429*11225SDana.Myers@Sun.COM }
430*11225SDana.Myers@Sun.COM
431*11225SDana.Myers@Sun.COM /* No more children, re-visit this node */
432*11225SDana.Myers@Sun.COM
433*11225SDana.Myers@Sun.COM if (!NodePreviouslyVisited)
434*11225SDana.Myers@Sun.COM {
435*11225SDana.Myers@Sun.COM NodePreviouslyVisited = TRUE;
436*11225SDana.Myers@Sun.COM continue;
437*11225SDana.Myers@Sun.COM }
438*11225SDana.Myers@Sun.COM
439*11225SDana.Myers@Sun.COM /* No more children, visit peers */
440*11225SDana.Myers@Sun.COM
441*11225SDana.Myers@Sun.COM ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
442*11225SDana.Myers@Sun.COM if (ChildNode)
443*11225SDana.Myers@Sun.COM {
444*11225SDana.Myers@Sun.COM NodePreviouslyVisited = FALSE;
445*11225SDana.Myers@Sun.COM }
446*11225SDana.Myers@Sun.COM
447*11225SDana.Myers@Sun.COM /* No peers, re-visit parent */
448*11225SDana.Myers@Sun.COM
4493446Smrj else
4503446Smrj {
4513446Smrj /*
4527851SDana.Myers@Sun.COM * No more children of this node (AcpiNsGetNextNode failed), go
4537851SDana.Myers@Sun.COM * back upwards in the namespace tree to the node's parent.
4543446Smrj */
4553446Smrj Level--;
4563446Smrj ChildNode = ParentNode;
4573446Smrj ParentNode = AcpiNsGetParentNode (ParentNode);
458*11225SDana.Myers@Sun.COM
459*11225SDana.Myers@Sun.COM NodePreviouslyVisited = TRUE;
4603446Smrj }
4613446Smrj }
4623446Smrj
4633446Smrj /* Complete walk, not terminated by user function */
4643446Smrj
4653446Smrj return_ACPI_STATUS (AE_OK);
4663446Smrj }
4673446Smrj
4683446Smrj
469