本文整理汇总了C++中ACPI_ROUND_UP_TO_NATIVE_WORD函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_ROUND_UP_TO_NATIVE_WORD函数的具体用法?C++ ACPI_ROUND_UP_TO_NATIVE_WORD怎么用?C++ ACPI_ROUND_UP_TO_NATIVE_WORD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_ROUND_UP_TO_NATIVE_WORD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acpi_rs_stream_option_length
static u32
acpi_rs_stream_option_length(u32 resource_length,
u32 minimum_aml_resource_length)
{
u32 string_length = 0;
ACPI_FUNCTION_ENTRY();
/*
* The resource_source_index and resource_source are optional elements of some
* Large-type resource descriptors.
*/
/*
* If the length of the actual resource descriptor is greater than the ACPI
* spec-defined minimum length, it means that a resource_source_index exists
* and is followed by a (required) null terminated string. The string length
* (including the null terminator) is the resource length minus the minimum
* length, minus one byte for the resource_source_index itself.
*/
if (resource_length > minimum_aml_resource_length) {
/* Compute the length of the optional string */
string_length =
resource_length - minimum_aml_resource_length - 1;
}
/*
* Round the length up to a multiple of the native word in order to
* guarantee that the entire resource descriptor is native word aligned
*/
return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length));
}
示例2: acpi_ut_get_package_object_size
static acpi_status
acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
acpi_size * obj_length)
{
acpi_status status;
struct acpi_pkg_info info;
ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object);
info.length = 0;
info.object_space = 0;
info.num_packages = 1;
status = acpi_ut_walk_package_tree(internal_object, NULL,
acpi_ut_get_element_length, &info);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* We have handled all of the objects in all levels of the package.
* just add the length of the package objects themselves.
* Round up to the next machine word.
*/
info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
(acpi_size) info.num_packages;
/* Return the total package length */
*obj_length = info.length;
return_ACPI_STATUS(status);
}
示例3: acpi_ut_copy_ipackage_to_epackage
static acpi_status
acpi_ut_copy_ipackage_to_epackage (
union acpi_operand_object *internal_object,
u8 *buffer,
acpi_size *space_used)
{
union acpi_object *external_object;
acpi_status status;
struct acpi_pkg_info info;
ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_epackage");
/*
* First package at head of the buffer
*/
external_object = ACPI_CAST_PTR (union acpi_object, buffer);
/*
* Free space begins right after the first package
*/
info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
info.object_space = 0;
info.num_packages = 1;
external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
external_object->package.count = internal_object->package.count;
external_object->package.elements = ACPI_CAST_PTR (union acpi_object, info.free_space);
/*
* Leave room for an array of ACPI_OBJECTS in the buffer
* and move the free space past it
*/
info.length += (acpi_size) external_object->package.count *
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
info.free_space += external_object->package.count *
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
status = acpi_ut_walk_package_tree (internal_object, external_object,
acpi_ut_copy_ielement_to_eelement, &info);
*space_used = info.length;
return_ACPI_STATUS (status);
}
示例4: acpi_ut_copy_iobject_to_eobject
acpi_status
acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
struct acpi_buffer *ret_buffer)
{
acpi_status status;
ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) {
/*
* Package object: Copy all subobjects (including
* nested packages)
*/
status = acpi_ut_copy_ipackage_to_epackage(internal_object,
ret_buffer->pointer,
&ret_buffer->length);
} else {
/*
* Build a simple object (no nested objects)
*/
status = acpi_ut_copy_isimple_to_esimple(internal_object,
ACPI_CAST_PTR(union
acpi_object,
ret_buffer->
pointer),
ACPI_ADD_PTR(u8,
ret_buffer->
pointer,
ACPI_ROUND_UP_TO_NATIVE_WORD
(sizeof
(union
acpi_object))),
&ret_buffer->length);
/*
* build simple does not include the object size in the length
* so we add it in here
*/
ret_buffer->length += sizeof(union acpi_object);
}
return_ACPI_STATUS(status);
}
示例5: AcpiRsStreamOptionLength
static UINT32
AcpiRsStreamOptionLength (
UINT32 ResourceLength,
UINT32 MinimumAmlResourceLength)
{
UINT32 StringLength = 0;
ACPI_FUNCTION_ENTRY ();
/*
* The ResourceSourceIndex and ResourceSource are optional elements of some
* Large-type resource descriptors.
*/
/*
* If the length of the actual resource descriptor is greater than the ACPI
* spec-defined minimum length, it means that a ResourceSourceIndex exists
* and is followed by a (required) null terminated string. The string length
* (including the null terminator) is the resource length minus the minimum
* length, minus one byte for the ResourceSourceIndex itself.
*/
if (ResourceLength > MinimumAmlResourceLength)
{
/* Compute the length of the optional string */
StringLength = ResourceLength - MinimumAmlResourceLength - 1;
}
/*
* Round the length up to a multiple of the native word in order to
* guarantee that the entire resource descriptor is native word aligned
*/
return ((UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (StringLength));
}
示例6: AcpiUtGetPackageObjectSize
static ACPI_STATUS
AcpiUtGetPackageObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_SIZE *ObjLength)
{
ACPI_STATUS Status;
ACPI_PKG_INFO Info;
ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject);
Info.Length = 0;
Info.ObjectSpace = 0;
Info.NumPackages = 1;
Status = AcpiUtWalkPackageTree (
InternalObject, NULL, AcpiUtGetElementLength, &Info);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* We have handled all of the objects in all levels of the package.
* just add the length of the package objects themselves.
* Round up to the next machine word.
*/
Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (
sizeof (ACPI_OBJECT)) * (ACPI_SIZE) Info.NumPackages;
/* Return the total package length */
*ObjLength = Info.Length;
return_ACPI_STATUS (Status);
}
示例7: AcpiUtGetSimpleObjectSize
static ACPI_STATUS
AcpiUtGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_SIZE *ObjLength)
{
ACPI_SIZE Length;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject);
/*
* Handle a null object (Could be a uninitialized package
* element -- which is legal)
*/
if (!InternalObject)
{
*ObjLength = 0;
return_ACPI_STATUS (AE_OK);
}
/* Start with the length of the Acpi object */
Length = sizeof (ACPI_OBJECT);
if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED)
{
/* Object is a named object (reference), just return the length */
*ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
return_ACPI_STATUS (Status);
}
/*
* 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 (ACPI_GET_OBJECT_TYPE (InternalObject))
{
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.Opcode)
{
case AML_INT_NAMEPATH_OP:
/*
* Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object
*/
Length += ACPI_ROUND_UP_TO_NATIVE_WORD (
AcpiNsGetPathnameLength (InternalObject->Reference.Node));
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,
"Unsupported Reference opcode=%X in object %p",
InternalObject->Reference.Opcode, InternalObject));
Status = AE_TYPE;
break;
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unsupported type=%X in object %p",
ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject));
Status = AE_TYPE;
break;
//.........这里部分代码省略.........
示例8: acpi_ut_get_simple_object_size
static acpi_status
acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
acpi_size * obj_length)
{
acpi_size length;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
/*
* Handle a null object (Could be a uninitialized package
* element -- which is legal)
*/
if (!internal_object) {
*obj_length = sizeof(union acpi_object);
return_ACPI_STATUS(AE_OK);
}
/* Start with the length of the Acpi object */
length = sizeof(union acpi_object);
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
/* Object is a named object (reference), just return the length */
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
return_ACPI_STATUS(status);
}
/*
* 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 (ACPI_GET_OBJECT_TYPE(internal_object)) {
case ACPI_TYPE_STRING:
length += (acpi_size) internal_object->string.length + 1;
break;
case ACPI_TYPE_BUFFER:
length += (acpi_size) internal_object->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 (internal_object->reference.opcode) {
case AML_INT_NAMEPATH_OP:
/*
* Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object
*/
length +=
ACPI_ROUND_UP_TO_NATIVE_WORD
(acpi_ns_get_pathname_length
(internal_object->reference.node));
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,
"Unsupported Reference opcode=%X in object %p",
internal_object->reference.opcode,
internal_object));
status = AE_TYPE;
break;
}
break;
default:
ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p",
ACPI_GET_OBJECT_TYPE(internal_object),
internal_object));
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.)
//.........这里部分代码省略.........
示例9: AcpiRsGetListLength
//.........这里部分代码省略.........
case ACPI_RESOURCE_NAME_END_TAG:
/*
* End Tag: This is the normal exit
*/
return_ACPI_STATUS (AE_OK);
case ACPI_RESOURCE_NAME_ADDRESS32:
case ACPI_RESOURCE_NAME_ADDRESS16:
case ACPI_RESOURCE_NAME_ADDRESS64:
/*
* Address Resource:
* Add the size of the optional ResourceSource
*/
ExtraStructBytes = AcpiRsStreamOptionLength (
ResourceLength, MinimumAmlResourceLength);
break;
case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
/*
* Extended IRQ Resource:
* Using the InterruptTableLength, add 4 bytes for each additional
* interrupt. Note: at least one interrupt is required and is
* included in the minimum descriptor size (reason for the -1)
*/
ExtraStructBytes = (Buffer[1] - 1) * sizeof (UINT32);
/* Add the size of the optional ResourceSource */
ExtraStructBytes += AcpiRsStreamOptionLength (
ResourceLength - ExtraStructBytes, MinimumAmlResourceLength);
break;
case ACPI_RESOURCE_NAME_GPIO:
/* Vendor data is optional */
if (AmlResource->Gpio.VendorLength)
{
ExtraStructBytes += AmlResource->Gpio.VendorOffset -
AmlResource->Gpio.PinTableOffset + AmlResource->Gpio.VendorLength;
}
else
{
ExtraStructBytes += AmlResource->LargeHeader.ResourceLength +
sizeof (AML_RESOURCE_LARGE_HEADER) -
AmlResource->Gpio.PinTableOffset;
}
break;
case ACPI_RESOURCE_NAME_SERIAL_BUS:
MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[
AmlResource->CommonSerialBus.Type];
ExtraStructBytes += AmlResource->CommonSerialBus.ResourceLength -
MinimumAmlResourceLength;
break;
default:
break;
}
/*
* Update the required buffer size for the internal descriptor structs
*
* Important: Round the size up for the appropriate alignment. This
* is a requirement on IA64.
*/
if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_SERIAL_BUS)
{
BufferSize = AcpiGbl_ResourceStructSerialBusSizes[
AmlResource->CommonSerialBus.Type] + ExtraStructBytes;
}
else
{
BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] +
ExtraStructBytes;
}
BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize);
*SizeNeeded += BufferSize;
ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES,
"Type %.2X, AmlLength %.2X InternalLength %.2X\n",
AcpiUtGetResourceType (AmlBuffer),
AcpiUtGetDescriptorLength (AmlBuffer), BufferSize));
/*
* Point to the next resource within the AML stream using the length
* contained in the resource descriptor header
*/
AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer);
}
/* Did not find an EndTag resource descriptor */
return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
示例10: acpi_rs_get_list_length
//.........这里部分代码省略.........
buffer =
aml_buffer + acpi_ut_get_resource_header_length(aml_buffer);
switch (acpi_ut_get_resource_type(aml_buffer)) {
case ACPI_RESOURCE_NAME_IRQ:
/*
* IRQ Resource:
* Get the number of bits set in the 16-bit IRQ mask
*/
ACPI_MOVE_16_TO_16(&temp16, buffer);
extra_struct_bytes = acpi_rs_count_set_bits(temp16);
break;
case ACPI_RESOURCE_NAME_DMA:
/*
* DMA Resource:
* Get the number of bits set in the 8-bit DMA mask
*/
extra_struct_bytes = acpi_rs_count_set_bits(*buffer);
break;
case ACPI_RESOURCE_NAME_VENDOR_SMALL:
case ACPI_RESOURCE_NAME_VENDOR_LARGE:
/*
* Vendor Resource:
* Get the number of vendor data bytes
*/
extra_struct_bytes = resource_length;
break;
case ACPI_RESOURCE_NAME_END_TAG:
/*
* End Tag:
* This is the normal exit, add size of end_tag
*/
*size_needed += ACPI_RS_SIZE_MIN;
return_ACPI_STATUS(AE_OK);
case ACPI_RESOURCE_NAME_ADDRESS32:
case ACPI_RESOURCE_NAME_ADDRESS16:
case ACPI_RESOURCE_NAME_ADDRESS64:
/*
* Address Resource:
* Add the size of the optional resource_source
*/
extra_struct_bytes =
acpi_rs_stream_option_length(resource_length,
minimum_aml_resource_length);
break;
case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
/*
* Extended IRQ Resource:
* Using the interrupt_table_length, add 4 bytes for each additional
* interrupt. Note: at least one interrupt is required and is
* included in the minimum descriptor size (reason for the -1)
*/
extra_struct_bytes = (buffer[1] - 1) * sizeof(u32);
/* Add the size of the optional resource_source */
extra_struct_bytes +=
acpi_rs_stream_option_length(resource_length -
extra_struct_bytes,
minimum_aml_resource_length);
break;
default:
break;
}
/*
* Update the required buffer size for the internal descriptor structs
*
* Important: Round the size up for the appropriate alignment. This
* is a requirement on IA64.
*/
buffer_size = acpi_gbl_resource_struct_sizes[resource_index] +
extra_struct_bytes;
buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size);
*size_needed += buffer_size;
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
"Type %.2X, AmlLength %.2X InternalLength %.2X\n",
acpi_ut_get_resource_type(aml_buffer),
acpi_ut_get_descriptor_length(aml_buffer),
buffer_size));
/*
* Point to the next resource within the AML stream using the length
* contained in the resource descriptor header
*/
aml_buffer += acpi_ut_get_descriptor_length(aml_buffer);
}
/* Did not find an end_tag resource descriptor */
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
示例11: ACPI_ADD_PTR
* pointer to the end of the current ResourceSource structure.
*/
ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
sizeof (ACPI_RESOURCE_SOURCE));
}
/*
* In order for the Resource length to be a multiple of the native
* word, calculate the length of the string (+1 for NULL terminator)
* and expand to the next word multiple.
*
* Zero the entire area of the buffer.
*/
TotalLength = (UINT32) ACPI_STRLEN (
ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
/* Copy the ResourceSource string to the destination */
ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr,
ACPI_CAST_PTR (char, &AmlResourceSource[1]));
return ((ACPI_RS_LENGTH) TotalLength);
}
/* ResourceSource is not present */
ResourceSource->Index = 0;
ResourceSource->StringLength = 0;
示例12: acpi_ut_copy_isimple_to_esimple
static acpi_status
acpi_ut_copy_isimple_to_esimple (
union acpi_operand_object *internal_object,
union acpi_object *external_object,
u8 *data_space,
acpi_size *buffer_space_used)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("ut_copy_isimple_to_esimple");
*buffer_space_used = 0;
/*
* Check for NULL object case (could be an uninitialized
* package element)
*/
if (!internal_object) {
return_ACPI_STATUS (AE_OK);
}
/* Always clear the external object */
ACPI_MEMSET (external_object, 0, sizeof (union acpi_object));
/*
* In general, the external object will be the same type as
* the internal object
*/
external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
/* However, only a limited number of external types are supported */
switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
case ACPI_TYPE_STRING:
external_object->string.pointer = (char *) data_space;
external_object->string.length = internal_object->string.length;
*buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((acpi_size) internal_object->string.length + 1);
ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer,
(acpi_size) internal_object->string.length + 1);
break;
case ACPI_TYPE_BUFFER:
external_object->buffer.pointer = data_space;
external_object->buffer.length = internal_object->buffer.length;
*buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length);
ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer,
internal_object->buffer.length);
break;
case ACPI_TYPE_INTEGER:
external_object->integer.value = internal_object->integer.value;
break;
case ACPI_TYPE_LOCAL_REFERENCE:
/*
* This is an object reference. Attempt to dereference it.
*/
switch (internal_object->reference.opcode) {
case AML_INT_NAMEPATH_OP:
/* For namepath, return the object handle ("reference") */
default:
/*
* Use the object type of "Any" to indicate a reference
* to object containing a handle to an ACPI named object.
*/
external_object->type = ACPI_TYPE_ANY;
external_object->reference.handle = internal_object->reference.node;
break;
}
break;
case ACPI_TYPE_PROCESSOR:
external_object->processor.proc_id = internal_object->processor.proc_id;
external_object->processor.pblk_address = internal_object->processor.address;
external_object->processor.pblk_length = internal_object->processor.length;
break;
case ACPI_TYPE_POWER:
external_object->power_resource.system_level =
internal_object->power_resource.system_level;
external_object->power_resource.resource_order =
//.........这里部分代码省略.........
示例13: AcpiUtCopyIsimpleToEsimple
static ACPI_STATUS
AcpiUtCopyIsimpleToEsimple (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_OBJECT *ExternalObject,
UINT8 *DataSpace,
ACPI_SIZE *BufferSpaceUsed)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (UtCopyIsimpleToEsimple);
*BufferSpaceUsed = 0;
/*
* Check for NULL object case (could be an uninitialized
* package element)
*/
if (!InternalObject)
{
return_ACPI_STATUS (AE_OK);
}
/* Always clear the external object */
ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT));
/*
* In general, the external object will be the same type as
* the internal object
*/
ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
/* However, only a limited number of external types are supported */
switch (ACPI_GET_OBJECT_TYPE (InternalObject))
{
case ACPI_TYPE_STRING:
ExternalObject->String.Pointer = (char *) DataSpace;
ExternalObject->String.Length = InternalObject->String.Length;
*BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
(ACPI_SIZE) InternalObject->String.Length + 1);
ACPI_MEMCPY ((void *) DataSpace,
(void *) InternalObject->String.Pointer,
(ACPI_SIZE) InternalObject->String.Length + 1);
break;
case ACPI_TYPE_BUFFER:
ExternalObject->Buffer.Pointer = DataSpace;
ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
*BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
InternalObject->String.Length);
ACPI_MEMCPY ((void *) DataSpace,
(void *) InternalObject->Buffer.Pointer,
InternalObject->Buffer.Length);
break;
case ACPI_TYPE_INTEGER:
ExternalObject->Integer.Value = InternalObject->Integer.Value;
break;
case ACPI_TYPE_LOCAL_REFERENCE:
/*
* This is an object reference. Attempt to dereference it.
*/
switch (InternalObject->Reference.Opcode)
{
case AML_INT_NAMEPATH_OP:
/* For namepath, return the object handle ("reference") */
default:
/*
* Use the object type of "Any" to indicate a reference
* to object containing a handle to an ACPI named object.
*/
ExternalObject->Type = ACPI_TYPE_ANY;
ExternalObject->Reference.Handle = InternalObject->Reference.Node;
break;
}
break;
case ACPI_TYPE_PROCESSOR:
ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId;
ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address;
ExternalObject->Processor.PblkLength = InternalObject->Processor.Length;
break;
//.........这里部分代码省略.........
示例14: ACPI_ADD_PTR
*/
resource_source->string_ptr =
ACPI_ADD_PTR(char, resource_source,
sizeof(struct acpi_resource_source));
}
/*
* In order for the Resource length to be a multiple of the native
* word, calculate the length of the string (+1 for NULL terminator)
* and expand to the next word multiple.
*
* Zero the entire area of the buffer.
*/
total_length = (u32)
ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 1;
total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
/* Copy the resource_source string to the destination */
resource_source->string_length =
acpi_rs_strcpy(resource_source->string_ptr,
ACPI_CAST_PTR(char,
&aml_resource_source[1]));
return ((acpi_rs_length) total_length);
}
/* resource_source is not present */
示例15: acpi_ut_get_simple_object_size
static acpi_status
acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
acpi_size * obj_length)
{
acpi_size length;
acpi_size size;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
/* Start with the length of the (external) Acpi object */
length = sizeof(union acpi_object);
/* A NULL object is allowed, can be a legal uninitialized package element */
if (!internal_object) {
/*
* Object is NULL, just return the length of union acpi_object
* (A NULL union acpi_object is an object of all zeroes.)
*/
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
return_ACPI_STATUS(AE_OK);
}
/* A Namespace Node should never appear here */
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == 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 (internal_object->common.type) {
case ACPI_TYPE_STRING:
length += (acpi_size) internal_object->string.length + 1;
break;
case ACPI_TYPE_BUFFER:
length += (acpi_size) internal_object->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 (internal_object->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 =
acpi_ns_get_pathname_length(internal_object->
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",
acpi_ut_get_reference_name(internal_object),
internal_object->reference.class,
internal_object));
status = AE_TYPE;
break;
}
break;
default:
ACPI_ERROR((AE_INFO, "Cannot convert to external object - "
"unsupported type [%s] 0x%X in object %p",
acpi_ut_get_object_type_name(internal_object),
internal_object->common.type, internal_object));
//.........这里部分代码省略.........