本文整理汇总了C++中AcpiUtGetObjectTypeName函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiUtGetObjectTypeName函数的具体用法?C++ AcpiUtGetObjectTypeName怎么用?C++ AcpiUtGetObjectTypeName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AcpiUtGetObjectTypeName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcpiDmDecodeInternalObject
void
AcpiDmDecodeInternalObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
UINT32 i;
if (!ObjDesc)
{
AcpiOsPrintf (" Uninitialized");
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
{
AcpiOsPrintf (" %p", ObjDesc);
return;
}
AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("(%d) \"%.24s",
ObjDesc->String.Length, ObjDesc->String.Pointer);
if (ObjDesc->String.Length > 24)
{
AcpiOsPrintf ("...");
}
else
{
AcpiOsPrintf ("\"");
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
{
AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
}
break;
default:
AcpiOsPrintf (" %p", ObjDesc);
break;
}
}
示例2: AcpiNsCheckObjectType
//.........这里部分代码省略.........
if (ACPI_SUCCESS (Status))
{
return (AE_OK); /* Repair was successful */
}
goto TypeErrorExit;
}
/* A Namespace node should not get here, but make sure */
if (ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
"Invalid return type - Found a Namespace node [%4.4s] type %s",
ReturnObject->Node.Name.Ascii,
AcpiUtGetTypeName (ReturnObject->Node.Type)));
return (AE_AML_OPERAND_TYPE);
}
/*
* Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type.
* The bitmapped type allows multiple possible return types.
*
* Note, the cases below must handle all of the possible types returned
* from all of the predefined names (including elements of returned
* packages)
*/
switch (ReturnObject->Common.Type)
{
case ACPI_TYPE_INTEGER:
ReturnBtype = ACPI_RTYPE_INTEGER;
break;
case ACPI_TYPE_BUFFER:
ReturnBtype = ACPI_RTYPE_BUFFER;
break;
case ACPI_TYPE_STRING:
ReturnBtype = ACPI_RTYPE_STRING;
break;
case ACPI_TYPE_PACKAGE:
ReturnBtype = ACPI_RTYPE_PACKAGE;
break;
case ACPI_TYPE_LOCAL_REFERENCE:
ReturnBtype = ACPI_RTYPE_REFERENCE;
break;
default:
/* Not one of the supported objects, must be incorrect */
goto TypeErrorExit;
}
/* Is the object one of the expected types? */
if (ReturnBtype & ExpectedBtypes)
{
/* For reference objects, check that the reference type is correct */
if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
{
Status = AcpiNsCheckReference (Data, ReturnObject);
}
return (Status);
}
/* Type mismatch -- attempt repair of the returned object */
Status = AcpiNsRepairObject (Data, ExpectedBtypes,
PackageIndex, ReturnObjectPtr);
if (ACPI_SUCCESS (Status))
{
return (AE_OK); /* Repair was successful */
}
TypeErrorExit:
/* Create a string with all expected types for this predefined object */
AcpiNsGetExpectedTypes (TypeBuffer, ExpectedBtypes);
if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
"Return type mismatch - found %s, expected %s",
AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
}
else
{
ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
"Return Package type mismatch at index %u - "
"found %s, expected %s", PackageIndex,
AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
}
return (AE_AML_OPERAND_TYPE);
}
示例3: AcpiUtGetSimpleObjectSize
//.........这里部分代码省略.........
{
/*
* Object is NULL, just return the length of ACPI_OBJECT
* (A NULL ACPI_OBJECT is an object of all zeroes.)
*/
*ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
return_ACPI_STATUS (AE_OK);
}
/* A Namespace Node should never appear here */
if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED)
{
/* A namespace node should never get here */
ACPI_ERROR ((AE_INFO,
"Received a namespace node [%4.4s] "
"where an operand object is required",
ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, InternalObject)->Name.Ascii));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* The final length depends on the object type
* Strings and Buffers are packed right up against the parent object and
* must be accessed bytewise or there may be alignment problems on
* certain processors
*/
switch (InternalObject->Common.Type)
{
case ACPI_TYPE_STRING:
Length += (ACPI_SIZE) InternalObject->String.Length + 1;
break;
case ACPI_TYPE_BUFFER:
Length += (ACPI_SIZE) InternalObject->Buffer.Length;
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
/* No extra data for these types */
break;
case ACPI_TYPE_LOCAL_REFERENCE:
switch (InternalObject->Reference.Class)
{
case ACPI_REFCLASS_NAME:
/*
* Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object
*/
Size = AcpiNsGetPathnameLength (InternalObject->Reference.Node);
if (!Size)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Length += ACPI_ROUND_UP_TO_NATIVE_WORD (Size);
break;
default:
/*
* No other reference opcodes are supported.
* Notably, Locals and Args are not supported, but this may be
* required eventually.
*/
ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
"unsupported Reference Class [%s] 0x%X in object %p",
AcpiUtGetReferenceName (InternalObject),
InternalObject->Reference.Class, InternalObject));
Status = AE_TYPE;
break;
}
break;
default:
ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
"unsupported type [%s] 0x%X in object %p",
AcpiUtGetObjectTypeName (InternalObject),
InternalObject->Common.Type, InternalObject));
Status = AE_TYPE;
break;
}
/*
* Account for the space required by the object rounded up to the next
* multiple of the machine word size. This keeps each object aligned
* on a machine word boundary. (preventing alignment faults on some
* machines.)
*/
*ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
return_ACPI_STATUS (Status);
}
示例4: AcpiExGetObjectReference
ACPI_STATUS
AcpiExGetObjectReference (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT **ReturnDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *ReferenceObj;
ACPI_OPERAND_OBJECT *ReferencedObj;
ACPI_FUNCTION_TRACE_PTR (ExGetObjectReference, ObjDesc);
*ReturnDesc = NULL;
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
case ACPI_DESC_TYPE_OPERAND:
if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Must be a reference to a Local or Arg
*/
switch (ObjDesc->Reference.Class)
{
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_DEBUG:
/* The referenced object is the pseudo-node for the local/arg */
ReferencedObj = ObjDesc->Reference.Object;
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid Reference Class 0x%2.2X",
ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
case ACPI_DESC_TYPE_NAMED:
/*
* A named reference that has already been resolved to a Node
*/
ReferencedObj = ObjDesc;
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X",
ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
return_ACPI_STATUS (AE_TYPE);
}
/* Create a new reference object */
ReferenceObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
if (!ReferenceObj)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF;
ReferenceObj->Reference.Object = ReferencedObj;
*ReturnDesc = ReferenceObj;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Object %p Type [%s], returning Reference %p\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
return_ACPI_STATUS (AE_OK);
}
示例5: AcpiDsResultPush
ACPI_STATUS
AcpiDsResultPush (
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
ACPI_STATUS Status;
UINT32 Index;
ACPI_FUNCTION_NAME (DsResultPush);
if (WalkState->ResultCount > WalkState->ResultSize)
{
ACPI_ERROR ((AE_INFO, "Result stack is full"));
return (AE_AML_INTERNAL);
}
else if (WalkState->ResultCount == WalkState->ResultSize)
{
/* Extend the result stack */
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Failed to extend the result stack"));
return (Status);
}
}
if (!(WalkState->ResultCount < WalkState->ResultSize))
{
ACPI_ERROR ((AE_INFO, "No free elements in result stack"));
return (AE_AML_INTERNAL);
}
State = WalkState->Results;
if (!State)
{
ACPI_ERROR ((AE_INFO, "No result stack frame during push"));
return (AE_AML_INTERNAL);
}
if (!Object)
{
ACPI_ERROR ((AE_INFO,
"Null Object! Obj=%p State=%p Num=%u",
Object, WalkState, WalkState->ResultCount));
return (AE_BAD_PARAMETER);
}
/* Assign the address of object to the top free element of result stack */
Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
State->Results.ObjDesc [Index] = Object;
WalkState->ResultCount++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
WalkState, WalkState->ResultCount, WalkState->CurrentResult));
return (AE_OK);
}
示例6: AcpiExStoreObjectToNode
ACPI_STATUS
AcpiExStoreObjectToNode (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node,
ACPI_WALK_STATE *WalkState,
UINT8 ImplicitConversion)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TargetDesc;
ACPI_OPERAND_OBJECT *NewDesc;
ACPI_OBJECT_TYPE TargetType;
ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc);
/* Get current type of the node, and object attached to Node */
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
Node, AcpiUtGetTypeName (TargetType)));
/* Only limited target types possible for everything except CopyObject */
if (WalkState->Opcode != AML_COPY_OBJECT_OP)
{
/*
* Only CopyObject allows all object types to be overwritten. For
* TargetRef(s), there are restrictions on the object types that
* are allowed.
*
* Allowable operations/typing for Store:
*
* 1) Simple Store
* Integer --> Integer (Named/Local/Arg)
* String --> String (Named/Local/Arg)
* Buffer --> Buffer (Named/Local/Arg)
* Package --> Package (Named/Local/Arg)
*
* 2) Store with implicit conversion
* Integer --> String or Buffer (Named)
* String --> Integer or Buffer (Named)
* Buffer --> Integer or String (Named)
*/
switch (TargetType)
{
case ACPI_TYPE_PACKAGE:
/*
* Here, can only store a package to an existing package.
* Storing a package to a Local/Arg is OK, and handled
* elsewhere.
*/
if (WalkState->Opcode == AML_STORE_OP)
{
if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
ACPI_ERROR ((AE_INFO,
"Cannot assign type [%s] to [Package] "
"(source must be type Pkg)",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_TARGET_TYPE);
}
break;
}
/* Fallthrough */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_REGION:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
ACPI_ERROR ((AE_INFO,
"Target must be [Buffer/Integer/String/Reference]"
", found [%s] (%4.4s)",
AcpiUtGetTypeName (Node->Type), Node->Name.Ascii));
return_ACPI_STATUS (AE_AML_TARGET_TYPE);
default:
break;
}
}
/*
* Resolve the source object to an actual value
* (If it is a reference object)
*/
Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
//.........这里部分代码省略.........
示例7: AcpiExDoDebugObject
void
AcpiExDoDebugObject (
ACPI_OPERAND_OBJECT *SourceDesc,
UINT32 Level,
UINT32 Index)
{
UINT32 i;
UINT32 Timer;
ACPI_OPERAND_OBJECT *ObjectDesc;
UINT32 Value;
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
/* Output must be enabled via the DebugObject global or the DbgLevel */
if (!AcpiGbl_EnableAmlDebugObject &&
!(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT))
{
return_VOID;
}
/*
* We will emit the current timer value (in microseconds) with each
* debug output. Only need the lower 26 bits. This allows for 67
* million microseconds or 67 seconds before rollover.
*/
Timer = ((UINT32) AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */
Timer &= 0x03FFFFFF;
/*
* Print line header as long as we are not in the middle of an
* object display
*/
if (!((Level > 0) && Index == 0))
{
AcpiOsPrintf ("[ACPI Debug %.8u] %*s", Timer, Level, " ");
}
/* Display the index for package output only */
if (Index > 0)
{
AcpiOsPrintf ("(%.2u) ", Index-1);
}
if (!SourceDesc)
{
AcpiOsPrintf ("[Null Object]\n");
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
{
AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
if (!AcpiUtValidInternalObject (SourceDesc))
{
AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc);
return_VOID;
}
}
else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf ("%s: %p\n",
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
SourceDesc);
return_VOID;
}
else
{
return_VOID;
}
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
/* Output correct integer width */
if (AcpiGbl_IntegerByteWidth == 4)
{
AcpiOsPrintf ("0x%8.8X\n",
(UINT32) SourceDesc->Integer.Value);
}
else
{
AcpiOsPrintf ("0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value));
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length);
AcpiUtDumpBuffer (SourceDesc->Buffer.Pointer,
(SourceDesc->Buffer.Length < 256) ?
//.........这里部分代码省略.........
示例8: AcpiNsEvaluate
//.........这里部分代码省略.........
else
{
/*
* 2) Object is not a method, return its current value
*
* Disallow certain object types. For these, "evaluation" is undefined.
*/
switch (Info->ResolvedNode->Type)
{
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_REGION:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE:
ACPI_ERROR ((AE_INFO,
"[%4.4s] Evaluation of object type [%s] is not supported",
Info->ResolvedNode->Name.Ascii,
AcpiUtGetTypeName (Info->ResolvedNode->Type)));
return_ACPI_STATUS (AE_TYPE);
default:
break;
}
/*
* Objects require additional resolution steps (e.g., the Node may be
* a field that must be read, etc.) -- we can't just grab the object
* out of the node.
*
* Use ResolveNodeToValue() to get the associated value.
*
* NOTE: we can get away with passing in NULL for a walk state because
* ResolvedNode is guaranteed to not be a reference to either a method
* local or a method argument (because this interface is never called
* from a running method.)
*
* Even though we do not directly invoke the interpreter for object
* resolution, we must lock it because we could access an opregion.
* The opregion access code assumes that the interpreter is locked.
*/
AcpiExEnterInterpreter ();
/* Function has a strange interface */
Status = AcpiExResolveNodeToValue (&Info->ResolvedNode, NULL);
AcpiExExitInterpreter ();
/*
* If AcpiExResolveNodeToValue() succeeded, the return value was placed
* in ResolvedNode.
*/
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_RETURN_VALUE;
Info->ReturnObject =
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->ResolvedNode);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
}
}
/*
* Check input argument count against the ASL-defined count for a method.
* Also check predefined names: argument count and return value against
* the ACPI specification. Some incorrect return value types are repaired.
*/
(void) AcpiNsCheckPredefinedNames (Node, Info->ParamCount,
Status, &Info->ReturnObject);
/* Check if there is a return value that must be dealt with */
if (Status == AE_CTRL_RETURN_VALUE)
{
/* If caller does not want the return value, delete it */
if (Info->Flags & ACPI_IGNORE_RETURN_VALUE)
{
AcpiUtRemoveReference (Info->ReturnObject);
Info->ReturnObject = NULL;
}
/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
Status = AE_OK;
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"*** Completed evaluation of object %s ***\n", Info->Pathname));
/*
* Namespace was unlocked by the handling AcpiNs* function, so we
* just return
*/
return_ACPI_STATUS (Status);
}
示例9: AcpiExStoreObjectToNode
ACPI_STATUS
AcpiExStoreObjectToNode (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node,
ACPI_WALK_STATE *WalkState,
UINT8 ImplicitConversion)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TargetDesc;
ACPI_OPERAND_OBJECT *NewDesc;
ACPI_OBJECT_TYPE TargetType;
ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc);
/* Get current type of the node, and object attached to Node */
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
Node, AcpiUtGetTypeName (TargetType)));
/*
* Resolve the source object to an actual value
* (If it is a reference object)
*/
Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Do the actual store operation */
switch (TargetType)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
* The simple data types all support implicit source operand
* conversion before the store.
*/
if ((WalkState->Opcode == AML_COPY_OP) ||
!ImplicitConversion)
{
/*
* However, CopyObject and Stores to ArgX do not perform
* an implicit conversion, as per the ACPI specification.
* A direct store is performed instead.
*/
Status = AcpiExStoreDirectToNode (SourceDesc, Node,
WalkState);
break;
}
/* Store with implicit source operand conversion support */
Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc,
&NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (NewDesc != TargetDesc)
{
/*
* Store the new NewDesc as the new value of the Name, and set
* the Name's type to that of the value being stored in it.
* SourceDesc reference count is incremented by AttachObject.
*
* Note: This may change the type of the node if an explicit
* store has been performed such that the node/object type
* has been changed.
*/
Status = AcpiNsAttachObject (Node, NewDesc,
NewDesc->Common.Type);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
AcpiUtGetObjectTypeName (SourceDesc),
AcpiUtGetObjectTypeName (NewDesc)));
}
break;
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* For all fields, always write the source data to the target
* field. Any required implicit source operand conversion is
* performed in the function below as necessary. Note, field
* objects must retain their original type permanently.
*/
//.........这里部分代码省略.........
示例10: AcpiExStoreObjectToNode
ACPI_STATUS
AcpiExStoreObjectToNode (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node,
ACPI_WALK_STATE *WalkState,
UINT8 ImplicitConversion)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TargetDesc;
ACPI_OPERAND_OBJECT *NewDesc;
ACPI_OBJECT_TYPE TargetType;
ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc);
/* Get current type of the node, and object attached to Node */
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
Node, AcpiUtGetTypeName (TargetType)));
/*
* Resolve the source object to an actual value
* (If it is a reference object)
*/
Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* If no implicit conversion, drop into the default case below */
if ((!ImplicitConversion) ||
((WalkState->Opcode == AML_COPY_OP) &&
(TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) &&
(TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) &&
(TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD)))
{
/*
* Force execution of default (no implicit conversion). Note:
* CopyObject does not perform an implicit conversion, as per the ACPI
* spec -- except in case of region/bank/index fields -- because these
* objects must retain their original type permanently.
*/
TargetType = ACPI_TYPE_ANY;
}
/* Do the actual store operation */
switch (TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* For fields, copy the source data to the target field. */
Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
&WalkState->ResultObj);
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
* These target types are all of type Integer/String/Buffer, and
* therefore support implicit conversion before the store.
*
* Copy and/or convert the source object to a new target object
*/
Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc,
&NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (NewDesc != TargetDesc)
{
/*
* Store the new NewDesc as the new value of the Name, and set
* the Name's type to that of the value being stored in it.
* SourceDesc reference count is incremented by AttachObject.
*
* Note: This may change the type of the node if an explicit store
* has been performed such that the node/object type has been
* changed.
*/
Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
//.........这里部分代码省略.........
示例11: AcpiExSetupRegion
static ACPI_STATUS
AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *RgnDesc;
UINT8 SpaceId;
ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
/* We must have a valid region */
if (RgnDesc->Common.Type != ACPI_TYPE_REGION)
{
ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)",
RgnDesc->Common.Type,
AcpiUtGetObjectTypeName (RgnDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
SpaceId = RgnDesc->Region.SpaceId;
/* Validate the Space ID */
if (!AcpiIsValidSpaceId (SpaceId))
{
ACPI_ERROR ((AE_INFO,
"Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
/*
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
*/
if (!(RgnDesc->Common.Flags & AOPOBJ_DATA_VALID))
{
Status = AcpiDsGetRegionArguments (RgnDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Exit now for SMBus, GSBus or IPMI address space, it has a non-linear
* address space and the request cannot be directly validated
*/
if (SpaceId == ACPI_ADR_SPACE_SMBUS ||
SpaceId == ACPI_ADR_SPACE_GSBUS ||
SpaceId == ACPI_ADR_SPACE_IPMI)
{
/* SMBus or IPMI has a non-linear address space */
return_ACPI_STATUS (AE_OK);
}
#ifdef ACPI_UNDER_DEVELOPMENT
/*
* If the Field access is AnyAcc, we can now compute the optimal
* access (because we know know the length of the parent region)
*/
if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
{
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
#endif
/*
* Validate the request. The entire request from the byte offset for a
* length of one field datum (access width) must fit within the region.
* (Region length is specified in bytes)
*/
if (RgnDesc->Region.Length <
(ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset +
ObjDesc->CommonField.AccessByteWidth))
{
if (AcpiGbl_EnableInterpreterSlack)
{
/*
* Slack mode only: We will go ahead and allow access to this
* field if it is within the region length rounded up to the next
* access width boundary. ACPI_SIZE cast for 64-bit compile.
*/
if (ACPI_ROUND_UP (RgnDesc->Region.Length,
ObjDesc->CommonField.AccessByteWidth) >=
((ACPI_SIZE) ObjDesc->CommonField.BaseByteOffset +
ObjDesc->CommonField.AccessByteWidth +
FieldDatumByteOffset))
{
return_ACPI_STATUS (AE_OK);
//.........这里部分代码省略.........
示例12: AcpiExStore
ACPI_STATUS
AcpiExStore (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc);
/* Validate parameters */
if (!SourceDesc || !DestDesc)
{
ACPI_ERROR ((AE_INFO, "Null parameter"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/* DestDesc can be either a namespace node or an ACPI object */
if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED)
{
/*
* Dest is a namespace node,
* Storing an object into a Named node.
*/
Status = AcpiExStoreObjectToNode (SourceDesc,
(ACPI_NAMESPACE_NODE *) DestDesc, WalkState,
ACPI_IMPLICIT_CONVERSION);
return_ACPI_STATUS (Status);
}
/* Destination object must be a Reference or a Constant object */
switch (DestDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
break;
case ACPI_TYPE_INTEGER:
/* Allow stores to Constants -- a Noop as per ACPI spec */
if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT)
{
return_ACPI_STATUS (AE_OK);
}
/*lint -fallthrough */
default:
/* Destination is not a Reference object */
ACPI_ERROR ((AE_INFO,
"Target is not a Reference or Constant object - [%s] %p",
AcpiUtGetObjectTypeName (DestDesc), DestDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Examine the Reference class. These cases are handled:
*
* 1) Store to Name (Change the object associated with a name)
* 2) Store to an indexed area of a Buffer or Package
* 3) Store to a Method Local or Arg
* 4) Store to the debug object
*/
switch (RefDesc->Reference.Class)
{
case ACPI_REFCLASS_REFOF:
/* Storing an object into a Name "container" */
Status = AcpiExStoreObjectToNode (SourceDesc,
RefDesc->Reference.Object,
WalkState, ACPI_IMPLICIT_CONVERSION);
break;
case ACPI_REFCLASS_INDEX:
/* Storing to an Index (pointer into a packager or buffer) */
Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState);
break;
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/* Store to a method local/arg */
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class,
RefDesc->Reference.Value, SourceDesc, WalkState);
break;
//.........这里部分代码省略.........
示例13: 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;
//.........这里部分代码省略.........
示例14: AcpiExStoreObjectToIndex
//.........这里部分代码省略.........
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if (ObjDesc)
{
/* Decrement reference count by the ref count of the parent package */
for (i = 0;
i < ((ACPI_OPERAND_OBJECT *)
IndexDesc->Reference.Object)->Common.ReferenceCount;
i++)
{
AcpiUtRemoveReference (ObjDesc);
}
}
*(IndexDesc->Reference.Where) = NewDesc;
/* Increment ref count by the ref count of the parent package-1 */
for (i = 1;
i < ((ACPI_OPERAND_OBJECT *)
IndexDesc->Reference.Object)->Common.ReferenceCount;
i++)
{
AcpiUtAddReference (NewDesc);
}
break;
case ACPI_TYPE_BUFFER_FIELD:
/*
* Store into a Buffer or String (not actually a real BufferField)
* at a location defined by an Index.
*
* The first 8-bit element of the source object is written to the
* 8-bit Buffer location defined by the Index destination object,
* according to the ACPI 2.0 specification.
*/
/*
* Make sure the target is a Buffer or String. An error should
* not happen here, since the ReferenceObject was constructed
* by the INDEX_OP code.
*/
ObjDesc = IndexDesc->Reference.Object;
if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ObjDesc->Common.Type != ACPI_TYPE_STRING))
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* The assignment of the individual elements will be slightly
* different for each source type.
*/
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
/* Use the least-significant byte of the integer */
Value = (UINT8) (SourceDesc->Integer.Value);
break;
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
/* Note: Takes advantage of common string/buffer fields */
Value = SourceDesc->Buffer.Pointer[0];
break;
default:
/* All other types are invalid */
ACPI_ERROR ((AE_INFO,
"Source must be type [Integer/Buffer/String], found [%s]",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Store the source value into the target buffer byte */
ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value;
break;
default:
ACPI_ERROR ((AE_INFO,
"Target is not of type [Package/BufferField]"));
Status = AE_AML_TARGET_TYPE;
break;
}
return_ACPI_STATUS (Status);
}
示例15: AcpiExWriteDataToField
ACPI_STATUS
AcpiExWriteDataToField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT **ResultDesc)
{
ACPI_STATUS Status;
UINT32 Length;
void *Buffer;
ACPI_OPERAND_OBJECT *BufferDesc;
UINT32 Function;
UINT16 AccessorType;
ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc);
/* Parameter validation */
if (!SourceDesc || !ObjDesc)
{
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* If the BufferField arguments have not been previously evaluated,
* evaluate them now and save the results.
*/
if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
{
Status = AcpiDsGetBufferFieldArguments (ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
}
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI))
{
/*
* This is an SMBus, GSBus or IPMI write. We will bypass the entire
* field mechanism and handoff the buffer directly to the handler.
* For these address spaces, the buffer is bi-directional; on a
* write, return data is returned in the same buffer.
*
* Source must be a buffer of sufficient size:
* ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or
* ACPI_IPMI_BUFFER_SIZE.
*
* Note: SMBus and GSBus protocol type is passed in upper 16-bits
* of Function
*/
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO,
"SMBus/IPMI/GenericSerialBus write requires "
"Buffer, found type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (ObjDesc->Field.RegionObj->Region.SpaceId ==
ACPI_ADR_SPACE_SMBUS)
{
Length = ACPI_SMBUS_BUFFER_SIZE;
Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16);
}
else if (ObjDesc->Field.RegionObj->Region.SpaceId ==
ACPI_ADR_SPACE_GSBUS)
{
AccessorType = ObjDesc->Field.Attribute;
Length = AcpiExGetSerialAccessLength (
AccessorType, ObjDesc->Field.AccessLength);
/*
* Add additional 2 bytes for the GenericSerialBus data buffer:
*
* Status; (Byte 0 of the data buffer)
* Length; (Byte 1 of the data buffer)
* Data[x-1]: (Bytes 2-x of the arbitrary length data buffer)
*/
Length += 2;
Function = ACPI_WRITE | (AccessorType << 16);
}
else /* IPMI */
{
Length = ACPI_IPMI_BUFFER_SIZE;
Function = ACPI_WRITE;
}
if (SourceDesc->Buffer.Length < Length)
{
ACPI_ERROR ((AE_INFO,
"SMBus/IPMI/GenericSerialBus write requires "
//.........这里部分代码省略.........