1 /******************************************************************************
2 *
3 * Module Name: utcopy - Internal to external object translation utilities
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
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.
25 *
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.
155 * the internal object
156 */
157 ExternalObject->Type = InternalObject->Common.Type;
158
159 /* However, only a limited number of external types are supported */
160
161 switch (InternalObject->Common.Type)
162 {
163 case ACPI_TYPE_STRING:
164
165 ExternalObject->String.Pointer = (char *) DataSpace;
166 ExternalObject->String.Length = InternalObject->String.Length;
167 *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
168 (ACPI_SIZE) InternalObject->String.Length + 1);
169
170 ACPI_MEMCPY ((void *) DataSpace,
171 (void *) InternalObject->String.Pointer,
172 (ACPI_SIZE) InternalObject->String.Length + 1);
173 break;
174
175
176 case ACPI_TYPE_BUFFER:
177
178 ExternalObject->Buffer.Pointer = DataSpace;
179 ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
180 *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
181 InternalObject->String.Length);
182
183 ACPI_MEMCPY ((void *) DataSpace,
184 (void *) InternalObject->Buffer.Pointer,
185 InternalObject->Buffer.Length);
186 break;
187
188
189 case ACPI_TYPE_INTEGER:
190
191 ExternalObject->Integer.Value = InternalObject->Integer.Value;
192 break;
193
194
195 case ACPI_TYPE_LOCAL_REFERENCE:
196
197 /* This is an object reference. */
198
199 switch (InternalObject->Reference.Class)
200 {
201 case ACPI_REFCLASS_NAME:
202
203 /*
204 * For namepath, return the object handle ("reference")
205 * We are referring to the namespace node
206 */
207 ExternalObject->Reference.Handle =
208 InternalObject->Reference.Node;
209 ExternalObject->Reference.ActualType =
210 AcpiNsGetType (InternalObject->Reference.Node);
211 break;
212
213 default:
214
215 /* All other reference types are unsupported */
216
217 return_ACPI_STATUS (AE_TYPE);
218 }
219 break;
220
221
222 case ACPI_TYPE_PROCESSOR:
223
224 ExternalObject->Processor.ProcId =
225 InternalObject->Processor.ProcId;
226 ExternalObject->Processor.PblkAddress =
227 InternalObject->Processor.Address;
228 ExternalObject->Processor.PblkLength =
229 InternalObject->Processor.Length;
230 break;
231
232
233 case ACPI_TYPE_POWER:
234
235 ExternalObject->PowerResource.SystemLevel =
236 InternalObject->PowerResource.SystemLevel;
237
238 ExternalObject->PowerResource.ResourceOrder =
239 InternalObject->PowerResource.ResourceOrder;
240 break;
241
242
243 default:
244 /*
245 * There is no corresponding external object type
246 */
247 ACPI_ERROR ((AE_INFO,
248 "Unsupported object type, cannot convert to external object: %s",
249 AcpiUtGetTypeName (InternalObject->Common.Type)));
250
251 return_ACPI_STATUS (AE_SUPPORT);
252 }
253
254 return_ACPI_STATUS (Status);
255 }
256
257
258 /*******************************************************************************
259 *
260 * FUNCTION: AcpiUtCopyIelementToEelement
261 *
262 * PARAMETERS: ACPI_PKG_CALLBACK
274 ACPI_GENERIC_STATE *State,
275 void *Context)
276 {
277 ACPI_STATUS Status = AE_OK;
278 ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
279 ACPI_SIZE ObjectSpace;
280 UINT32 ThisIndex;
281 ACPI_OBJECT *TargetObject;
282
283
284 ACPI_FUNCTION_ENTRY ();
285
286
287 ThisIndex = State->Pkg.Index;
288 TargetObject = (ACPI_OBJECT *)
289 &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
290
291 switch (ObjectType)
292 {
293 case ACPI_COPY_TYPE_SIMPLE:
294
295 /*
296 * This is a simple or null object
297 */
298 Status = AcpiUtCopyIsimpleToEsimple (SourceObject,
299 TargetObject, Info->FreeSpace, &ObjectSpace);
300 if (ACPI_FAILURE (Status))
301 {
302 return (Status);
303 }
304 break;
305
306
307 case ACPI_COPY_TYPE_PACKAGE:
308
309 /*
310 * Build the package object
311 */
312 TargetObject->Type = ACPI_TYPE_PACKAGE;
313 TargetObject->Package.Count = SourceObject->Package.Count;
314 TargetObject->Package.Elements =
315 ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);
316
317 /*
318 * Pass the new package object back to the package walk routine
319 */
320 State->Pkg.ThisTargetObj = TargetObject;
321
322 /*
323 * Save space for the array of objects (Package elements)
324 * update the buffer length counter
325 */
326 ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
327 (ACPI_SIZE) TargetObject->Package.Count *
328 sizeof (ACPI_OBJECT));
329 break;
330
331
332 default:
333 return (AE_BAD_PARAMETER);
334 }
335
336 Info->FreeSpace += ObjectSpace;
337 Info->Length += ObjectSpace;
338 return (Status);
339 }
340
341
342 /*******************************************************************************
343 *
344 * FUNCTION: AcpiUtCopyIpackageToEpackage
345 *
346 * PARAMETERS: InternalObject - Pointer to the object we are returning
347 * Buffer - Where the object is returned
348 * SpaceUsed - Where the object length is returned
349 *
350 * RETURN: Status
351 *
352 * DESCRIPTION: This function is called to place a package object in a user
497 {
498 case ACPI_TYPE_STRING:
499 case ACPI_TYPE_BUFFER:
500 case ACPI_TYPE_INTEGER:
501 case ACPI_TYPE_LOCAL_REFERENCE:
502
503 InternalObject = AcpiUtCreateInternalObject (
504 (UINT8) ExternalObject->Type);
505 if (!InternalObject)
506 {
507 return_ACPI_STATUS (AE_NO_MEMORY);
508 }
509 break;
510
511 case ACPI_TYPE_ANY: /* This is the case for a NULL object */
512
513 *RetInternalObject = NULL;
514 return_ACPI_STATUS (AE_OK);
515
516 default:
517 /* All other types are not supported */
518
519 ACPI_ERROR ((AE_INFO,
520 "Unsupported object type, cannot convert to internal object: %s",
521 AcpiUtGetTypeName (ExternalObject->Type)));
522
523 return_ACPI_STATUS (AE_SUPPORT);
524 }
525
526
527 /* Must COPY string and buffer contents */
528
529 switch (ExternalObject->Type)
530 {
531 case ACPI_TYPE_STRING:
532
533 InternalObject->String.Pointer =
534 ACPI_ALLOCATE_ZEROED ((ACPI_SIZE)
535 ExternalObject->String.Length + 1);
536
537 if (!InternalObject->String.Pointer)
538 {
539 goto ErrorExit;
540 }
541
542 ACPI_MEMCPY (InternalObject->String.Pointer,
543 ExternalObject->String.Pointer,
544 ExternalObject->String.Length);
545
546 InternalObject->String.Length = ExternalObject->String.Length;
547 break;
548
549
550 case ACPI_TYPE_BUFFER:
551
552 InternalObject->Buffer.Pointer =
553 ACPI_ALLOCATE_ZEROED (ExternalObject->Buffer.Length);
554 if (!InternalObject->Buffer.Pointer)
555 {
556 goto ErrorExit;
557 }
558
559 ACPI_MEMCPY (InternalObject->Buffer.Pointer,
560 ExternalObject->Buffer.Pointer,
561 ExternalObject->Buffer.Length);
562
563 InternalObject->Buffer.Length = ExternalObject->Buffer.Length;
564
565 /* Mark buffer data valid */
566
567 InternalObject->Buffer.Flags |= AOPOBJ_DATA_VALID;
568 break;
569
570
571 case ACPI_TYPE_INTEGER:
572
573 InternalObject->Integer.Value = ExternalObject->Integer.Value;
574 break;
575
576 case ACPI_TYPE_LOCAL_REFERENCE:
577
578 /* TBD: should validate incoming handle */
579
580 InternalObject->Reference.Class = ACPI_REFCLASS_NAME;
581 InternalObject->Reference.Node = ExternalObject->Reference.Handle;
582 break;
583
584 default:
585 /* Other types can't get here */
586 break;
587 }
588
589 *RetInternalObject = InternalObject;
590 return_ACPI_STATUS (AE_OK);
591
592
593 ErrorExit:
594 AcpiUtRemoveReference (InternalObject);
595 return_ACPI_STATUS (AE_NO_MEMORY);
596 }
597
598
599 /*******************************************************************************
600 *
601 * FUNCTION: AcpiUtCopyEpackageToIpackage
602 *
603 * PARAMETERS: ExternalObject - The external object to be converted
604 * InternalObject - Where the internal object is returned
605 *
838 case ACPI_TYPE_MUTEX:
839
840 Status = AcpiOsCreateMutex (&DestDesc->Mutex.OsMutex);
841 if (ACPI_FAILURE (Status))
842 {
843 return (Status);
844 }
845 break;
846
847 case ACPI_TYPE_EVENT:
848
849 Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
850 &DestDesc->Event.OsSemaphore);
851 if (ACPI_FAILURE (Status))
852 {
853 return (Status);
854 }
855 break;
856
857 default:
858 /* Nothing to do for other simple objects */
859 break;
860 }
861
862 return (AE_OK);
863 }
864
865
866 /*******************************************************************************
867 *
868 * FUNCTION: AcpiUtCopyIelementToIelement
869 *
870 * PARAMETERS: ACPI_PKG_CALLBACK
871 *
872 * RETURN: Status
873 *
874 * DESCRIPTION: Copy one package element to another package element
875 *
876 ******************************************************************************/
877
878 static ACPI_STATUS
912 {
913 return (AE_NO_MEMORY);
914 }
915
916 Status = AcpiUtCopySimpleObject (SourceObject, TargetObject);
917 if (ACPI_FAILURE (Status))
918 {
919 goto ErrorExit;
920 }
921
922 *ThisTargetPtr = TargetObject;
923 }
924 else
925 {
926 /* Pass through a null element */
927
928 *ThisTargetPtr = NULL;
929 }
930 break;
931
932
933 case ACPI_COPY_TYPE_PACKAGE:
934
935 /*
936 * This object is a package - go down another nesting level
937 * Create and build the package object
938 */
939 TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count);
940 if (!TargetObject)
941 {
942 return (AE_NO_MEMORY);
943 }
944
945 TargetObject->Common.Flags = SourceObject->Common.Flags;
946
947 /* Pass the new package object back to the package walk routine */
948
949 State->Pkg.ThisTargetObj = TargetObject;
950
951 /* Store the object pointer in the parent package object */
952
953 *ThisTargetPtr = TargetObject;
954 break;
955
956
957 default:
958 return (AE_BAD_PARAMETER);
959 }
960
961 return (Status);
962
963 ErrorExit:
964 AcpiUtRemoveReference (TargetObject);
965 return (Status);
966 }
967
968
969 /*******************************************************************************
970 *
971 * FUNCTION: AcpiUtCopyIpackageToIpackage
972 *
973 * PARAMETERS: SourceObj - Pointer to the source package object
974 * DestObj - Where the internal object is returned
975 * WalkState - Current Walk state descriptor
976 *
977 * RETURN: Status
1057 *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type);
1058 if (!*DestDesc)
1059 {
1060 return_ACPI_STATUS (AE_NO_MEMORY);
1061 }
1062
1063 /* Copy the object and possible subobjects */
1064
1065 if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE)
1066 {
1067 Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
1068 WalkState);
1069 }
1070 else
1071 {
1072 Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
1073 }
1074
1075 return_ACPI_STATUS (Status);
1076 }
1077
1078
|
1 /******************************************************************************
2 *
3 * Module Name: utcopy - Internal to external object translation utilities
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
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.
25 *
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.
155 * the internal object
156 */
157 ExternalObject->Type = InternalObject->Common.Type;
158
159 /* However, only a limited number of external types are supported */
160
161 switch (InternalObject->Common.Type)
162 {
163 case ACPI_TYPE_STRING:
164
165 ExternalObject->String.Pointer = (char *) DataSpace;
166 ExternalObject->String.Length = InternalObject->String.Length;
167 *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
168 (ACPI_SIZE) InternalObject->String.Length + 1);
169
170 ACPI_MEMCPY ((void *) DataSpace,
171 (void *) InternalObject->String.Pointer,
172 (ACPI_SIZE) InternalObject->String.Length + 1);
173 break;
174
175 case ACPI_TYPE_BUFFER:
176
177 ExternalObject->Buffer.Pointer = DataSpace;
178 ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
179 *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
180 InternalObject->String.Length);
181
182 ACPI_MEMCPY ((void *) DataSpace,
183 (void *) InternalObject->Buffer.Pointer,
184 InternalObject->Buffer.Length);
185 break;
186
187 case ACPI_TYPE_INTEGER:
188
189 ExternalObject->Integer.Value = InternalObject->Integer.Value;
190 break;
191
192 case ACPI_TYPE_LOCAL_REFERENCE:
193
194 /* This is an object reference. */
195
196 switch (InternalObject->Reference.Class)
197 {
198 case ACPI_REFCLASS_NAME:
199 /*
200 * For namepath, return the object handle ("reference")
201 * We are referring to the namespace node
202 */
203 ExternalObject->Reference.Handle =
204 InternalObject->Reference.Node;
205 ExternalObject->Reference.ActualType =
206 AcpiNsGetType (InternalObject->Reference.Node);
207 break;
208
209 default:
210
211 /* All other reference types are unsupported */
212
213 return_ACPI_STATUS (AE_TYPE);
214 }
215 break;
216
217 case ACPI_TYPE_PROCESSOR:
218
219 ExternalObject->Processor.ProcId =
220 InternalObject->Processor.ProcId;
221 ExternalObject->Processor.PblkAddress =
222 InternalObject->Processor.Address;
223 ExternalObject->Processor.PblkLength =
224 InternalObject->Processor.Length;
225 break;
226
227 case ACPI_TYPE_POWER:
228
229 ExternalObject->PowerResource.SystemLevel =
230 InternalObject->PowerResource.SystemLevel;
231
232 ExternalObject->PowerResource.ResourceOrder =
233 InternalObject->PowerResource.ResourceOrder;
234 break;
235
236 default:
237 /*
238 * There is no corresponding external object type
239 */
240 ACPI_ERROR ((AE_INFO,
241 "Unsupported object type, cannot convert to external object: %s",
242 AcpiUtGetTypeName (InternalObject->Common.Type)));
243
244 return_ACPI_STATUS (AE_SUPPORT);
245 }
246
247 return_ACPI_STATUS (Status);
248 }
249
250
251 /*******************************************************************************
252 *
253 * FUNCTION: AcpiUtCopyIelementToEelement
254 *
255 * PARAMETERS: ACPI_PKG_CALLBACK
267 ACPI_GENERIC_STATE *State,
268 void *Context)
269 {
270 ACPI_STATUS Status = AE_OK;
271 ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
272 ACPI_SIZE ObjectSpace;
273 UINT32 ThisIndex;
274 ACPI_OBJECT *TargetObject;
275
276
277 ACPI_FUNCTION_ENTRY ();
278
279
280 ThisIndex = State->Pkg.Index;
281 TargetObject = (ACPI_OBJECT *)
282 &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
283
284 switch (ObjectType)
285 {
286 case ACPI_COPY_TYPE_SIMPLE:
287 /*
288 * This is a simple or null object
289 */
290 Status = AcpiUtCopyIsimpleToEsimple (SourceObject,
291 TargetObject, Info->FreeSpace, &ObjectSpace);
292 if (ACPI_FAILURE (Status))
293 {
294 return (Status);
295 }
296 break;
297
298 case ACPI_COPY_TYPE_PACKAGE:
299 /*
300 * Build the package object
301 */
302 TargetObject->Type = ACPI_TYPE_PACKAGE;
303 TargetObject->Package.Count = SourceObject->Package.Count;
304 TargetObject->Package.Elements =
305 ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);
306
307 /*
308 * Pass the new package object back to the package walk routine
309 */
310 State->Pkg.ThisTargetObj = TargetObject;
311
312 /*
313 * Save space for the array of objects (Package elements)
314 * update the buffer length counter
315 */
316 ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
317 (ACPI_SIZE) TargetObject->Package.Count *
318 sizeof (ACPI_OBJECT));
319 break;
320
321 default:
322
323 return (AE_BAD_PARAMETER);
324 }
325
326 Info->FreeSpace += ObjectSpace;
327 Info->Length += ObjectSpace;
328 return (Status);
329 }
330
331
332 /*******************************************************************************
333 *
334 * FUNCTION: AcpiUtCopyIpackageToEpackage
335 *
336 * PARAMETERS: InternalObject - Pointer to the object we are returning
337 * Buffer - Where the object is returned
338 * SpaceUsed - Where the object length is returned
339 *
340 * RETURN: Status
341 *
342 * DESCRIPTION: This function is called to place a package object in a user
487 {
488 case ACPI_TYPE_STRING:
489 case ACPI_TYPE_BUFFER:
490 case ACPI_TYPE_INTEGER:
491 case ACPI_TYPE_LOCAL_REFERENCE:
492
493 InternalObject = AcpiUtCreateInternalObject (
494 (UINT8) ExternalObject->Type);
495 if (!InternalObject)
496 {
497 return_ACPI_STATUS (AE_NO_MEMORY);
498 }
499 break;
500
501 case ACPI_TYPE_ANY: /* This is the case for a NULL object */
502
503 *RetInternalObject = NULL;
504 return_ACPI_STATUS (AE_OK);
505
506 default:
507
508 /* All other types are not supported */
509
510 ACPI_ERROR ((AE_INFO,
511 "Unsupported object type, cannot convert to internal object: %s",
512 AcpiUtGetTypeName (ExternalObject->Type)));
513
514 return_ACPI_STATUS (AE_SUPPORT);
515 }
516
517
518 /* Must COPY string and buffer contents */
519
520 switch (ExternalObject->Type)
521 {
522 case ACPI_TYPE_STRING:
523
524 InternalObject->String.Pointer =
525 ACPI_ALLOCATE_ZEROED ((ACPI_SIZE)
526 ExternalObject->String.Length + 1);
527
528 if (!InternalObject->String.Pointer)
529 {
530 goto ErrorExit;
531 }
532
533 ACPI_MEMCPY (InternalObject->String.Pointer,
534 ExternalObject->String.Pointer,
535 ExternalObject->String.Length);
536
537 InternalObject->String.Length = ExternalObject->String.Length;
538 break;
539
540 case ACPI_TYPE_BUFFER:
541
542 InternalObject->Buffer.Pointer =
543 ACPI_ALLOCATE_ZEROED (ExternalObject->Buffer.Length);
544 if (!InternalObject->Buffer.Pointer)
545 {
546 goto ErrorExit;
547 }
548
549 ACPI_MEMCPY (InternalObject->Buffer.Pointer,
550 ExternalObject->Buffer.Pointer,
551 ExternalObject->Buffer.Length);
552
553 InternalObject->Buffer.Length = ExternalObject->Buffer.Length;
554
555 /* Mark buffer data valid */
556
557 InternalObject->Buffer.Flags |= AOPOBJ_DATA_VALID;
558 break;
559
560 case ACPI_TYPE_INTEGER:
561
562 InternalObject->Integer.Value = ExternalObject->Integer.Value;
563 break;
564
565 case ACPI_TYPE_LOCAL_REFERENCE:
566
567 /* TBD: should validate incoming handle */
568
569 InternalObject->Reference.Class = ACPI_REFCLASS_NAME;
570 InternalObject->Reference.Node = ExternalObject->Reference.Handle;
571 break;
572
573 default:
574
575 /* Other types can't get here */
576
577 break;
578 }
579
580 *RetInternalObject = InternalObject;
581 return_ACPI_STATUS (AE_OK);
582
583
584 ErrorExit:
585 AcpiUtRemoveReference (InternalObject);
586 return_ACPI_STATUS (AE_NO_MEMORY);
587 }
588
589
590 /*******************************************************************************
591 *
592 * FUNCTION: AcpiUtCopyEpackageToIpackage
593 *
594 * PARAMETERS: ExternalObject - The external object to be converted
595 * InternalObject - Where the internal object is returned
596 *
829 case ACPI_TYPE_MUTEX:
830
831 Status = AcpiOsCreateMutex (&DestDesc->Mutex.OsMutex);
832 if (ACPI_FAILURE (Status))
833 {
834 return (Status);
835 }
836 break;
837
838 case ACPI_TYPE_EVENT:
839
840 Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
841 &DestDesc->Event.OsSemaphore);
842 if (ACPI_FAILURE (Status))
843 {
844 return (Status);
845 }
846 break;
847
848 default:
849
850 /* Nothing to do for other simple objects */
851
852 break;
853 }
854
855 return (AE_OK);
856 }
857
858
859 /*******************************************************************************
860 *
861 * FUNCTION: AcpiUtCopyIelementToIelement
862 *
863 * PARAMETERS: ACPI_PKG_CALLBACK
864 *
865 * RETURN: Status
866 *
867 * DESCRIPTION: Copy one package element to another package element
868 *
869 ******************************************************************************/
870
871 static ACPI_STATUS
905 {
906 return (AE_NO_MEMORY);
907 }
908
909 Status = AcpiUtCopySimpleObject (SourceObject, TargetObject);
910 if (ACPI_FAILURE (Status))
911 {
912 goto ErrorExit;
913 }
914
915 *ThisTargetPtr = TargetObject;
916 }
917 else
918 {
919 /* Pass through a null element */
920
921 *ThisTargetPtr = NULL;
922 }
923 break;
924
925 case ACPI_COPY_TYPE_PACKAGE:
926 /*
927 * This object is a package - go down another nesting level
928 * Create and build the package object
929 */
930 TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count);
931 if (!TargetObject)
932 {
933 return (AE_NO_MEMORY);
934 }
935
936 TargetObject->Common.Flags = SourceObject->Common.Flags;
937
938 /* Pass the new package object back to the package walk routine */
939
940 State->Pkg.ThisTargetObj = TargetObject;
941
942 /* Store the object pointer in the parent package object */
943
944 *ThisTargetPtr = TargetObject;
945 break;
946
947 default:
948
949 return (AE_BAD_PARAMETER);
950 }
951
952 return (Status);
953
954 ErrorExit:
955 AcpiUtRemoveReference (TargetObject);
956 return (Status);
957 }
958
959
960 /*******************************************************************************
961 *
962 * FUNCTION: AcpiUtCopyIpackageToIpackage
963 *
964 * PARAMETERS: SourceObj - Pointer to the source package object
965 * DestObj - Where the internal object is returned
966 * WalkState - Current Walk state descriptor
967 *
968 * RETURN: Status
1048 *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type);
1049 if (!*DestDesc)
1050 {
1051 return_ACPI_STATUS (AE_NO_MEMORY);
1052 }
1053
1054 /* Copy the object and possible subobjects */
1055
1056 if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE)
1057 {
1058 Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
1059 WalkState);
1060 }
1061 else
1062 {
1063 Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
1064 }
1065
1066 return_ACPI_STATUS (Status);
1067 }
|