1 /*******************************************************************************
3 * Module Name: dsutils - Dispatcher utilities
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_DISPATCHER
56 ACPI_MODULE_NAME ("dsutils")
59 /*******************************************************************************
61 * FUNCTION: AcpiDsClearImplicitReturn
63 * PARAMETERS: WalkState - Current State
67 * DESCRIPTION: Clear and remove a reference on an implicit return value. Used
68 * to delete "stale" return values (if enabled, the return value
69 * from every operator is saved at least momentarily, in case the
70 * parent method exits.)
72 ******************************************************************************/
75 AcpiDsClearImplicitReturn (
76 ACPI_WALK_STATE
*WalkState
)
78 ACPI_FUNCTION_NAME (DsClearImplicitReturn
);
82 * Slack must be enabled for this feature
84 if (!AcpiGbl_EnableInterpreterSlack
)
89 if (WalkState
->ImplicitReturnObj
)
92 * Delete any "stale" implicit return. However, in
93 * complex statements, the implicit return value can be
94 * bubbled up several levels.
96 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
97 "Removing reference on stale implicit return obj %p\n",
98 WalkState
->ImplicitReturnObj
));
100 AcpiUtRemoveReference (WalkState
->ImplicitReturnObj
);
101 WalkState
->ImplicitReturnObj
= NULL
;
106 #ifndef ACPI_NO_METHOD_EXECUTION
107 /*******************************************************************************
109 * FUNCTION: AcpiDsDoImplicitReturn
111 * PARAMETERS: ReturnDesc - The return value
112 * WalkState - Current State
113 * AddReference - True if a reference should be added to the
116 * RETURN: TRUE if implicit return enabled, FALSE otherwise
118 * DESCRIPTION: Implements the optional "implicit return". We save the result
119 * of every ASL operator and control method invocation in case the
120 * parent method exit. Before storing a new return value, we
121 * delete the previous return value.
123 ******************************************************************************/
126 AcpiDsDoImplicitReturn (
127 ACPI_OPERAND_OBJECT
*ReturnDesc
,
128 ACPI_WALK_STATE
*WalkState
,
129 BOOLEAN AddReference
)
131 ACPI_FUNCTION_NAME (DsDoImplicitReturn
);
135 * Slack must be enabled for this feature, and we must
136 * have a valid return object
138 if ((!AcpiGbl_EnableInterpreterSlack
) ||
144 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
145 "Result %p will be implicitly returned; Prev=%p\n",
147 WalkState
->ImplicitReturnObj
));
150 * Delete any "stale" implicit return value first. However, in
151 * complex statements, the implicit return value can be
152 * bubbled up several levels, so we don't clear the value if it
153 * is the same as the ReturnDesc.
155 if (WalkState
->ImplicitReturnObj
)
157 if (WalkState
->ImplicitReturnObj
== ReturnDesc
)
161 AcpiDsClearImplicitReturn (WalkState
);
164 /* Save the implicit return value, add a reference if requested */
166 WalkState
->ImplicitReturnObj
= ReturnDesc
;
169 AcpiUtAddReference (ReturnDesc
);
176 /*******************************************************************************
178 * FUNCTION: AcpiDsIsResultUsed
180 * PARAMETERS: Op - Current Op
181 * WalkState - Current State
183 * RETURN: TRUE if result is used, FALSE otherwise
185 * DESCRIPTION: Check if a result object will be used by the parent
187 ******************************************************************************/
191 ACPI_PARSE_OBJECT
*Op
,
192 ACPI_WALK_STATE
*WalkState
)
194 const ACPI_OPCODE_INFO
*ParentInfo
;
196 ACPI_FUNCTION_TRACE_PTR (DsIsResultUsed
, Op
);
199 /* Must have both an Op and a Result Object */
203 ACPI_ERROR ((AE_INFO
, "Null Op"));
208 * We know that this operator is not a
209 * Return() operator (would not come here.) The following code is the
210 * optional support for a so-called "implicit return". Some AML code
211 * assumes that the last value of the method is "implicitly" returned
212 * to the caller. Just save the last result as the return value.
213 * NOTE: this is optional because the ASL language does not actually
214 * support this behavior.
216 (void) AcpiDsDoImplicitReturn (WalkState
->ResultObj
, WalkState
, TRUE
);
219 * Now determine if the parent will use the result
221 * If there is no parent, or the parent is a ScopeOp, we are executing
222 * at the method level. An executing method typically has no parent,
223 * since each method is parsed separately. A method invoked externally
224 * via ExecuteControlMethod has a ScopeOp as the parent.
226 if ((!Op
->Common
.Parent
) ||
227 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_SCOPE_OP
))
229 /* No parent, the return value cannot possibly be used */
231 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
232 "At Method level, result of [%s] not used\n",
233 AcpiPsGetOpcodeName (Op
->Common
.AmlOpcode
)));
234 return_UINT8 (FALSE
);
237 /* Get info on the parent. The RootOp is AML_SCOPE */
239 ParentInfo
= AcpiPsGetOpcodeInfo (Op
->Common
.Parent
->Common
.AmlOpcode
);
240 if (ParentInfo
->Class
== AML_CLASS_UNKNOWN
)
242 ACPI_ERROR ((AE_INFO
,
243 "Unknown parent opcode Op=%p", Op
));
244 return_UINT8 (FALSE
);
248 * Decide what to do with the result based on the parent. If
249 * the parent opcode will not use the result, delete the object.
250 * Otherwise leave it as is, it will be deleted when it is used
251 * as an operand later.
253 switch (ParentInfo
->Class
)
255 case AML_CLASS_CONTROL
:
257 switch (Op
->Common
.Parent
->Common
.AmlOpcode
)
261 /* Never delete the return value associated with a return opcode */
268 * If we are executing the predicate AND this is the predicate op,
269 * we will use the return value
271 if ((WalkState
->ControlState
->Common
.State
== ACPI_CONTROL_PREDICATE_EXECUTING
) &&
272 (WalkState
->ControlState
->Control
.PredicateOp
== Op
))
280 /* Ignore other control opcodes */
285 /* The general control opcode returns no result */
289 case AML_CLASS_CREATE
:
291 * These opcodes allow TermArg(s) as operands and therefore
292 * the operands can be method calls. The result is used.
296 case AML_CLASS_NAMED_OBJECT
:
298 if ((Op
->Common
.Parent
->Common
.AmlOpcode
== AML_REGION_OP
) ||
299 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_DATA_REGION_OP
) ||
300 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_PACKAGE_OP
) ||
301 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_VAR_PACKAGE_OP
) ||
302 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_BUFFER_OP
) ||
303 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_INT_EVAL_SUBTREE_OP
) ||
304 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_BANK_FIELD_OP
))
307 * These opcodes allow TermArg(s) as operands and therefore
308 * the operands can be method calls. The result is used.
317 * In all other cases. the parent will actually use the return
318 * object, so keep it.
325 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
326 "Result of [%s] used by Parent [%s] Op=%p\n",
327 AcpiPsGetOpcodeName (Op
->Common
.AmlOpcode
),
328 AcpiPsGetOpcodeName (Op
->Common
.Parent
->Common
.AmlOpcode
), Op
));
334 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
335 "Result of [%s] not used by Parent [%s] Op=%p\n",
336 AcpiPsGetOpcodeName (Op
->Common
.AmlOpcode
),
337 AcpiPsGetOpcodeName (Op
->Common
.Parent
->Common
.AmlOpcode
), Op
));
339 return_UINT8 (FALSE
);
343 /*******************************************************************************
345 * FUNCTION: AcpiDsDeleteResultIfNotUsed
347 * PARAMETERS: Op - Current parse Op
348 * ResultObj - Result of the operation
349 * WalkState - Current state
353 * DESCRIPTION: Used after interpretation of an opcode. If there is an internal
354 * result descriptor, check if the parent opcode will actually use
355 * this result. If not, delete the result now so that it will
356 * not become orphaned.
358 ******************************************************************************/
361 AcpiDsDeleteResultIfNotUsed (
362 ACPI_PARSE_OBJECT
*Op
,
363 ACPI_OPERAND_OBJECT
*ResultObj
,
364 ACPI_WALK_STATE
*WalkState
)
366 ACPI_OPERAND_OBJECT
*ObjDesc
;
370 ACPI_FUNCTION_TRACE_PTR (DsDeleteResultIfNotUsed
, ResultObj
);
375 ACPI_ERROR ((AE_INFO
, "Null Op"));
384 if (!AcpiDsIsResultUsed (Op
, WalkState
))
386 /* Must pop the result stack (ObjDesc should be equal to ResultObj) */
388 Status
= AcpiDsResultPop (&ObjDesc
, WalkState
);
389 if (ACPI_SUCCESS (Status
))
391 AcpiUtRemoveReference (ResultObj
);
399 /*******************************************************************************
401 * FUNCTION: AcpiDsResolveOperands
403 * PARAMETERS: WalkState - Current walk state with operands on stack
407 * DESCRIPTION: Resolve all operands to their values. Used to prepare
408 * arguments to a control method invocation (a call from one
409 * method to another.)
411 ******************************************************************************/
414 AcpiDsResolveOperands (
415 ACPI_WALK_STATE
*WalkState
)
418 ACPI_STATUS Status
= AE_OK
;
421 ACPI_FUNCTION_TRACE_PTR (DsResolveOperands
, WalkState
);
425 * Attempt to resolve each of the valid operands
426 * Method arguments are passed by reference, not by value. This means
427 * that the actual objects are passed, not copies of the objects.
429 for (i
= 0; i
< WalkState
->NumOperands
; i
++)
431 Status
= AcpiExResolveToValue (&WalkState
->Operands
[i
], WalkState
);
432 if (ACPI_FAILURE (Status
))
438 return_ACPI_STATUS (Status
);
442 /*******************************************************************************
444 * FUNCTION: AcpiDsClearOperands
446 * PARAMETERS: WalkState - Current walk state with operands on stack
450 * DESCRIPTION: Clear all operands on the current walk state operand stack.
452 ******************************************************************************/
455 AcpiDsClearOperands (
456 ACPI_WALK_STATE
*WalkState
)
461 ACPI_FUNCTION_TRACE_PTR (DsClearOperands
, WalkState
);
464 /* Remove a reference on each operand on the stack */
466 for (i
= 0; i
< WalkState
->NumOperands
; i
++)
469 * Remove a reference to all operands, including both
470 * "Arguments" and "Targets".
472 AcpiUtRemoveReference (WalkState
->Operands
[i
]);
473 WalkState
->Operands
[i
] = NULL
;
476 WalkState
->NumOperands
= 0;
482 /*******************************************************************************
484 * FUNCTION: AcpiDsCreateOperand
486 * PARAMETERS: WalkState - Current walk state
487 * Arg - Parse object for the argument
488 * ArgIndex - Which argument (zero based)
492 * DESCRIPTION: Translate a parse tree object that is an argument to an AML
493 * opcode to the equivalent interpreter object. This may include
494 * looking up a name or entering a new name into the internal
497 ******************************************************************************/
500 AcpiDsCreateOperand (
501 ACPI_WALK_STATE
*WalkState
,
502 ACPI_PARSE_OBJECT
*Arg
,
505 ACPI_STATUS Status
= AE_OK
;
508 ACPI_OPERAND_OBJECT
*ObjDesc
;
509 ACPI_PARSE_OBJECT
*ParentOp
;
511 ACPI_INTERPRETER_MODE InterpreterMode
;
512 const ACPI_OPCODE_INFO
*OpInfo
;
515 ACPI_FUNCTION_TRACE_PTR (DsCreateOperand
, Arg
);
518 /* A valid name must be looked up in the namespace */
520 if ((Arg
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
) &&
521 (Arg
->Common
.Value
.String
) &&
522 !(Arg
->Common
.Flags
& ACPI_PARSEOP_IN_STACK
))
524 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
, "Getting a name: Arg=%p\n", Arg
));
526 /* Get the entire name string from the AML stream */
528 Status
= AcpiExGetNameString (ACPI_TYPE_ANY
, Arg
->Common
.Value
.Buffer
,
529 &NameString
, &NameLength
);
531 if (ACPI_FAILURE (Status
))
533 return_ACPI_STATUS (Status
);
536 /* All prefixes have been handled, and the name is in NameString */
539 * Special handling for BufferField declarations. This is a deferred
540 * opcode that unfortunately defines the field name as the last
541 * parameter instead of the first. We get here when we are performing
542 * the deferred execution, so the actual name of the field is already
543 * in the namespace. We don't want to attempt to look it up again
544 * because we may be executing in a different scope than where the
545 * actual opcode exists.
547 if ((WalkState
->DeferredNode
) &&
548 (WalkState
->DeferredNode
->Type
== ACPI_TYPE_BUFFER_FIELD
) &&
549 (ArgIndex
== (UINT32
) ((WalkState
->Opcode
== AML_CREATE_FIELD_OP
) ? 3 : 2)))
551 ObjDesc
= ACPI_CAST_PTR (
552 ACPI_OPERAND_OBJECT
, WalkState
->DeferredNode
);
555 else /* All other opcodes */
558 * Differentiate between a namespace "create" operation
559 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
560 * IMODE_EXECUTE) in order to support the creation of
561 * namespace objects during the execution of control methods.
563 ParentOp
= Arg
->Common
.Parent
;
564 OpInfo
= AcpiPsGetOpcodeInfo (ParentOp
->Common
.AmlOpcode
);
565 if ((OpInfo
->Flags
& AML_NSNODE
) &&
566 (ParentOp
->Common
.AmlOpcode
!= AML_INT_METHODCALL_OP
) &&
567 (ParentOp
->Common
.AmlOpcode
!= AML_REGION_OP
) &&
568 (ParentOp
->Common
.AmlOpcode
!= AML_INT_NAMEPATH_OP
))
570 /* Enter name into namespace if not found */
572 InterpreterMode
= ACPI_IMODE_LOAD_PASS2
;
576 /* Return a failure if name not found */
578 InterpreterMode
= ACPI_IMODE_EXECUTE
;
581 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, NameString
,
582 ACPI_TYPE_ANY
, InterpreterMode
,
583 ACPI_NS_SEARCH_PARENT
| ACPI_NS_DONT_OPEN_SCOPE
,
585 ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE
, &ObjDesc
));
587 * The only case where we pass through (ignore) a NOT_FOUND
588 * error is for the CondRefOf opcode.
590 if (Status
== AE_NOT_FOUND
)
592 if (ParentOp
->Common
.AmlOpcode
== AML_COND_REF_OF_OP
)
595 * For the Conditional Reference op, it's OK if
596 * the name is not found; We just need a way to
597 * indicate this to the interpreter, set the
600 ObjDesc
= ACPI_CAST_PTR (
601 ACPI_OPERAND_OBJECT
, AcpiGbl_RootNode
);
607 * We just plain didn't find it -- which is a
608 * very serious error at this point
610 Status
= AE_AML_NAME_NOT_FOUND
;
614 if (ACPI_FAILURE (Status
))
616 ACPI_ERROR_NAMESPACE (NameString
, Status
);
620 /* Free the namestring created above */
622 ACPI_FREE (NameString
);
624 /* Check status from the lookup */
626 if (ACPI_FAILURE (Status
))
628 return_ACPI_STATUS (Status
);
631 /* Put the resulting object onto the current object stack */
633 Status
= AcpiDsObjStackPush (ObjDesc
, WalkState
);
634 if (ACPI_FAILURE (Status
))
636 return_ACPI_STATUS (Status
);
638 ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc
, WalkState
));
642 /* Check for null name case */
644 if ((Arg
->Common
.AmlOpcode
== AML_INT_NAMEPATH_OP
) &&
645 !(Arg
->Common
.Flags
& ACPI_PARSEOP_IN_STACK
))
648 * If the name is null, this means that this is an
649 * optional result parameter that was not specified
650 * in the original ASL. Create a Zero Constant for a
651 * placeholder. (Store to a constant is a Noop.)
653 Opcode
= AML_ZERO_OP
; /* Has no arguments! */
655 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
656 "Null namepath: Arg=%p\n", Arg
));
660 Opcode
= Arg
->Common
.AmlOpcode
;
663 /* Get the object type of the argument */
665 OpInfo
= AcpiPsGetOpcodeInfo (Opcode
);
666 if (OpInfo
->ObjectType
== ACPI_TYPE_INVALID
)
668 return_ACPI_STATUS (AE_NOT_IMPLEMENTED
);
671 if ((OpInfo
->Flags
& AML_HAS_RETVAL
) || (Arg
->Common
.Flags
& ACPI_PARSEOP_IN_STACK
))
673 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
,
674 "Argument previously created, already stacked\n"));
676 ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
677 WalkState
->Operands
[WalkState
->NumOperands
- 1], WalkState
));
680 * Use value that was already previously returned
681 * by the evaluation of this argument
683 Status
= AcpiDsResultPop (&ObjDesc
, WalkState
);
684 if (ACPI_FAILURE (Status
))
687 * Only error is underflow, and this indicates
688 * a missing or null operand!
690 ACPI_EXCEPTION ((AE_INFO
, Status
,
691 "Missing or null operand"));
692 return_ACPI_STATUS (Status
);
697 /* Create an ACPI_INTERNAL_OBJECT for the argument */
699 ObjDesc
= AcpiUtCreateInternalObject (OpInfo
->ObjectType
);
702 return_ACPI_STATUS (AE_NO_MEMORY
);
705 /* Initialize the new object */
707 Status
= AcpiDsInitObjectFromOp (
708 WalkState
, Arg
, Opcode
, &ObjDesc
);
709 if (ACPI_FAILURE (Status
))
711 AcpiUtDeleteObjectDesc (ObjDesc
);
712 return_ACPI_STATUS (Status
);
716 /* Put the operand object on the object stack */
718 Status
= AcpiDsObjStackPush (ObjDesc
, WalkState
);
719 if (ACPI_FAILURE (Status
))
721 return_ACPI_STATUS (Status
);
724 ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc
, WalkState
));
727 return_ACPI_STATUS (AE_OK
);
731 /*******************************************************************************
733 * FUNCTION: AcpiDsCreateOperands
735 * PARAMETERS: WalkState - Current state
736 * FirstArg - First argument of a parser argument tree
740 * DESCRIPTION: Convert an operator's arguments from a parse tree format to
741 * namespace objects and place those argument object on the object
742 * stack in preparation for evaluation by the interpreter.
744 ******************************************************************************/
747 AcpiDsCreateOperands (
748 ACPI_WALK_STATE
*WalkState
,
749 ACPI_PARSE_OBJECT
*FirstArg
)
751 ACPI_STATUS Status
= AE_OK
;
752 ACPI_PARSE_OBJECT
*Arg
;
753 ACPI_PARSE_OBJECT
*Arguments
[ACPI_OBJ_NUM_OPERANDS
];
755 UINT32 Index
= WalkState
->NumOperands
;
759 ACPI_FUNCTION_TRACE_PTR (DsCreateOperands
, FirstArg
);
762 /* Get all arguments in the list */
767 if (Index
>= ACPI_OBJ_NUM_OPERANDS
)
769 return_ACPI_STATUS (AE_BAD_DATA
);
772 Arguments
[Index
] = Arg
;
773 WalkState
->Operands
[Index
] = NULL
;
775 /* Move on to next argument, if any */
777 Arg
= Arg
->Common
.Next
;
784 /* It is the appropriate order to get objects from the Result stack */
786 for (i
= 0; i
< ArgCount
; i
++)
788 Arg
= Arguments
[Index
];
790 /* Force the filling of the operand stack in inverse order */
792 WalkState
->OperandIndex
= (UINT8
) Index
;
794 Status
= AcpiDsCreateOperand (WalkState
, Arg
, Index
);
795 if (ACPI_FAILURE (Status
))
802 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH
, "Arg #%u (%p) done, Arg1=%p\n",
803 Index
, Arg
, FirstArg
));
806 return_ACPI_STATUS (Status
);
811 * We must undo everything done above; meaning that we must
812 * pop everything off of the operand stack and delete those
815 AcpiDsObjStackPopAndDelete (ArgCount
, WalkState
);
817 ACPI_EXCEPTION ((AE_INFO
, Status
, "While creating Arg %u", Index
));
818 return_ACPI_STATUS (Status
);
822 /*****************************************************************************
824 * FUNCTION: AcpiDsEvaluateNamePath
826 * PARAMETERS: WalkState - Current state of the parse tree walk,
827 * the opcode of current operation should be
828 * AML_INT_NAMEPATH_OP
832 * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent
833 * interpreter object, convert it to value, if needed, duplicate
834 * it, if needed, and push it onto the current result stack.
836 ****************************************************************************/
839 AcpiDsEvaluateNamePath (
840 ACPI_WALK_STATE
*WalkState
)
842 ACPI_STATUS Status
= AE_OK
;
843 ACPI_PARSE_OBJECT
*Op
= WalkState
->Op
;
844 ACPI_OPERAND_OBJECT
**Operand
= &WalkState
->Operands
[0];
845 ACPI_OPERAND_OBJECT
*NewObjDesc
;
849 ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath
, WalkState
);
852 if (!Op
->Common
.Parent
)
854 /* This happens after certain exception processing */
859 if ((Op
->Common
.Parent
->Common
.AmlOpcode
== AML_PACKAGE_OP
) ||
860 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_VAR_PACKAGE_OP
) ||
861 (Op
->Common
.Parent
->Common
.AmlOpcode
== AML_REF_OF_OP
))
863 /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */
868 Status
= AcpiDsCreateOperand (WalkState
, Op
, 0);
869 if (ACPI_FAILURE (Status
))
874 if (Op
->Common
.Flags
& ACPI_PARSEOP_TARGET
)
876 NewObjDesc
= *Operand
;
880 Type
= (*Operand
)->Common
.Type
;
882 Status
= AcpiExResolveToValue (Operand
, WalkState
);
883 if (ACPI_FAILURE (Status
))
888 if (Type
== ACPI_TYPE_INTEGER
)
890 /* It was incremented by AcpiExResolveToValue */
892 AcpiUtRemoveReference (*Operand
);
894 Status
= AcpiUtCopyIobjectToIobject (*Operand
, &NewObjDesc
, WalkState
);
895 if (ACPI_FAILURE (Status
))
903 * The object either was anew created or is
904 * a Namespace node - don't decrement it.
906 NewObjDesc
= *Operand
;
909 /* Cleanup for name-path operand */
911 Status
= AcpiDsObjStackPop (1, WalkState
);
912 if (ACPI_FAILURE (Status
))
914 WalkState
->ResultObj
= NewObjDesc
;
920 WalkState
->ResultObj
= NewObjDesc
;
922 Status
= AcpiDsResultPush (WalkState
->ResultObj
, WalkState
);
923 if (ACPI_SUCCESS (Status
))
925 /* Force to take it from stack */
927 Op
->Common
.Flags
|= ACPI_PARSEOP_IN_STACK
;
932 return_ACPI_STATUS (Status
);