1 /******************************************************************************
3 * Module Name: adwalk - Application-level disassembler parse tree walk routines
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2009, 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 *****************************************************************************/
118 #include "accommon.h"
119 #include "acparser.h"
122 #include "acdisasm.h"
123 #include "acdispat.h"
124 #include "acnamesp.h"
128 #define _COMPONENT ACPI_TOOLS
129 ACPI_MODULE_NAME ("adwalk")
132 * aslmap - opcode mappings and reserved method names
135 AslMapNamedOpcodeToDataType (
138 /* Local prototypes */
141 AcpiDmFindOrphanDescending (
142 ACPI_PARSE_OBJECT
*Op
,
147 AcpiDmDumpDescending (
148 ACPI_PARSE_OBJECT
*Op
,
153 AcpiDmXrefDescendingOp (
154 ACPI_PARSE_OBJECT
*Op
,
159 AcpiDmCommonAscendingOp (
160 ACPI_PARSE_OBJECT
*Op
,
165 AcpiDmLoadDescendingOp (
166 ACPI_PARSE_OBJECT
*Op
,
171 AcpiDmInspectPossibleArgs (
172 UINT32 CurrentOpArgCount
,
174 ACPI_PARSE_OBJECT
*Op
);
177 AcpiDmResourceDescendingOp (
178 ACPI_PARSE_OBJECT
*Op
,
183 /*******************************************************************************
185 * FUNCTION: AcpiDmDumpTree
187 * PARAMETERS: Origin - Starting object
191 * DESCRIPTION: Parse tree walk to format and output the nodes
193 ******************************************************************************/
197 ACPI_PARSE_OBJECT
*Origin
)
199 ACPI_OP_WALK_INFO Info
;
207 AcpiOsPrintf ("/*\nAML Parse Tree\n\n");
211 Info
.WalkState
= NULL
;
212 AcpiDmWalkParseTree (Origin
, AcpiDmDumpDescending
, NULL
, &Info
);
213 AcpiOsPrintf ("*/\n\n");
217 /*******************************************************************************
219 * FUNCTION: AcpiDmFindOrphanMethods
221 * PARAMETERS: Origin - Starting object
225 * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods
226 * that are not resolved in the namespace
228 ******************************************************************************/
231 AcpiDmFindOrphanMethods (
232 ACPI_PARSE_OBJECT
*Origin
)
234 ACPI_OP_WALK_INFO Info
;
244 Info
.WalkState
= NULL
;
245 AcpiDmWalkParseTree (Origin
, AcpiDmFindOrphanDescending
, NULL
, &Info
);
249 /*******************************************************************************
251 * FUNCTION: AcpiDmFinishNamespaceLoad
253 * PARAMETERS: ParseTreeRoot - Root of the parse tree
254 * NamespaceRoot - Root of the internal namespace
255 * OwnerId - OwnerId of the table to be disassembled
259 * DESCRIPTION: Load all namespace items that are created within control
260 * methods. Used before namespace cross reference
262 ******************************************************************************/
265 AcpiDmFinishNamespaceLoad (
266 ACPI_PARSE_OBJECT
*ParseTreeRoot
,
267 ACPI_NAMESPACE_NODE
*NamespaceRoot
,
268 ACPI_OWNER_ID OwnerId
)
271 ACPI_OP_WALK_INFO Info
;
272 ACPI_WALK_STATE
*WalkState
;
280 /* Create and initialize a new walk state */
282 WalkState
= AcpiDsCreateWalkState (OwnerId
, ParseTreeRoot
, NULL
, NULL
);
288 Status
= AcpiDsScopeStackPush (NamespaceRoot
, NamespaceRoot
->Type
, WalkState
);
289 if (ACPI_FAILURE (Status
))
296 Info
.WalkState
= WalkState
;
297 AcpiDmWalkParseTree (ParseTreeRoot
, AcpiDmLoadDescendingOp
,
298 AcpiDmCommonAscendingOp
, &Info
);
299 ACPI_FREE (WalkState
);
303 /*******************************************************************************
305 * FUNCTION: AcpiDmCrossReferenceNamespace
307 * PARAMETERS: ParseTreeRoot - Root of the parse tree
308 * NamespaceRoot - Root of the internal namespace
309 * OwnerId - OwnerId of the table to be disassembled
313 * DESCRIPTION: Cross reference the namespace to create externals
315 ******************************************************************************/
318 AcpiDmCrossReferenceNamespace (
319 ACPI_PARSE_OBJECT
*ParseTreeRoot
,
320 ACPI_NAMESPACE_NODE
*NamespaceRoot
,
321 ACPI_OWNER_ID OwnerId
)
324 ACPI_OP_WALK_INFO Info
;
325 ACPI_WALK_STATE
*WalkState
;
333 /* Create and initialize a new walk state */
335 WalkState
= AcpiDsCreateWalkState (OwnerId
, ParseTreeRoot
, NULL
, NULL
);
341 Status
= AcpiDsScopeStackPush (NamespaceRoot
, NamespaceRoot
->Type
, WalkState
);
342 if (ACPI_FAILURE (Status
))
349 Info
.WalkState
= WalkState
;
350 AcpiDmWalkParseTree (ParseTreeRoot
, AcpiDmXrefDescendingOp
,
351 AcpiDmCommonAscendingOp
, &Info
);
352 ACPI_FREE (WalkState
);
356 /*******************************************************************************
358 * FUNCTION: AcpiDmConvertResourceIndexes
360 * PARAMETERS: ParseTreeRoot - Root of the parse tree
361 * NamespaceRoot - Root of the internal namespace
365 * DESCRIPTION: Convert fixed-offset references to resource descriptors to
366 * symbolic references. Should only be called after namespace has
367 * been cross referenced.
369 ******************************************************************************/
372 AcpiDmConvertResourceIndexes (
373 ACPI_PARSE_OBJECT
*ParseTreeRoot
,
374 ACPI_NAMESPACE_NODE
*NamespaceRoot
)
377 ACPI_OP_WALK_INFO Info
;
378 ACPI_WALK_STATE
*WalkState
;
386 /* Create and initialize a new walk state */
388 WalkState
= AcpiDsCreateWalkState (0, ParseTreeRoot
, NULL
, NULL
);
394 Status
= AcpiDsScopeStackPush (NamespaceRoot
, NamespaceRoot
->Type
, WalkState
);
395 if (ACPI_FAILURE (Status
))
402 Info
.WalkState
= WalkState
;
403 AcpiDmWalkParseTree (ParseTreeRoot
, AcpiDmResourceDescendingOp
,
404 AcpiDmCommonAscendingOp
, &Info
);
405 ACPI_FREE (WalkState
);
410 /*******************************************************************************
412 * FUNCTION: AcpiDmDumpDescending
414 * PARAMETERS: ASL_WALK_CALLBACK
418 * DESCRIPTION: Format and print contents of one parse Op.
420 ******************************************************************************/
423 AcpiDmDumpDescending (
424 ACPI_PARSE_OBJECT
*Op
,
428 ACPI_OP_WALK_INFO
*Info
= Context
;
429 const ACPI_OPCODE_INFO
*OpInfo
;
438 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
441 /* Most of the information (count, level, name) here */
443 AcpiOsPrintf ("% 5d [%2.2d] ", Info
->Count
, Level
);
444 AcpiDmIndent (Level
);
445 AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op
->Common
.AmlOpcode
));
447 /* Extra info is helpful */
449 switch (Op
->Common
.AmlOpcode
)
454 AcpiOsPrintf ("%X", (UINT32
) Op
->Common
.Value
.Integer
);
457 case AML_INT_NAMEPATH_OP
:
458 if (Op
->Common
.Value
.String
)
460 AcpiNsExternalizeName (ACPI_UINT32_MAX
, Op
->Common
.Value
.String
,
462 AcpiOsPrintf ("%s %p", Path
, Op
->Common
.Node
);
467 AcpiOsPrintf ("[NULL]");
474 case AML_INT_NAMEDFIELD_OP
:
475 AcpiOsPrintf ("%4.4s", &Op
->Named
.Name
);
487 /*******************************************************************************
489 * FUNCTION: AcpiDmFindOrphanDescending
491 * PARAMETERS: ASL_WALK_CALLBACK
495 * DESCRIPTION: Check namepath Ops for orphaned method invocations
497 * Note: Experimental.
499 ******************************************************************************/
502 AcpiDmFindOrphanDescending (
503 ACPI_PARSE_OBJECT
*Op
,
507 const ACPI_OPCODE_INFO
*OpInfo
;
508 ACPI_PARSE_OBJECT
*ChildOp
;
509 ACPI_PARSE_OBJECT
*NextOp
;
510 ACPI_PARSE_OBJECT
*ParentOp
;
519 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
521 switch (Op
->Common
.AmlOpcode
)
523 #ifdef ACPI_UNDER_DEVELOPMENT
525 ChildOp
= Op
->Common
.Value
.Arg
;
526 if ((ChildOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
) &&
527 !ChildOp
->Common
.Node
)
529 AcpiNsExternalizeName (ACPI_UINT32_MAX
, ChildOp
->Common
.Value
.String
,
531 AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op
->Common
.AmlOpName
, Path
);
534 NextOp
= Op
->Common
.Next
;
537 /* This NamePath has no args, assume it is an integer */
539 AcpiDmAddToExternalList (ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
543 ArgCount
= AcpiDmInspectPossibleArgs (3, 1, NextOp
);
544 AcpiOsPrintf ("/* A-CHILDREN: %d Actual %d */\n", ArgCount
, AcpiDmCountChildren (Op
));
548 /* One Arg means this is just a Store(Name,Target) */
550 AcpiDmAddToExternalList (ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
554 AcpiDmAddToExternalList (ChildOp
->Common
.Value
.String
, ACPI_TYPE_METHOD
, ArgCount
);
561 ChildOp
= Op
->Common
.Value
.Arg
;
562 if ((ChildOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
) &&
563 !ChildOp
->Common
.Node
)
565 NextOp
= Op
->Common
.Next
;
568 /* This NamePath has no args, assume it is an integer */
570 AcpiDmAddToExternalList (ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
574 ArgCount
= AcpiDmInspectPossibleArgs (2, 1, NextOp
);
577 /* One Arg means this is just a Store(Name,Target) */
579 AcpiDmAddToExternalList (ChildOp
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
583 AcpiDmAddToExternalList (ChildOp
->Common
.Value
.String
, ACPI_TYPE_METHOD
, ArgCount
);
587 case AML_INT_NAMEPATH_OP
:
589 /* Must examine parent to see if this namepath is an argument */
591 ParentOp
= Op
->Common
.Parent
;
592 OpInfo
= AcpiPsGetOpcodeInfo (ParentOp
->Common
.AmlOpcode
);
594 if ((OpInfo
->Class
!= AML_CLASS_EXECUTE
) &&
595 (OpInfo
->Class
!= AML_CLASS_CREATE
) &&
596 (ParentOp
->Common
.AmlOpcode
!= AML_INT_METHODCALL_OP
) &&
599 ArgCount
= AcpiDmInspectPossibleArgs (0, 0, Op
->Common
.Next
);
602 * Check if namepath is a predicate for if/while or lone parameter to
607 if (((ParentOp
->Common
.AmlOpcode
== AML_IF_OP
) ||
608 (ParentOp
->Common
.AmlOpcode
== AML_WHILE_OP
) ||
609 (ParentOp
->Common
.AmlOpcode
== AML_RETURN_OP
)) &&
611 /* And namepath is the first argument */
612 (ParentOp
->Common
.Value
.Arg
== Op
))
614 AcpiDmAddToExternalList (Op
->Common
.Value
.String
, ACPI_TYPE_INTEGER
, 0);
620 * This is a standalone namestring (not a parameter to another
621 * operator) - it *must* be a method invocation, nothing else is
622 * grammatically possible.
624 AcpiDmAddToExternalList (Op
->Common
.Value
.String
, ACPI_TYPE_METHOD
, ArgCount
);
637 /*******************************************************************************
639 * FUNCTION: AcpiDmLoadDescendingOp
641 * PARAMETERS: ASL_WALK_CALLBACK
645 * DESCRIPTION: Descending handler for namespace control method object load
647 ******************************************************************************/
650 AcpiDmLoadDescendingOp (
651 ACPI_PARSE_OBJECT
*Op
,
655 ACPI_OP_WALK_INFO
*Info
= Context
;
656 const ACPI_OPCODE_INFO
*OpInfo
;
657 ACPI_WALK_STATE
*WalkState
;
658 ACPI_OBJECT_TYPE ObjectType
;
661 ACPI_PARSE_OBJECT
*NextOp
;
662 ACPI_NAMESPACE_NODE
*Node
;
664 BOOLEAN PreDefined
= FALSE
;
665 UINT8 PreDefineIndex
= 0;
668 WalkState
= Info
->WalkState
;
669 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
670 ObjectType
= OpInfo
->ObjectType
;
671 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
673 /* Only interested in operators that create new names */
675 if (!(OpInfo
->Flags
& AML_NAMED
) &&
676 !(OpInfo
->Flags
& AML_CREATE
))
681 /* Get the NamePath from the appropriate place */
683 if (OpInfo
->Flags
& AML_NAMED
)
685 /* For all named operators, get the new name */
687 Path
= (char *) Op
->Named
.Path
;
689 if (!Path
&& Op
->Common
.AmlOpcode
== AML_INT_NAMEDFIELD_OP
)
691 *ACPI_CAST_PTR (UINT32
, &FieldPath
[0]) = Op
->Named
.Name
;
696 else if (OpInfo
->Flags
& AML_CREATE
)
698 /* New name is the last child */
700 NextOp
= Op
->Common
.Value
.Arg
;
702 while (NextOp
->Common
.Next
)
704 NextOp
= NextOp
->Common
.Next
;
706 Path
= NextOp
->Common
.Value
.String
;
714 /* Insert the name into the namespace */
716 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ObjectType
,
717 ACPI_IMODE_LOAD_PASS2
, ACPI_NS_DONT_OPEN_SCOPE
,
720 Op
->Common
.Node
= Node
;
722 if (ACPI_SUCCESS (Status
))
724 /* Check if it's a predefined node */
726 while (AcpiGbl_PreDefinedNames
[PreDefineIndex
].Name
)
728 if (!ACPI_STRNCMP (Node
->Name
.Ascii
,
729 AcpiGbl_PreDefinedNames
[PreDefineIndex
].Name
, 4))
739 * Set node owner id if it satisfies all the following conditions:
740 * 1) Not a predefined node, _SB_ etc
741 * 2) Not the root node
742 * 3) Not a node created by Scope
745 if (!PreDefined
&& Node
!= AcpiGbl_RootNode
&&
746 Op
->Common
.AmlOpcode
!= AML_SCOPE_OP
)
748 Node
->OwnerId
= WalkState
->OwnerId
;
755 if (AcpiNsOpensScope (ObjectType
))
759 Status
= AcpiDsScopeStackPush (Op
->Common
.Node
, ObjectType
, WalkState
);
760 if (ACPI_FAILURE (Status
))
771 /*******************************************************************************
773 * FUNCTION: AcpiDmXrefDescendingOp
775 * PARAMETERS: ASL_WALK_CALLBACK
779 * DESCRIPTION: Descending handler for namespace cross reference
781 ******************************************************************************/
784 AcpiDmXrefDescendingOp (
785 ACPI_PARSE_OBJECT
*Op
,
789 ACPI_OP_WALK_INFO
*Info
= Context
;
790 const ACPI_OPCODE_INFO
*OpInfo
;
791 ACPI_WALK_STATE
*WalkState
;
792 ACPI_OBJECT_TYPE ObjectType
;
793 ACPI_OBJECT_TYPE ObjectType2
;
796 ACPI_PARSE_OBJECT
*NextOp
;
797 ACPI_NAMESPACE_NODE
*Node
;
798 ACPI_OPERAND_OBJECT
*Object
;
801 WalkState
= Info
->WalkState
;
802 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
803 ObjectType
= OpInfo
->ObjectType
;
804 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
806 if ((!(OpInfo
->Flags
& AML_NAMED
)) &&
807 (!(OpInfo
->Flags
& AML_CREATE
)) &&
808 (Op
->Common
.AmlOpcode
!= AML_INT_NAMEPATH_OP
))
813 /* Get the NamePath from the appropriate place */
815 if (OpInfo
->Flags
& AML_NAMED
)
817 if ((Op
->Common
.AmlOpcode
== AML_ALIAS_OP
) ||
818 (Op
->Common
.AmlOpcode
== AML_SCOPE_OP
))
821 * Only these two operators refer to an existing name,
824 Path
= (char *) Op
->Named
.Path
;
827 else if (OpInfo
->Flags
& AML_CREATE
)
829 /* Referenced Buffer Name is the first child */
831 NextOp
= Op
->Common
.Value
.Arg
;
832 if (NextOp
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
)
834 Path
= NextOp
->Common
.Value
.String
;
839 Path
= Op
->Common
.Value
.String
;
848 * Lookup the name in the namespace. Name must exist at this point, or it
849 * is an invalid reference.
851 * The namespace is also used as a lookup table for references to resource
852 * descriptors and the fields within them.
854 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_ANY
,
855 ACPI_IMODE_EXECUTE
, ACPI_NS_SEARCH_PARENT
| ACPI_NS_DONT_OPEN_SCOPE
,
857 if (ACPI_FAILURE (Status
))
859 if (Status
== AE_NOT_FOUND
)
861 AcpiDmAddToExternalList (Path
, (UINT8
) ObjectType
, 0);
864 * We could install this into the namespace, but we catch duplicate
865 * externals when they are added to the list.
868 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_ANY
,
869 ACPI_IMODE_LOAD_PASS1
, ACPI_NS_DONT_OPEN_SCOPE
,
876 * Found the node in external table, add it to external list
877 * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc
879 else if (Node
->OwnerId
&& WalkState
->OwnerId
!= Node
->OwnerId
)
881 ObjectType2
= ObjectType
;
883 Object
= AcpiNsGetAttachedObject (Node
);
886 ObjectType2
= Object
->Common
.Type
;
889 if (ObjectType2
== ACPI_TYPE_METHOD
)
891 AcpiDmAddToExternalList (Path
, ACPI_TYPE_METHOD
,
892 Object
->Method
.ParamCount
);
896 AcpiDmAddToExternalList (Path
, (UINT8
) ObjectType2
, 0);
899 Op
->Common
.Node
= Node
;
903 Op
->Common
.Node
= Node
;
908 /* Open new scope if necessary */
910 if (AcpiNsOpensScope (ObjectType
))
914 Status
= AcpiDsScopeStackPush (Op
->Common
.Node
, ObjectType
, WalkState
);
915 if (ACPI_FAILURE (Status
))
926 /*******************************************************************************
928 * FUNCTION: AcpiDmResourceDescendingOp
930 * PARAMETERS: ASL_WALK_CALLBACK
934 * DESCRIPTION: Process one parse op during symbolic resource index conversion.
936 ******************************************************************************/
939 AcpiDmResourceDescendingOp (
940 ACPI_PARSE_OBJECT
*Op
,
944 ACPI_OP_WALK_INFO
*Info
= Context
;
945 const ACPI_OPCODE_INFO
*OpInfo
;
946 ACPI_WALK_STATE
*WalkState
;
947 ACPI_OBJECT_TYPE ObjectType
;
951 WalkState
= Info
->WalkState
;
952 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
954 /* Open new scope if necessary */
956 ObjectType
= OpInfo
->ObjectType
;
957 if (AcpiNsOpensScope (ObjectType
))
962 Status
= AcpiDsScopeStackPush (Op
->Common
.Node
, ObjectType
, WalkState
);
963 if (ACPI_FAILURE (Status
))
971 * Check if this operator contains a reference to a resource descriptor.
972 * If so, convert the reference into a symbolic reference.
974 AcpiDmCheckResourceReference (Op
, WalkState
);
979 /*******************************************************************************
981 * FUNCTION: AcpiDmCommonAscendingOp
983 * PARAMETERS: ASL_WALK_CALLBACK
987 * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes
988 * scope if necessary.
990 ******************************************************************************/
993 AcpiDmCommonAscendingOp (
994 ACPI_PARSE_OBJECT
*Op
,
998 ACPI_OP_WALK_INFO
*Info
= Context
;
999 const ACPI_OPCODE_INFO
*OpInfo
;
1000 ACPI_OBJECT_TYPE ObjectType
;
1003 /* Close scope if necessary */
1005 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
1006 ObjectType
= OpInfo
->ObjectType
;
1007 ObjectType
= AslMapNamedOpcodeToDataType (Op
->Asl
.AmlOpcode
);
1009 if (AcpiNsOpensScope (ObjectType
))
1011 (void) AcpiDsScopeStackPop (Info
->WalkState
);
1018 /*******************************************************************************
1020 * FUNCTION: AcpiDmInspectPossibleArgs
1022 * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the
1023 * possible method invocation found
1024 * TargetCount - Number of targets (0,1,2) for this op
1029 * DESCRIPTION: Examine following args and next ops for possible arguments
1030 * for an unrecognized method invocation.
1032 ******************************************************************************/
1035 AcpiDmInspectPossibleArgs (
1036 UINT32 CurrentOpArgCount
,
1038 ACPI_PARSE_OBJECT
*Op
)
1040 const ACPI_OPCODE_INFO
*OpInfo
;
1046 Lookahead
= (ACPI_METHOD_NUM_ARGS
+ TargetCount
) - CurrentOpArgCount
;
1048 /* Lookahead for the maximum number of possible arguments */
1050 for (i
= 0; i
< Lookahead
; i
++)
1057 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.AmlOpcode
);
1060 * Any one of these operators is "very probably" not a method arg
1062 if ((Op
->Common
.AmlOpcode
== AML_STORE_OP
) ||
1063 (Op
->Common
.AmlOpcode
== AML_NOTIFY_OP
))
1068 if ((OpInfo
->Class
!= AML_CLASS_EXECUTE
) &&
1069 (OpInfo
->Class
!= AML_CLASS_CONTROL
))
1074 Op
= Op
->Common
.Next
;