utcopy.c (cb5629b10d64a8006622ce3a52bc887d91057d69) utcopy.c (3371c19c294a4cb3649aa4e84606be8a1d999e61)
1/******************************************************************************
2 *
3 * Module Name: utcopy - Internal to external object translation utilities
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.

--- 121 unchanged lines hidden (view full) ---

130 /* Always clear the external object */
131
132 ACPI_MEMSET(external_object, 0, sizeof(union acpi_object));
133
134 /*
135 * In general, the external object will be the same type as
136 * the internal object
137 */
1/******************************************************************************
2 *
3 * Module Name: utcopy - Internal to external object translation utilities
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.

--- 121 unchanged lines hidden (view full) ---

130 /* Always clear the external object */
131
132 ACPI_MEMSET(external_object, 0, sizeof(union acpi_object));
133
134 /*
135 * In general, the external object will be the same type as
136 * the internal object
137 */
138 external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
138 external_object->type = internal_object->common.type;
139
140 /* However, only a limited number of external types are supported */
141
139
140 /* However, only a limited number of external types are supported */
141
142 switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
142 switch (internal_object->common.type) {
143 case ACPI_TYPE_STRING:
144
145 external_object->string.pointer = (char *)data_space;
146 external_object->string.length = internal_object->string.length;
147 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
148 internal_object->
149 string.
150 length + 1);

--- 66 unchanged lines hidden (view full) ---

217 break;
218
219 default:
220 /*
221 * There is no corresponding external object type
222 */
223 ACPI_ERROR((AE_INFO,
224 "Unsupported object type, cannot convert to external object: %s",
143 case ACPI_TYPE_STRING:
144
145 external_object->string.pointer = (char *)data_space;
146 external_object->string.length = internal_object->string.length;
147 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
148 internal_object->
149 string.
150 length + 1);

--- 66 unchanged lines hidden (view full) ---

217 break;
218
219 default:
220 /*
221 * There is no corresponding external object type
222 */
223 ACPI_ERROR((AE_INFO,
224 "Unsupported object type, cannot convert to external object: %s",
225 acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
226 (internal_object))));
225 acpi_ut_get_type_name(internal_object->common.
226 type)));
227
228 return_ACPI_STATUS(AE_SUPPORT);
229 }
230
231 return_ACPI_STATUS(status);
232}
233
234/*******************************************************************************

--- 115 unchanged lines hidden (view full) ---

350 * Free space begins right after the first package
351 */
352 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
353 info.free_space =
354 buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
355 info.object_space = 0;
356 info.num_packages = 1;
357
227
228 return_ACPI_STATUS(AE_SUPPORT);
229 }
230
231 return_ACPI_STATUS(status);
232}
233
234/*******************************************************************************

--- 115 unchanged lines hidden (view full) ---

350 * Free space begins right after the first package
351 */
352 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
353 info.free_space =
354 buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
355 info.object_space = 0;
356 info.num_packages = 1;
357
358 external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
358 external_object->type = internal_object->common.type;
359 external_object->package.count = internal_object->package.count;
360 external_object->package.elements = ACPI_CAST_PTR(union acpi_object,
361 info.free_space);
362
363 /*
364 * Leave room for an array of ACPI_OBJECTS in the buffer
365 * and move the free space past it
366 */

--- 27 unchanged lines hidden (view full) ---

