Linux-2.6.12-rc2
[linux-2.6/kvm.git] / drivers / acpi / utilities / utcopy.c
blob0fcd98bde0d10533cce5a0d24eeea98b0806895f
1 /******************************************************************************
3 * Module Name: utcopy - Internal to external object translation utilities
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
30 * NO WARRANTY
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.
45 #include <acpi/acpi.h>
46 #include <acpi/amlcode.h>
49 #define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("utcopy")
53 /*******************************************************************************
55 * FUNCTION: acpi_ut_copy_isimple_to_esimple
57 * PARAMETERS: *internal_object - Pointer to the object we are examining
58 * *Buffer - Where the object is returned
59 * *space_used - Where the data length is returned
61 * RETURN: Status
63 * DESCRIPTION: This function is called to place a simple object in a user
64 * buffer.
66 * The buffer is assumed to have sufficient space for the object.
68 ******************************************************************************/
70 static acpi_status
71 acpi_ut_copy_isimple_to_esimple (
72 union acpi_operand_object *internal_object,
73 union acpi_object *external_object,
74 u8 *data_space,
75 acpi_size *buffer_space_used)
77 acpi_status status = AE_OK;
80 ACPI_FUNCTION_TRACE ("ut_copy_isimple_to_esimple");
83 *buffer_space_used = 0;
86 * Check for NULL object case (could be an uninitialized
87 * package element)
89 if (!internal_object) {
90 return_ACPI_STATUS (AE_OK);
93 /* Always clear the external object */
95 ACPI_MEMSET (external_object, 0, sizeof (union acpi_object));
98 * In general, the external object will be the same type as
99 * the internal object
101 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
103 /* However, only a limited number of external types are supported */
105 switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
106 case ACPI_TYPE_STRING:
108 external_object->string.pointer = (char *) data_space;
109 external_object->string.length = internal_object->string.length;
110 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((acpi_size) internal_object->string.length + 1);
112 ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer,
113 (acpi_size) internal_object->string.length + 1);
114 break;
117 case ACPI_TYPE_BUFFER:
119 external_object->buffer.pointer = data_space;
120 external_object->buffer.length = internal_object->buffer.length;
121 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length);
123 ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer,
124 internal_object->buffer.length);
125 break;
128 case ACPI_TYPE_INTEGER:
130 external_object->integer.value = internal_object->integer.value;
131 break;
134 case ACPI_TYPE_LOCAL_REFERENCE:
137 * This is an object reference. Attempt to dereference it.
139 switch (internal_object->reference.opcode) {
140 case AML_INT_NAMEPATH_OP:
142 /* For namepath, return the object handle ("reference") */
144 default:
146 * Use the object type of "Any" to indicate a reference
147 * to object containing a handle to an ACPI named object.
149 external_object->type = ACPI_TYPE_ANY;
150 external_object->reference.handle = internal_object->reference.node;
151 break;
153 break;
156 case ACPI_TYPE_PROCESSOR:
158 external_object->processor.proc_id = internal_object->processor.proc_id;
159 external_object->processor.pblk_address = internal_object->processor.address;
160 external_object->processor.pblk_length = internal_object->processor.length;
161 break;
164 case ACPI_TYPE_POWER:
166 external_object->power_resource.system_level =
167 internal_object->power_resource.system_level;
169 external_object->power_resource.resource_order =
170 internal_object->power_resource.resource_order;
171 break;
174 default:
176 * There is no corresponding external object type
178 return_ACPI_STATUS (AE_SUPPORT);
181 return_ACPI_STATUS (status);
185 /*******************************************************************************
187 * FUNCTION: acpi_ut_copy_ielement_to_eelement
189 * PARAMETERS: acpi_pkg_callback
191 * RETURN: Status
193 * DESCRIPTION: Copy one package element to another package element
195 ******************************************************************************/
197 acpi_status
198 acpi_ut_copy_ielement_to_eelement (
199 u8 object_type,
200 union acpi_operand_object *source_object,
201 union acpi_generic_state *state,
202 void *context)
204 acpi_status status = AE_OK;
205 struct acpi_pkg_info *info = (struct acpi_pkg_info *) context;
206 acpi_size object_space;
207 u32 this_index;
208 union acpi_object *target_object;
211 ACPI_FUNCTION_ENTRY ();
214 this_index = state->pkg.index;
215 target_object = (union acpi_object *)
216 &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index];
218 switch (object_type) {
219 case ACPI_COPY_TYPE_SIMPLE:
222 * This is a simple or null object
224 status = acpi_ut_copy_isimple_to_esimple (source_object,
225 target_object, info->free_space, &object_space);
226 if (ACPI_FAILURE (status)) {
227 return (status);
229 break;
232 case ACPI_COPY_TYPE_PACKAGE:
235 * Build the package object
237 target_object->type = ACPI_TYPE_PACKAGE;
238 target_object->package.count = source_object->package.count;
239 target_object->package.elements = ACPI_CAST_PTR (union acpi_object, info->free_space);
242 * Pass the new package object back to the package walk routine
244 state->pkg.this_target_obj = target_object;
247 * Save space for the array of objects (Package elements)
248 * update the buffer length counter
250 object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
251 (acpi_size) target_object->package.count * sizeof (union acpi_object));
252 break;
255 default:
256 return (AE_BAD_PARAMETER);
259 info->free_space += object_space;
260 info->length += object_space;
261 return (status);
265 /*******************************************************************************
267 * FUNCTION: acpi_ut_copy_ipackage_to_epackage
269 * PARAMETERS: *internal_object - Pointer to the object we are returning
270 * *Buffer - Where the object is returned
271 * *space_used - Where the object length is returned
273 * RETURN: Status
275 * DESCRIPTION: This function is called to place a package object in a user
276 * buffer. A package object by definition contains other objects.
278 * The buffer is assumed to have sufficient space for the object.
279 * The caller must have verified the buffer length needed using the
280 * acpi_ut_get_object_size function before calling this function.
282 ******************************************************************************/
284 static acpi_status
285 acpi_ut_copy_ipackage_to_epackage (
286 union acpi_operand_object *internal_object,
287 u8 *buffer,
288 acpi_size *space_used)
290 union acpi_object *external_object;
291 acpi_status status;
292 struct acpi_pkg_info info;
295 ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_epackage");
299 * First package at head of the buffer
301 external_object = ACPI_CAST_PTR (union acpi_object, buffer);
304 * Free space begins right after the first package
306 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
307 info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
308 info.object_space = 0;
309 info.num_packages = 1;
311 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
312 external_object->package.count = internal_object->package.count;
313 external_object->package.elements = ACPI_CAST_PTR (union acpi_object, info.free_space);
316 * Leave room for an array of ACPI_OBJECTS in the buffer
317 * and move the free space past it
319 info.length += (acpi_size) external_object->package.count *
320 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
321 info.free_space += external_object->package.count *
322 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
324 status = acpi_ut_walk_package_tree (internal_object, external_object,
325 acpi_ut_copy_ielement_to_eelement, &info);
327 *space_used = info.length;
328 return_ACPI_STATUS (status);
332 /*******************************************************************************
334 * FUNCTION: acpi_ut_copy_iobject_to_eobject
336 * PARAMETERS: *internal_object - The internal object to be converted
337 * *buffer_ptr - Where the object is returned
339 * RETURN: Status
341 * DESCRIPTION: This function is called to build an API object to be returned to
342 * the caller.
344 ******************************************************************************/
346 acpi_status
347 acpi_ut_copy_iobject_to_eobject (
348 union acpi_operand_object *internal_object,
349 struct acpi_buffer *ret_buffer)
351 acpi_status status;
354 ACPI_FUNCTION_TRACE ("ut_copy_iobject_to_eobject");
357 if (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE) {
359 * Package object: Copy all subobjects (including
360 * nested packages)
362 status = acpi_ut_copy_ipackage_to_epackage (internal_object,
363 ret_buffer->pointer, &ret_buffer->length);
365 else {
367 * Build a simple object (no nested objects)
369 status = acpi_ut_copy_isimple_to_esimple (internal_object,
370 (union acpi_object *) ret_buffer->pointer,
371 ((u8 *) ret_buffer->pointer +
372 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))),
373 &ret_buffer->length);
375 * build simple does not include the object size in the length
376 * so we add it in here
378 ret_buffer->length += sizeof (union acpi_object);
381 return_ACPI_STATUS (status);
385 /*******************************************************************************
387 * FUNCTION: acpi_ut_copy_esimple_to_isimple
389 * PARAMETERS: *external_object - The external object to be converted
390 * *internal_object - Where the internal object is returned
392 * RETURN: Status
394 * DESCRIPTION: This function copies an external object to an internal one.
395 * NOTE: Pointers can be copied, we don't need to copy data.
396 * (The pointers have to be valid in our address space no matter
397 * what we do with them!)
399 ******************************************************************************/
401 acpi_status
402 acpi_ut_copy_esimple_to_isimple (
403 union acpi_object *external_object,
404 union acpi_operand_object **ret_internal_object)
406 union acpi_operand_object *internal_object;
409 ACPI_FUNCTION_TRACE ("ut_copy_esimple_to_isimple");
413 * Simple types supported are: String, Buffer, Integer
415 switch (external_object->type) {
416 case ACPI_TYPE_STRING:
417 case ACPI_TYPE_BUFFER:
418 case ACPI_TYPE_INTEGER:
420 internal_object = acpi_ut_create_internal_object ((u8) external_object->type);
421 if (!internal_object) {
422 return_ACPI_STATUS (AE_NO_MEMORY);
424 break;
426 default:
427 /* All other types are not supported */
429 return_ACPI_STATUS (AE_SUPPORT);
433 /* Must COPY string and buffer contents */
435 switch (external_object->type) {
436 case ACPI_TYPE_STRING:
438 internal_object->string.pointer =
439 ACPI_MEM_CALLOCATE ((acpi_size) external_object->string.length + 1);
440 if (!internal_object->string.pointer) {
441 goto error_exit;
444 ACPI_MEMCPY (internal_object->string.pointer,
445 external_object->string.pointer,
446 external_object->string.length);
448 internal_object->string.length = external_object->string.length;
449 break;
452 case ACPI_TYPE_BUFFER:
454 internal_object->buffer.pointer =
455 ACPI_MEM_CALLOCATE (external_object->buffer.length);
456 if (!internal_object->buffer.pointer) {
457 goto error_exit;
460 ACPI_MEMCPY (internal_object->buffer.pointer,
461 external_object->buffer.pointer,
462 external_object->buffer.length);
464 internal_object->buffer.length = external_object->buffer.length;
465 break;
468 case ACPI_TYPE_INTEGER:
470 internal_object->integer.value = external_object->integer.value;
471 break;
473 default:
474 /* Other types can't get here */
475 break;
478 *ret_internal_object = internal_object;
479 return_ACPI_STATUS (AE_OK);
482 error_exit:
483 acpi_ut_remove_reference (internal_object);
484 return_ACPI_STATUS (AE_NO_MEMORY);
488 #ifdef ACPI_FUTURE_IMPLEMENTATION
490 /* Code to convert packages that are parameters to control methods */
492 /*******************************************************************************
494 * FUNCTION: acpi_ut_copy_epackage_to_ipackage
496 * PARAMETERS: *internal_object - Pointer to the object we are returning
497 * *Buffer - Where the object is returned
498 * *space_used - Where the length of the object is returned
500 * RETURN: Status
502 * DESCRIPTION: This function is called to place a package object in a user
503 * buffer. A package object by definition contains other objects.
505 * The buffer is assumed to have sufficient space for the object.
506 * The caller must have verified the buffer length needed using the
507 * acpi_ut_get_object_size function before calling this function.
509 ******************************************************************************/
511 static acpi_status
512 acpi_ut_copy_epackage_to_ipackage (
513 union acpi_operand_object *internal_object,
514 u8 *buffer,
515 u32 *space_used)
517 u8 *free_space;
518 union acpi_object *external_object;
519 u32 length = 0;
520 u32 this_index;
521 u32 object_space = 0;
522 union acpi_operand_object *this_internal_obj;
523 union acpi_object *this_external_obj;
526 ACPI_FUNCTION_TRACE ("ut_copy_epackage_to_ipackage");
530 * First package at head of the buffer
532 external_object = (union acpi_object *)buffer;
535 * Free space begins right after the first package
537 free_space = buffer + sizeof(union acpi_object);
540 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
541 external_object->package.count = internal_object->package.count;
542 external_object->package.elements = (union acpi_object *)free_space;
545 * Build an array of ACPI_OBJECTS in the buffer
546 * and move the free space past it
548 free_space += external_object->package.count * sizeof(union acpi_object);
551 /* Call walk_package */
555 #endif /* Future implementation */
558 /*******************************************************************************
560 * FUNCTION: acpi_ut_copy_eobject_to_iobject
562 * PARAMETERS: *internal_object - The external object to be converted
563 * *buffer_ptr - Where the internal object is returned
565 * RETURN: Status - the status of the call
567 * DESCRIPTION: Converts an external object to an internal object.
569 ******************************************************************************/
571 acpi_status
572 acpi_ut_copy_eobject_to_iobject (
573 union acpi_object *external_object,
574 union acpi_operand_object **internal_object)
576 acpi_status status;
579 ACPI_FUNCTION_TRACE ("ut_copy_eobject_to_iobject");
582 if (external_object->type == ACPI_TYPE_PACKAGE) {
584 * Packages as external input to control methods are not supported,
586 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
587 "Packages as parameters not implemented!\n"));
589 return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
592 else {
594 * Build a simple object (no nested objects)
596 status = acpi_ut_copy_esimple_to_isimple (external_object, internal_object);
599 return_ACPI_STATUS (status);
603 /*******************************************************************************
605 * FUNCTION: acpi_ut_copy_simple_object
607 * PARAMETERS: source_desc - The internal object to be copied
608 * dest_desc - New target object
610 * RETURN: Status
612 * DESCRIPTION: Simple copy of one internal object to another. Reference count
613 * of the destination object is preserved.
615 ******************************************************************************/
617 acpi_status
618 acpi_ut_copy_simple_object (
619 union acpi_operand_object *source_desc,
620 union acpi_operand_object *dest_desc)
622 u16 reference_count;
623 union acpi_operand_object *next_object;
626 /* Save fields from destination that we don't want to overwrite */
628 reference_count = dest_desc->common.reference_count;
629 next_object = dest_desc->common.next_object;
631 /* Copy the entire source object over the destination object*/
633 ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc,
634 sizeof (union acpi_operand_object));
636 /* Restore the saved fields */
638 dest_desc->common.reference_count = reference_count;
639 dest_desc->common.next_object = next_object;
641 /* Handle the objects with extra data */
643 switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
644 case ACPI_TYPE_BUFFER:
646 dest_desc->buffer.node = NULL;
647 dest_desc->common.flags = source_desc->common.flags;
650 * Allocate and copy the actual buffer if and only if:
651 * 1) There is a valid buffer pointer
652 * 2) The buffer is not static (not in an ACPI table) (in this case,
653 * the actual pointer was already copied above)
655 if ((source_desc->buffer.pointer) &&
656 (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
657 dest_desc->buffer.pointer = NULL;
659 /* Create an actual buffer only if length > 0 */
661 if (source_desc->buffer.length) {
662 dest_desc->buffer.pointer =
663 ACPI_MEM_ALLOCATE (source_desc->buffer.length);
664 if (!dest_desc->buffer.pointer) {
665 return (AE_NO_MEMORY);
668 /* Copy the actual buffer data */
670 ACPI_MEMCPY (dest_desc->buffer.pointer,
671 source_desc->buffer.pointer,
672 source_desc->buffer.length);
675 break;
677 case ACPI_TYPE_STRING:
680 * Allocate and copy the actual string if and only if:
681 * 1) There is a valid string pointer
682 * 2) The string is not static (not in an ACPI table) (in this case,
683 * the actual pointer was already copied above)
685 if ((source_desc->string.pointer) &&
686 (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
687 dest_desc->string.pointer =
688 ACPI_MEM_ALLOCATE ((acpi_size) source_desc->string.length + 1);
689 if (!dest_desc->string.pointer) {
690 return (AE_NO_MEMORY);
693 ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer,
694 (acpi_size) source_desc->string.length + 1);
696 break;
698 case ACPI_TYPE_LOCAL_REFERENCE:
700 * We copied the reference object, so we now must add a reference
701 * to the object pointed to by the reference
703 acpi_ut_add_reference (source_desc->reference.object);
704 break;
706 default:
707 /* Nothing to do for other simple objects */
708 break;
711 return (AE_OK);
715 /*******************************************************************************
717 * FUNCTION: acpi_ut_copy_ielement_to_ielement
719 * PARAMETERS: acpi_pkg_callback
721 * RETURN: Status
723 * DESCRIPTION: Copy one package element to another package element
725 ******************************************************************************/
727 acpi_status
728 acpi_ut_copy_ielement_to_ielement (
729 u8 object_type,
730 union acpi_operand_object *source_object,
731 union acpi_generic_state *state,
732 void *context)
734 acpi_status status = AE_OK;
735 u32 this_index;
736 union acpi_operand_object **this_target_ptr;
737 union acpi_operand_object *target_object;
740 ACPI_FUNCTION_ENTRY ();
743 this_index = state->pkg.index;
744 this_target_ptr = (union acpi_operand_object **)
745 &state->pkg.dest_object->package.elements[this_index];
747 switch (object_type) {
748 case ACPI_COPY_TYPE_SIMPLE:
750 /* A null source object indicates a (legal) null package element */
752 if (source_object) {
754 * This is a simple object, just copy it
756 target_object = acpi_ut_create_internal_object (
757 ACPI_GET_OBJECT_TYPE (source_object));
758 if (!target_object) {
759 return (AE_NO_MEMORY);
762 status = acpi_ut_copy_simple_object (source_object, target_object);
763 if (ACPI_FAILURE (status)) {
764 goto error_exit;
767 *this_target_ptr = target_object;
769 else {
770 /* Pass through a null element */
772 *this_target_ptr = NULL;
774 break;
777 case ACPI_COPY_TYPE_PACKAGE:
780 * This object is a package - go down another nesting level
781 * Create and build the package object
783 target_object = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
784 if (!target_object) {
785 return (AE_NO_MEMORY);
788 target_object->package.count = source_object->package.count;
789 target_object->common.flags = source_object->common.flags;
792 * Create the object array
794 target_object->package.elements =
795 ACPI_MEM_CALLOCATE (((acpi_size) source_object->package.count + 1) *
796 sizeof (void *));
797 if (!target_object->package.elements) {
798 status = AE_NO_MEMORY;
799 goto error_exit;
803 * Pass the new package object back to the package walk routine
805 state->pkg.this_target_obj = target_object;
808 * Store the object pointer in the parent package object
810 *this_target_ptr = target_object;
811 break;
814 default:
815 return (AE_BAD_PARAMETER);
818 return (status);
820 error_exit:
821 acpi_ut_remove_reference (target_object);
822 return (status);
826 /*******************************************************************************
828 * FUNCTION: acpi_ut_copy_ipackage_to_ipackage
830 * PARAMETERS: *source_obj - Pointer to the source package object
831 * *dest_obj - Where the internal object is returned
833 * RETURN: Status - the status of the call
835 * DESCRIPTION: This function is called to copy an internal package object
836 * into another internal package object.
838 ******************************************************************************/
840 acpi_status
841 acpi_ut_copy_ipackage_to_ipackage (
842 union acpi_operand_object *source_obj,
843 union acpi_operand_object *dest_obj,
844 struct acpi_walk_state *walk_state)
846 acpi_status status = AE_OK;
849 ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_ipackage");
852 dest_obj->common.type = ACPI_GET_OBJECT_TYPE (source_obj);
853 dest_obj->common.flags = source_obj->common.flags;
854 dest_obj->package.count = source_obj->package.count;
857 * Create the object array and walk the source package tree
859 dest_obj->package.elements = ACPI_MEM_CALLOCATE (
860 ((acpi_size) source_obj->package.count + 1) *
861 sizeof (void *));
862 if (!dest_obj->package.elements) {
863 ACPI_REPORT_ERROR (
864 ("aml_build_copy_internal_package_object: Package allocation failure\n"));
865 return_ACPI_STATUS (AE_NO_MEMORY);
869 * Copy the package element-by-element by walking the package "tree".
870 * This handles nested packages of arbitrary depth.
872 status = acpi_ut_walk_package_tree (source_obj, dest_obj,
873 acpi_ut_copy_ielement_to_ielement, walk_state);
874 if (ACPI_FAILURE (status)) {
875 /* On failure, delete the destination package object */
877 acpi_ut_remove_reference (dest_obj);
880 return_ACPI_STATUS (status);
884 /*******************************************************************************
886 * FUNCTION: acpi_ut_copy_iobject_to_iobject
888 * PARAMETERS: walk_state - Current walk state
889 * source_desc - The internal object to be copied
890 * dest_desc - Where the copied object is returned
892 * RETURN: Status
894 * DESCRIPTION: Copy an internal object to a new internal object
896 ******************************************************************************/
898 acpi_status
899 acpi_ut_copy_iobject_to_iobject (
900 union acpi_operand_object *source_desc,
901 union acpi_operand_object **dest_desc,
902 struct acpi_walk_state *walk_state)
904 acpi_status status = AE_OK;
907 ACPI_FUNCTION_TRACE ("ut_copy_iobject_to_iobject");
910 /* Create the top level object */
912 *dest_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_desc));
913 if (!*dest_desc) {
914 return_ACPI_STATUS (AE_NO_MEMORY);
917 /* Copy the object and possible subobjects */
919 if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_PACKAGE) {
920 status = acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc,
921 walk_state);
923 else {
924 status = acpi_ut_copy_simple_object (source_desc, *dest_desc);
927 return_ACPI_STATUS (status);