本文整理匯總了C++中AcpiUtAddReference函數的典型用法代碼示例。如果您正苦於以下問題:C++ AcpiUtAddReference函數的具體用法?C++ AcpiUtAddReference怎麽用?C++ AcpiUtAddReference使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AcpiUtAddReference函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AcpiDsMethodDataSetEntry
ACPI_STATUS
AcpiDsMethodDataSetEntry (
UINT16 Opcode,
UINT32 Index,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Entry;
FUNCTION_TRACE ("DsMethodDataSetEntry");
/* Get a pointer to the stack entry to set */
Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Increment ref count so object can't be deleted while installed */
AcpiUtAddReference (Object);
/* Install the object into the stack entry */
*Entry = Object;
return_ACPI_STATUS (AE_OK);
}
示例2: AcpiEvAttachRegion
ACPI_STATUS
AcpiEvAttachRegion (
ACPI_OPERAND_OBJECT *HandlerObj,
ACPI_OPERAND_OBJECT *RegionObj,
BOOLEAN AcpiNsIsLocked)
{
ACPI_FUNCTION_TRACE (EvAttachRegion);
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Adding Region [%4.4s] %p to address handler %p [%s]\n",
AcpiUtGetNodeName (RegionObj->Region.Node),
RegionObj, HandlerObj,
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
/* Link this region to the front of the handler's list */
RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;
HandlerObj->AddressSpace.RegionList = RegionObj;
/* Install the region's handler */
if (RegionObj->Region.Handler)
{
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
RegionObj->Region.Handler = HandlerObj;
AcpiUtAddReference (HandlerObj);
return_ACPI_STATUS (AE_OK);
}
示例3: AcpiNsResolveReferences
static void
AcpiNsResolveReferences (
ACPI_EVALUATE_INFO *Info)
{
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
ACPI_NAMESPACE_NODE *Node;
/* We are interested in reference objects only */
if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
{
return;
}
/*
* Two types of references are supported - those created by Index and
* RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted
* to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle
* (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
* an ACPI_OBJECT.
*/
switch (Info->ReturnObject->Reference.Class)
{
case ACPI_REFCLASS_INDEX:
ObjDesc = *(Info->ReturnObject->Reference.Where);
break;
case ACPI_REFCLASS_REFOF:
Node = Info->ReturnObject->Reference.Object;
if (Node)
{
ObjDesc = Node->Object;
}
break;
default:
return;
}
/* Replace the existing reference object */
if (ObjDesc)
{
AcpiUtAddReference (ObjDesc);
AcpiUtRemoveReference (Info->ReturnObject);
Info->ReturnObject = ObjDesc;
}
return;
}
示例4: AcpiDsDoImplicitReturn
BOOLEAN
AcpiDsDoImplicitReturn (
ACPI_OPERAND_OBJECT *ReturnDesc,
ACPI_WALK_STATE *WalkState,
BOOLEAN AddReference)
{
ACPI_FUNCTION_NAME (DsDoImplicitReturn);
/*
* Slack must be enabled for this feature, and we must
* have a valid return object
*/
if ((!AcpiGbl_EnableInterpreterSlack) ||
(!ReturnDesc))
{
return (FALSE);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result %p will be implicitly returned; Prev=%p\n",
ReturnDesc,
WalkState->ImplicitReturnObj));
/*
* Delete any "stale" implicit return value first. However, in
* complex statements, the implicit return value can be
* bubbled up several levels, so we don't clear the value if it
* is the same as the ReturnDesc.
*/
if (WalkState->ImplicitReturnObj)
{
if (WalkState->ImplicitReturnObj == ReturnDesc)
{
return (TRUE);
}
AcpiDsClearImplicitReturn (WalkState);
}
/* Save the implicit return value, add a reference if requested */
WalkState->ImplicitReturnObj = ReturnDesc;
if (AddReference)
{
AcpiUtAddReference (ReturnDesc);
}
return (TRUE);
}
示例5: AcpiDsMethodDataSetValue
static ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_FUNCTION_TRACE (DsMethodDataSetValue);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"NewObj %p Type %2.2X, Refs=%u [%s]\n", Object,
Type, Object->Common.ReferenceCount,
AcpiUtGetTypeName (Object->Common.Type)));
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Increment ref count so object can't be deleted while installed.
* NOTE: We do not copy the object in order to preserve the call by
* reference semantics of ACPI Control Method invocation.
* (See ACPI Specification 2.0C)
*/
AcpiUtAddReference (Object);
/* Install the object */
Node->Object = Object;
return_ACPI_STATUS (Status);
}
示例6: AcpiInstallNotifyHandler
//.........這裏部分代碼省略.........
}
/*
* All Other Objects:
* Caller will only receive notifications specific to the target
* object. Note that only certain object types are allowed to
* receive notifications.
*/
/* Are Notifies allowed on this object? */
if (!AcpiEvIsNotifyObject (Node))
{
Status = AE_TYPE;
goto UnlockAndExit;
}
/* Check for an existing internal object, might not exist */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
/* Create a new object */
ObjDesc = AcpiUtCreateInternalObject (Node->Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Attach new object to the Node, remove local reference */
Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
AcpiUtRemoveReference (ObjDesc);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
/* Ensure that the handler is not already installed in the lists */
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
{
if (HandlerType & (i+1))
{
HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
while (HandlerObj)
{
if (HandlerObj->Notify.Handler == Handler)
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
}
HandlerObj = HandlerObj->Notify.Next[i];
}
}
}
/* Create and populate a new notify handler object */
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);
if (!HandlerObj)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
HandlerObj->Notify.Node = Node;
HandlerObj->Notify.HandlerType = HandlerType;
HandlerObj->Notify.Handler = Handler;
HandlerObj->Notify.Context = Context;
/* Install the handler at the list head(s) */
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
{
if (HandlerType & (i+1))
{
HandlerObj->Notify.Next[i] =
ObjDesc->CommonNotify.NotifyList[i];
ObjDesc->CommonNotify.NotifyList[i] = HandlerObj;
}
}
/* Add an extra reference if handler was installed in both lists */
if (HandlerType == ACPI_ALL_NOTIFY)
{
AcpiUtAddReference (HandlerObj);
}
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
示例7: AcpiNsConvertToReference
ACPI_STATUS
AcpiNsConvertToReference (
ACPI_NAMESPACE_NODE *Scope,
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject = NULL;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_STATE ScopeInfo;
char *Name;
ACPI_FUNCTION_NAME (NsConvertToReference);
/* Convert path into internal presentation */
Status = AcpiNsInternalizeName (OriginalObject->String.Pointer, &Name);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Find the namespace node */
ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Scope);
Status = AcpiNsLookup (&ScopeInfo, Name,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
if (ACPI_FAILURE (Status))
{
/* Check if we are resolving a named reference within a package */
ACPI_ERROR_NAMESPACE (&ScopeInfo,
OriginalObject->String.Pointer, Status);
goto ErrorExit;
}
/* Create and init a new internal ACPI object */
NewObject = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
if (!NewObject)
{
Status = AE_NO_MEMORY;
goto ErrorExit;
}
NewObject->Reference.Node = Node;
NewObject->Reference.Object = Node->Object;
NewObject->Reference.Class = ACPI_REFCLASS_NAME;
/*
* Increase reference of the object if needed (the object is likely a
* null for device nodes).
*/
AcpiUtAddReference (Node->Object);
ErrorExit:
ACPI_FREE (Name);
*ReturnObject = NewObject;
return (AE_OK);
}
示例8: AcpiDsExecEndOp
//.........這裏部分代碼省略.........
WalkState->ResultObj)
{
Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
}
break;
default:
switch (OpType)
{
case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
/* 1 Operand, 0 ExternalResult, 0 InternalResult */
Status = AcpiDsExecEndControlOp (WalkState, Op);
break;
case AML_TYPE_METHOD_CALL:
/*
* If the method is referenced from within a package
* declaration, it is not a invocation of the method, just
* a reference to it.
*/
if ((Op->Asl.Parent) &&
((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Method Reference in a Package, Op=%p\n", Op));
Op->Common.Node = (ACPI_NAMESPACE_NODE *)
Op->Asl.Value.Arg->Asl.Node;
AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
return_ACPI_STATUS (AE_OK);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Method invocation, Op=%p\n", Op));
/*
* (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
* the method Node pointer
*/
/* NextOp points to the op that holds the method name */
NextOp = FirstArg;
/* NextOp points to first argument op */
NextOp = NextOp->Common.Next;
/*
* Get the method's arguments and put them on the operand stack
*/
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
{
break;
}
/*
* Since the operands will be passed to another control method,
* we must resolve all local references here (Local variables,
* arguments to *this* method, etc.)
*/
示例9: AcpiExResolveNodeToValue
ACPI_STATUS
AcpiExResolveNodeToValue (
ACPI_NAMESPACE_NODE **ObjectPtr,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *SourceDesc;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
ACPI_NAMESPACE_NODE *Node;
ACPI_OBJECT_TYPE EntryType;
ACPI_FUNCTION_TRACE (ExResolveNodeToValue);
/*
* The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the
* object that is attached to the Node.
*/
Node = *ObjectPtr;
SourceDesc = AcpiNsGetAttachedObject (Node);
EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
Node, SourceDesc, AcpiUtGetTypeName (EntryType)));
if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) ||
(EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS))
{
/* There is always exactly one level of indirection */
Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);
SourceDesc = AcpiNsGetAttachedObject (Node);
EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
*ObjectPtr = Node;
}
/*
* Several object types require no further processing:
* 1) Device/Thermal objects don't have a "real" subobject, return the Node
* 2) Method locals and arguments have a pseudo-Node
* 3) 10/2007: Added method type to assist with Package construction.
*/
if ((EntryType == ACPI_TYPE_DEVICE) ||
(EntryType == ACPI_TYPE_THERMAL) ||
(EntryType == ACPI_TYPE_METHOD) ||
(Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
{
return_ACPI_STATUS (AE_OK);
}
if (!SourceDesc)
{
ACPI_ERROR ((AE_INFO, "No object attached to node %p",
Node));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/*
* Action is based on the type of the Node, which indicates the type
* of the attached object or pointer
*/
switch (EntryType)
{
case ACPI_TYPE_PACKAGE:
if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
Status = AcpiDsGetPackageArguments (SourceDesc);
if (ACPI_SUCCESS (Status))
{
/* Return an additional reference to the object */
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
}
break;
case ACPI_TYPE_BUFFER:
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
Status = AcpiDsGetBufferArguments (SourceDesc);
if (ACPI_SUCCESS (Status))
{
/* Return an additional reference to the object */
ObjDesc = SourceDesc;
//.........這裏部分代碼省略.........
示例10: AcpiExOpcode_1A_0T_1R
ACPI_STATUS
AcpiExOpcode_1A_0T_1R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *TempDesc;
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUS Status = AE_OK;
UINT32 Type;
UINT64 Value;
ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
switch (WalkState->Opcode)
{
case AML_LNOT_OP: /* LNot (Operand) */
ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/*
* Set result to ONES (TRUE) if Value == 0. Note:
* ReturnDesc->Integer.Value is initially == 0 (FALSE) from above.
*/
if (!Operand[0]->Integer.Value)
{
ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
}
break;
case AML_DECREMENT_OP: /* Decrement (Operand) */
case AML_INCREMENT_OP: /* Increment (Operand) */
/*
* Create a new integer. Can't just get the base integer and
* increment it because it may be an Arg or Field.
*/
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/*
* Since we are expecting a Reference operand, it can be either a
* NS Node or an internal object.
*/
TempDesc = Operand[0];
if (ACPI_GET_DESCRIPTOR_TYPE (TempDesc) == ACPI_DESC_TYPE_OPERAND)
{
/* Internal reference object - prevent deletion */
AcpiUtAddReference (TempDesc);
}
/*
* Convert the Reference operand to an Integer (This removes a
* reference on the Operand[0] object)
*
* NOTE: We use LNOT_OP here in order to force resolution of the
* reference operand to an actual integer.
*/
Status = AcpiExResolveOperands (AML_LNOT_OP, &TempDesc, WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While resolving operands for [%s]",
AcpiPsGetOpcodeName (WalkState->Opcode)));
goto Cleanup;
}
/*
* TempDesc is now guaranteed to be an Integer object --
* Perform the actual increment or decrement
*/
if (WalkState->Opcode == AML_INCREMENT_OP)
{
ReturnDesc->Integer.Value = TempDesc->Integer.Value + 1;
}
else
{
ReturnDesc->Integer.Value = TempDesc->Integer.Value - 1;
}
/* Finished with this Integer object */
AcpiUtRemoveReference (TempDesc);
/*
* Store the result back (indirectly) through the original
//.........這裏部分代碼省略.........
示例11: AcpiPsxExecute
ACPI_STATUS
AcpiPsxExecute (
ACPI_NAMESPACE_NODE *MethodNode,
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObjDesc)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
UINT32 i;
ACPI_PARSE_OBJECT *Op;
ACPI_WALK_STATE *WalkState;
ACPI_FUNCTION_TRACE ("PsxExecute");
/* Validate the Node and get the attached object */
if (!MethodNode)
{
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ObjDesc = AcpiNsGetAttachedObject (MethodNode);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NULL_OBJECT);
}
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (Params)
{
/*
* The caller "owns" the parameters, so give each one an extra
* reference
*/
for (i = 0; Params[i]; i++)
{
AcpiUtAddReference (Params[i]);
}
}
/*
* 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Parse **** Entry=%p obj=%p\n",
MethodNode, ObjDesc));
/* Create and init a Root Node */
Op = AcpiPsCreateScopeOp ();
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Get a new OwnerId for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart,
ObjDesc->Method.AmlLength, NULL, NULL, 1);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
return_ACPI_STATUS (Status);
}
/* Parse the AML */
Status = AcpiPsParseAml (WalkState);
AcpiPsDeleteParseTree (Op);
/*
* 2) Execute the method. Performs second pass parse simultaneously
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Execution **** Entry=%p obj=%p\n",
MethodNode, ObjDesc));
//.........這裏部分代碼省略.........
示例12: AcpiDsMethodDataGetValue
ACPI_STATUS
AcpiDsMethodDataGetValue (
UINT16 Opcode,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT **DestDesc)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Entry;
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataGetValue");
/* Validate the object descriptor */
if (!DestDesc)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Get a pointer to the requested method stack entry */
Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Get the object from the method stack */
Object = *Entry;
/* Examine the returned object, it must be valid. */
if (!Object)
{
/*
* Index points to uninitialized object stack value.
* This means that either 1) The expected argument was
* not passed to the method, or 2) A local variable
* was referenced by the method (via the ASL)
* before it was initialized. Either case is an error.
*/
switch (Opcode)
{
case AML_ARG_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at entry %p\n",
Index, Entry));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
break;
case AML_LOCAL_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at entry %p\n",
Index, Entry));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
break;
}
}
/*
* Index points to initialized and valid object stack value.
* Return an additional reference to the object
*/
*DestDesc = Object;
AcpiUtAddReference (Object);
return_ACPI_STATUS (AE_OK);
}
示例13: AcpiExResolveObjectToValue
static ACPI_STATUS
AcpiExResolveObjectToValue (
ACPI_OPERAND_OBJECT **StackPtr,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *StackDesc;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
UINT8 RefType;
ACPI_FUNCTION_TRACE (ExResolveObjectToValue);
StackDesc = *StackPtr;
/* This is an object of type ACPI_OPERAND_OBJECT */
switch (StackDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
RefType = StackDesc->Reference.Class;
switch (RefType)
{
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/*
* Get the local from the method's state info
* Note: this increments the local's object reference count
*/
Status = AcpiDsMethodDataGetValue (RefType,
StackDesc->Reference.Value, WalkState, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n",
StackDesc->Reference.Value, ObjDesc));
/*
* Now we can delete the original Reference Object and
* replace it with the resolved value
*/
AcpiUtRemoveReference (StackDesc);
*StackPtr = ObjDesc;
break;
case ACPI_REFCLASS_INDEX:
switch (StackDesc->Reference.TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
/* Just return - do not dereference */
break;
case ACPI_TYPE_PACKAGE:
/* If method call or CopyObject - do not dereference */
if ((WalkState->Opcode == AML_INT_METHODCALL_OP) ||
(WalkState->Opcode == AML_COPY_OBJECT_OP))
{
break;
}
/* Otherwise, dereference the PackageIndex to a package element */
ObjDesc = *StackDesc->Reference.Where;
if (ObjDesc)
{
/*
* Valid object descriptor, copy pointer to return value
* (i.e., dereference the package index)
* Delete the ref object, increment the returned object
*/
AcpiUtAddReference (ObjDesc);
*StackPtr = ObjDesc;
}
else
{
/*
* A NULL object descriptor means an uninitialized element of
* the package, can't dereference it
*/
ACPI_ERROR ((AE_INFO,
"Attempt to dereference an Index to "
"NULL package element Idx=%p",
StackDesc));
Status = AE_AML_UNINITIALIZED_ELEMENT;
}
break;
default:
/* Invalid reference object */
//.........這裏部分代碼省略.........
示例14: AcpiExOpcode_2A_1T_1R
//.........這裏部分代碼省略.........
ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
break;
case ACPI_TYPE_BUFFER:
if (Index >= Operand[0]->Buffer.Length)
{
Length = Operand[0]->Buffer.Length;
Status = AE_AML_BUFFER_LIMIT;
}
ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
break;
case ACPI_TYPE_PACKAGE:
if (Index >= Operand[0]->Package.Count)
{
Length = Operand[0]->Package.Count;
Status = AE_AML_PACKAGE_LIMIT;
}
ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
break;
default:
Status = AE_AML_INTERNAL;
goto Cleanup;
}
/* Failure means that the Index was beyond the end of the object */
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
ACPI_FORMAT_UINT64 (Index), (UINT32) Length));
goto Cleanup;
}
/*
* Save the target object and add a reference to it for the life
* of the index
*/
ReturnDesc->Reference.Object = Operand[0];
AcpiUtAddReference (Operand[0]);
/* Store the reference to the Target */
Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
/* Return the reference */
WalkState->ResultObj = ReturnDesc;
goto Cleanup;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
}
StoreResultToTarget:
if (ACPI_SUCCESS (Status))
{
/*
* Store the result of the operation (which is now in ReturnDesc) into
* the Target descriptor.
*/
Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
if (!WalkState->ResultObj)
{
WalkState->ResultObj = ReturnDesc;
}
}
Cleanup:
/* Delete return object on error */
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ReturnDesc);
WalkState->ResultObj = NULL;
}
return_ACPI_STATUS (Status);
}
示例15: AcpiExPrepFieldValue
//.........這裏部分代碼省略.........
{
AcpiUtDeleteObjectDesc (ObjDesc);
return_ACPI_STATUS (Status);
}
}
ObjDesc->Field.ResourceBuffer = SecondDesc->Buffer.Pointer;
ObjDesc->Field.ResourceLength = (UINT16) SecondDesc->Buffer.Length;
}
else if (Info->ResourceBuffer)
{
ObjDesc->Field.ResourceBuffer = Info->ResourceBuffer;
ObjDesc->Field.ResourceLength = Info->ResourceLength;
}
/* Allow full data read from EC address space */
if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
(ObjDesc->CommonField.BitLength > 8))
{
AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength);
/* Maximum byte width supported is 255 */
if (AccessByteWidth < 256)
{
ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;
}
}
/* An additional reference for the container */
AcpiUtAddReference (ObjDesc->Field.RegionObj);
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
ObjDesc->BankField.Value = Info->BankValue;
ObjDesc->BankField.RegionObj =
AcpiNsGetAttachedObject (Info->RegionNode);
ObjDesc->BankField.BankObj =
AcpiNsGetAttachedObject (Info->RegisterNode);
/* An additional reference for the attached objects */
AcpiUtAddReference (ObjDesc->BankField.RegionObj);
AcpiUtAddReference (ObjDesc->BankField.BankObj);
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
ObjDesc->BankField.StartFieldBitOffset,
ObjDesc->BankField.BaseByteOffset,
ObjDesc->Field.AccessByteWidth,
ObjDesc->BankField.RegionObj,
ObjDesc->BankField.BankObj));
/*
* Remember location in AML stream of the field unit
* opcode and operands -- since the BankValue
* operands must be evaluated.