示例#1
0
acpi_status
acpi_ut_copy_iobject_to_eobject (
	acpi_operand_object     *internal_object,
	acpi_buffer             *ret_buffer)
{
	acpi_status             status;


	FUNCTION_TRACE ("Ut_copy_iobject_to_eobject");


	if (IS_THIS_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_object *) ret_buffer->pointer,
				  ((u8 *) ret_buffer->pointer +
				  ROUND_UP_TO_NATIVE_WORD (sizeof (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 (acpi_object);
	}

	return_ACPI_STATUS (status);
}
示例#2
0
acpi_status
acpi_ut_copy_ielement_to_eelement (
	u8                              object_type,
	union acpi_operand_object       *source_object,
	union acpi_generic_state        *state,
	void                            *context)
{
	acpi_status                     status = AE_OK;
	struct acpi_pkg_info            *info = (struct acpi_pkg_info *) context;
	acpi_size                       object_space;
	u32                             this_index;
	union acpi_object               *target_object;


	ACPI_FUNCTION_ENTRY ();


	this_index   = state->pkg.index;
	target_object = (union acpi_object *)
			  &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index];

	switch (object_type) {
	case ACPI_COPY_TYPE_SIMPLE:

		/*
		 * This is a simple or null object
		 */
		status = acpi_ut_copy_isimple_to_esimple (source_object,
				  target_object, info->free_space, &object_space);
		if (ACPI_FAILURE (status)) {
			return (status);
		}
		break;


	case ACPI_COPY_TYPE_PACKAGE:

		/*
		 * Build the package object
		 */
		target_object->type             = ACPI_TYPE_PACKAGE;
		target_object->package.count    = source_object->package.count;
		target_object->package.elements = ACPI_CAST_PTR (union acpi_object, info->free_space);

		/*
		 * Pass the new package object back to the package walk routine
		 */
		state->pkg.this_target_obj = target_object;

		/*
		 * Save space for the array of objects (Package elements)
		 * update the buffer length counter
		 */
		object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
				   (acpi_size) target_object->package.count * sizeof (union acpi_object));
		break;


	default:
		return (AE_BAD_PARAMETER);
	}

	info->free_space  += object_space;
	info->length      += object_space;
	return (status);
}