1 /******************************************************************************
3 * Module Name: adwalk - Application-level disassembler parse tree walk routines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
55 #define _COMPONENT ACPI_TOOLS
56 ACPI_MODULE_NAME ("adwalk")
59 * aslmap - opcode mappings and reserved method names
62 AslMapNamedOpcodeToDataType (
65 /* Local prototypes */
68 AcpiDmFindOrphanDescending (
69 ACPI_PARSE_OBJECT
*Op
,
74 AcpiDmDumpDescending (
75 ACPI_PARSE_OBJECT
*Op
,
80 AcpiDmXrefDescendingOp (
81 ACPI_PARSE_OBJECT
*Op
,
86 AcpiDmCommonAscendingOp (
87 ACPI_PARSE_OBJECT
*Op
,
92 AcpiDmLoadDescendingOp (
93 ACPI_PARSE_OBJECT
*Op
,
98 AcpiDmInspectPossibleArgs (
99 UINT32 CurrentOpArgCount
,
101 ACPI_PARSE_OBJECT
*Op
);
104 AcpiDmResourceDescendingOp (
105 ACPI_PARSE_OBJECT
*Op
,
110 /*******************************************************************************
112 * FUNCTION: AcpiDmDumpTree
114 * PARAMETERS: Origin - Starting object
118 * DESCRIPTION: Parse tree walk to format and output the nodes
120 ******************************************************************************/
124 ACPI_PARSE_OBJECT
*Origin
)
126 ACPI_OP_WALK_INFO Info
;
134 AcpiOsPrintf ("/*\nAML Parse Tree\n\n");
138 Info
.WalkState
= NULL
;
139 AcpiDmWalkParseTree (Origin
, AcpiDmDumpDescending
, NULL
, &Info
);
140 AcpiOsPrintf ("*/\n\n");
144 /*******************************************************************************
146 * FUNCTION: AcpiDmFindOrphanMethods
148 * PARAMETERS: Origin - Starting object
152 * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods
153 * that are not resolved in the namespace
155 ******************************************************************************/
158 AcpiDmFindOrphanMethods (
159 ACPI_PARSE_OBJECT
*Origin
)
161 ACPI_OP_WALK_INFO Info
;
171 Info
.WalkState
= NULL
;
172 AcpiDmWalkParseTree (Origin
, AcpiDmFindOrphanDescending
, NULL
, &Info
);
176 /*******************************************************************************
178 * FUNCTION: AcpiDmFinishNamespaceLoad
180 * PARAMETERS: ParseTreeRoot - Root of the parse tree
181 * NamespaceRoot - Root of the internal namespace
182 * OwnerId - OwnerId of the table to be disassembled
186 * DESCRIPTION: Load all namespace items that are created within control
187 * methods. Used before namespace cross reference
189 ******************************************************************************/
192 AcpiDmFinishNamespaceLoad (
193 ACPI_PARSE_OBJECT
*ParseTreeRoot
,
194 ACPI_NAMESPACE_NODE
*NamespaceRoot
,
195 ACPI_OWNER_ID OwnerId
)
198 ACPI_OP_WALK_INFO Info
;
199 ACPI_WALK_STATE
*WalkState
;
207 /* Create and initialize a new walk state */
209 WalkState
= AcpiDsCreateWalkState (OwnerId
, ParseTreeRoot
, NULL
, NULL
);
215 Status
= AcpiDsScopeStackPush (NamespaceRoot
, NamespaceRoot
->Type
, WalkState
);
216 if (ACPI_FAILURE (Status
))
223 Info
.WalkState
= WalkState
;
224 AcpiDmWalkParseTree (ParseTreeRoot
, AcpiDmLoadDescendingOp
,
225 AcpiDmCommonAscendingOp
, &Info
);
226 ACPI_FREE (WalkState
);
230 /*******************************************************************************
232 * FUNCTION: AcpiDmCrossReferenceNamespace
234 * PARAMETERS: ParseTreeRoot - Root of the parse tree
235 * NamespaceRoot - Root of the internal namespace
236 * OwnerId - OwnerId of the table to be disassembled
240 * DESCRIPTION: Cross reference the namespace to create externals
242 ******************************************************************************/
245 AcpiDmCrossReferenceNamespace (
246 ACPI_PARSE_OBJECT
*ParseTreeRoot
,
247 ACPI_NAMESPACE_NODE
*NamespaceRoot
,
248 ACPI_OWNER_ID OwnerId
)
251 ACPI_OP_WALK_INFO Info
;
252 ACPI_WALK_STATE
*WalkState
;
260 /* Create and initialize a new walk state */
262 WalkState
= AcpiDsCreateWalkState (OwnerId
, ParseTreeRoot
, NULL
, NULL
);
268 Status
= AcpiDsScopeStackPush (NamespaceRoot
, NamespaceRoot
->Type
, WalkState
);
269 if (ACPI_FAILURE (Status
))
276 Info
.WalkState
= WalkState
;
277 AcpiDmWalkParseTree (ParseTreeRoot
, AcpiDmXrefDescendingOp
,
278 AcpiDmCommonAscendingOp
, &Info
);
279 ACPI_FREE (WalkState
);
283 /*******************************************************************************
285 * FUNCTION: AcpiDmConvertResourceIndexes
287 * PARAMETERS: ParseTreeRoot - Root of the parse tree
288 * NamespaceRoot - Root of the internal namespace
292 * DESCRIPTION: Convert fixed-offset references to resource descriptors to
293 * symbolic references. Should only be called after namespace has
294 * been cross referenced.
296 ******************************************************************************/
299 AcpiDmConvertResourceIndexes (
300 ACPI_PARSE_OBJECT
*ParseTreeRoot
,
301 ACPI_NAMESPACE_NODE
*NamespaceRoot
)
304 ACPI_OP_WALK_INFO Info
;
305 ACPI_WALK_STATE
*WalkState
;
313 /* Create and initialize a new walk state */
315 WalkState
= AcpiDsCreateWalkState (0, ParseTreeRoot
, NULL
, NULL
);
321 Status
= AcpiDsScopeStackPush (NamespaceRoot
, NamespaceRoot
->Type
, WalkState
);
322 if (ACPI_FAILURE (Status
))
329 Info
.WalkState
= WalkState
;
330 AcpiDmWalkParseTree (ParseTreeRoot
, AcpiDmResourceDescendingOp
,
331 AcpiDmCommonAscendingOp
, &Info
);
332 ACPI_FREE (WalkState
);
337 /*******************************************************************************
339 * FUNCTION: AcpiDmDumpDescending
341 * PARAMETERS: ASL_WALK_CALLBACK
345 * DESCRIPTION: Format and print contents of one parse Op.
347 ******************************************************************************/
350 AcpiDmDumpDescending (
351 ACPI_PARSE_OBJECT
*Op
,
355 ACPI_OP_WALK_INFO
*Info
= Context
;
364 /* Most of the information (count, level, name) here */
367 AcpiOsPrintf ("% 5d [%2.2d] ", Info
->Count
, Level
);
368 AcpiDmIndent (Level
);
369 AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op
->Common
.AmlOpcode
));
371 /* Extra info is helpful */
373 switch (Op
->Common
.AmlOpcode
)
377 AcpiOsPrintf ("%2.2X", (UINT32
) Op
->Common
.Value
.Integer
);
382 AcpiOsPrintf ("%4.4X", (UINT32
) Op
->Common
.Value
.Integer
);
387 AcpiOsPrintf ("%8.8X", (UINT32
) Op
->Common
.Value
.Integer
);
392 AcpiOsPrintf ("%8.8X%8.8X", ACPI_FORMAT_UINT64 (Op
->Common
.Value
.Integer
));
395 case AML_INT_NAMEPATH_OP
:
397 if (Op
->Common
.Value
.String
)
399 AcpiNsExternalizeName (ACPI_UINT32_MAX
, Op
->Common
.Value
.String
,
401 AcpiOsPrintf ("%s %p", Path
, Op
->Common
.Node
);
406 AcpiOsPrintf ("[NULL]");
413 case AML_INT_NAMEDFIELD_OP
:
415 AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op
->Named
.Name
));
428 /*******************************************************************************
430 * FUNCTION: AcpiDmFindOrphanDescending
432 * PARAMETERS: ASL_WALK_CALLBACK
436 * DESCRIPTION: Check namepath Ops for orphaned method invocations
438 * Note: Experimental.
440 ******************************************************************************/
443 AcpiDmFindOrphanDescending (
444 ACPI_PARSE_OBJECT
*Op
,
448 const ACPI_OPCODE_INFO
*OpInfo
;
449 ACPI_PARSE_OBJECT
*ChildOp
;
450 ACPI_PARSE_OBJECT
*NextOp
;
451 ACPI_PARSE_OBJECT
*ParentOp
;
460 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
462 switch (Op
->Common
.AmlOpcode
)
464 #ifdef ACPI_UNDER_DEVELOPMENT
467 ChildOp
= Op
->Common
.Value
.Arg
;
468 if ((ChildOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
) &&
469 !ChildOp
->Common
.Node
)
471 AcpiNsExternalizeName (ACPI_UINT32_MAX
, ChildOp
->Common
.Value
.String
,
473 AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op
->Common
.AmlOpName
, Path
);
476 NextOp
= Op
->Common
.Next
;
479 /* This NamePath has no args, assume it is an integer */
481 AcpiDmAddToExternalList (ChildOp
, ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
485 ArgCount
= AcpiDmInspectPossibleArgs (3, 1, NextOp
);
486 AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount
, AcpiDmCountChildren (Op
));
490 /* One Arg means this is just a Store(Name,Target) */
492 AcpiDmAddToExternalList (ChildOp
, ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
496 AcpiDmAddToExternalList (ChildOp
, ChildOp
->Common
.Value
.String
, ACPI_TYPE_METHOD
, ArgCount
);
503 ChildOp
= Op
->Common
.Value
.Arg
;
504 if ((ChildOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
) &&
505 !ChildOp
->Common
.Node
)
507 NextOp
= Op
->Common
.Next
;
510 /* This NamePath has no args, assume it is an integer */
512 AcpiDmAddToExternalList (ChildOp
, ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
516 ArgCount
= AcpiDmInspectPossibleArgs (2, 1, NextOp
);
519 /* One Arg means this is just a Store(Name,Target) */
521 AcpiDmAddToExternalList (ChildOp
, ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
525 AcpiDmAddToExternalList (ChildOp
, ChildOp
->Common
.Value
.String
, ACPI_TYPE_METHOD
, ArgCount
);
529 case AML_INT_NAMEPATH_OP
:
531 /* Must examine parent to see if this namepath is an argument */
533 ParentOp
= Op
->Common
.Parent
;
534 OpInfo
= AcpiPsGetOpcodeInfo (ParentOp
->Common
.AmlOpcode
);
536 if ((OpInfo
->Class
!= AML_CLASS_EXECUTE
) &&
537 (OpInfo
->Class
!= AML_CLASS_CREATE
) &&
538 (OpInfo
->ObjectType
!= ACPI_TYPE_LOCAL_ALIAS
) &&
539 (ParentOp
->Common
.AmlOpcode
!= AML_INT_METHODCALL_OP
) &&
542 ArgCount
= AcpiDmInspectPossibleArgs (0, 0, Op
->Common
.Next
);
545 * Check if namepath is a predicate for if/while or lone parameter to
550 if (((ParentOp
->Common
.AmlOpcode
== AML_IF_OP
) ||
551 (ParentOp
->Common
.AmlOpcode
== AML_WHILE_OP
) ||
552 (ParentOp
->Common
.AmlOpcode
== AML_RETURN_OP
)) &&
554 /* And namepath is the first argument */
555 (ParentOp
->Common
.Value
.Arg
== Op
))
557 AcpiDmAddToExternalList (Op
, Op
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
563 * This is a standalone namestring (not a parameter to another
564 * operator) - it *must* be a method invocation, nothing else is
565 * grammatically possible.
567 AcpiDmAddToExternalList (Op
, Op
->Common
.Value
.String
, ACPI_TYPE_METHOD
, ArgCount
);
581 /*******************************************************************************
583 * FUNCTION: AcpiDmLoadDescendingOp
585 * PARAMETERS: ASL_WALK_CALLBACK
589 * DESCRIPTION: Descending handler for namespace control method object load
591 ******************************************************************************/
594 AcpiDmLoadDescendingOp (
595 ACPI_PARSE_OBJECT
*Op
,
599 ACPI_OP_WALK_INFO
*Info
= Context
;
600 const ACPI_OPCODE_INFO
*OpInfo
;
601 ACPI_WALK_STATE
*WalkState
;
602 ACPI_OBJECT_TYPE ObjectType
;
605 ACPI_PARSE_OBJECT
*NextOp
;
606 ACPI_NAMESPACE_NODE
*Node
;
608 BOOLEAN PreDefined
= FALSE
;
609 UINT8 PreDefineIndex
= 0;
612 WalkState
= Info
->WalkState
;
613 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
614 ObjectType
= OpInfo
->ObjectType
;
615 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
617 /* Only interested in operators that create new names */
619 if (!(OpInfo
->Flags
& AML_NAMED
) &&
620 !(OpInfo
->Flags
& AML_CREATE
))
625 /* Get the NamePath from the appropriate place */
627 if (OpInfo
->Flags
& AML_NAMED
)
629 /* For all named operators, get the new name */
631 Path
= (char *) Op
->Named
.Path
;
633 if (!Path
&& Op
->Common
.AmlOpcode
== AML_INT_NAMEDFIELD_OP
)
635 *ACPI_CAST_PTR (UINT32
, &FieldPath
[0]) = Op
->Named
.Name
;
640 else if (OpInfo
->Flags
& AML_CREATE
)
642 /* New name is the last child */
644 NextOp
= Op
->Common
.Value
.Arg
;
646 while (NextOp
->Common
.Next
)
648 NextOp
= NextOp
->Common
.Next
;
650 Path
= NextOp
->Common
.Value
.String
;
658 /* Insert the name into the namespace */
660 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ObjectType
,
661 ACPI_IMODE_LOAD_PASS2
, ACPI_NS_DONT_OPEN_SCOPE
,
664 Op
->Common
.Node
= Node
;
666 if (ACPI_SUCCESS (Status
))
668 /* Check if it's a predefined node */
670 while (AcpiGbl_PreDefinedNames
[PreDefineIndex
].Name
)
672 if (ACPI_COMPARE_NAME (Node
->Name
.Ascii
,
673 AcpiGbl_PreDefinedNames
[PreDefineIndex
].Name
))
683 * Set node owner id if it satisfies all the following conditions:
684 * 1) Not a predefined node, _SB_ etc
685 * 2) Not the root node
686 * 3) Not a node created by Scope
689 if (!PreDefined
&& Node
!= AcpiGbl_RootNode
&&
690 Op
->Common
.AmlOpcode
!= AML_SCOPE_OP
)
692 Node
->OwnerId
= WalkState
->OwnerId
;
699 if (AcpiNsOpensScope (ObjectType
))
703 Status
= AcpiDsScopeStackPush (Op
->Common
.Node
, ObjectType
, WalkState
);
704 if (ACPI_FAILURE (Status
))
715 /*******************************************************************************
717 * FUNCTION: AcpiDmXrefDescendingOp
719 * PARAMETERS: ASL_WALK_CALLBACK
723 * DESCRIPTION: Descending handler for namespace cross reference
725 ******************************************************************************/
728 AcpiDmXrefDescendingOp (
729 ACPI_PARSE_OBJECT
*Op
,
733 ACPI_OP_WALK_INFO
*Info
= Context
;
734 const ACPI_OPCODE_INFO
*OpInfo
;
735 ACPI_WALK_STATE
*WalkState
;
736 ACPI_OBJECT_TYPE ObjectType
;
737 ACPI_OBJECT_TYPE ObjectType2
;
740 ACPI_PARSE_OBJECT
*NextOp
;
741 ACPI_NAMESPACE_NODE
*Node
;
742 ACPI_OPERAND_OBJECT
*Object
;
743 UINT32 ParamCount
= 0;
746 WalkState
= Info
->WalkState
;
747 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
748 ObjectType
= OpInfo
->ObjectType
;
749 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
751 if ((!(OpInfo
->Flags
& AML_NAMED
)) &&
752 (!(OpInfo
->Flags
& AML_CREATE
)) &&
753 (Op
->Common
.AmlOpcode
!= AML_INT_NAMEPATH_OP
))
758 /* Get the NamePath from the appropriate place */
760 if (OpInfo
->Flags
& AML_NAMED
)
763 * Only these two operators (Alias, Scope) refer to an existing
764 * name, it is the first argument
766 if (Op
->Common
.AmlOpcode
== AML_ALIAS_OP
)
768 ObjectType
= ACPI_TYPE_ANY
;
770 NextOp
= Op
->Common
.Value
.Arg
;
771 NextOp
= NextOp
->Common
.Value
.Arg
;
772 if (NextOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
)
774 Path
= NextOp
->Common
.Value
.String
;
777 else if (Op
->Common
.AmlOpcode
== AML_SCOPE_OP
)
779 Path
= (char *) Op
->Named
.Path
;
782 else if (OpInfo
->Flags
& AML_CREATE
)
784 /* Referenced Buffer Name is the first child */
786 ObjectType
= ACPI_TYPE_BUFFER
; /* Change from TYPE_BUFFER_FIELD */
788 NextOp
= Op
->Common
.Value
.Arg
;
789 if (NextOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
)
791 Path
= NextOp
->Common
.Value
.String
;
796 Path
= Op
->Common
.Value
.String
;
805 * Lookup the name in the namespace. Name must exist at this point, or it
806 * is an invalid reference.
808 * The namespace is also used as a lookup table for references to resource
809 * descriptors and the fields within them.
811 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_ANY
,
812 ACPI_IMODE_EXECUTE
, ACPI_NS_SEARCH_PARENT
| ACPI_NS_DONT_OPEN_SCOPE
,
814 if (ACPI_SUCCESS (Status
) && (Node
->Flags
& ANOBJ_IS_EXTERNAL
))
816 Status
= AE_NOT_FOUND
;
819 if (ACPI_FAILURE (Status
))
821 if (Status
== AE_NOT_FOUND
)
824 * Add this symbol as an external declaration, except if the
825 * parent is a CondRefOf operator. For this operator, we do not
826 * need an external, nor do we want one, since this can cause
827 * disassembly problems if the symbol is actually a control
830 if (!(Op
->Asl
.Parent
&&
831 (Op
->Asl
.Parent
->Asl
.AmlOpcode
== AML_COND_REF_OF_OP
)))
833 AcpiDmAddToExternalList (Op
, Path
, (UINT8
) ObjectType
, 0);
839 * Found the node in external table, add it to external list
840 * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc
842 else if (Node
->OwnerId
&& WalkState
->OwnerId
!= Node
->OwnerId
)
844 ObjectType2
= ObjectType
;
846 Object
= AcpiNsGetAttachedObject (Node
);
849 ObjectType2
= Object
->Common
.Type
;
850 if (ObjectType2
== ACPI_TYPE_METHOD
)
852 ParamCount
= Object
->Method
.ParamCount
;
856 AcpiDmAddToExternalList (Op
, Path
, (UINT8
) ObjectType2
, ParamCount
| 0x80);
857 Op
->Common
.Node
= Node
;
861 Op
->Common
.Node
= Node
;
866 /* Open new scope if necessary */
868 if (AcpiNsOpensScope (ObjectType
))
872 Status
= AcpiDsScopeStackPush (Op
->Common
.Node
, ObjectType
, WalkState
);
873 if (ACPI_FAILURE (Status
))
884 /*******************************************************************************
886 * FUNCTION: AcpiDmResourceDescendingOp
888 * PARAMETERS: ASL_WALK_CALLBACK
892 * DESCRIPTION: Process one parse op during symbolic resource index conversion.
894 ******************************************************************************/
897 AcpiDmResourceDescendingOp (
898 ACPI_PARSE_OBJECT
*Op
,
902 ACPI_OP_WALK_INFO
*Info
= Context
;
903 const ACPI_OPCODE_INFO
*OpInfo
;
904 ACPI_WALK_STATE
*WalkState
;
905 ACPI_OBJECT_TYPE ObjectType
;
909 WalkState
= Info
->WalkState
;
910 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
912 /* Open new scope if necessary */
914 ObjectType
= OpInfo
->ObjectType
;
915 if (AcpiNsOpensScope (ObjectType
))
920 Status
= AcpiDsScopeStackPush (Op
->Common
.Node
, ObjectType
, WalkState
);
921 if (ACPI_FAILURE (Status
))
929 * Check if this operator contains a reference to a resource descriptor.
930 * If so, convert the reference into a symbolic reference.
932 AcpiDmCheckResourceReference (Op
, WalkState
);
937 /*******************************************************************************
939 * FUNCTION: AcpiDmCommonAscendingOp
941 * PARAMETERS: ASL_WALK_CALLBACK
945 * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes
946 * scope if necessary.
948 ******************************************************************************/
951 AcpiDmCommonAscendingOp (
952 ACPI_PARSE_OBJECT
*Op
,
956 ACPI_OP_WALK_INFO
*Info
= Context
;
957 const ACPI_OPCODE_INFO
*OpInfo
;
958 ACPI_OBJECT_TYPE ObjectType
;
961 /* Close scope if necessary */
963 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
964 ObjectType
= OpInfo
->ObjectType
;
965 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
967 if (AcpiNsOpensScope (ObjectType
))
969 (void) AcpiDsScopeStackPop (Info
->WalkState
);
976 /*******************************************************************************
978 * FUNCTION: AcpiDmInspectPossibleArgs
980 * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the
981 * possible method invocation found
982 * TargetCount - Number of targets (0,1,2) for this op
987 * DESCRIPTION: Examine following args and next ops for possible arguments
988 * for an unrecognized method invocation.
990 ******************************************************************************/
993 AcpiDmInspectPossibleArgs (
994 UINT32 CurrentOpArgCount
,
996 ACPI_PARSE_OBJECT
*Op
)
998 const ACPI_OPCODE_INFO
*OpInfo
;
1004 Lookahead
= (ACPI_METHOD_NUM_ARGS
+ TargetCount
) - CurrentOpArgCount
;
1006 /* Lookahead for the maximum number of possible arguments */
1008 for (i
= 0; i
< Lookahead
; i
++)
1015 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
1018 * Any one of these operators is "very probably" not a method arg
1020 if ((Op
->Common
.AmlOpcode
== AML_STORE_OP
) ||
1021 (Op
->Common
.AmlOpcode
== AML_NOTIFY_OP
))
1026 if ((OpInfo
->Class
!= AML_CLASS_EXECUTE
) &&
1027 (OpInfo
->Class
!= AML_CLASS_CONTROL
))
1032 Op
= Op
->Common
.Next
;