1 /******************************************************************************
3 * Module Name: utcopy - Internal to external object translation utilities
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2008, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <acpi/acpi.h>
49 #define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME("utcopy")
52 /* Local prototypes */
54 acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
55 union acpi_object *external_object,
56 u8 * data_space, acpi_size * buffer_space_used);
59 acpi_ut_copy_ielement_to_ielement(u8 object_type,
60 union acpi_operand_object *source_object,
61 union acpi_generic_state *state,
65 acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
66 u8 * buffer, acpi_size * space_used);
69 acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
70 union acpi_operand_object **return_obj);
73 acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
74 union acpi_operand_object **internal_object);
77 acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
78 union acpi_operand_object *dest_desc);
81 acpi_ut_copy_ielement_to_eelement(u8 object_type,
82 union acpi_operand_object *source_object,
83 union acpi_generic_state *state,
87 acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
88 union acpi_operand_object *dest_obj,
89 struct acpi_walk_state *walk_state);
91 /*******************************************************************************
93 * FUNCTION: acpi_ut_copy_isimple_to_esimple
95 * PARAMETERS: internal_object - Source object to be copied
96 * external_object - Where to return the copied object
97 * data_space - Where object data is returned (such as
98 * buffer and string data)
99 * buffer_space_used - Length of data_space that was used
103 * DESCRIPTION: This function is called to copy a simple internal object to
104 * an external object.
106 * The data_space buffer is assumed to have sufficient space for
109 ******************************************************************************/
112 acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
113 union acpi_object *external_object,
114 u8 * data_space, acpi_size * buffer_space_used)
116 acpi_status status = AE_OK;
118 ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple);
120 *buffer_space_used = 0;
123 * Check for NULL object case (could be an uninitialized
126 if (!internal_object) {
127 return_ACPI_STATUS(AE_OK);
130 /* Always clear the external object */
132 ACPI_MEMSET(external_object, 0, sizeof(union acpi_object));
135 * In general, the external object will be the same type as
136 * the internal object
138 external_object->type = internal_object->common.type;
140 /* However, only a limited number of external types are supported */
142 switch (internal_object->common.type) {
143 case ACPI_TYPE_STRING:
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)
152 ACPI_MEMCPY((void *)data_space,
153 (void *)internal_object->string.pointer,
154 (acpi_size) internal_object->string.length + 1);
157 case ACPI_TYPE_BUFFER:
159 external_object->buffer.pointer = data_space;
160 external_object->buffer.length = internal_object->buffer.length;
162 ACPI_ROUND_UP_TO_NATIVE_WORD(internal_object->string.
165 ACPI_MEMCPY((void *)data_space,
166 (void *)internal_object->buffer.pointer,
167 internal_object->buffer.length);
170 case ACPI_TYPE_INTEGER:
172 external_object->integer.value = internal_object->integer.value;
175 case ACPI_TYPE_LOCAL_REFERENCE:
177 /* This is an object reference. */
179 switch (internal_object->reference.class) {
180 case ACPI_REFCLASS_NAME:
183 * For namepath, return the object handle ("reference")
184 * We are referring to the namespace node
186 external_object->reference.handle =
187 internal_object->reference.node;
188 external_object->reference.actual_type =
189 acpi_ns_get_type(internal_object->reference.node);
194 /* All other reference types are unsupported */
196 return_ACPI_STATUS(AE_TYPE);
200 case ACPI_TYPE_PROCESSOR:
202 external_object->processor.proc_id =
203 internal_object->processor.proc_id;
204 external_object->processor.pblk_address =
205 internal_object->processor.address;
206 external_object->processor.pblk_length =
207 internal_object->processor.length;
210 case ACPI_TYPE_POWER:
212 external_object->power_resource.system_level =
213 internal_object->power_resource.system_level;
215 external_object->power_resource.resource_order =
216 internal_object->power_resource.resource_order;
221 * There is no corresponding external object type
224 "Unsupported object type, cannot convert to external object: %s",
225 acpi_ut_get_type_name(internal_object->common.
228 return_ACPI_STATUS(AE_SUPPORT);
231 return_ACPI_STATUS(status);
234 /*******************************************************************************
236 * FUNCTION: acpi_ut_copy_ielement_to_eelement
238 * PARAMETERS: acpi_pkg_callback
242 * DESCRIPTION: Copy one package element to another package element
244 ******************************************************************************/
247 acpi_ut_copy_ielement_to_eelement(u8 object_type,
248 union acpi_operand_object *source_object,
249 union acpi_generic_state *state,
252 acpi_status status = AE_OK;
253 struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
254 acpi_size object_space;
256 union acpi_object *target_object;
258 ACPI_FUNCTION_ENTRY();
260 this_index = state->pkg.index;
261 target_object = (union acpi_object *)
262 &((union acpi_object *)(state->pkg.dest_object))->package.
263 elements[this_index];
265 switch (object_type) {
266 case ACPI_COPY_TYPE_SIMPLE:
269 * This is a simple or null object
271 status = acpi_ut_copy_isimple_to_esimple(source_object,
275 if (ACPI_FAILURE(status)) {
280 case ACPI_COPY_TYPE_PACKAGE:
283 * Build the package object
285 target_object->type = ACPI_TYPE_PACKAGE;
286 target_object->package.count = source_object->package.count;
287 target_object->package.elements =
288 ACPI_CAST_PTR(union acpi_object, info->free_space);
291 * Pass the new package object back to the package walk routine
293 state->pkg.this_target_obj = target_object;
296 * Save space for the array of objects (Package elements)
297 * update the buffer length counter
299 object_space = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
307 return (AE_BAD_PARAMETER);
310 info->free_space += object_space;
311 info->length += object_space;
315 /*******************************************************************************
317 * FUNCTION: acpi_ut_copy_ipackage_to_epackage
319 * PARAMETERS: internal_object - Pointer to the object we are returning
320 * Buffer - Where the object is returned
321 * space_used - Where the object length is returned
325 * DESCRIPTION: This function is called to place a package object in a user
326 * buffer. A package object by definition contains other objects.
328 * The buffer is assumed to have sufficient space for the object.
329 * The caller must have verified the buffer length needed using the
330 * acpi_ut_get_object_size function before calling this function.
332 ******************************************************************************/
335 acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
336 u8 * buffer, acpi_size * space_used)
338 union acpi_object *external_object;
340 struct acpi_pkg_info info;
342 ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage);
345 * First package at head of the buffer
347 external_object = ACPI_CAST_PTR(union acpi_object, buffer);
350 * Free space begins right after the first package
352 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
354 buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
355 info.object_space = 0;
356 info.num_packages = 1;
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,
364 * Leave room for an array of ACPI_OBJECTS in the buffer
365 * and move the free space past it
367 info.length += (acpi_size) external_object->package.count *
368 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
369 info.free_space += external_object->package.count *
370 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
372 status = acpi_ut_walk_package_tree(internal_object, external_object,
373 acpi_ut_copy_ielement_to_eelement,
376 *space_used = info.length;
377 return_ACPI_STATUS(status);
380 /*******************************************************************************
382 * FUNCTION: acpi_ut_copy_iobject_to_eobject
384 * PARAMETERS: internal_object - The internal object to be converted
385 * buffer_ptr - Where the object is returned
389 * DESCRIPTION: This function is called to build an API object to be returned to
392 ******************************************************************************/
395 acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
396 struct acpi_buffer *ret_buffer)
400 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
402 if (internal_object->common.type == ACPI_TYPE_PACKAGE) {
404 * Package object: Copy all subobjects (including
407 status = acpi_ut_copy_ipackage_to_epackage(internal_object,
409 &ret_buffer->length);
412 * Build a simple object (no nested objects)
414 status = acpi_ut_copy_isimple_to_esimple(internal_object,
422 ACPI_ROUND_UP_TO_NATIVE_WORD
426 &ret_buffer->length);
428 * build simple does not include the object size in the length
429 * so we add it in here
431 ret_buffer->length += sizeof(union acpi_object);
434 return_ACPI_STATUS(status);
437 /*******************************************************************************
439 * FUNCTION: acpi_ut_copy_esimple_to_isimple
441 * PARAMETERS: external_object - The external object to be converted
442 * ret_internal_object - Where the internal object is returned
446 * DESCRIPTION: This function copies an external object to an internal one.
447 * NOTE: Pointers can be copied, we don't need to copy data.
448 * (The pointers have to be valid in our address space no matter
449 * what we do with them!)
451 ******************************************************************************/
454 acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
455 union acpi_operand_object **ret_internal_object)
457 union acpi_operand_object *internal_object;
459 ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple);
462 * Simple types supported are: String, Buffer, Integer
464 switch (external_object->type) {
465 case ACPI_TYPE_STRING:
466 case ACPI_TYPE_BUFFER:
467 case ACPI_TYPE_INTEGER:
468 case ACPI_TYPE_LOCAL_REFERENCE:
470 internal_object = acpi_ut_create_internal_object((u8)
473 if (!internal_object) {
474 return_ACPI_STATUS(AE_NO_MEMORY);
478 case ACPI_TYPE_ANY: /* This is the case for a NULL object */
480 *ret_internal_object = NULL;
481 return_ACPI_STATUS(AE_OK);
484 /* All other types are not supported */
487 "Unsupported object type, cannot convert to internal object: %s",
488 acpi_ut_get_type_name(external_object->type)));
490 return_ACPI_STATUS(AE_SUPPORT);
493 /* Must COPY string and buffer contents */
495 switch (external_object->type) {
496 case ACPI_TYPE_STRING:
498 internal_object->string.pointer =
499 ACPI_ALLOCATE_ZEROED((acpi_size)
500 external_object->string.length + 1);
502 if (!internal_object->string.pointer) {
506 ACPI_MEMCPY(internal_object->string.pointer,
507 external_object->string.pointer,
508 external_object->string.length);
510 internal_object->string.length = external_object->string.length;
513 case ACPI_TYPE_BUFFER:
515 internal_object->buffer.pointer =
516 ACPI_ALLOCATE_ZEROED(external_object->buffer.length);
517 if (!internal_object->buffer.pointer) {
521 ACPI_MEMCPY(internal_object->buffer.pointer,
522 external_object->buffer.pointer,
523 external_object->buffer.length);
525 internal_object->buffer.length = external_object->buffer.length;
527 /* Mark buffer data valid */
529 internal_object->buffer.flags |= AOPOBJ_DATA_VALID;
532 case ACPI_TYPE_INTEGER:
534 internal_object->integer.value = external_object->integer.value;
537 case ACPI_TYPE_LOCAL_REFERENCE:
539 /* TBD: should validate incoming handle */
541 internal_object->reference.class = ACPI_REFCLASS_NAME;
542 internal_object->reference.node =
543 external_object->reference.handle;
547 /* Other types can't get here */
551 *ret_internal_object = internal_object;
552 return_ACPI_STATUS(AE_OK);
555 acpi_ut_remove_reference(internal_object);
556 return_ACPI_STATUS(AE_NO_MEMORY);
559 /*******************************************************************************
561 * FUNCTION: acpi_ut_copy_epackage_to_ipackage
563 * PARAMETERS: external_object - The external object to be converted
564 * internal_object - Where the internal object is returned
568 * DESCRIPTION: Copy an external package object to an internal package.
569 * Handles nested packages.
571 ******************************************************************************/
574 acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
575 union acpi_operand_object **internal_object)
577 acpi_status status = AE_OK;
578 union acpi_operand_object *package_object;
579 union acpi_operand_object **package_elements;
582 ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage);
584 /* Create the package object */
587 acpi_ut_create_package_object(external_object->package.count);
588 if (!package_object) {
589 return_ACPI_STATUS(AE_NO_MEMORY);
592 package_elements = package_object->package.elements;
595 * Recursive implementation. Probably ok, since nested external packages
596 * as parameters should be very rare.
598 for (i = 0; i < external_object->package.count; i++) {
600 acpi_ut_copy_eobject_to_iobject(&external_object->package.
602 &package_elements[i]);
603 if (ACPI_FAILURE(status)) {
605 /* Truncate package and delete it */
607 package_object->package.count = i;
608 package_elements[i] = NULL;
609 acpi_ut_remove_reference(package_object);
610 return_ACPI_STATUS(status);
614 /* Mark package data valid */
616 package_object->package.flags |= AOPOBJ_DATA_VALID;
618 *internal_object = package_object;
619 return_ACPI_STATUS(status);
622 /*******************************************************************************
624 * FUNCTION: acpi_ut_copy_eobject_to_iobject
626 * PARAMETERS: external_object - The external object to be converted
627 * internal_object - Where the internal object is returned
629 * RETURN: Status - the status of the call
631 * DESCRIPTION: Converts an external object to an internal object.
633 ******************************************************************************/
636 acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
637 union acpi_operand_object **internal_object)
641 ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject);
643 if (external_object->type == ACPI_TYPE_PACKAGE) {
645 acpi_ut_copy_epackage_to_ipackage(external_object,
649 * Build a simple object (no nested objects)
652 acpi_ut_copy_esimple_to_isimple(external_object,
656 return_ACPI_STATUS(status);
659 /*******************************************************************************
661 * FUNCTION: acpi_ut_copy_simple_object
663 * PARAMETERS: source_desc - The internal object to be copied
664 * dest_desc - New target object
668 * DESCRIPTION: Simple copy of one internal object to another. Reference count
669 * of the destination object is preserved.
671 ******************************************************************************/
674 acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
675 union acpi_operand_object *dest_desc)
678 union acpi_operand_object *next_object;
681 /* Save fields from destination that we don't want to overwrite */
683 reference_count = dest_desc->common.reference_count;
684 next_object = dest_desc->common.next_object;
686 /* Copy the entire source object over the destination object */
688 ACPI_MEMCPY((char *)dest_desc, (char *)source_desc,
689 sizeof(union acpi_operand_object));
691 /* Restore the saved fields */
693 dest_desc->common.reference_count = reference_count;
694 dest_desc->common.next_object = next_object;
696 /* New object is not static, regardless of source */
698 dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
700 /* Handle the objects with extra data */
702 switch (dest_desc->common.type) {
703 case ACPI_TYPE_BUFFER:
705 * Allocate and copy the actual buffer if and only if:
706 * 1) There is a valid buffer pointer
707 * 2) The buffer has a length > 0
709 if ((source_desc->buffer.pointer) &&
710 (source_desc->buffer.length)) {
711 dest_desc->buffer.pointer =
712 ACPI_ALLOCATE(source_desc->buffer.length);
713 if (!dest_desc->buffer.pointer) {
714 return (AE_NO_MEMORY);
717 /* Copy the actual buffer data */
719 ACPI_MEMCPY(dest_desc->buffer.pointer,
720 source_desc->buffer.pointer,
721 source_desc->buffer.length);
725 case ACPI_TYPE_STRING:
727 * Allocate and copy the actual string if and only if:
728 * 1) There is a valid string pointer
729 * (Pointer to a NULL string is allowed)
731 if (source_desc->string.pointer) {
732 dest_desc->string.pointer =
733 ACPI_ALLOCATE((acpi_size) source_desc->string.
735 if (!dest_desc->string.pointer) {
736 return (AE_NO_MEMORY);
739 /* Copy the actual string data */
741 ACPI_MEMCPY(dest_desc->string.pointer,
742 source_desc->string.pointer,
743 (acpi_size) source_desc->string.length + 1);
747 case ACPI_TYPE_LOCAL_REFERENCE:
749 * We copied the reference object, so we now must add a reference
750 * to the object pointed to by the reference
752 * DDBHandle reference (from Load/load_table) is a special reference,
753 * it does not have a Reference.Object, so does not need to
754 * increase the reference count
756 if (source_desc->reference.class == ACPI_REFCLASS_TABLE) {
760 acpi_ut_add_reference(source_desc->reference.object);
763 case ACPI_TYPE_REGION:
765 * We copied the Region Handler, so we now must add a reference
767 if (dest_desc->region.handler) {
768 acpi_ut_add_reference(dest_desc->region.handler);
773 * For Mutex and Event objects, we cannot simply copy the underlying
774 * OS object. We must create a new one.
776 case ACPI_TYPE_MUTEX:
778 status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex);
779 if (ACPI_FAILURE(status)) {
784 case ACPI_TYPE_EVENT:
786 status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0,
789 if (ACPI_FAILURE(status)) {
795 /* Nothing to do for other simple objects */
802 /*******************************************************************************
804 * FUNCTION: acpi_ut_copy_ielement_to_ielement
806 * PARAMETERS: acpi_pkg_callback
810 * DESCRIPTION: Copy one package element to another package element
812 ******************************************************************************/
815 acpi_ut_copy_ielement_to_ielement(u8 object_type,
816 union acpi_operand_object *source_object,
817 union acpi_generic_state *state,
820 acpi_status status = AE_OK;
822 union acpi_operand_object **this_target_ptr;
823 union acpi_operand_object *target_object;
825 ACPI_FUNCTION_ENTRY();
827 this_index = state->pkg.index;
828 this_target_ptr = (union acpi_operand_object **)
829 &state->pkg.dest_object->package.elements[this_index];
831 switch (object_type) {
832 case ACPI_COPY_TYPE_SIMPLE:
834 /* A null source object indicates a (legal) null package element */
838 * This is a simple object, just copy it
841 acpi_ut_create_internal_object(source_object->
843 if (!target_object) {
844 return (AE_NO_MEMORY);
848 acpi_ut_copy_simple_object(source_object,
850 if (ACPI_FAILURE(status)) {
854 *this_target_ptr = target_object;
856 /* Pass through a null element */
858 *this_target_ptr = NULL;
862 case ACPI_COPY_TYPE_PACKAGE:
865 * This object is a package - go down another nesting level
866 * Create and build the package object
869 acpi_ut_create_package_object(source_object->package.count);
870 if (!target_object) {
871 return (AE_NO_MEMORY);
874 target_object->common.flags = source_object->common.flags;
876 /* Pass the new package object back to the package walk routine */
878 state->pkg.this_target_obj = target_object;
880 /* Store the object pointer in the parent package object */
882 *this_target_ptr = target_object;
886 return (AE_BAD_PARAMETER);
892 acpi_ut_remove_reference(target_object);
896 /*******************************************************************************
898 * FUNCTION: acpi_ut_copy_ipackage_to_ipackage
900 * PARAMETERS: *source_obj - Pointer to the source package object
901 * *dest_obj - Where the internal object is returned
903 * RETURN: Status - the status of the call
905 * DESCRIPTION: This function is called to copy an internal package object
906 * into another internal package object.
908 ******************************************************************************/
911 acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
912 union acpi_operand_object *dest_obj,
913 struct acpi_walk_state *walk_state)
915 acpi_status status = AE_OK;
917 ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage);
919 dest_obj->common.type = source_obj->common.type;
920 dest_obj->common.flags = source_obj->common.flags;
921 dest_obj->package.count = source_obj->package.count;
924 * Create the object array and walk the source package tree
926 dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
929 1) * sizeof(void *));
930 if (!dest_obj->package.elements) {
931 ACPI_ERROR((AE_INFO, "Package allocation failure"));
932 return_ACPI_STATUS(AE_NO_MEMORY);
936 * Copy the package element-by-element by walking the package "tree".
937 * This handles nested packages of arbitrary depth.
939 status = acpi_ut_walk_package_tree(source_obj, dest_obj,
940 acpi_ut_copy_ielement_to_ielement,
942 if (ACPI_FAILURE(status)) {
944 /* On failure, delete the destination package object */
946 acpi_ut_remove_reference(dest_obj);
949 return_ACPI_STATUS(status);
952 /*******************************************************************************
954 * FUNCTION: acpi_ut_copy_iobject_to_iobject
956 * PARAMETERS: walk_state - Current walk state
957 * source_desc - The internal object to be copied
958 * dest_desc - Where the copied object is returned
962 * DESCRIPTION: Copy an internal object to a new internal object
964 ******************************************************************************/
967 acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
968 union acpi_operand_object **dest_desc,
969 struct acpi_walk_state *walk_state)
971 acpi_status status = AE_OK;
973 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject);
975 /* Create the top level object */
977 *dest_desc = acpi_ut_create_internal_object(source_desc->common.type);
979 return_ACPI_STATUS(AE_NO_MEMORY);
982 /* Copy the object and possible subobjects */
984 if (source_desc->common.type == ACPI_TYPE_PACKAGE) {
986 acpi_ut_copy_ipackage_to_ipackage(source_desc, *dest_desc,
989 status = acpi_ut_copy_simple_object(source_desc, *dest_desc);
992 return_ACPI_STATUS(status);