本文整理汇总了C++中AcpiUtInitializeBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiUtInitializeBuffer函数的具体用法?C++ AcpiUtInitializeBuffer怎么用?C++ AcpiUtInitializeBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AcpiUtInitializeBuffer函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AcpiGetSystemInfo
ACPI_STATUS
AcpiGetSystemInfo (
ACPI_BUFFER *OutBuffer)
{
ACPI_SYSTEM_INFO *InfoPtr;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiGetSystemInfo);
/* Parameter validation */
Status = AcpiUtValidateBuffer (OutBuffer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Populate the return buffer
*/
InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
/* System flags (ACPI capabilities) */
InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
/* Timer resolution - 24 or 32 bits */
if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER)
{
InfoPtr->TimerResolution = 24;
}
else
{
InfoPtr->TimerResolution = 32;
}
/* Clear the reserved fields */
InfoPtr->Reserved1 = 0;
InfoPtr->Reserved2 = 0;
/* Current debug levels */
InfoPtr->DebugLayer = AcpiDbgLayer;
InfoPtr->DebugLevel = AcpiDbgLevel;
return_ACPI_STATUS (AE_OK);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:60,代码来源:utxface.c
示例2: AcpiRsCreateResourceList
ACPI_STATUS
AcpiRsCreateResourceList (
ACPI_OPERAND_OBJECT *AmlBuffer,
ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
UINT8 *AmlStart;
ACPI_SIZE ListSizeNeeded = 0;
UINT32 AmlBufferLength;
void *Resource;
ACPI_FUNCTION_TRACE (RsCreateResourceList);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n",
AmlBuffer));
/* Params already validated, so we don't re-validate here */
AmlBufferLength = AmlBuffer->Buffer.Length;
AmlStart = AmlBuffer->Buffer.Pointer;
/*
* Pass the AmlBuffer into a module that can calculate
* the buffer size needed for the linked list
*/
Status = AcpiRsGetListLength (AmlStart, AmlBufferLength,
&ListSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
Status, (UINT32) ListSizeNeeded));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutputBuffer, ListSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Do the conversion */
Resource = OutputBuffer->Pointer;
Status = AcpiUtWalkAmlResources (NULL, AmlStart, AmlBufferLength,
AcpiRsConvertAmlToResources, &Resource);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
开发者ID:libkeiser,项目名称:illumos-nexenta,代码行数:60,代码来源:rscreate.c
示例3: AcpiRsMatchVendorResource
static ACPI_STATUS
AcpiRsMatchVendorResource (
ACPI_RESOURCE *Resource,
void *Context)
{
ACPI_VENDOR_WALK_INFO *Info = Context;
ACPI_RESOURCE_VENDOR_TYPED *Vendor;
ACPI_BUFFER *Buffer;
ACPI_STATUS Status;
/* Ignore all descriptors except Vendor */
if (Resource->Type != ACPI_RESOURCE_TYPE_VENDOR)
{
return (AE_OK);
}
Vendor = &Resource->Data.VendorTyped;
/*
* For a valid match, these conditions must hold:
*
* 1) Length of descriptor data must be at least as long as a UUID struct
* 2) The UUID subtypes must match
* 3) The UUID data must match
*/
if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) ||
(Vendor->UuidSubtype != Info->Uuid->Subtype) ||
(ACPI_MEMCMP (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH)))
{
return (AE_OK);
}
/* Validate/Allocate/Clear caller buffer */
Buffer = Info->Buffer;
Status = AcpiUtInitializeBuffer (Buffer, Resource->Length);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Found the correct resource, copy and return it */
ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length);
Buffer->Length = Resource->Length;
/* Found the desired descriptor, terminate resource walk */
Info->Status = AE_OK;
return (AE_CTRL_TERMINATE);
}
开发者ID:CSharpLover,项目名称:MosquitOS,代码行数:53,代码来源:rsxface.c
示例4: AcpiRsCreateAmlResources
ACPI_STATUS
AcpiRsCreateAmlResources (
ACPI_RESOURCE *LinkedListBuffer,
ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
ACPI_SIZE AmlSizeNeeded = 0;
ACPI_FUNCTION_TRACE (RsCreateAmlResources);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
LinkedListBuffer));
/*
* Params already validated, so we don't re-validate here
*
* Pass the LinkedListBuffer into a module that calculates
* the buffer size needed for the byte stream.
*/
Status = AcpiRsGetAmlLength (LinkedListBuffer,
&AmlSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
(UINT32) AmlSizeNeeded, AcpiFormatException (Status)));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Do the conversion */
Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded,
OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
开发者ID:libkeiser,项目名称:illumos-nexenta,代码行数:52,代码来源:rscreate.c
示例5: AcpiRsCreateAmlResources
ACPI_STATUS
AcpiRsCreateAmlResources (
ACPI_BUFFER *ResourceList,
ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
ACPI_SIZE AmlSizeNeeded = 0;
ACPI_FUNCTION_TRACE (RsCreateAmlResources);
/* Params already validated, no need to re-validate here */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ResourceList Buffer = %p\n",
ResourceList->Pointer));
/* Get the buffer size needed for the AML byte stream */
Status = AcpiRsGetAmlLength (ResourceList->Pointer,
ResourceList->Length, &AmlSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
(UINT32) AmlSizeNeeded, AcpiFormatException (Status)));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Do the conversion */
Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer,
AmlSizeNeeded, OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:50,代码来源:rscreate.c
示例6: AcpiNsHandleToPathname
ACPI_STATUS
AcpiNsHandleToPathname (
ACPI_HANDLE TargetHandle,
ACPI_BUFFER *Buffer,
BOOLEAN NoTrailing)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_SIZE RequiredSize;
ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle);
Node = AcpiNsValidateHandle (TargetHandle);
if (!Node)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Determine size required for the caller buffer */
RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
if (!RequiredSize)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (Buffer, RequiredSize);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Build the path in the caller buffer */
(void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer,
RequiredSize, NoTrailing);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
(char *) Buffer->Pointer, (UINT32) RequiredSize));
return_ACPI_STATUS (AE_OK);
}
开发者ID:Lekensteyn,项目名称:acpica,代码行数:49,代码来源:nsnames.c
示例7: AcpiNsHandleToPathname
ACPI_STATUS
AcpiNsHandleToPathname (
ACPI_HANDLE TargetHandle,
ACPI_BUFFER *Buffer)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_SIZE RequiredSize;
ACPI_FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
Node = AcpiNsMapHandleToNode (TargetHandle);
if (!Node)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Determine size required for the caller buffer */
RequiredSize = AcpiNsGetPathnameLength (Node);
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (Buffer, RequiredSize);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Build the path in the caller buffer */
AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, (UINT32) RequiredSize));
return_ACPI_STATUS (AE_OK);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:38,代码来源:nsnames.c
示例8: AcpiNsHandleToName
ACPI_STATUS
AcpiNsHandleToName (
ACPI_HANDLE TargetHandle,
ACPI_BUFFER *Buffer)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
const char *NodeName;
ACPI_FUNCTION_TRACE_PTR (NsHandleToName, TargetHandle);
Node = AcpiNsValidateHandle (TargetHandle);
if (!Node)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Just copy the ACPI name from the Node and zero terminate it */
NodeName = AcpiUtGetNodeName (Node);
ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%4.4s\n", (char *) Buffer->Pointer));
return_ACPI_STATUS (AE_OK);
}
开发者ID:Lekensteyn,项目名称:acpica,代码行数:36,代码来源:nsnames.c
示例9: AcpiEvaluateObject
//.........这里部分代码省略.........
/* 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))
{
/*
* 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",
(UINT32) BufferSpaceNeeded,
AcpiFormatException (Status)));
}
else
{
/* We have enough space for the object, build it */
Status = AcpiUtCopyIobjectToEobject (
Info->ReturnObject, ReturnBuffer);
}
}
}
}
}
if (Info->ReturnObject)
{
/*
* Delete the internal return object. NOTE: Interpreter must be
* locked to avoid race condition.
*/
AcpiExEnterInterpreter ();
/* Remove one reference on the return object (should delete it) */
AcpiUtRemoveReference (Info->ReturnObject);
AcpiExExitInterpreter ();
}
Cleanup:
/* Free the input parameter list (if we created one) */
if (Info->Parameters)
{
/* Free the allocated parameter block */
AcpiUtDeleteInternalObjectList (Info->Parameters);
}
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:nsxfeval.c
示例10: AcpiRsCreatePciRoutingTable
ACPI_STATUS
AcpiRsCreatePciRoutingTable (
ACPI_OPERAND_OBJECT *PackageObject,
ACPI_BUFFER *OutputBuffer)
{
UINT8 *Buffer;
ACPI_OPERAND_OBJECT **TopObjectList;
ACPI_OPERAND_OBJECT **SubObjectList;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_SIZE BufferSizeNeeded = 0;
UINT32 NumberOfElements;
UINT32 Index;
ACPI_PCI_ROUTING_TABLE *UserPrt;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_BUFFER PathBuffer;
ACPI_FUNCTION_TRACE (RsCreatePciRoutingTable);
/* Params already validated, so we don't re-validate here */
/* Get the required buffer length */
Status = AcpiRsGetPciRoutingTableLength (PackageObject,
&BufferSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n",
(UINT32) BufferSizeNeeded));
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutputBuffer, BufferSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a
* package that in turn contains an UINT64 Address, a UINT8 Pin,
* a Name, and a UINT8 SourceIndex.
*/
TopObjectList = PackageObject->Package.Elements;
NumberOfElements = PackageObject->Package.Count;
Buffer = OutputBuffer->Pointer;
UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
for (Index = 0; Index < NumberOfElements; Index++)
{
/*
* Point UserPrt past this current structure
*
* NOTE: On the first iteration, UserPrt->Length will
* be zero because we cleared the return buffer earlier
*/
Buffer += UserPrt->Length;
UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
/*
* Fill in the Length field with the information we have at this point.
* The minus four is to subtract the size of the UINT8 Source[4] member
* because it is added below.
*/
UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
/* Each element of the top-level package must also be a package */
if ((*TopObjectList)->Common.Type != ACPI_TYPE_PACKAGE)
{
ACPI_ERROR ((AE_INFO,
"(PRT[%u]) Need sub-package, found %s",
Index, AcpiUtGetObjectTypeName (*TopObjectList)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Each sub-package must be of length 4 */
if ((*TopObjectList)->Package.Count != 4)
{
ACPI_ERROR ((AE_INFO,
"(PRT[%u]) Need package of length 4, found length %u",
Index, (*TopObjectList)->Package.Count));
return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
}
/*
* Dereference the sub-package.
* The SubObjectList will now point to an array of the four IRQ
* elements: [Address, Pin, Source, SourceIndex]
*/
SubObjectList = (*TopObjectList)->Package.Elements;
/* 1) First subobject: Dereference the PRT.Address */
//.........这里部分代码省略.........
开发者ID:libkeiser,项目名称:illumos-nexenta,代码行数:101,代码来源:rscreate.c
示例11: AcpiEvaluateObject
//.........这里部分代码省略.........
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))
{
/*
* 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",
(UINT32) BufferSpaceNeeded,
AcpiFormatException (Status)));
}
else
{
/* We have enough space for the object, build it */
Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject,
ReturnBuffer);
}
}
}
}
}
if (Info->ReturnObject)
{
/*
* Delete the internal return object. NOTE: Interpreter must be
* locked to avoid race condition.
*/
AcpiExEnterInterpreter ();
/* Remove one reference on the return object (should delete it) */
AcpiUtRemoveReference (Info->ReturnObject);
AcpiExExitInterpreter ();
}
Cleanup:
/* Free the input parameter list (if we created one) */
if (Info->Parameters)
{
/* Free the allocated parameter block */
AcpiUtDeleteInternalObjectList (Info->Parameters);
}
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
开发者ID:ExpressOS,项目名称:third_party-l4re,代码行数:101,代码来源:nsxfeval.c
示例12: AcpiGetObjectInfo
//.........这里部分代码省略.........
Info->Name = Node->Name.Integer;
Info->Valid = 0;
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* If not a device, we are all done */
if (Info->Type == ACPI_TYPE_DEVICE)
{
/*
* Get extra info for ACPI Devices objects only:
* Run the Device _HID, _UID, _CID, _STA, _ADR and _SxD methods.
*
* Note: none of these methods are required, so they may or may
* not be present for this device. The Info->Valid bitfield is used
* to indicate which methods were found and ran successfully.
*/
/* Execute the Device._HID method */
Status = AcpiUtExecute_HID (Node, &Info->HardwareId);
if (ACPI_SUCCESS (Status))
{
Info->Valid |= ACPI_VALID_HID;
}
/* Execute the Device._UID method */
Status = AcpiUtExecute_UID (Node, &Info->UniqueId);
if (ACPI_SUCCESS (Status))
{
Info->Valid |= ACPI_VALID_UID;
}
/* Execute the Device._CID method */
Status = AcpiUtExecute_CID (Node, &CidList);
if (ACPI_SUCCESS (Status))
{
Size += CidList->Size;
Info->Valid |= ACPI_VALID_CID;
}
/* Execute the Device._STA method */
Status = AcpiUtExecute_STA (Node, &Info->CurrentStatus);
if (ACPI_SUCCESS (Status))
{
Info->Valid |= ACPI_VALID_STA;
}
/* Execute the Device._ADR method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node,
&Info->Address);
if (ACPI_SUCCESS (Status))
{
Info->Valid |= ACPI_VALID_ADR;
}
/* Execute the Device._SxD methods */
Status = AcpiUtExecute_Sxds (Node, Info->HighestDstates);
if (ACPI_SUCCESS (Status))
{
Info->Valid |= ACPI_VALID_SXDS;
}
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (Buffer, Size);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Populate the return buffer */
ReturnInfo = Buffer->Pointer;
ACPI_MEMCPY (ReturnInfo, Info, sizeof (ACPI_DEVICE_INFO));
if (CidList)
{
ACPI_MEMCPY (&ReturnInfo->CompatibilityId, CidList, CidList->Size);
}
Cleanup:
ACPI_FREE (Info);
if (CidList)
{
ACPI_FREE (CidList);
}
return (Status);
}
开发者ID:samueldotj,项目名称:AceOS,代码行数:101,代码来源:nsxfname.c
示例13: AcpiGetName
ACPI_STATUS
AcpiGetName (
ACPI_HANDLE Handle,
UINT32 NameType,
ACPI_BUFFER *Buffer)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
/* Parameter validation */
if (NameType > ACPI_NAME_TYPE_MAX)
{
return (AE_BAD_PARAMETER);
}
Status = AcpiUtValidateBuffer (Buffer);
if (ACPI_FAILURE (Status))
{
return (Status);
}
if (NameType == ACPI_FULL_PATHNAME)
{
/* Get the full pathname (From the namespace root) */
Status = AcpiNsHandleToPathname (Handle, Buffer);
return (Status);
}
/*
* Wants the single segment ACPI name.
* Validate handle and convert to a namespace Node
*/
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Node = AcpiNsMapHandleToNode (Handle);
if (!Node)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Just copy the ACPI name from the Node and zero terminate it */
ACPI_STRNCPY (Buffer->Pointer, AcpiUtGetNodeName (Node),
ACPI_NAME_SIZE);
((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
Status = AE_OK;
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
开发者ID:samueldotj,项目名称:AceOS,代码行数:69,代码来源:nsxfname.c
示例14: AcpiGetTable
ACPI_STATUS
AcpiGetTable (
ACPI_TABLE_TYPE TableType,
UINT32 Instance,
ACPI_BUFFER *RetBuffer)
{
ACPI_TABLE_HEADER *TblPtr;
ACPI_STATUS Status;
ACPI_SIZE TableLength;
ACPI_FUNCTION_TRACE ("AcpiGetTable");
/* Parameter validation */
if (Instance == 0)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiUtValidateBuffer (RetBuffer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Check the table type and instance */
if ((TableType > ACPI_TABLE_MAX) ||
(ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
Instance > 1))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Get a pointer to the entire table */
Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* AcpiTbGetTablePtr will return a NULL pointer if the
* table is not loaded.
*/
if (TblPtr == NULL)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Get the table length */
if (TableType == ACPI_TABLE_RSDP)
{
/*
* RSD PTR is the only "table" without a header
*/
TableLength = sizeof (RSDP_DESCRIPTOR);
}
else
{
TableLength = (ACPI_SIZE) TblPtr->Length;
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (RetBuffer, TableLength);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Copy the table to the buffer */
ACPI_MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength);
return_ACPI_STATUS (AE_OK);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:81,代码来源:tbxface.c
注:本文中的AcpiUtInitializeBuffer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论