1 /******************************************************************************
3 * Module Name: adwalk - Application-level disassembler parse tree walk routines
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
117 #include <contrib/dev/acpica/include/acpi.h>
118 #include <contrib/dev/acpica/include/accommon.h>
119 #include <contrib/dev/acpica/include/acparser.h>
120 #include <contrib/dev/acpica/include/amlcode.h>
121 #include <contrib/dev/acpica/include/acdisasm.h>
122 #include <contrib/dev/acpica/include/acdispat.h>
123 #include <contrib/dev/acpica/include/acnamesp.h>
124 #include <contrib/dev/acpica/include/acapps.h>
127 #define _COMPONENT ACPI_TOOLS
128 ACPI_MODULE_NAME ("adwalk")
131 * aslmap - opcode mappings and reserved method names
134 AslMapNamedOpcodeToDataType (
137 /* Local prototypes */
140 AcpiDmFindOrphanDescending (
141 ACPI_PARSE_OBJECT *Op,
146 AcpiDmDumpDescending (
147 ACPI_PARSE_OBJECT *Op,
152 AcpiDmXrefDescendingOp (
153 ACPI_PARSE_OBJECT *Op,
158 AcpiDmCommonAscendingOp (
159 ACPI_PARSE_OBJECT *Op,
164 AcpiDmLoadDescendingOp (
165 ACPI_PARSE_OBJECT *Op,
170 AcpiDmInspectPossibleArgs (
171 UINT32 CurrentOpArgCount,
173 ACPI_PARSE_OBJECT *Op);
176 AcpiDmResourceDescendingOp (
177 ACPI_PARSE_OBJECT *Op,
182 /*******************************************************************************
184 * FUNCTION: AcpiDmDumpTree
186 * PARAMETERS: Origin - Starting object
190 * DESCRIPTION: Parse tree walk to format and output the nodes
192 ******************************************************************************/
196 ACPI_PARSE_OBJECT *Origin)
198 ACPI_OP_WALK_INFO Info;
206 AcpiOsPrintf ("/*\nAML Parse Tree\n\n");
210 Info.WalkState = NULL;
211 AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
212 AcpiOsPrintf ("*/\n\n");
216 /*******************************************************************************
218 * FUNCTION: AcpiDmFindOrphanMethods
220 * PARAMETERS: Origin - Starting object
224 * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods
225 * that are not resolved in the namespace
227 ******************************************************************************/
230 AcpiDmFindOrphanMethods (
231 ACPI_PARSE_OBJECT *Origin)
233 ACPI_OP_WALK_INFO Info;
243 Info.WalkState = NULL;
244 AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
248 /*******************************************************************************
250 * FUNCTION: AcpiDmFinishNamespaceLoad
252 * PARAMETERS: ParseTreeRoot - Root of the parse tree
253 * NamespaceRoot - Root of the internal namespace
254 * OwnerId - OwnerId of the table to be disassembled
258 * DESCRIPTION: Load all namespace items that are created within control
259 * methods. Used before namespace cross reference
261 ******************************************************************************/
264 AcpiDmFinishNamespaceLoad (
265 ACPI_PARSE_OBJECT *ParseTreeRoot,
266 ACPI_NAMESPACE_NODE *NamespaceRoot,
267 ACPI_OWNER_ID OwnerId)
270 ACPI_OP_WALK_INFO Info;
271 ACPI_WALK_STATE *WalkState;
279 /* Create and initialize a new walk state */
281 WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL);
287 Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
288 if (ACPI_FAILURE (Status))
295 Info.WalkState = WalkState;
296 AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
297 AcpiDmCommonAscendingOp, &Info);
298 ACPI_FREE (WalkState);
302 /*******************************************************************************
304 * FUNCTION: AcpiDmCrossReferenceNamespace
306 * PARAMETERS: ParseTreeRoot - Root of the parse tree
307 * NamespaceRoot - Root of the internal namespace
308 * OwnerId - OwnerId of the table to be disassembled
312 * DESCRIPTION: Cross reference the namespace to create externals
314 ******************************************************************************/
317 AcpiDmCrossReferenceNamespace (
318 ACPI_PARSE_OBJECT *ParseTreeRoot,
319 ACPI_NAMESPACE_NODE *NamespaceRoot,
320 ACPI_OWNER_ID OwnerId)
323 ACPI_OP_WALK_INFO Info;
324 ACPI_WALK_STATE *WalkState;
332 /* Create and initialize a new walk state */
334 WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL);
340 Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
341 if (ACPI_FAILURE (Status))
348 Info.WalkState = WalkState;
349 AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
350 AcpiDmCommonAscendingOp, &Info);
351 ACPI_FREE (WalkState);
355 /*******************************************************************************
357 * FUNCTION: AcpiDmConvertResourceIndexes
359 * PARAMETERS: ParseTreeRoot - Root of the parse tree
360 * NamespaceRoot - Root of the internal namespace
364 * DESCRIPTION: Convert fixed-offset references to resource descriptors to
365 * symbolic references. Should only be called after namespace has
366 * been cross referenced.
368 ******************************************************************************/
371 AcpiDmConvertResourceIndexes (
372 ACPI_PARSE_OBJECT *ParseTreeRoot,
373 ACPI_NAMESPACE_NODE *NamespaceRoot)
376 ACPI_OP_WALK_INFO Info;
377 ACPI_WALK_STATE *WalkState;
385 /* Create and initialize a new walk state */
387 WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
393 Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
394 if (ACPI_FAILURE (Status))
401 Info.WalkState = WalkState;
402 AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
403 AcpiDmCommonAscendingOp, &Info);
404 ACPI_FREE (WalkState);
409 /*******************************************************************************
411 * FUNCTION: AcpiDmDumpDescending
413 * PARAMETERS: ASL_WALK_CALLBACK
417 * DESCRIPTION: Format and print contents of one parse Op.
419 ******************************************************************************/
422 AcpiDmDumpDescending (
423 ACPI_PARSE_OBJECT *Op,
427 ACPI_OP_WALK_INFO *Info = Context;
436 /* Most of the information (count, level, name) here */
439 AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level);
440 AcpiDmIndent (Level);
441 AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode));
443 /* Extra info is helpful */
445 switch (Op->Common.AmlOpcode)
450 AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
453 case AML_INT_NAMEPATH_OP:
454 if (Op->Common.Value.String)
456 AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
458 AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
463 AcpiOsPrintf ("[NULL]");
470 case AML_INT_NAMEDFIELD_OP:
471 AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op->Named.Name));
483 /*******************************************************************************
485 * FUNCTION: AcpiDmFindOrphanDescending
487 * PARAMETERS: ASL_WALK_CALLBACK
491 * DESCRIPTION: Check namepath Ops for orphaned method invocations
493 * Note: Experimental.
495 ******************************************************************************/
498 AcpiDmFindOrphanDescending (
499 ACPI_PARSE_OBJECT *Op,
503 const ACPI_OPCODE_INFO *OpInfo;
504 ACPI_PARSE_OBJECT *ChildOp;
505 ACPI_PARSE_OBJECT *NextOp;
506 ACPI_PARSE_OBJECT *ParentOp;
515 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
517 switch (Op->Common.AmlOpcode)
519 #ifdef ACPI_UNDER_DEVELOPMENT
521 ChildOp = Op->Common.Value.Arg;
522 if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
523 !ChildOp->Common.Node)
525 AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String,
527 AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op->Common.AmlOpName, Path);
530 NextOp = Op->Common.Next;
533 /* This NamePath has no args, assume it is an integer */
535 AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
539 ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp);
540 AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount, AcpiDmCountChildren (Op));
544 /* One Arg means this is just a Store(Name,Target) */
546 AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
550 AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
557 ChildOp = Op->Common.Value.Arg;
558 if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
559 !ChildOp->Common.Node)
561 NextOp = Op->Common.Next;
564 /* This NamePath has no args, assume it is an integer */
566 AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
570 ArgCount = AcpiDmInspectPossibleArgs (2, 1, NextOp);
573 /* One Arg means this is just a Store(Name,Target) */
575 AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
579 AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
583 case AML_INT_NAMEPATH_OP:
585 /* Must examine parent to see if this namepath is an argument */
587 ParentOp = Op->Common.Parent;
588 OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
590 if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
591 (OpInfo->Class != AML_CLASS_CREATE) &&
592 (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
595 ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next);
598 * Check if namepath is a predicate for if/while or lone parameter to
603 if (((ParentOp->Common.AmlOpcode == AML_IF_OP) ||
604 (ParentOp->Common.AmlOpcode == AML_WHILE_OP) ||
605 (ParentOp->Common.AmlOpcode == AML_RETURN_OP)) &&
607 /* And namepath is the first argument */
608 (ParentOp->Common.Value.Arg == Op))
610 AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_INTEGER, 0);
616 * This is a standalone namestring (not a parameter to another
617 * operator) - it *must* be a method invocation, nothing else is
618 * grammatically possible.
620 AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
633 /*******************************************************************************
635 * FUNCTION: AcpiDmLoadDescendingOp
637 * PARAMETERS: ASL_WALK_CALLBACK
641 * DESCRIPTION: Descending handler for namespace control method object load
643 ******************************************************************************/
646 AcpiDmLoadDescendingOp (
647 ACPI_PARSE_OBJECT *Op,
651 ACPI_OP_WALK_INFO *Info = Context;
652 const ACPI_OPCODE_INFO *OpInfo;
653 ACPI_WALK_STATE *WalkState;
654 ACPI_OBJECT_TYPE ObjectType;
657 ACPI_PARSE_OBJECT *NextOp;
658 ACPI_NAMESPACE_NODE *Node;
660 BOOLEAN PreDefined = FALSE;
661 UINT8 PreDefineIndex = 0;
664 WalkState = Info->WalkState;
665 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
666 ObjectType = OpInfo->ObjectType;
667 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
669 /* Only interested in operators that create new names */
671 if (!(OpInfo->Flags & AML_NAMED) &&
672 !(OpInfo->Flags & AML_CREATE))
677 /* Get the NamePath from the appropriate place */
679 if (OpInfo->Flags & AML_NAMED)
681 /* For all named operators, get the new name */
683 Path = (char *) Op->Named.Path;
685 if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
687 *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name;
692 else if (OpInfo->Flags & AML_CREATE)
694 /* New name is the last child */
696 NextOp = Op->Common.Value.Arg;
698 while (NextOp->Common.Next)
700 NextOp = NextOp->Common.Next;
702 Path = NextOp->Common.Value.String;
710 /* Insert the name into the namespace */
712 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
713 ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
716 Op->Common.Node = Node;
718 if (ACPI_SUCCESS (Status))
720 /* Check if it's a predefined node */
722 while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name)
724 if (!ACPI_STRNCMP (Node->Name.Ascii,
725 AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4))
735 * Set node owner id if it satisfies all the following conditions:
736 * 1) Not a predefined node, _SB_ etc
737 * 2) Not the root node
738 * 3) Not a node created by Scope
741 if (!PreDefined && Node != AcpiGbl_RootNode &&
742 Op->Common.AmlOpcode != AML_SCOPE_OP)
744 Node->OwnerId = WalkState->OwnerId;
751 if (AcpiNsOpensScope (ObjectType))
755 Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
756 if (ACPI_FAILURE (Status))
767 /*******************************************************************************
769 * FUNCTION: AcpiDmXrefDescendingOp
771 * PARAMETERS: ASL_WALK_CALLBACK
775 * DESCRIPTION: Descending handler for namespace cross reference
777 ******************************************************************************/
780 AcpiDmXrefDescendingOp (
781 ACPI_PARSE_OBJECT *Op,
785 ACPI_OP_WALK_INFO *Info = Context;
786 const ACPI_OPCODE_INFO *OpInfo;
787 ACPI_WALK_STATE *WalkState;
788 ACPI_OBJECT_TYPE ObjectType;
789 ACPI_OBJECT_TYPE ObjectType2;
792 ACPI_PARSE_OBJECT *NextOp;
793 ACPI_NAMESPACE_NODE *Node;
794 ACPI_OPERAND_OBJECT *Object;
795 UINT32 ParamCount = 0;
798 WalkState = Info->WalkState;
799 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
800 ObjectType = OpInfo->ObjectType;
801 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
803 if ((!(OpInfo->Flags & AML_NAMED)) &&
804 (!(OpInfo->Flags & AML_CREATE)) &&
805 (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
810 /* Get the NamePath from the appropriate place */
812 if (OpInfo->Flags & AML_NAMED)
814 if ((Op->Common.AmlOpcode == AML_ALIAS_OP) ||
815 (Op->Common.AmlOpcode == AML_SCOPE_OP))
818 * Only these two operators refer to an existing name,
821 Path = (char *) Op->Named.Path;
824 else if (OpInfo->Flags & AML_CREATE)
826 /* Referenced Buffer Name is the first child */
828 NextOp = Op->Common.Value.Arg;
829 if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
831 Path = NextOp->Common.Value.String;
836 Path = Op->Common.Value.String;
845 * Lookup the name in the namespace. Name must exist at this point, or it
846 * is an invalid reference.
848 * The namespace is also used as a lookup table for references to resource
849 * descriptors and the fields within them.
851 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
852 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
854 if (ACPI_FAILURE (Status))
856 if (Status == AE_NOT_FOUND)
858 AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0);
861 * We could install this into the namespace, but we catch duplicate
862 * externals when they are added to the list.
865 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
866 ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE,
873 * Found the node in external table, add it to external list
874 * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc
876 else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId)
878 ObjectType2 = ObjectType;
880 Object = AcpiNsGetAttachedObject (Node);
883 ObjectType2 = Object->Common.Type;
884 if (ObjectType2 == ACPI_TYPE_METHOD)
886 ParamCount = Object->Method.ParamCount;
890 AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount);
891 Op->Common.Node = Node;
895 Op->Common.Node = Node;
900 /* Open new scope if necessary */
902 if (AcpiNsOpensScope (ObjectType))
906 Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
907 if (ACPI_FAILURE (Status))
918 /*******************************************************************************
920 * FUNCTION: AcpiDmResourceDescendingOp
922 * PARAMETERS: ASL_WALK_CALLBACK
926 * DESCRIPTION: Process one parse op during symbolic resource index conversion.
928 ******************************************************************************/
931 AcpiDmResourceDescendingOp (
932 ACPI_PARSE_OBJECT *Op,
936 ACPI_OP_WALK_INFO *Info = Context;
937 const ACPI_OPCODE_INFO *OpInfo;
938 ACPI_WALK_STATE *WalkState;
939 ACPI_OBJECT_TYPE ObjectType;
943 WalkState = Info->WalkState;
944 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
946 /* Open new scope if necessary */
948 ObjectType = OpInfo->ObjectType;
949 if (AcpiNsOpensScope (ObjectType))
954 Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
955 if (ACPI_FAILURE (Status))
963 * Check if this operator contains a reference to a resource descriptor.
964 * If so, convert the reference into a symbolic reference.
966 AcpiDmCheckResourceReference (Op, WalkState);
971 /*******************************************************************************
973 * FUNCTION: AcpiDmCommonAscendingOp
975 * PARAMETERS: ASL_WALK_CALLBACK
979 * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes
980 * scope if necessary.
982 ******************************************************************************/
985 AcpiDmCommonAscendingOp (
986 ACPI_PARSE_OBJECT *Op,
990 ACPI_OP_WALK_INFO *Info = Context;
991 const ACPI_OPCODE_INFO *OpInfo;
992 ACPI_OBJECT_TYPE ObjectType;
995 /* Close scope if necessary */
997 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
998 ObjectType = OpInfo->ObjectType;
999 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
1001 if (AcpiNsOpensScope (ObjectType))
1003 (void) AcpiDsScopeStackPop (Info->WalkState);
1010 /*******************************************************************************
1012 * FUNCTION: AcpiDmInspectPossibleArgs
1014 * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the
1015 * possible method invocation found
1016 * TargetCount - Number of targets (0,1,2) for this op
1021 * DESCRIPTION: Examine following args and next ops for possible arguments
1022 * for an unrecognized method invocation.
1024 ******************************************************************************/
1027 AcpiDmInspectPossibleArgs (
1028 UINT32 CurrentOpArgCount,
1030 ACPI_PARSE_OBJECT *Op)
1032 const ACPI_OPCODE_INFO *OpInfo;
1038 Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;
1040 /* Lookahead for the maximum number of possible arguments */
1042 for (i = 0; i < Lookahead; i++)
1049 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
1052 * Any one of these operators is "very probably" not a method arg
1054 if ((Op->Common.AmlOpcode == AML_STORE_OP) ||
1055 (Op->Common.AmlOpcode == AML_NOTIFY_OP))
1060 if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
1061 (OpInfo->Class != AML_CLASS_CONTROL))
1066 Op = Op->Common.Next;