本文整理汇总了C++中AcpiExStore函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiExStore函数的具体用法?C++ AcpiExStore怎么用?C++ AcpiExStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AcpiExStore函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AeDoOneOverride
static void
AeDoOneOverride (
char *Pathname,
char *ValueString,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_HANDLE Handle;
ACPI_STATUS Status;
UINT64 Value;
AcpiOsPrintf ("Value Override: %s, ", Pathname);
/*
* Get the namespace node associated with the override
* pathname from the init file.
*/
Status = AcpiGetHandle (NULL, Pathname, &Handle);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
return;
}
/* Extract the 64-bit integer */
Status = AcpiUtStrtoul64 (ValueString,
(ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &Value);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s %s\n", ValueString,
AcpiFormatException (Status));
return;
}
ObjDesc->Integer.Value = Value;
/*
* At the point this function is called, the namespace is fully
* built and initialized. We can simply store the new object to
* the target node.
*/
AcpiExEnterInterpreter ();
Status = AcpiExStore (ObjDesc, Handle, WalkState);
AcpiExExitInterpreter ();
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
return;
}
AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value));
}
开发者ID:ColinIanKing,项目名称:acpica,代码行数:56,代码来源:aeinitfile.c
示例2: AcpiExOpcode_1A_0T_1R
//.........这里部分代码省略.........
* 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
* Reference object
*/
Status = AcpiExStore (ReturnDesc, Operand[0], WalkState);
break;
case AML_OBJECT_TYPE_OP: /* ObjectType (SourceObject) */
/*
* Note: The operand is not resolved at this point because we want to
* get the associated object, not its value. For example, we don't
* want to resolve a FieldUnit to its value, we want the actual
* FieldUnit object.
*/
/* Get the type of the base object */
Status = AcpiExResolveMultiple (WalkState, Operand[0], &Type, NULL);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Allocate a descriptor to hold the type. */
ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) Type);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
break;
case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
/*
* Note: The operand is not resolved at this point because we want to
* get the associated object, not its value.
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:67,代码来源:exoparg1.c
示例3: AcpiExOpcode_1A_1T_1R
//.........这里部分代码省略.........
ACPI_ERROR ((AE_INFO,
"Integer too large to convert to BCD: 0x%8.8X%8.8X",
ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
break;
case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
/*
* This op is a little strange because the internal return value is
* different than the return value stored in the result descriptor
* (There are really two return values)
*/
if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode)
{
/*
* This means that the object does not exist in the namespace,
* return FALSE
*/
ReturnDesc->Integer.Value = 0;
goto Cleanup;
}
/* Get the object reference, store it, and remove our reference */
Status = AcpiExGetObjectReference (Operand[0],
&ReturnDesc2, WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
AcpiUtRemoveReference (ReturnDesc2);
/* The object exists in the namespace, return TRUE */
ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
goto Cleanup;
default:
/* No other opcodes get here */
break;
}
break;
case AML_STORE_OP: /* Store (Source, Target) */
/*
* A store operand is typically a number, string, buffer or lvalue
* Be careful about deleting the source object,
* since the object itself may have been stored.
*/
Status = AcpiExStore (Operand[0], Operand[1], WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* It is possible that the Store already produced a return object */
if (!WalkState->ResultObj)
{
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:67,代码来源:exoparg1.c
示例4: AcpiExOpcode_3A_1T_1R
//.........这里部分代码省略.........
{
Length = 0;
}
/* Truncate request if larger than the actual String/Buffer */
else if ((Index + Length) > Operand[0]->String.Length)
{
Length = (ACPI_SIZE) Operand[0]->String.Length -
(ACPI_SIZE) Index;
}
/* Strings always have a sub-pointer, not so for buffers */
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_STRING:
/* Always allocate a new buffer for the String */
Buffer = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1);
if (!Buffer)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
break;
case ACPI_TYPE_BUFFER:
/* If the requested length is zero, don't allocate a buffer */
if (Length > 0)
{
/* Allocate a new buffer for the Buffer */
Buffer = ACPI_ALLOCATE_ZEROED (Length);
if (!Buffer)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
}
break;
default: /* Should not happen */
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
if (Buffer)
{
/* We have a buffer, copy the portion requested */
ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
Length);
}
/* Set the length of the new String/Buffer */
ReturnDesc->String.Pointer = Buffer;
ReturnDesc->String.Length = (UINT32) Length;
/* Mark buffer initialized */
ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
/* Store the result in the target */
Status = AcpiExStore (ReturnDesc, Operand[3], WalkState);
Cleanup:
/* Delete return object on error */
if (ACPI_FAILURE (Status) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
WalkState->ResultObj = NULL;
}
/* Set the return object and exit */
else
{
WalkState->ResultObj = ReturnDesc;
}
return_ACPI_STATUS (Status);
}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:101,代码来源:exoparg3.c
示例5: AcpiExLoadOp
//.........这里部分代码省略.........
/* Table cannot extend beyond the buffer */
if (Length > ObjDesc->Buffer.Length)
{
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
if (Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
/*
* Copy the table from the buffer because the buffer could be modified
* or even deleted in the future
*/
TableDesc.Pointer = ACPI_ALLOCATE (Length);
if (!TableDesc.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
break;
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Validate table checksum (will not get validated in TbAddTable) */
Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (TableDesc.Pointer);
return_ACPI_STATUS (Status);
}
/* Complete the table descriptor */
TableDesc.Length = Length;
TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
/* Install the new table into the local data structures */
Status = AcpiTbAddTable (&TableDesc, &TableIndex);
if (ACPI_FAILURE (Status))
{
/* Delete allocated table buffer */
AcpiTbDeleteTable (&TableDesc);
return_ACPI_STATUS (Status);
}
/*
* Add the table to the namespace.
*
* Note: Load the table objects relative to the root of the namespace.
* This appears to go against the ACPI specification, but we do it for
* compatibility with other ACPI implementations.
*/
Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
/* On error, TablePtr was deallocated above */
return_ACPI_STATUS (Status);
}
/* Store the DdbHandle into the Target operand */
Status = AcpiExStore (DdbHandle, Target, WalkState);
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
/* TablePtr was deallocated above */
AcpiUtRemoveReference (DdbHandle);
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Dynamic OEM Table Load:"));
AcpiTbPrintTableHeader (0, TableDesc.Pointer);
/* Remove the reference by added by AcpiExStore above */
AcpiUtRemoveReference (DdbHandle);
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer,
AcpiGbl_TableHandlerContext);
}
return_ACPI_STATUS (Status);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:101,代码来源:exconfig.c
示例6: AcpiExLoadTableOp
//.........这里部分代码省略.........
DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0);
if (!DdbHandle)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (AE_OK);
}
/* Default nodes */
StartNode = WalkState->ScopeInfo->Scope.Node;
ParentNode = AcpiGbl_RootNode;
/* RootPath (optional parameter) */
if (Operand[3]->String.Length > 0)
{
/*
* Find the node referenced by the RootPathString. This is the
* location within the namespace where the table will be loaded.
*/
Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,
ACPI_NS_SEARCH_PARENT, &ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* ParameterPath (optional parameter) */
if (Operand[4]->String.Length > 0)
{
if ((Operand[4]->String.Pointer[0] != '\\') &&
(Operand[4]->String.Pointer[0] != '^'))
{
/*
* Path is not absolute, so it will be relative to the node
* referenced by the RootPathString (or the NS root if omitted)
*/
StartNode = ParentNode;
}
/* Find the node referenced by the ParameterPathString */
Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer,
ACPI_NS_SEARCH_PARENT, &ParameterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Load the table into the namespace */
Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Parameter Data (optional) */
if (ParameterNode)
{
/* Store the parameter data into the optional parameter object */
Status = AcpiExStore (Operand[5],
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
WalkState);
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
AcpiUtRemoveReference (DdbHandle);
return_ACPI_STATUS (Status);
}
}
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_SUCCESS (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Dynamic OEM Table Load:"));
AcpiTbPrintTableHeader (0, Table);
}
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
AcpiGbl_TableHandlerContext);
}
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (Status);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:101,代码来源:exconfig.c
示例7: 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);
}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:101,代码来源:exoparg2.c
示例8: AcpiExOpcode_2A_2T_1R
ACPI_STATUS
AcpiExOpcode_2A_2T_1R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc1 = NULL;
ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Execute the opcode */
switch (WalkState->Opcode)
{
case AML_DIVIDE_OP:
/* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc1)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc2)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Quotient to ReturnDesc1, remainder to ReturnDesc2 */
Status = AcpiUtDivide (Operand[0]->Integer.Value,
Operand[1]->Integer.Value,
&ReturnDesc1->Integer.Value,
&ReturnDesc2->Integer.Value);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
/* Store the results to the target reference operands */
Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Cleanup:
/*
* Since the remainder is not returned indirectly, remove a reference to
* it. Only the quotient is returned indirectly.
*/
AcpiUtRemoveReference (ReturnDesc2);
if (ACPI_FAILURE (Status))
{
/* Delete the return object */
AcpiUtRemoveReference (ReturnDesc1);
}
/* Save return object (the remainder) on success */
else
{
WalkState->ResultObj = ReturnDesc1;
}
return_ACPI_STATUS (Status);
}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:93,代码来源:exoparg2.c
注:本文中的AcpiExStore函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论