Deleted Added
full compact
4c4
< * $Revision: 49 $
---
> * $Revision: 53 $
143a144,149
> * NOTES: WalkState fields are initialized to zero by the
> * ACPI_MEM_CALLOCATE().
> *
> * A pseudo-Namespace Node is assigned to each argument and local
> * so that RefOf() can return a pointer to the Node.
> *
155,161d160
< /*
< * WalkState fields are initialized to zero by the
< * ACPI_MEM_CALLOCATE().
< *
< * An Node is assigned to each argument and local so
< * that RefOf() can return a pointer to the Node.
< */
210d208
< ACPI_OPERAND_OBJECT *Object;
216c214
< /* Delete the locals */
---
> /* Detach the locals */
218,219d215
< ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting local variables in %p\n", WalkState));
<
222,223c218
< Object = WalkState->LocalVariables[Index].Object;
< if (Object)
---
> if (WalkState->LocalVariables[Index].Object)
225c220,221
< ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", Index, Object));
---
> ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
> Index, WalkState->LocalVariables[Index].Object));
227c223
< /* Remove first */
---
> /* Detach object (if present) and remove a reference */
229,233c225
< WalkState->LocalVariables[Index].Object = NULL;
<
< /* Was given a ref when stored */
<
< AcpiUtRemoveReference (Object);
---
> AcpiNsDetachObject (&WalkState->LocalVariables[Index]);
236a229
> /* Detach the arguments */
238,241d230
< /* Delete the arguments */
<
< ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting arguments in %p\n", WalkState));
<
244,245c233
< Object = WalkState->Arguments[Index].Object;
< if (Object)
---
> if (WalkState->Arguments[Index].Object)
247c235,236
< ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", Index, Object));
---
> ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
> Index, WalkState->Arguments[Index].Object));
249c238
< /* Remove first */
---
> /* Detach object (if present) and remove a reference */
251,255c240
< WalkState->Arguments[Index].Object = NULL;
<
< /* Was given a ref when stored */
<
< AcpiUtRemoveReference (Object);
---
> AcpiNsDetachObject (&WalkState->Arguments[Index]);
273c258,260
< * DESCRIPTION: Initialize arguments for a method
---
> * DESCRIPTION: Initialize arguments for a method. The parameter list is a list
> * of ACPI operand objects, either null terminated or whose length
> * is defined by MaxParamCount.
284,285c271
< UINT32 Mindex;
< UINT32 Pindex;
---
> UINT32 Index = 0;
299,301c285
< for (Pindex = Mindex = 0;
< (Mindex < MTH_NUM_ARGS) && (Pindex < MaxParamCount);
< Mindex++)
---
> while ((Index < MTH_NUM_ARGS) && (Index < MaxParamCount) && Params[Index])
303c287,293
< if (Params[Pindex])
---
> /*
> * A valid parameter.
> * Store the argument in the method/walk descriptor
> */
> Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, Params[Index],
> WalkState);
> if (ACPI_FAILURE (Status))
305,317c295
< /*
< * A valid parameter.
< * Set the current method argument to the
< * Params[Pindex++] argument object descriptor
< */
< Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Mindex,
< Params[Pindex], WalkState);
< if (ACPI_FAILURE (Status))
< {
< break;
< }
<
< Pindex++;
---
> return_ACPI_STATUS (Status);
320,323c298
< else
< {
< break;
< }
---
> Index++;
326c301
< ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Pindex));
---
> ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Index));
333c308
< * FUNCTION: AcpiDsMethodDataGetEntry
---
> * FUNCTION: AcpiDsMethodDataGetNode
336,338c311,312
< * Index - Which localVar or argument to get
< * Entry - Pointer to where a pointer to the stack
< * entry is returned.
---
> * Index - Which localVar or argument whose type
> * to get
341c315
< * RETURN: Status
---
> * RETURN: Get the Node associated with a local or arg.
343,344d316
< * DESCRIPTION: Get the address of the object entry given by Opcode:Index
< *
348c320
< AcpiDsMethodDataGetEntry (
---
> AcpiDsMethodDataGetNode (
352c324
< ACPI_OPERAND_OBJECT ***Entry)
---
> ACPI_NAMESPACE_NODE **Node)
353a326
> FUNCTION_TRACE ("DsMethodDataGetNode");
355d327
< FUNCTION_TRACE_U32 ("DsMethodDataGetEntry", Index);
357d328
<
359,360c330
< * Get the requested object.
< * The stack "Opcode" is either a LocalVariable or an Argument
---
> * Method Locals and Arguments are supported
364d333
<
369c338
< ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "LocalVar index %d is invalid (max %d)\n",
---
> ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
371c340
< return_ACPI_STATUS (AE_BAD_PARAMETER);
---
> return_ACPI_STATUS (AE_AML_INVALID_INDEX);
374,375c343,345
< *Entry = (ACPI_OPERAND_OBJECT **)
< &WalkState->LocalVariables[Index].Object;
---
> /* Return a pointer to the pseudo-node */
>
> *Node = &WalkState->LocalVariables[Index];
378d347
<
385c354
< return_ACPI_STATUS (AE_BAD_PARAMETER);
---
> return_ACPI_STATUS (AE_AML_INVALID_INDEX);
388,389c357,359
< *Entry = (ACPI_OPERAND_OBJECT **)
< &WalkState->Arguments[Index].Object;
---
> /* Return a pointer to the pseudo-node */
>
> *Node = &WalkState->Arguments[Index];
392d361
<
395c364,365
< return_ACPI_STATUS (AE_BAD_PARAMETER);
---
> return_ACPI_STATUS (AE_AML_BAD_OPCODE);
> break;
398d367
<
405c374
< * FUNCTION: AcpiDsMethodDataSetEntry
---
> * FUNCTION: AcpiDsMethodDataSetValue
419c388
< AcpiDsMethodDataSetEntry (
---
> AcpiDsMethodDataSetValue (
426c395
< ACPI_OPERAND_OBJECT **Entry;
---
> ACPI_NAMESPACE_NODE *Node;
429c398
< FUNCTION_TRACE ("DsMethodDataSetEntry");
---
> FUNCTION_TRACE ("DsMethodDataSetValue");
432c401
< /* Get a pointer to the stack entry to set */
---
> /* Get the namespace node for the arg/local */
434c403
< Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
---
> Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
446,447c415
< *Entry = Object;
<
---
> Node->Object = Object;
461,462c429
< * RETURN: Data type of selected Arg or Local
< * Used only in ExecMonadic2()/TypeOp.
---
> * RETURN: Data type of current value of the selected Arg or Local
473c440
< ACPI_OPERAND_OBJECT **Entry;
---
> ACPI_NAMESPACE_NODE *Node;
480c447
< /* Get a pointer to the requested stack entry */
---
> /* Get the namespace node for the arg/local */
482c449
< Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
---
> Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
488c455
< /* Get the object from the method stack */
---
> /* Get the object */
490,493c457
< Object = *Entry;
<
< /* Get the object type */
<
---
> Object = AcpiNsGetAttachedObject (Node);
496c460,461
< /* Any == 0 => "uninitialized" -- see spec 15.2.3.5.2.28 */
---
> /* Uninitialized local/arg, return TYPE_ANY */
>
499a465,466
> /* Get the object type */
>
506,569d472
< * FUNCTION: AcpiDsMethodDataGetNode
< *
< * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
< * Index - Which localVar or argument whose type
< * to get
< * WalkState - Current walk state object
< *
< * RETURN: Get the Node associated with a local or arg.
< *
< ******************************************************************************/
<
< ACPI_NAMESPACE_NODE *
< AcpiDsMethodDataGetNode (
< UINT16 Opcode,
< UINT32 Index,
< ACPI_WALK_STATE *WalkState)
< {
< ACPI_NAMESPACE_NODE *Node = NULL;
<
<
< FUNCTION_TRACE ("DsMethodDataGetNode");
<
<
< switch (Opcode)
< {
<
< case AML_LOCAL_OP:
<
< if (Index > MTH_MAX_LOCAL)
< {
< ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
< Index, MTH_MAX_LOCAL));
< return_PTR (Node);
< }
<
< Node = &WalkState->LocalVariables[Index];
< break;
<
<
< case AML_ARG_OP:
<
< if (Index > MTH_MAX_ARG)
< {
< ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
< Index, MTH_MAX_ARG));
< return_PTR (Node);
< }
<
< Node = &WalkState->Arguments[Index];
< break;
<
<
< default:
< ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
< break;
< }
<
<
< return_PTR (Node);
< }
<
<
< /*******************************************************************************
< *
594c497
< ACPI_OPERAND_OBJECT **Entry;
---
> ACPI_NAMESPACE_NODE *Node;
608a512
> /* Get the namespace node for the arg/local */
610,612c514
< /* Get a pointer to the requested method stack entry */
<
< Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
---
> Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
618c520
< /* Get the object from the method stack */
---
> /* Get the object from the node */
620c522
< Object = *Entry;
---
> Object = Node->Object;
622d523
<
628c529
< * Index points to uninitialized object stack value.
---
> * Index points to uninitialized object.
638,639c539,540
< ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at entry %p\n",
< Index, Entry));
---
> ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n",
> Index, Node));
646,647c547,548
< ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at entry %p\n",
< Index, Entry));
---
> ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
> Index, Node));
654d554
<
656c556
< * Index points to initialized and valid object stack value.
---
> * The Index points to an initialized and valid object.
688c588
< ACPI_OPERAND_OBJECT **Entry;
---
> ACPI_NAMESPACE_NODE *Node;
695c595
< /* Get a pointer to the requested entry */
---
> /* Get the namespace node for the arg/local */
697c597
< Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
---
> Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
703c603
< /* Get the current entry in this slot k */
---
> /* Get the associated object */
705c605
< Object = *Entry;
---
> Object = AcpiNsGetAttachedObject (Node);
712c612
< *Entry = NULL;
---
> Node->Object = NULL;
718c618
< * There is a valid object in this slot
---
> * There is a valid object.
720c620
< * increment when the object was stored in the slot.
---
> * increment when the object was stored.
735c635
< * SrcDesc - Value to be stored
---
> * ObjDesc - Value to be stored
740c640
< * DESCRIPTION: Store a value in an Arg or Local. The SrcDesc is installed
---
> * DESCRIPTION: Store a value in an Arg or Local. The ObjDesc is installed
742c642
< * for SrcDesc is incremented.
---
> * for ObjDesc is incremented.
750c650
< ACPI_OPERAND_OBJECT *SrcDesc,
---
> ACPI_OPERAND_OBJECT *ObjDesc,
754c654,655
< ACPI_OPERAND_OBJECT **Entry;
---
> ACPI_NAMESPACE_NODE *Node;
> ACPI_OPERAND_OBJECT *CurrentObjDesc;
757c658
< FUNCTION_TRACE ("DsMethodDataSetValue");
---
> FUNCTION_TRACE ("DsStoreObjectToLocal");
759c660
< Opcode, Index, SrcDesc));
---
> Opcode, Index, ObjDesc));
764c665
< if (!SrcDesc)
---
> if (!ObjDesc)
768a670
> /* Get the namespace node for the arg/local */
770,772c672
< /* Get a pointer to the requested method stack entry */
<
< Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
---
> Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
775c675
< goto Cleanup;
---
> return_ACPI_STATUS (Status);
778c678,679
< if (*Entry == SrcDesc)
---
> CurrentObjDesc = AcpiNsGetAttachedObject (Node);
> if (CurrentObjDesc == ObjDesc)
780,781c681,682
< ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", SrcDesc));
< goto Cleanup;
---
> ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", ObjDesc));
> return_ACPI_STATUS (Status);
784d684
<
791c691
< if (*Entry)
---
> if (CurrentObjDesc)
810c710
< (VALID_DESCRIPTOR_TYPE (*Entry, ACPI_DESC_TYPE_NAMED)))
---
> (VALID_DESCRIPTOR_TYPE (CurrentObjDesc, ACPI_DESC_TYPE_NAMED)))
813,814c713,714
< "Arg (%p) is an ObjRef(Node), storing in %p\n",
< SrcDesc, *Entry));
---
> "Arg (%p) is an ObjRef(Node), storing in node %p\n",
> ObjDesc, CurrentObjDesc));
818c718
< AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) *Entry);
---
> AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc);
822c722
< * (do the indirect store)
---
> * (perform the indirect store)
824,825c724,725
< Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) *Entry, SrcDesc,
< SrcDesc->Common.Type);
---
> Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
> ObjDesc, ObjDesc->Common.Type);
829,830d728
<
< #ifdef ACPI_ENABLE_IMPLICIT_CONVERSION
832,842d729
< * Perform "Implicit conversion" of the new object to the type of the
< * existing object
< */
< Status = AcpiExConvertToTargetType ((*Entry)->Common.Type, &SrcDesc, WalkState);
< if (ACPI_FAILURE (Status))
< {
< goto Cleanup;
< }
< #endif
<
< /*
849d735
<
851c737
< * Install the ObjStack descriptor (*SrcDesc) into
---
> * Install the ObjStack descriptor (*ObjDesc) into
856,870c742
< Status = AcpiDsMethodDataSetEntry (Opcode, Index, SrcDesc, WalkState);
< if (ACPI_FAILURE (Status))
< {
< goto Cleanup;
< }
<
< /* Normal exit */
<
< return_ACPI_STATUS (AE_OK);
<
<
< /* Error exit */
<
< Cleanup:
<
---
> Status = AcpiDsMethodDataSetValue (Opcode, Index, ObjDesc, WalkState);
873a746
>