2 /******************************************************************************
4 * Module Name: asltree - parse tree management
6 *****************************************************************************/
9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
46 #include <contrib/dev/acpica/compiler/aslcompiler.h>
47 #include "aslcompiler.y.h"
50 #define _COMPONENT ACPI_COMPILER
51 ACPI_MODULE_NAME ("asltree")
53 /* Local prototypes */
55 static ACPI_PARSE_OBJECT *
64 /*******************************************************************************
66 * FUNCTION: TrGetNextNode
70 * RETURN: New parse node. Aborts on allocation failure
72 * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
73 * dynamic memory manager for performance reasons (This has a
74 * major impact on the speed of the compiler.)
76 ******************************************************************************/
78 static ACPI_PARSE_OBJECT *
83 if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast)
85 Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) *
87 Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE;
90 return (Gbl_NodeCacheNext++);
94 /*******************************************************************************
96 * FUNCTION: TrAllocateNode
98 * PARAMETERS: ParseOpcode - Opcode to be assigned to the node
100 * RETURN: New parse node. Aborts on allocation failure
102 * DESCRIPTION: Allocate and initialize a new parse node for the parse tree
104 ******************************************************************************/
110 ACPI_PARSE_OBJECT *Op;
113 Op = TrGetNextNode ();
115 Op->Asl.ParseOpcode = (UINT16) ParseOpcode;
116 Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
117 Op->Asl.LineNumber = Gbl_CurrentLineNumber;
118 Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber;
119 Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset;
120 Op->Asl.Column = Gbl_CurrentColumn;
122 UtSetParseOpName (Op);
127 /*******************************************************************************
129 * FUNCTION: TrReleaseNode
131 * PARAMETERS: Op - Op to be released
135 * DESCRIPTION: "release" a node. In truth, nothing is done since the node
136 * is part of a larger buffer
138 ******************************************************************************/
142 ACPI_PARSE_OBJECT *Op)
149 /*******************************************************************************
151 * FUNCTION: TrUpdateNode
153 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node
154 * Op - An existing parse node
156 * RETURN: The updated node
158 * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to
159 * change an opcode to DEFAULT_ARG so that the node is ignored
160 * during the code generation. Also used to set generic integers
161 * to a specific size (8, 16, 32, or 64 bits)
163 ******************************************************************************/
168 ACPI_PARSE_OBJECT *Op)
176 DbgPrint (ASL_PARSE_OUTPUT,
177 "\nUpdateNode: Old - %s, New - %s\n\n",
178 UtGetOpName (Op->Asl.ParseOpcode),
179 UtGetOpName (ParseOpcode));
181 /* Assign new opcode and name */
183 if (Op->Asl.ParseOpcode == PARSEOP_ONES)
187 case PARSEOP_BYTECONST:
188 Op->Asl.Value.Integer = 0xFF;
191 case PARSEOP_WORDCONST:
192 Op->Asl.Value.Integer = 0xFFFF;
195 case PARSEOP_DWORDCONST:
196 Op->Asl.Value.Integer = 0xFFFFFFFF;
200 /* Don't care about others, don't need to check QWORD */
205 Op->Asl.ParseOpcode = (UINT16) ParseOpcode;
206 UtSetParseOpName (Op);
209 * For the BYTE, WORD, and DWORD constants, make sure that the integer
210 * that was passed in will actually fit into the data type
214 case PARSEOP_BYTECONST:
215 Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
218 case PARSEOP_WORDCONST:
219 Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
222 case PARSEOP_DWORDCONST:
223 Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
227 /* Don't care about others, don't need to check QWORD */
235 /*******************************************************************************
237 * FUNCTION: TrGetNodeFlagName
239 * PARAMETERS: Flags - Flags word to be decoded
241 * RETURN: Name string. Always returns a valid string pointer.
243 * DESCRIPTION: Decode a flags word
245 ******************************************************************************/
255 return ("NODE_VISITED");
257 case NODE_AML_PACKAGE:
258 return ("NODE_AML_PACKAGE");
261 return ("NODE_IS_TARGET");
263 case NODE_IS_RESOURCE_DESC:
264 return ("NODE_IS_RESOURCE_DESC");
266 case NODE_IS_RESOURCE_FIELD:
267 return ("NODE_IS_RESOURCE_FIELD");
269 case NODE_HAS_NO_EXIT:
270 return ("NODE_HAS_NO_EXIT");
272 case NODE_IF_HAS_NO_EXIT:
273 return ("NODE_IF_HAS_NO_EXIT");
275 case NODE_NAME_INTERNALIZED:
276 return ("NODE_NAME_INTERNALIZED");
278 case NODE_METHOD_NO_RETVAL:
279 return ("NODE_METHOD_NO_RETVAL");
281 case NODE_METHOD_SOME_NO_RETVAL:
282 return ("NODE_METHOD_SOME_NO_RETVAL");
284 case NODE_RESULT_NOT_USED:
285 return ("NODE_RESULT_NOT_USED");
287 case NODE_METHOD_TYPED:
288 return ("NODE_METHOD_TYPED");
290 case NODE_IS_BIT_OFFSET:
291 return ("NODE_IS_BIT_OFFSET");
293 case NODE_COMPILE_TIME_CONST:
294 return ("NODE_COMPILE_TIME_CONST");
296 case NODE_IS_TERM_ARG:
297 return ("NODE_IS_TERM_ARG");
299 case NODE_WAS_ONES_OP:
300 return ("NODE_WAS_ONES_OP");
302 case NODE_IS_NAME_DECLARATION:
303 return ("NODE_IS_NAME_DECLARATION");
306 return ("Multiple Flags (or unknown flag) set");
311 /*******************************************************************************
313 * FUNCTION: TrSetNodeFlags
315 * PARAMETERS: Op - An existing parse node
316 * Flags - New flags word
318 * RETURN: The updated parser op
320 * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
322 ******************************************************************************/
326 ACPI_PARSE_OBJECT *Op,
330 DbgPrint (ASL_PARSE_OUTPUT,
331 "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags,
332 TrGetNodeFlagName (Flags));
339 Op->Asl.CompileFlags |= Flags;
345 /*******************************************************************************
347 * FUNCTION: TrSetEndLineNumber
349 * PARAMETERS: Op - An existing parse node
353 * DESCRIPTION: Set the ending line numbers (file line and logical line) of a
354 * parse node to the current line numbers.
356 ******************************************************************************/
360 ACPI_PARSE_OBJECT *Op)
363 /* If the end line # is already set, just return */
370 Op->Asl.EndLine = Gbl_CurrentLineNumber;
371 Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber;
375 /*******************************************************************************
377 * FUNCTION: TrCreateLeafNode
379 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node
381 * RETURN: Pointer to the new node. Aborts on allocation failure
383 * DESCRIPTION: Create a simple leaf node (no children or peers, and no value
384 * assigned to the node)
386 ******************************************************************************/
392 ACPI_PARSE_OBJECT *Op;
395 Op = TrAllocateNode (ParseOpcode);
397 DbgPrint (ASL_PARSE_OUTPUT,
398 "\nCreateLeafNode Ln/Col %u/%u NewNode %p Op %s\n\n",
399 Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode));
405 /*******************************************************************************
407 * FUNCTION: TrCreateConstantLeafNode
409 * PARAMETERS: ParseOpcode - The constant opcode
411 * RETURN: Pointer to the new node. Aborts on allocation failure
413 * DESCRIPTION: Create a leaf node (no children or peers) for one of the
414 * special constants - __LINE__, __FILE__, and __DATE__.
416 * Note: An implemenation of __FUNC__ cannot happen here because we don't
417 * have a full parse tree at this time and cannot find the parent control
418 * method. If it is ever needed, __FUNC__ must be implemented later, after
419 * the parse tree has been fully constructed.
421 ******************************************************************************/
424 TrCreateConstantLeafNode (
427 ACPI_PARSE_OBJECT *Op = NULL;
429 char *StaticTimeString;
435 case PARSEOP___LINE__:
436 Op = TrAllocateNode (PARSEOP_INTEGER);
437 Op->Asl.Value.Integer = Op->Asl.LineNumber;
440 case PARSEOP___FILE__:
441 Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
443 /* Op.Asl.Filename contains the full pathname to the file */
445 Op->Asl.Value.String = Op->Asl.Filename;
448 case PARSEOP___DATE__:
449 Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
451 /* Get a copy of the current time */
453 CurrentTime = time (NULL);
454 StaticTimeString = ctime (&CurrentTime);
455 TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
456 strcpy (TimeString, StaticTimeString);
458 TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
459 Op->Asl.Value.String = TimeString;
462 default: /* This would be an internal error */
466 DbgPrint (ASL_PARSE_OUTPUT,
467 "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
468 Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
469 ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
474 /*******************************************************************************
476 * FUNCTION: TrCreateValuedLeafNode
478 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node
479 * Value - Value to be assigned to the node
481 * RETURN: Pointer to the new node. Aborts on allocation failure
483 * DESCRIPTION: Create a leaf node (no children or peers) with a value
486 ******************************************************************************/
489 TrCreateValuedLeafNode (
493 ACPI_PARSE_OBJECT *Op;
496 Op = TrAllocateNode (ParseOpcode);
498 DbgPrint (ASL_PARSE_OUTPUT,
499 "\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
500 Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
501 ACPI_FORMAT_UINT64 (Value));
502 Op->Asl.Value.Integer = Value;
506 case PARSEOP_STRING_LITERAL:
507 DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);
510 case PARSEOP_NAMESEG:
511 DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);
514 case PARSEOP_NAMESTRING:
515 DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);
519 DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);
523 DbgPrint (ASL_PARSE_OUTPUT, "METHOD");
526 case PARSEOP_INTEGER:
527 DbgPrint (ASL_PARSE_OUTPUT, "INTEGER");
534 DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
539 /*******************************************************************************
541 * FUNCTION: TrCreateNode
543 * PARAMETERS: ParseOpcode - Opcode to be assigned to the node
544 * NumChildren - Number of children to follow
545 * ... - A list of child nodes to link to the new
546 * node. NumChildren long.
548 * RETURN: Pointer to the new node. Aborts on allocation failure
550 * DESCRIPTION: Create a new parse node and link together a list of child
551 * nodes underneath the new node.
553 ******************************************************************************/
561 ACPI_PARSE_OBJECT *Op;
562 ACPI_PARSE_OBJECT *Child;
563 ACPI_PARSE_OBJECT *PrevChild;
569 va_start (ap, NumChildren);
571 /* Allocate one new node */
573 Op = TrAllocateNode (ParseOpcode);
575 DbgPrint (ASL_PARSE_OUTPUT,
576 "\nCreateNode Ln/Col %u/%u NewParent %p Child %u Op %s ",
577 Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));
579 /* Some extra debug output based on the parse opcode */
583 case PARSEOP_DEFINITIONBLOCK:
585 DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
588 case PARSEOP_OPERATIONREGION:
589 DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");
593 DbgPrint (ASL_PARSE_OUTPUT, "OR->");
597 /* Nothing to do for other opcodes */
601 /* Link the new node to its children */
605 for (i = 0; i < NumChildren; i++)
607 /* Get the next child */
609 Child = va_arg (ap, ACPI_PARSE_OBJECT *);
610 DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
613 * If child is NULL, this means that an optional argument
614 * was omitted. We must create a placeholder with a special
615 * opcode (DEFAULT_ARG) so that the code generator will know
616 * that it must emit the correct default for this argument
620 Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);
623 /* Link first child to parent */
628 Op->Asl.Child = Child;
631 /* Point all children to parent */
633 Child->Asl.Parent = Op;
635 /* Link children in a peer list */
639 PrevChild->Asl.Next = Child;
643 * This child might be a list, point all nodes in the list
646 while (Child->Asl.Next)
648 Child = Child->Asl.Next;
649 Child->Asl.Parent = Op;
656 DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
661 /*******************************************************************************
663 * FUNCTION: TrLinkChildren
665 * PARAMETERS: Op - An existing parse node
666 * NumChildren - Number of children to follow
667 * ... - A list of child nodes to link to the new
668 * node. NumChildren long.
670 * RETURN: The updated (linked) node
672 * DESCRIPTION: Link a group of nodes to an existing parse node
674 ******************************************************************************/
678 ACPI_PARSE_OBJECT *Op,
682 ACPI_PARSE_OBJECT *Child;
683 ACPI_PARSE_OBJECT *PrevChild;
689 va_start (ap, NumChildren);
692 TrSetEndLineNumber (Op);
694 DbgPrint (ASL_PARSE_OUTPUT,
695 "\nLinkChildren Line [%u to %u] NewParent %p Child %u Op %s ",
696 Op->Asl.LineNumber, Op->Asl.EndLine,
697 Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode));
699 switch (Op->Asl.ParseOpcode)
701 case PARSEOP_DEFINITIONBLOCK:
703 DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
706 case PARSEOP_OPERATIONREGION:
707 DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");
711 DbgPrint (ASL_PARSE_OUTPUT, "OR->");
715 /* Nothing to do for other opcodes */
719 /* Link the new node to it's children */
723 for (i = 0; i < NumChildren; i++)
725 Child = va_arg (ap, ACPI_PARSE_OBJECT *);
727 if ((Child == PrevChild) && (Child != NULL))
729 AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,
730 "Child node list invalid");
734 DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
737 * If child is NULL, this means that an optional argument
738 * was omitted. We must create a placeholder with a special
739 * opcode (DEFAULT_ARG) so that the code generator will know
740 * that it must emit the correct default for this argument
744 Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);
747 /* Link first child to parent */
752 Op->Asl.Child = Child;
755 /* Point all children to parent */
757 Child->Asl.Parent = Op;
759 /* Link children in a peer list */
763 PrevChild->Asl.Next = Child;
767 * This child might be a list, point all nodes in the list
770 while (Child->Asl.Next)
772 Child = Child->Asl.Next;
773 Child->Asl.Parent = Op;
779 DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
784 /*******************************************************************************
786 * FUNCTION: TrLinkPeerNode
788 * PARAMETERS: Op1 - First peer
791 * RETURN: Op1 or the non-null node.
793 * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null.
795 ******************************************************************************/
799 ACPI_PARSE_OBJECT *Op1,
800 ACPI_PARSE_OBJECT *Op2)
802 ACPI_PARSE_OBJECT *Next;
805 DbgPrint (ASL_PARSE_OUTPUT,
806 "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n\n",
807 Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode) : NULL,
808 Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode) : NULL);
811 if ((!Op1) && (!Op2))
813 DbgPrint (ASL_PARSE_OUTPUT, "\nTwo Null nodes!\n");
817 /* If one of the nodes is null, just return the non-null node */
831 DbgPrint (ASL_DEBUG_OUTPUT,
832 "\n\n************* Internal error, linking node to itself %p\n\n\n",
834 AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1,
835 "Linking node to itself");
839 Op1->Asl.Parent = Op2->Asl.Parent;
842 * Op 1 may already have a peer list (such as an IF/ELSE pair),
843 * so we must walk to the end of the list and attach the new
847 while (Next->Asl.Next)
849 Next = Next->Asl.Next;
852 Next->Asl.Next = Op2;
857 /*******************************************************************************
859 * FUNCTION: TrLinkPeerNodes
861 * PARAMETERS: NumPeers - The number of nodes in the list to follow
862 * ... - A list of nodes to link together as peers
864 * RETURN: The first node in the list (head of the peer list)
866 * DESCRIPTION: Link together an arbitrary number of peer nodes.
868 ******************************************************************************/
875 ACPI_PARSE_OBJECT *This;
876 ACPI_PARSE_OBJECT *Next;
879 ACPI_PARSE_OBJECT *Start;
882 DbgPrint (ASL_PARSE_OUTPUT,
883 "\nLinkPeerNodes: (%u) ", NumPeers);
885 va_start (ap, NumPeers);
886 This = va_arg (ap, ACPI_PARSE_OBJECT *);
892 for (i = 0; i < (NumPeers -1); i++)
894 DbgPrint (ASL_PARSE_OUTPUT, "%u=%p ", (i+1), This);
896 while (This->Asl.Next)
898 This = This->Asl.Next;
901 /* Get another peer node */
903 Next = va_arg (ap, ACPI_PARSE_OBJECT *);
906 Next = TrAllocateNode (PARSEOP_DEFAULT_ARG);
909 /* link new node to the current node */
911 This->Asl.Next = Next;
916 DbgPrint (ASL_PARSE_OUTPUT,"\n\n");
921 /*******************************************************************************
923 * FUNCTION: TrLinkChildNode
925 * PARAMETERS: Op1 - Parent node
926 * Op2 - Op to become a child
928 * RETURN: The parent node
930 * DESCRIPTION: Link two nodes together as a parent and child
932 ******************************************************************************/
936 ACPI_PARSE_OBJECT *Op1,
937 ACPI_PARSE_OBJECT *Op2)
939 ACPI_PARSE_OBJECT *Next;
942 DbgPrint (ASL_PARSE_OUTPUT,
943 "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n\n",
944 Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL,
945 Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL);
952 Op1->Asl.Child = Op2;
954 /* Set the child and all peers of the child to point to the parent */
959 Next->Asl.Parent = Op1;
960 Next = Next->Asl.Next;
967 /*******************************************************************************
969 * FUNCTION: TrWalkParseTree
971 * PARAMETERS: Visitation - Type of walk
972 * DescendingCallback - Called during tree descent
973 * AscendingCallback - Called during tree ascent
974 * Context - To be passed to the callbacks
976 * RETURN: Status from callback(s)
978 * DESCRIPTION: Walk the entire parse tree.
980 ******************************************************************************/
984 ACPI_PARSE_OBJECT *Op,
986 ASL_WALK_CALLBACK DescendingCallback,
987 ASL_WALK_CALLBACK AscendingCallback,
991 BOOLEAN NodePreviouslyVisited;
992 ACPI_PARSE_OBJECT *StartOp = Op;
1002 NodePreviouslyVisited = FALSE;
1006 case ASL_WALK_VISIT_DOWNWARD:
1010 if (!NodePreviouslyVisited)
1012 /* Let the callback process the node. */
1014 Status = DescendingCallback (Op, Level, Context);
1015 if (ACPI_SUCCESS (Status))
1017 /* Visit children first, once */
1026 else if (Status != AE_CTRL_DEPTH)
1028 /* Exit immediately on any error */
1034 /* Terminate walk at start op */
1041 /* No more children, visit peers */
1046 NodePreviouslyVisited = FALSE;
1050 /* No children or peers, re-visit parent */
1056 Op = Op->Asl.Parent;
1057 NodePreviouslyVisited = TRUE;
1063 case ASL_WALK_VISIT_UPWARD:
1067 /* Visit leaf node (no children) or parent node on return trip */
1069 if ((!Op->Asl.Child) ||
1070 (NodePreviouslyVisited))
1072 /* Let the callback process the node. */
1074 Status = AscendingCallback (Op, Level, Context);
1075 if (ACPI_FAILURE (Status))
1082 /* Visit children first, once */
1089 /* Terminate walk at start op */
1096 /* No more children, visit peers */
1101 NodePreviouslyVisited = FALSE;
1105 /* No children or peers, re-visit parent */
1111 Op = Op->Asl.Parent;
1112 NodePreviouslyVisited = TRUE;
1118 case ASL_WALK_VISIT_TWICE:
1122 if (NodePreviouslyVisited)
1124 Status = AscendingCallback (Op, Level, Context);
1125 if (ACPI_FAILURE (Status))
1132 /* Let the callback process the node. */
1134 Status = DescendingCallback (Op, Level, Context);
1135 if (ACPI_SUCCESS (Status))
1137 /* Visit children first, once */
1146 else if (Status != AE_CTRL_DEPTH)
1148 /* Exit immediately on any error */
1154 /* Terminate walk at start op */
1161 /* No more children, visit peers */
1166 NodePreviouslyVisited = FALSE;
1170 /* No children or peers, re-visit parent */
1176 Op = Op->Asl.Parent;
1177 NodePreviouslyVisited = TRUE;
1183 /* No other types supported */
1187 /* If we get here, the walk completed with no errors */