394acpi_status
395acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
396 struct acpi_buffer *ret_buffer)
397{
398 acpi_status status;
399
400 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
401
359 external_object->package.count = internal_object->package.count;
360 external_object->package.elements = ACPI_CAST_PTR(union acpi_object,
361 info.free_space);
362
363 /*
364 * Leave room for an array of ACPI_OBJECTS in the buffer
365 * and move the free space past it
366 */

--- 27 unchanged lines hidden (view full) ---

394acpi_status
395acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
396 struct acpi_buffer *ret_buffer)
397{
398 acpi_status status;
399
400 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
401
402 if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) {
402 if (internal_object->common.type == ACPI_TYPE_PACKAGE) {
403 /*
404 * Package object: Copy all subobjects (including
405 * nested packages)
406 */
407 status = acpi_ut_copy_ipackage_to_epackage(internal_object,
408 ret_buffer->pointer,
409 &ret_buffer->length);
410 } else {

--- 281 unchanged lines hidden (view full) ---

692 dest_desc->common.next_object = next_object;
693
694 /* New object is not static, regardless of source */
695
696 dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
697
698 /* Handle the objects with extra data */
699
403 /*
404 * Package object: Copy all subobjects (including
405 * nested packages)
406 */
407 status = acpi_ut_copy_ipackage_to_epackage(internal_object,
408 ret_buffer->pointer,
409 &ret_buffer->length);
410 } else {

--- 281 unchanged lines hidden (view full) ---

692 dest_desc->common.next_object = next_object;
693
694 /* New object is not static, regardless of source */
695
696 dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
697
698 /* Handle the objects with extra data */
699
700 switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
700 switch (dest_desc->common.type) {
701 case ACPI_TYPE_BUFFER:
702 /*
703 * Allocate and copy the actual buffer if and only if:
704 * 1) There is a valid buffer pointer
705 * 2) The buffer has a length > 0
706 */
707 if ((source_desc->buffer.pointer) &&
708 (source_desc->buffer.length)) {

--- 100 unchanged lines hidden (view full) ---

809
810 /* A null source object indicates a (legal) null package element */
811
812 if (source_object) {
813 /*
814 * This is a simple object, just copy it
815 */
816 target_object =
701 case ACPI_TYPE_BUFFER:
702 /*
703 * Allocate and copy the actual buffer if and only if:
704 * 1) There is a valid buffer pointer
705 * 2) The buffer has a length > 0
706 */
707 if ((source_desc->buffer.pointer) &&
708 (source_desc->buffer.length)) {

--- 100 unchanged lines hidden (view full) ---

809
810 /* A null source object indicates a (legal) null package element */
811
812 if (source_object) {
813 /*
814 * This is a simple object, just copy it
815 */
816 target_object =
817 acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
818 (source_object));
817 acpi_ut_create_internal_object(source_object->
818 common.type);
819 if (!target_object) {
820 return (AE_NO_MEMORY);
821 }
822
823 status =
824 acpi_ut_copy_simple_object(source_object,
825 target_object);
826 if (ACPI_FAILURE(status)) {

--- 60 unchanged lines hidden (view full) ---

887acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
888 union acpi_operand_object *dest_obj,
889 struct acpi_walk_state *walk_state)
890{
891 acpi_status status = AE_OK;
892
893 ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage);
894
819 if (!target_object) {
820 return (AE_NO_MEMORY);
821 }
822
823 status =
824 acpi_ut_copy_simple_object(source_object,
825 target_object);
826 if (ACPI_FAILURE(status)) {

--- 60 unchanged lines hidden (view full) ---

887acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
888 union acpi_operand_object *dest_obj,
889 struct acpi_walk_state *walk_state)
890{
891 acpi_status status = AE_OK;
892
893 ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage);
894
895 dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj);
895 dest_obj->common.type = source_obj->common.type;
896 dest_obj->common.flags = source_obj->common.flags;
897 dest_obj->package.count = source_obj->package.count;
898
899 /*
900 * Create the object array and walk the source package tree
901 */
902 dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
903 source_obj->package.

--- 41 unchanged lines hidden (view full) ---

945 struct acpi_walk_state *walk_state)
946{
947 acpi_status status = AE_OK;
948
949 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject);
950
951 /* Create the top level object */
952
896 dest_obj->common.flags = source_obj->common.flags;
897 dest_obj->package.count = source_obj->package.count;
898
899 /*
900 * Create the object array and walk the source package tree
901 */
902 dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
903 source_obj->package.

--- 41 unchanged lines hidden (view full) ---

945 struct acpi_walk_state *walk_state)
946{
947 acpi_status status = AE_OK;
948
949 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject);
950
951 /* Create the top level object */
952
953 *dest_desc =
954 acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE(source_desc));
953 *dest_desc = acpi_ut_create_internal_object(source_desc->common.type);
955 if (!*dest_desc) {
956 return_ACPI_STATUS(AE_NO_MEMORY);
957 }
958
959 /* Copy the object and possible subobjects */
960
954 if (!*dest_desc) {
955 return_ACPI_STATUS(AE_NO_MEMORY);
956 }
957
958 /* Copy the object and possible subobjects */
959
961 if (ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_PACKAGE) {
960 if (source_desc->common.type == ACPI_TYPE_PACKAGE) {
962 status =
963 acpi_ut_copy_ipackage_to_ipackage(source_desc, *dest_desc,
964 walk_state);
965 } else {
966 status = acpi_ut_copy_simple_object(source_desc, *dest_desc);
967 }
968
969 return_ACPI_STATUS(status);
970}
961 status =
962 acpi_ut_copy_ipackage_to_ipackage(source_desc, *dest_desc,
963 walk_state);
964 } else {
965 status = acpi_ut_copy_simple_object(source_desc, *dest_desc);
966 }
967
968 return_ACPI_STATUS(status);
969}