nswalk.c revision 1.1.1.2.2.2 1 1.1.1.2.2.2 bouyer /******************************************************************************
2 1.1.1.2.2.2 bouyer *
3 1.1.1.2.2.2 bouyer * Module Name: nswalk - Functions for walking the ACPI namespace
4 1.1.1.2.2.2 bouyer *
5 1.1.1.2.2.2 bouyer *****************************************************************************/
6 1.1.1.2.2.2 bouyer
7 1.1.1.2.2.2 bouyer /*
8 1.1.1.2.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
9 1.1.1.2.2.2 bouyer * All rights reserved.
10 1.1.1.2.2.2 bouyer *
11 1.1.1.2.2.2 bouyer * Redistribution and use in source and binary forms, with or without
12 1.1.1.2.2.2 bouyer * modification, are permitted provided that the following conditions
13 1.1.1.2.2.2 bouyer * are met:
14 1.1.1.2.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2.2.2 bouyer * without modification.
17 1.1.1.2.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2.2.2 bouyer * including a substantially similar Disclaimer requirement for further
21 1.1.1.2.2.2 bouyer * binary redistribution.
22 1.1.1.2.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2.2.2 bouyer * of any contributors may be used to endorse or promote products derived
24 1.1.1.2.2.2 bouyer * from this software without specific prior written permission.
25 1.1.1.2.2.2 bouyer *
26 1.1.1.2.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2.2.2 bouyer * Software Foundation.
29 1.1.1.2.2.2 bouyer *
30 1.1.1.2.2.2 bouyer * NO WARRANTY
31 1.1.1.2.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2.2.2 bouyer */
43 1.1.1.2.2.2 bouyer
44 1.1.1.2.2.2 bouyer
45 1.1.1.2.2.2 bouyer #define __NSWALK_C__
46 1.1.1.2.2.2 bouyer
47 1.1.1.2.2.2 bouyer #include "acpi.h"
48 1.1.1.2.2.2 bouyer #include "accommon.h"
49 1.1.1.2.2.2 bouyer #include "acnamesp.h"
50 1.1.1.2.2.2 bouyer
51 1.1.1.2.2.2 bouyer
52 1.1.1.2.2.2 bouyer #define _COMPONENT ACPI_NAMESPACE
53 1.1.1.2.2.2 bouyer ACPI_MODULE_NAME ("nswalk")
54 1.1.1.2.2.2 bouyer
55 1.1.1.2.2.2 bouyer
56 1.1.1.2.2.2 bouyer /*******************************************************************************
57 1.1.1.2.2.2 bouyer *
58 1.1.1.2.2.2 bouyer * FUNCTION: AcpiNsGetNextNode
59 1.1.1.2.2.2 bouyer *
60 1.1.1.2.2.2 bouyer * PARAMETERS: ParentNode - Parent node whose children we are
61 1.1.1.2.2.2 bouyer * getting
62 1.1.1.2.2.2 bouyer * ChildNode - Previous child that was found.
63 1.1.1.2.2.2 bouyer * The NEXT child will be returned
64 1.1.1.2.2.2 bouyer *
65 1.1.1.2.2.2 bouyer * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
66 1.1.1.2.2.2 bouyer * none is found.
67 1.1.1.2.2.2 bouyer *
68 1.1.1.2.2.2 bouyer * DESCRIPTION: Return the next peer node within the namespace. If Handle
69 1.1.1.2.2.2 bouyer * is valid, Scope is ignored. Otherwise, the first node
70 1.1.1.2.2.2 bouyer * within Scope is returned.
71 1.1.1.2.2.2 bouyer *
72 1.1.1.2.2.2 bouyer ******************************************************************************/
73 1.1.1.2.2.2 bouyer
74 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *
75 1.1.1.2.2.2 bouyer AcpiNsGetNextNode (
76 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *ParentNode,
77 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *ChildNode)
78 1.1.1.2.2.2 bouyer {
79 1.1.1.2.2.2 bouyer ACPI_FUNCTION_ENTRY ();
80 1.1.1.2.2.2 bouyer
81 1.1.1.2.2.2 bouyer
82 1.1.1.2.2.2 bouyer if (!ChildNode)
83 1.1.1.2.2.2 bouyer {
84 1.1.1.2.2.2 bouyer /* It's really the parent's _scope_ that we want */
85 1.1.1.2.2.2 bouyer
86 1.1.1.2.2.2 bouyer return (ParentNode->Child);
87 1.1.1.2.2.2 bouyer }
88 1.1.1.2.2.2 bouyer
89 1.1.1.2.2.2 bouyer /* Otherwise just return the next peer */
90 1.1.1.2.2.2 bouyer
91 1.1.1.2.2.2 bouyer return (ChildNode->Peer);
92 1.1.1.2.2.2 bouyer }
93 1.1.1.2.2.2 bouyer
94 1.1.1.2.2.2 bouyer
95 1.1.1.2.2.2 bouyer /*******************************************************************************
96 1.1.1.2.2.2 bouyer *
97 1.1.1.2.2.2 bouyer * FUNCTION: AcpiNsGetNextNodeTyped
98 1.1.1.2.2.2 bouyer *
99 1.1.1.2.2.2 bouyer * PARAMETERS: Type - Type of node to be searched for
100 1.1.1.2.2.2 bouyer * ParentNode - Parent node whose children we are
101 1.1.1.2.2.2 bouyer * getting
102 1.1.1.2.2.2 bouyer * ChildNode - Previous child that was found.
103 1.1.1.2.2.2 bouyer * The NEXT child will be returned
104 1.1.1.2.2.2 bouyer *
105 1.1.1.2.2.2 bouyer * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
106 1.1.1.2.2.2 bouyer * none is found.
107 1.1.1.2.2.2 bouyer *
108 1.1.1.2.2.2 bouyer * DESCRIPTION: Return the next peer node within the namespace. If Handle
109 1.1.1.2.2.2 bouyer * is valid, Scope is ignored. Otherwise, the first node
110 1.1.1.2.2.2 bouyer * within Scope is returned.
111 1.1.1.2.2.2 bouyer *
112 1.1.1.2.2.2 bouyer ******************************************************************************/
113 1.1.1.2.2.2 bouyer
114 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *
115 1.1.1.2.2.2 bouyer AcpiNsGetNextNodeTyped (
116 1.1.1.2.2.2 bouyer ACPI_OBJECT_TYPE Type,
117 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *ParentNode,
118 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *ChildNode)
119 1.1.1.2.2.2 bouyer {
120 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *NextNode = NULL;
121 1.1.1.2.2.2 bouyer
122 1.1.1.2.2.2 bouyer
123 1.1.1.2.2.2 bouyer ACPI_FUNCTION_ENTRY ();
124 1.1.1.2.2.2 bouyer
125 1.1.1.2.2.2 bouyer
126 1.1.1.2.2.2 bouyer NextNode = AcpiNsGetNextNode (ParentNode, ChildNode);
127 1.1.1.2.2.2 bouyer
128 1.1.1.2.2.2 bouyer /* If any type is OK, we are done */
129 1.1.1.2.2.2 bouyer
130 1.1.1.2.2.2 bouyer if (Type == ACPI_TYPE_ANY)
131 1.1.1.2.2.2 bouyer {
132 1.1.1.2.2.2 bouyer /* NextNode is NULL if we are at the end-of-list */
133 1.1.1.2.2.2 bouyer
134 1.1.1.2.2.2 bouyer return (NextNode);
135 1.1.1.2.2.2 bouyer }
136 1.1.1.2.2.2 bouyer
137 1.1.1.2.2.2 bouyer /* Must search for the node -- but within this scope only */
138 1.1.1.2.2.2 bouyer
139 1.1.1.2.2.2 bouyer while (NextNode)
140 1.1.1.2.2.2 bouyer {
141 1.1.1.2.2.2 bouyer /* If type matches, we are done */
142 1.1.1.2.2.2 bouyer
143 1.1.1.2.2.2 bouyer if (NextNode->Type == Type)
144 1.1.1.2.2.2 bouyer {
145 1.1.1.2.2.2 bouyer return (NextNode);
146 1.1.1.2.2.2 bouyer }
147 1.1.1.2.2.2 bouyer
148 1.1.1.2.2.2 bouyer /* Otherwise, move on to the next peer node */
149 1.1.1.2.2.2 bouyer
150 1.1.1.2.2.2 bouyer NextNode = NextNode->Peer;
151 1.1.1.2.2.2 bouyer }
152 1.1.1.2.2.2 bouyer
153 1.1.1.2.2.2 bouyer /* Not found */
154 1.1.1.2.2.2 bouyer
155 1.1.1.2.2.2 bouyer return (NULL);
156 1.1.1.2.2.2 bouyer }
157 1.1.1.2.2.2 bouyer
158 1.1.1.2.2.2 bouyer
159 1.1.1.2.2.2 bouyer /*******************************************************************************
160 1.1.1.2.2.2 bouyer *
161 1.1.1.2.2.2 bouyer * FUNCTION: AcpiNsWalkNamespace
162 1.1.1.2.2.2 bouyer *
163 1.1.1.2.2.2 bouyer * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
164 1.1.1.2.2.2 bouyer * StartNode - Handle in namespace where search begins
165 1.1.1.2.2.2 bouyer * MaxDepth - Depth to which search is to reach
166 1.1.1.2.2.2 bouyer * Flags - Whether to unlock the NS before invoking
167 1.1.1.2.2.2 bouyer * the callback routine
168 1.1.1.2.2.2 bouyer * PreOrderVisit - Called during tree pre-order visit
169 1.1.1.2.2.2 bouyer * when an object of "Type" is found
170 1.1.1.2.2.2 bouyer * PostOrderVisit - Called during tree post-order visit
171 1.1.1.2.2.2 bouyer * when an object of "Type" is found
172 1.1.1.2.2.2 bouyer * Context - Passed to user function(s) above
173 1.1.1.2.2.2 bouyer * ReturnValue - from the UserFunction if terminated
174 1.1.1.2.2.2 bouyer * early. Otherwise, returns NULL.
175 1.1.1.2.2.2 bouyer * RETURNS: Status
176 1.1.1.2.2.2 bouyer *
177 1.1.1.2.2.2 bouyer * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
178 1.1.1.2.2.2 bouyer * starting (and ending) at the node specified by StartHandle.
179 1.1.1.2.2.2 bouyer * The callback function is called whenever a node that matches
180 1.1.1.2.2.2 bouyer * the type parameter is found. If the callback function returns
181 1.1.1.2.2.2 bouyer * a non-zero value, the search is terminated immediately and
182 1.1.1.2.2.2 bouyer * this value is returned to the caller.
183 1.1.1.2.2.2 bouyer *
184 1.1.1.2.2.2 bouyer * The point of this procedure is to provide a generic namespace
185 1.1.1.2.2.2 bouyer * walk routine that can be called from multiple places to
186 1.1.1.2.2.2 bouyer * provide multiple services; the callback function(s) can be
187 1.1.1.2.2.2 bouyer * tailored to each task, whether it is a print function,
188 1.1.1.2.2.2 bouyer * a compare function, etc.
189 1.1.1.2.2.2 bouyer *
190 1.1.1.2.2.2 bouyer ******************************************************************************/
191 1.1.1.2.2.2 bouyer
192 1.1.1.2.2.2 bouyer ACPI_STATUS
193 1.1.1.2.2.2 bouyer AcpiNsWalkNamespace (
194 1.1.1.2.2.2 bouyer ACPI_OBJECT_TYPE Type,
195 1.1.1.2.2.2 bouyer ACPI_HANDLE StartNode,
196 1.1.1.2.2.2 bouyer UINT32 MaxDepth,
197 1.1.1.2.2.2 bouyer UINT32 Flags,
198 1.1.1.2.2.2 bouyer ACPI_WALK_CALLBACK PreOrderVisit,
199 1.1.1.2.2.2 bouyer ACPI_WALK_CALLBACK PostOrderVisit,
200 1.1.1.2.2.2 bouyer void *Context,
201 1.1.1.2.2.2 bouyer void **ReturnValue)
202 1.1.1.2.2.2 bouyer {
203 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
204 1.1.1.2.2.2 bouyer ACPI_STATUS MutexStatus;
205 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *ChildNode;
206 1.1.1.2.2.2 bouyer ACPI_NAMESPACE_NODE *ParentNode;
207 1.1.1.2.2.2 bouyer ACPI_OBJECT_TYPE ChildType;
208 1.1.1.2.2.2 bouyer UINT32 Level;
209 1.1.1.2.2.2 bouyer BOOLEAN NodePreviouslyVisited = FALSE;
210 1.1.1.2.2.2 bouyer
211 1.1.1.2.2.2 bouyer
212 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE (NsWalkNamespace);
213 1.1.1.2.2.2 bouyer
214 1.1.1.2.2.2 bouyer
215 1.1.1.2.2.2 bouyer /* Special case for the namespace Root Node */
216 1.1.1.2.2.2 bouyer
217 1.1.1.2.2.2 bouyer if (StartNode == ACPI_ROOT_OBJECT)
218 1.1.1.2.2.2 bouyer {
219 1.1.1.2.2.2 bouyer StartNode = AcpiGbl_RootNode;
220 1.1.1.2.2.2 bouyer }
221 1.1.1.2.2.2 bouyer
222 1.1.1.2.2.2 bouyer /* Null child means "get first node" */
223 1.1.1.2.2.2 bouyer
224 1.1.1.2.2.2 bouyer ParentNode = StartNode;
225 1.1.1.2.2.2 bouyer ChildNode = AcpiNsGetNextNode (ParentNode, NULL);
226 1.1.1.2.2.2 bouyer ChildType = ACPI_TYPE_ANY;
227 1.1.1.2.2.2 bouyer Level = 1;
228 1.1.1.2.2.2 bouyer
229 1.1.1.2.2.2 bouyer /*
230 1.1.1.2.2.2 bouyer * Traverse the tree of nodes until we bubble back up to where we
231 1.1.1.2.2.2 bouyer * started. When Level is zero, the loop is done because we have
232 1.1.1.2.2.2 bouyer * bubbled up to (and passed) the original parent handle (StartEntry)
233 1.1.1.2.2.2 bouyer */
234 1.1.1.2.2.2 bouyer while (Level > 0 && ChildNode)
235 1.1.1.2.2.2 bouyer {
236 1.1.1.2.2.2 bouyer Status = AE_OK;
237 1.1.1.2.2.2 bouyer
238 1.1.1.2.2.2 bouyer /* Found next child, get the type if we are not searching for ANY */
239 1.1.1.2.2.2 bouyer
240 1.1.1.2.2.2 bouyer if (Type != ACPI_TYPE_ANY)
241 1.1.1.2.2.2 bouyer {
242 1.1.1.2.2.2 bouyer ChildType = ChildNode->Type;
243 1.1.1.2.2.2 bouyer }
244 1.1.1.2.2.2 bouyer
245 1.1.1.2.2.2 bouyer /*
246 1.1.1.2.2.2 bouyer * Ignore all temporary namespace nodes (created during control
247 1.1.1.2.2.2 bouyer * method execution) unless told otherwise. These temporary nodes
248 1.1.1.2.2.2 bouyer * can cause a race condition because they can be deleted during
249 1.1.1.2.2.2 bouyer * the execution of the user function (if the namespace is
250 1.1.1.2.2.2 bouyer * unlocked before invocation of the user function.) Only the
251 1.1.1.2.2.2 bouyer * debugger namespace dump will examine the temporary nodes.
252 1.1.1.2.2.2 bouyer */
253 1.1.1.2.2.2 bouyer if ((ChildNode->Flags & ANOBJ_TEMPORARY) &&
254 1.1.1.2.2.2 bouyer !(Flags & ACPI_NS_WALK_TEMP_NODES))
255 1.1.1.2.2.2 bouyer {
256 1.1.1.2.2.2 bouyer Status = AE_CTRL_DEPTH;
257 1.1.1.2.2.2 bouyer }
258 1.1.1.2.2.2 bouyer
259 1.1.1.2.2.2 bouyer /* Type must match requested type */
260 1.1.1.2.2.2 bouyer
261 1.1.1.2.2.2 bouyer else if (ChildType == Type)
262 1.1.1.2.2.2 bouyer {
263 1.1.1.2.2.2 bouyer /*
264 1.1.1.2.2.2 bouyer * Found a matching node, invoke the user callback function.
265 1.1.1.2.2.2 bouyer * Unlock the namespace if flag is set.
266 1.1.1.2.2.2 bouyer */
267 1.1.1.2.2.2 bouyer if (Flags & ACPI_NS_WALK_UNLOCK)
268 1.1.1.2.2.2 bouyer {
269 1.1.1.2.2.2 bouyer MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
270 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (MutexStatus))
271 1.1.1.2.2.2 bouyer {
272 1.1.1.2.2.2 bouyer return_ACPI_STATUS (MutexStatus);
273 1.1.1.2.2.2 bouyer }
274 1.1.1.2.2.2 bouyer }
275 1.1.1.2.2.2 bouyer
276 1.1.1.2.2.2 bouyer /*
277 1.1.1.2.2.2 bouyer * Invoke the user function, either pre-order or post-order
278 1.1.1.2.2.2 bouyer * or both.
279 1.1.1.2.2.2 bouyer */
280 1.1.1.2.2.2 bouyer if (!NodePreviouslyVisited)
281 1.1.1.2.2.2 bouyer {
282 1.1.1.2.2.2 bouyer if (PreOrderVisit)
283 1.1.1.2.2.2 bouyer {
284 1.1.1.2.2.2 bouyer Status = PreOrderVisit (ChildNode, Level,
285 1.1.1.2.2.2 bouyer Context, ReturnValue);
286 1.1.1.2.2.2 bouyer }
287 1.1.1.2.2.2 bouyer }
288 1.1.1.2.2.2 bouyer else
289 1.1.1.2.2.2 bouyer {
290 1.1.1.2.2.2 bouyer if (PostOrderVisit)
291 1.1.1.2.2.2 bouyer {
292 1.1.1.2.2.2 bouyer Status = PostOrderVisit (ChildNode, Level,
293 1.1.1.2.2.2 bouyer Context, ReturnValue);
294 1.1.1.2.2.2 bouyer }
295 1.1.1.2.2.2 bouyer }
296 1.1.1.2.2.2 bouyer
297 1.1.1.2.2.2 bouyer if (Flags & ACPI_NS_WALK_UNLOCK)
298 1.1.1.2.2.2 bouyer {
299 1.1.1.2.2.2 bouyer MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
300 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (MutexStatus))
301 1.1.1.2.2.2 bouyer {
302 1.1.1.2.2.2 bouyer return_ACPI_STATUS (MutexStatus);
303 1.1.1.2.2.2 bouyer }
304 1.1.1.2.2.2 bouyer }
305 1.1.1.2.2.2 bouyer
306 1.1.1.2.2.2 bouyer switch (Status)
307 1.1.1.2.2.2 bouyer {
308 1.1.1.2.2.2 bouyer case AE_OK:
309 1.1.1.2.2.2 bouyer case AE_CTRL_DEPTH:
310 1.1.1.2.2.2 bouyer
311 1.1.1.2.2.2 bouyer /* Just keep going */
312 1.1.1.2.2.2 bouyer break;
313 1.1.1.2.2.2 bouyer
314 1.1.1.2.2.2 bouyer case AE_CTRL_TERMINATE:
315 1.1.1.2.2.2 bouyer
316 1.1.1.2.2.2 bouyer /* Exit now, with OK status */
317 1.1.1.2.2.2 bouyer
318 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_OK);
319 1.1.1.2.2.2 bouyer
320 1.1.1.2.2.2 bouyer default:
321 1.1.1.2.2.2 bouyer
322 1.1.1.2.2.2 bouyer /* All others are valid exceptions */
323 1.1.1.2.2.2 bouyer
324 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
325 1.1.1.2.2.2 bouyer }
326 1.1.1.2.2.2 bouyer }
327 1.1.1.2.2.2 bouyer
328 1.1.1.2.2.2 bouyer /*
329 1.1.1.2.2.2 bouyer * Depth first search: Attempt to go down another level in the
330 1.1.1.2.2.2 bouyer * namespace if we are allowed to. Don't go any further if we have
331 1.1.1.2.2.2 bouyer * reached the caller specified maximum depth or if the user
332 1.1.1.2.2.2 bouyer * function has specified that the maximum depth has been reached.
333 1.1.1.2.2.2 bouyer */
334 1.1.1.2.2.2 bouyer if (!NodePreviouslyVisited &&
335 1.1.1.2.2.2 bouyer (Level < MaxDepth) &&
336 1.1.1.2.2.2 bouyer (Status != AE_CTRL_DEPTH))
337 1.1.1.2.2.2 bouyer {
338 1.1.1.2.2.2 bouyer if (ChildNode->Child)
339 1.1.1.2.2.2 bouyer {
340 1.1.1.2.2.2 bouyer /* There is at least one child of this node, visit it */
341 1.1.1.2.2.2 bouyer
342 1.1.1.2.2.2 bouyer Level++;
343 1.1.1.2.2.2 bouyer ParentNode = ChildNode;
344 1.1.1.2.2.2 bouyer ChildNode = AcpiNsGetNextNode (ParentNode, NULL);
345 1.1.1.2.2.2 bouyer continue;
346 1.1.1.2.2.2 bouyer }
347 1.1.1.2.2.2 bouyer }
348 1.1.1.2.2.2 bouyer
349 1.1.1.2.2.2 bouyer /* No more children, re-visit this node */
350 1.1.1.2.2.2 bouyer
351 1.1.1.2.2.2 bouyer if (!NodePreviouslyVisited)
352 1.1.1.2.2.2 bouyer {
353 1.1.1.2.2.2 bouyer NodePreviouslyVisited = TRUE;
354 1.1.1.2.2.2 bouyer continue;
355 1.1.1.2.2.2 bouyer }
356 1.1.1.2.2.2 bouyer
357 1.1.1.2.2.2 bouyer /* No more children, visit peers */
358 1.1.1.2.2.2 bouyer
359 1.1.1.2.2.2 bouyer ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
360 1.1.1.2.2.2 bouyer if (ChildNode)
361 1.1.1.2.2.2 bouyer {
362 1.1.1.2.2.2 bouyer NodePreviouslyVisited = FALSE;
363 1.1.1.2.2.2 bouyer }
364 1.1.1.2.2.2 bouyer
365 1.1.1.2.2.2 bouyer /* No peers, re-visit parent */
366 1.1.1.2.2.2 bouyer
367 1.1.1.2.2.2 bouyer else
368 1.1.1.2.2.2 bouyer {
369 1.1.1.2.2.2 bouyer /*
370 1.1.1.2.2.2 bouyer * No more children of this node (AcpiNsGetNextNode failed), go
371 1.1.1.2.2.2 bouyer * back upwards in the namespace tree to the node's parent.
372 1.1.1.2.2.2 bouyer */
373 1.1.1.2.2.2 bouyer Level--;
374 1.1.1.2.2.2 bouyer ChildNode = ParentNode;
375 1.1.1.2.2.2 bouyer ParentNode = ParentNode->Parent;
376 1.1.1.2.2.2 bouyer
377 1.1.1.2.2.2 bouyer NodePreviouslyVisited = TRUE;
378 1.1.1.2.2.2 bouyer }
379 1.1.1.2.2.2 bouyer }
380 1.1.1.2.2.2 bouyer
381 1.1.1.2.2.2 bouyer /* Complete walk, not terminated by user function */
382 1.1.1.2.2.2 bouyer
383 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_OK);
384 1.1.1.2.2.2 bouyer }
385 1.1.1.2.2.2 bouyer
386 1.1.1.2.2.2 bouyer
387