本文整理匯總了C++中ACPI_GET_DESCRIPTOR_TYPE函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACPI_GET_DESCRIPTOR_TYPE函數的具體用法?C++ ACPI_GET_DESCRIPTOR_TYPE怎麽用?C++ ACPI_GET_DESCRIPTOR_TYPE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ACPI_GET_DESCRIPTOR_TYPE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AcpiDsInitBufferField
static ACPI_STATUS
AcpiDsInitBufferField (
UINT16 AmlOpcode,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT *BufferDesc,
ACPI_OPERAND_OBJECT *OffsetDesc,
ACPI_OPERAND_OBJECT *LengthDesc,
ACPI_OPERAND_OBJECT *ResultDesc)
{
UINT32 Offset;
UINT32 BitOffset;
UINT32 BitCount;
UINT8 FieldFlags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
/* Host object must be a Buffer */
if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO,
"Target of Create Field is not a Buffer object - %s",
AcpiUtGetObjectTypeName (BufferDesc)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/*
* The last parameter to all of these opcodes (ResultDesc) started
* out as a NameString, and should therefore now be a NS node
* after resolution in AcpiExResolveOperands().
*/
if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
{
ACPI_ERROR ((AE_INFO,
"(%s) destination not a NS Node [%s]",
AcpiPsGetOpcodeName (AmlOpcode),
AcpiUtGetDescriptorName (ResultDesc)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
Offset = (UINT32) OffsetDesc->Integer.Value;
/*
* Setup the Bit offsets and counts, according to the opcode
*/
switch (AmlOpcode)
{
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
FieldFlags = AML_FIELD_ACCESS_BYTE;
BitOffset = Offset;
BitCount = (UINT32) LengthDesc->Integer.Value;
/* Must have a valid (>0) bit count */
if (BitCount == 0)
{
ACPI_ERROR ((AE_INFO,
"Attempt to CreateField of length zero"));
Status = AE_AML_OPERAND_VALUE;
goto Cleanup;
}
break;
case AML_CREATE_BIT_FIELD_OP:
/* Offset is in bits, Field is one bit */
BitOffset = Offset;
BitCount = 1;
FieldFlags = AML_FIELD_ACCESS_BYTE;
break;
case AML_CREATE_BYTE_FIELD_OP:
/* Offset is in bytes, field is one byte */
BitOffset = 8 * Offset;
BitCount = 8;
FieldFlags = AML_FIELD_ACCESS_BYTE;
break;
case AML_CREATE_WORD_FIELD_OP:
/* Offset is in bytes, field is one word */
BitOffset = 8 * Offset;
BitCount = 16;
FieldFlags = AML_FIELD_ACCESS_WORD;
break;
//.........這裏部分代碼省略.........
示例2: 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;
ACPI_INTEGER 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_INTEGER_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);
//.........這裏部分代碼省略.........
示例3: AcpiUtUpdateObjectReference
ACPI_STATUS
AcpiUtUpdateObjectReference (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *StateList = NULL;
ACPI_OPERAND_OBJECT *NextObject = NULL;
ACPI_GENERIC_STATE *State;
UINT32 i;
ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object);
while (Object)
{
/* Make sure that this isn't a namespace handle */
if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
"Object %p is NS handle\n", Object));
return_ACPI_STATUS (AE_OK);
}
/*
* All sub-objects must have their reference count incremented also.
* Different object types have different subobjects.
*/
switch (Object->Common.Type)
{
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
/* Update the notify objects for these types (if present) */
AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
break;
case ACPI_TYPE_PACKAGE:
/*
* We must update all the sub-objects of the package,
* each of whom may have their own sub-objects.
*/
for (i = 0; i < Object->Package.Count; i++)
{
/*
* Push each element onto the stack for later processing.
* Note: There can be null elements within the package,
* these are simply ignored
*/
Status = AcpiUtCreateUpdateStateAndPush (
Object->Package.Elements[i], Action, &StateList);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
}
break;
case ACPI_TYPE_BUFFER_FIELD:
NextObject = Object->BufferField.BufferObj;
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
NextObject = Object->Field.RegionObj;
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
NextObject = Object->BankField.BankObj;
Status = AcpiUtCreateUpdateStateAndPush (
Object->BankField.RegionObj, Action, &StateList);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
NextObject = Object->IndexField.IndexObj;
Status = AcpiUtCreateUpdateStateAndPush (
Object->IndexField.DataObj, Action, &StateList);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
/*
* The target of an Index (a package, string, or buffer) or a named
* reference must track changes to the ref count of the index or
//.........這裏部分代碼省略.........
示例4: AcpiExResolveOperands
ACPI_STATUS
AcpiExResolveOperands (
UINT16 Opcode,
ACPI_OPERAND_OBJECT **StackPtr,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status = AE_OK;
UINT8 ObjectType;
UINT32 ArgTypes;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 ThisArgType;
ACPI_OBJECT_TYPE TypeNeeded;
UINT16 TargetOp = 0;
ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
{
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
ArgTypes = OpInfo->RuntimeArgs;
if (ArgTypes == ARGI_INVALID_OPCODE)
{
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
Opcode, OpInfo->Name, ArgTypes));
/*
* Normal exit is with (ArgTypes == 0) at end of argument list.
* Function will return an exception from within the loop upon
* finding an entry which is not (or cannot be converted
* to) the required type; if stack underflows; or upon
* finding a NULL stack entry (which should not happen).
*/
while (GET_CURRENT_ARG_TYPE (ArgTypes))
{
if (!StackPtr || !*StackPtr)
{
ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
StackPtr));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/* Extract useful items */
ObjDesc = *StackPtr;
/* Decode the descriptor type */
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
case ACPI_DESC_TYPE_NAMED:
/* Namespace Node */
ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
/*
* Resolve an alias object. The construction of these objects
* guarantees that there is only one level of alias indirection;
* thus, the attached object is always the aliased namespace node
*/
if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
{
ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
*StackPtr = ObjDesc;
ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
}
break;
case ACPI_DESC_TYPE_OPERAND:
/* ACPI internal object */
ObjectType = ObjDesc->Common.Type;
/* Check for bad ACPI_OBJECT_TYPE */
if (!AcpiUtValidObjectType (ObjectType))
{
ACPI_ERROR ((AE_INFO,
"Bad operand object type [0x%X]", ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
//.........這裏部分代碼省略.........
示例5: AcpiNsCheckObjectType
ACPI_STATUS
AcpiNsCheckObjectType (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr,
UINT32 ExpectedBtypes,
UINT32 PackageIndex)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_STATUS Status = AE_OK;
char TypeBuffer[96]; /* Room for 10 types */
/* A Namespace node should not get here, but make sure */
if (ReturnObject &&
ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->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)
*/
Info->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject);
if (Info->ReturnBtype == ACPI_RTYPE_ANY)
{
/* Not one of the supported objects, must be incorrect */
goto TypeErrorExit;
}
/* For reference objects, check that the reference type is correct */
if ((Info->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE)
{
Status = AcpiNsCheckReference (Info, ReturnObject);
return (Status);
}
/* Attempt simple repair of the returned object if necessary */
Status = AcpiNsSimpleRepair (Info, ExpectedBtypes,
PackageIndex, ReturnObjectPtr);
if (ACPI_SUCCESS (Status))
{
return (AE_OK); /* Successful repair */
}
TypeErrorExit:
/* Create a string with all expected types for this predefined object */
AcpiUtGetExpectedReturnTypes (TypeBuffer, ExpectedBtypes);
if (!ReturnObject)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Expected return object of type %s",
TypeBuffer));
}
else if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Return type mismatch - found %s, expected %s",
AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
}
else
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Return Package type mismatch at index %u - "
"found %s, expected %s", PackageIndex,
AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
}
return (AE_AML_OPERAND_TYPE);
}
示例6: AcpiUtCopySimpleObject
static ACPI_STATUS
AcpiUtCopySimpleObject (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *DestDesc)
{
UINT16 ReferenceCount;
ACPI_OPERAND_OBJECT *NextObject;
ACPI_STATUS Status;
ACPI_SIZE CopySize;
/* Save fields from destination that we don't want to overwrite */
ReferenceCount = DestDesc->Common.ReferenceCount;
NextObject = DestDesc->Common.NextObject;
/*
* Copy the entire source object over the destination object.
* Note: Source can be either an operand object or namespace node.
*/
CopySize = sizeof (ACPI_OPERAND_OBJECT);
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
{
CopySize = sizeof (ACPI_NAMESPACE_NODE);
}
ACPI_MEMCPY (ACPI_CAST_PTR (char, DestDesc),
ACPI_CAST_PTR (char, SourceDesc), CopySize);
/* Restore the saved fields */
DestDesc->Common.ReferenceCount = ReferenceCount;
DestDesc->Common.NextObject = NextObject;
/* New object is not static, regardless of source */
DestDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
/* Handle the objects with extra data */
switch (DestDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
/*
* Allocate and copy the actual buffer if and only if:
* 1) There is a valid buffer pointer
* 2) The buffer has a length > 0
*/
if ((SourceDesc->Buffer.Pointer) &&
(SourceDesc->Buffer.Length))
{
DestDesc->Buffer.Pointer =
ACPI_ALLOCATE (SourceDesc->Buffer.Length);
if (!DestDesc->Buffer.Pointer)
{
return (AE_NO_MEMORY);
}
/* Copy the actual buffer data */
ACPI_MEMCPY (DestDesc->Buffer.Pointer,
SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length);
}
break;
case ACPI_TYPE_STRING:
/*
* Allocate and copy the actual string if and only if:
* 1) There is a valid string pointer
* (Pointer to a NULL string is allowed)
*/
if (SourceDesc->String.Pointer)
{
DestDesc->String.Pointer =
ACPI_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
if (!DestDesc->String.Pointer)
{
return (AE_NO_MEMORY);
}
/* Copy the actual string data */
ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
(ACPI_SIZE) SourceDesc->String.Length + 1);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
/*
* We copied the reference object, so we now must add a reference
* to the object pointed to by the reference
*
* DDBHandle reference (from Load/LoadTable) is a special reference,
* it does not have a Reference.Object, so does not need to
* increase the reference count
*/
if (SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE)
{
break;
}
//.........這裏部分代碼省略.........
示例7: acpi_ex_dump_operand
static int
acpi_ex_dump_operand(char * buf, int maxlen, union acpi_operand_object *obj_desc, u32 depth)
{
u32 length;
int str_len = 0;
ACPI_FUNCTION_NAME(ex_dump_operand)
if (maxlen <= 0) {
return maxlen;
}
if (!obj_desc) {
/* This could be a null element of a package */
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
return maxlen;
}
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
obj_desc));
ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
return maxlen;
}
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"%p is not a node or operand object: [%s]\n",
obj_desc,
acpi_ut_get_descriptor_name(obj_desc)));
ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
return maxlen;
}
/* obj_desc is a valid object */
if (depth > 0) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ",
depth, " ", depth, obj_desc));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc));
}
/* Decode object type */
switch (obj_desc->common.type) {
#if 0
case ACPI_TYPE_LOCAL_REFERENCE:
//str_len += snprintf(buf + str_len, maxlen - str_len, "Reference: [%s] ",
// acpi_ut_get_reference_name(obj_desc));
switch (obj_desc->reference.class) {
case ACPI_REFCLASS_DEBUG:
str_len += snprintf(buf + str_len, maxlen - str_len, "\n");
break;
case ACPI_REFCLASS_INDEX:
str_len += snprintf(buf + str_len, maxlen - str_len, "%p\n", obj_desc->reference.object);
break;
case ACPI_REFCLASS_TABLE:
str_len += snprintf(buf + str_len, maxlen - str_len, "Table Index %X\n",
obj_desc->reference.value);
break;
case ACPI_REFCLASS_REFOF:
//str_len += snprintf(buf + str_len, maxlen - str_len, "%p [%s]\n", obj_desc->reference.object,
// acpi_ut_get_type_name(((union
// acpi_operand_object
// *)
// obj_desc->
// reference.
// object)->common.
// type));
break;
case ACPI_REFCLASS_NAME:
str_len += snprintf(buf + str_len, maxlen - str_len, "- [%4.4s]\n",
obj_desc->reference.node->name.ascii);
break;
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL:
str_len += snprintf(buf + str_len, maxlen - str_len, "%X\n", obj_desc->reference.value);
break;
default: /* Unknown reference class */
str_len += snprintf(buf + str_len, maxlen - str_len, "%2.2X\n", obj_desc->reference.class);
break;
}
//.........這裏部分代碼省略.........
示例8: acpi_ds_exec_end_control_op
//.........這裏部分代碼省略.........
* If value being returned is a Reference (such as
* an arg or local), resolve it now because it may
* cease to exist at the end of the method.
*/
status =
acpi_ex_resolve_to_value(&walk_state->operands[0],
walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}
/*
* Get the return value and save as the last result
* value. This is the only place where walk_state->return_desc
* is set to anything other than zero!
*/
walk_state->return_desc = walk_state->operands[0];
} else if ((walk_state->results) &&
(walk_state->results->results.num_results > 0)) {
/* Since we have a real Return(), delete any implicit return */
acpi_ds_clear_implicit_return(walk_state);
/*
* The return value has come from a previous calculation.
*
* If value being returned is a Reference (such as
* an arg or local), resolve it now because it may
* cease to exist at the end of the method.
*
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE
(walk_state->results->results.obj_desc[0]) ==
ACPI_DESC_TYPE_OPERAND)
&&
(ACPI_GET_OBJECT_TYPE
(walk_state->results->results.obj_desc[0]) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])->
reference.opcode != AML_INDEX_OP)) {
status =
acpi_ex_resolve_to_value(&walk_state->
results->results.
obj_desc[0],
walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}
}
walk_state->return_desc =
walk_state->results->results.obj_desc[0];
} else {
/* No return operand */
if (walk_state->num_operands) {
acpi_ut_remove_reference(walk_state->
operands[0]);
}
walk_state->operands[0] = NULL;
walk_state->num_operands = 0;
walk_state->return_desc = NULL;
}
示例9: acpi_evaluate_object
//.........這裏部分代碼省略.........
status = AE_BAD_PARAMETER;
}
else {
/*
* We get here if we have a handle -- and if we have a
* pathname it is relative. The handle will be validated
* in the lower procedures
*/
if (!pathname) {
/*
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
status = acpi_ns_evaluate_by_handle (&info);
}
else {
/*
* Both a Handle and a relative Pathname
*/
status = acpi_ns_evaluate_relative (pathname, &info);
}
}
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
if (return_buffer) {
if (!info.return_object) {
return_buffer->length = 0;
}
else {
if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) {
/*
* If we received a NS Node as a return object, this means that
* the object we are evaluating has nothing interesting to
* return (such as a mutex, etc.) We return an error because
* these types are essentially unsupported by this interface.
* We don't check up front because this makes it easier to add
* support for various types at a later date if necessary.
*/
status = AE_TYPE;
info.return_object = NULL; /* No need to delete a NS Node */
return_buffer->length = 0;
}
if (ACPI_SUCCESS (status)) {
/*
* Find out how large a buffer is needed
* to contain the returned object
*/
status = acpi_ut_get_object_size (info.return_object,
&buffer_space_needed);
if (ACPI_SUCCESS (status)) {
/* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed);
if (ACPI_FAILURE (status)) {
/*
* Caller's buffer is too small or a new one can't be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
(u32) buffer_space_needed,
acpi_format_exception (status)));
示例10: AcpiEvaluateObject
//.........這裏部分代碼省略.........
default:
/* Warn if arguments passed to an object that is not a method */
if (Info->ParamCount)
{
ACPI_WARNING ((AE_INFO,
"%u arguments were passed to a non-method ACPI object",
Info->ParamCount));
}
break;
}
#endif
/* Now we can evaluate the object */
Status = AcpiNsEvaluate (Info);
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
if (ReturnBuffer)
{
if (!Info->ReturnObject)
{
ReturnBuffer->Length = 0;
}
else
{
if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) ==
ACPI_DESC_TYPE_NAMED)
{
/*
* If we received a NS Node as a return object, this means that
* the object we are evaluating has nothing interesting to
* return (such as a mutex, etc.) We return an error because
* these types are essentially unsupported by this interface.
* We don't check up front because this makes it easier to add
* support for various types at a later date if necessary.
*/
Status = AE_TYPE;
Info->ReturnObject = NULL; /* No need to delete a NS Node */
ReturnBuffer->Length = 0;
}
if (ACPI_SUCCESS (Status))
{
/* Dereference Index and RefOf references */
AcpiNsResolveReferences (Info);
/* Get the size of the returned object */
Status = AcpiUtGetObjectSize (Info->ReturnObject,
&BufferSpaceNeeded);
if (ACPI_SUCCESS (Status))
{
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (ReturnBuffer,
BufferSpaceNeeded);
if (ACPI_FAILURE (Status))
示例11: acpi_ds_init_buffer_field
static acpi_status
acpi_ds_init_buffer_field(u16 aml_opcode,
union acpi_operand_object *obj_desc,
union acpi_operand_object *buffer_desc,
union acpi_operand_object *offset_desc,
union acpi_operand_object *length_desc,
union acpi_operand_object *result_desc)
{
u32 offset;
u32 bit_offset;
u32 bit_count;
u8 field_flags;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc);
/* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO,
"Target of Create Field is not a Buffer object - %s",
acpi_ut_get_object_type_name(buffer_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/*
* The last parameter to all of these opcodes (result_desc) started
* out as a name_string, and should therefore now be a NS node
* after resolution in acpi_ex_resolve_operands().
*/
if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
ACPI_ERROR((AE_INFO,
"(%s) destination not a NS Node [%s]",
acpi_ps_get_opcode_name(aml_opcode),
acpi_ut_get_descriptor_name(result_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
offset = (u32) offset_desc->integer.value;
/*
* Setup the Bit offsets and counts, according to the opcode
*/
switch (aml_opcode) {
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
field_flags = AML_FIELD_ACCESS_BYTE;
bit_offset = offset;
bit_count = (u32) length_desc->integer.value;
/* Must have a valid (>0) bit count */
if (bit_count == 0) {
ACPI_ERROR((AE_INFO,
"Attempt to CreateField of length zero"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
break;
case AML_CREATE_BIT_FIELD_OP:
/* Offset is in bits, Field is one bit */
bit_offset = offset;
bit_count = 1;
field_flags = AML_FIELD_ACCESS_BYTE;
break;
case AML_CREATE_BYTE_FIELD_OP:
/* Offset is in bytes, field is one byte */
bit_offset = 8 * offset;
bit_count = 8;
field_flags = AML_FIELD_ACCESS_BYTE;
break;
case AML_CREATE_WORD_FIELD_OP:
/* Offset is in bytes, field is one word */
bit_offset = 8 * offset;
bit_count = 16;
field_flags = AML_FIELD_ACCESS_WORD;
break;
case AML_CREATE_DWORD_FIELD_OP:
/* Offset is in bytes, field is one dword */
bit_offset = 8 * offset;
bit_count = 32;
field_flags = AML_FIELD_ACCESS_DWORD;
//.........這裏部分代碼省略.........
示例12: acpi_ex_dump_operand
void
acpi_ex_dump_operand (
union acpi_operand_object *obj_desc,
u32 depth)
{
u32 length;
u32 index;
ACPI_FUNCTION_NAME ("ex_dump_operand")
if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return;
}
if (!obj_desc) {
/*
* This could be a null element of a package
*/
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc));
ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"%p is not a node or operand object: [%s]\n",
obj_desc, acpi_ut_get_descriptor_name (obj_desc)));
ACPI_DUMP_BUFFER (obj_desc, sizeof (union acpi_operand_object));
return;
}
/* obj_desc is a valid object */
if (depth > 0) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%*s[%u] ", depth, " ", depth));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%p ", obj_desc));
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE:
switch (obj_desc->reference.opcode) {
case AML_DEBUG_OP:
acpi_os_printf ("Reference: Debug\n");
break;
case AML_NAME_OP:
ACPI_DUMP_PATHNAME (obj_desc->reference.object,
"Reference: Name: ", ACPI_LV_INFO, _COMPONENT);
ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO);
break;
case AML_INDEX_OP:
acpi_os_printf ("Reference: Index %p\n",
obj_desc->reference.object);
break;
case AML_REF_OF_OP:
acpi_os_printf ("Reference: (ref_of) %p\n",
obj_desc->reference.object);
break;
case AML_ARG_OP:
acpi_os_printf ("Reference: Arg%d",
obj_desc->reference.offset);
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
/* Value is an Integer */
acpi_os_printf (" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
}
acpi_os_printf ("\n");
break;
case AML_LOCAL_OP:
acpi_os_printf ("Reference: Local%d",
obj_desc->reference.offset);
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
//.........這裏部分代碼省略.........
示例13: acpi_ex_dump_object_descriptor
void
acpi_ex_dump_object_descriptor (
union acpi_operand_object *obj_desc,
u32 flags)
{
u32 i;
ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return_VOID;
}
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
acpi_ex_dump_node ((struct acpi_namespace_node *) obj_desc, flags);
acpi_os_printf ("\nAttached Object (%p):\n",
((struct acpi_namespace_node *) obj_desc)->object);
acpi_ex_dump_object_descriptor (
((struct acpi_namespace_node *) obj_desc)->object, flags);
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
acpi_os_printf (
"ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
obj_desc, acpi_ut_get_descriptor_name (obj_desc));
return_VOID;
}
/* Common Fields */
acpi_ex_out_string ("Type", acpi_ut_get_object_type_name (obj_desc));
acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count);
acpi_ex_out_integer ("Flags", obj_desc->common.flags);
/* Object-specific Fields */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER:
acpi_os_printf ("%20s : %8.8X%8.8X\n", "Value",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
break;
case ACPI_TYPE_STRING:
acpi_ex_out_integer ("Length", obj_desc->string.length);
acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer);
acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf ("\n");
break;
case ACPI_TYPE_BUFFER:
acpi_ex_out_integer ("Length", obj_desc->buffer.length);
acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer);
ACPI_DUMP_BUFFER (obj_desc->buffer.pointer, obj_desc->buffer.length);
break;
case ACPI_TYPE_PACKAGE:
acpi_ex_out_integer ("Flags", obj_desc->package.flags);
acpi_ex_out_integer ("Count", obj_desc->package.count);
acpi_ex_out_pointer ("Elements", obj_desc->package.elements);
/* Dump the package contents */
if (obj_desc->package.count > 0) {
acpi_os_printf ("\nPackage Contents:\n");
for (i = 0; i < obj_desc->package.count; i++) {
acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
if (obj_desc->package.elements[i]) {
acpi_os_printf (" %s",
acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
}
acpi_os_printf ("\n");
}
}
break;
case ACPI_TYPE_DEVICE:
acpi_ex_out_pointer ("Handler", obj_desc->device.handler);
acpi_ex_out_pointer ("system_notify", obj_desc->device.system_notify);
acpi_ex_out_pointer ("device_notify", obj_desc->device.device_notify);
break;
case ACPI_TYPE_EVENT:
acpi_ex_out_pointer ("Semaphore", obj_desc->event.semaphore);
//.........這裏部分代碼省略.........
示例14: acpi_ns_lookup
acpi_status
acpi_ns_lookup(union acpi_generic_state *scope_info,
char *pathname,
acpi_object_type type,
acpi_interpreter_mode interpreter_mode,
u32 flags,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node **return_node)
{
acpi_status status;
char *path = pathname;
struct acpi_namespace_node *prefix_node;
struct acpi_namespace_node *current_node = NULL;
struct acpi_namespace_node *this_node = NULL;
u32 num_segments;
u32 num_carats;
acpi_name simple_name;
acpi_object_type type_to_check_for;
acpi_object_type this_search_type;
u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
u32 local_flags;
ACPI_FUNCTION_TRACE(ns_lookup);
if (!return_node) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
*return_node = ACPI_ENTRY_NOT_FOUND;
acpi_gbl_ns_lookup_count++;
if (!acpi_gbl_root_node) {
return_ACPI_STATUS(AE_NO_NAMESPACE);
}
/* Get the prefix scope. A null scope means use the root scope */
if ((!scope_info) || (!scope_info->scope.node)) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Null scope prefix, using root node (%p)\n",
acpi_gbl_root_node));
prefix_node = acpi_gbl_root_node;
} else {
prefix_node = scope_info->scope.node;
if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
ACPI_DESC_TYPE_NAMED) {
ACPI_ERROR((AE_INFO, "%p is not a namespace node [%s]",
prefix_node,
acpi_ut_get_descriptor_name(prefix_node)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) {
/*
* This node might not be a actual "scope" node (such as a
* Device/Method, etc.) It could be a Package or other object
* node. Backup up the tree to find the containing scope node.
*/
while (!acpi_ns_opens_scope(prefix_node->type) &&
prefix_node->type != ACPI_TYPE_ANY) {
prefix_node = prefix_node->parent;
}
}
}
/* Save type. TBD: may be no longer necessary */
type_to_check_for = type;
/*
* Begin examination of the actual pathname
*/
if (!pathname) {
/* A Null name_path is allowed and refers to the root */
num_segments = 0;
this_node = acpi_gbl_root_node;
path = "";
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Null Pathname (Zero segments), Flags=%X\n",
flags));
} else {
/*
* Name pointer is valid (and must be in internal name format)
*
* Check for scope prefixes:
*
* As represented in the AML stream, a namepath consists of an
* optional scope prefix followed by a name segment part.
*
* If present, the scope prefix is either a Root Prefix (in
* which case the name is fully qualified), or one or more
* Parent Prefixes (in which case the name's scope is relative
* to the current scope).
*/
if (*path == (u8) AML_ROOT_PREFIX) {
//.........這裏部分代碼省略.........
示例15: AcpiUtGetSimpleObjectSize
static ACPI_STATUS
AcpiUtGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_SIZE *ObjLength)
{
ACPI_SIZE Length;
ACPI_SIZE Size;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject);
/* Start with the length of the (external) Acpi object */
Length = sizeof (ACPI_OBJECT);
/* A NULL object is allowed, can be a legal uninitialized package element */
if (!InternalObject)
{
/*
* 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 */
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 - "
//.........這裏部分代碼省略.........