]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c
Vendor import of Intel ACPI-CA 20041119 with system includes fixups.
[FreeBSD/FreeBSD.git] / sys / contrib / dev / acpica / Subsystem / Interpreter / amstore.c
1
2 /******************************************************************************
3  *
4  * Module Name: amstore - AML Interpreter object store support
5  *              $Revision: 123 $
6  *
7  *****************************************************************************/
8
9 /******************************************************************************
10  *
11  * 1. Copyright Notice
12  *
13  * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
14  * All rights reserved.
15  *
16  * 2. License
17  *
18  * 2.1. This is your license from Intel Corp. under its intellectual property
19  * rights.  You may have additional license terms from the party that provided
20  * you this software, covering your right to use that party's intellectual
21  * property rights.
22  *
23  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24  * copy of the source code appearing in this file ("Covered Code") an
25  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26  * base code distributed originally by Intel ("Original Intel Code") to copy,
27  * make derivatives, distribute, use and display any portion of the Covered
28  * Code in any form, with the right to sublicense such rights; and
29  *
30  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31  * license (with the right to sublicense), under only those claims of Intel
32  * patents that are infringed by the Original Intel Code, to make, use, sell,
33  * offer to sell, and import the Covered Code and derivative works thereof
34  * solely to the minimum extent necessary to exercise the above copyright
35  * license, and in no event shall the patent license extend to any additions
36  * to or modifications of the Original Intel Code.  No other license or right
37  * is granted directly or by implication, estoppel or otherwise;
38  *
39  * The above copyright and patent license is granted only if the following
40  * conditions are met:
41  *
42  * 3. Conditions
43  *
44  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45  * Redistribution of source code of any substantial portion of the Covered
46  * Code or modification with rights to further distribute source must include
47  * the above Copyright Notice, the above License, this list of Conditions,
48  * and the following Disclaimer and Export Compliance provision.  In addition,
49  * Licensee must cause all Covered Code to which Licensee contributes to
50  * contain a file documenting the changes Licensee made to create that Covered
51  * Code and the date of any change.  Licensee must include in that file the
52  * documentation of any changes made by any predecessor Licensee.  Licensee
53  * must include a prominent statement that the modification is derived,
54  * directly or indirectly, from Original Intel Code.
55  *
56  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57  * Redistribution of source code of any substantial portion of the Covered
58  * Code or modification without rights to further distribute source must
59  * include the following Disclaimer and Export Compliance provision in the
60  * documentation and/or other materials provided with distribution.  In
61  * addition, Licensee may not authorize further sublicense of source of any
62  * portion of the Covered Code, and must include terms to the effect that the
63  * license from Licensee to its licensee is limited to the intellectual
64  * property embodied in the software Licensee provides to its licensee, and
65  * not to intellectual property embodied in modifications its licensee may
66  * make.
67  *
68  * 3.3. Redistribution of Executable. Redistribution in executable form of any
69  * substantial portion of the Covered Code or modification must reproduce the
70  * above Copyright Notice, and the following Disclaimer and Export Compliance
71  * provision in the documentation and/or other materials provided with the
72  * distribution.
73  *
74  * 3.4. Intel retains all right, title, and interest in and to the Original
75  * Intel Code.
76  *
77  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78  * Intel shall be used in advertising or otherwise to promote the sale, use or
79  * other dealings in products derived from or relating to the Covered Code
80  * without prior written authorization from Intel.
81  *
82  * 4. Disclaimer and Export Compliance
83  *
84  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90  * PARTICULAR PURPOSE.
91  *
92  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99  * LIMITED REMEDY.
100  *
101  * 4.3. Licensee shall not export, either directly or indirectly, any of this
102  * software or system incorporating such software without first obtaining any
103  * required license or other approval from the U. S. Department of Commerce or
104  * any other agency or department of the United States Government.  In the
105  * event Licensee exports any such software from the United States or
106  * re-exports any such software from a foreign destination, Licensee shall
107  * ensure that the distribution and export/re-export of the software is in
108  * compliance with all laws, regulations, orders, or other restrictions of the
109  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110  * any of its subsidiaries will export/re-export any technical data, process,
111  * software, or service, directly or indirectly, to any country for which the
112  * United States government or any agency thereof requires an export license,
113  * other governmental approval, or letter of assurance, without first obtaining
114  * such license, approval or letter.
115  *
116  *****************************************************************************/
117
118 #define __AMSTORE_C__
119
120 #include "acpi.h"
121 #include "acparser.h"
122 #include "acdispat.h"
123 #include "acinterp.h"
124 #include "amlcode.h"
125 #include "acnamesp.h"
126 #include "actables.h"
127
128
129 #define _COMPONENT          INTERPRETER
130         MODULE_NAME         ("amstore")
131
132
133
134
135
136
137 /*******************************************************************************
138  *
139  * FUNCTION:    AcpiAmlExecStore
140  *
141  * PARAMETERS:  *ValDesc            - Value to be stored
142  *              *DestDesc           - Where to store it 0 Must be (ACPI_HANDLE)
143  *                                    or an ACPI_OPERAND_OBJECT  of type
144  *                                    Reference; if the latter the descriptor
145  *                                    will be either reused or deleted.
146  *
147  * RETURN:      Status
148  *
149  * DESCRIPTION: Store the value described by ValDesc into the location
150  *              described by DestDesc.  Called by various interpreter
151  *              functions to store the result of an operation into
152  *              the destination operand.
153  *
154  ******************************************************************************/
155
156 ACPI_STATUS
157 AcpiAmlExecStore (
158     ACPI_OPERAND_OBJECT     *ValDesc,
159     ACPI_OPERAND_OBJECT     *DestDesc,
160     ACPI_WALK_STATE         *WalkState)
161 {
162     ACPI_STATUS             Status = AE_OK;
163     ACPI_OPERAND_OBJECT     *RefDesc = DestDesc;
164
165
166     FUNCTION_TRACE_PTR ("AmlExecStore", DestDesc);
167
168
169     /* Validate parameters */
170
171     if (!ValDesc || !DestDesc)
172     {
173         DEBUG_PRINT (ACPI_ERROR,
174             ("AmlExecStore: Internal error - null pointer\n"));
175         return_ACPI_STATUS (AE_AML_NO_OPERAND);
176     }
177
178     /* DestDesc can be either a namespace node or an ACPI object */
179
180     if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED))
181     {
182         /* 
183          * Dest is a namespace node,
184          * Storing an object into a Name "container" 
185          */
186         Status = AcpiAmlStoreObjectToNode (ValDesc, 
187                     (ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
188
189         /* All done, that's it */
190
191         return_ACPI_STATUS (Status);
192     }
193
194
195     /* Destination object must be an object of type Reference */
196
197     if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
198     {
199         /* Destination is not an Reference */
200
201         DEBUG_PRINT (ACPI_ERROR,
202             ("AmlExecStore: Destination is not a ReferenceObj [%p]\n", DestDesc));
203
204         DUMP_STACK_ENTRY (ValDesc);
205         DUMP_STACK_ENTRY (DestDesc);
206         DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "AmlExecStore",
207                         2, "Target is not a ReferenceObj");
208
209         return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
210     }
211
212
213     /* 
214      * Examine the Reference opcode.  These cases are handled:
215      *
216      * 1) Store to Name (Change the object associated with a name)
217      * 2) Store to an indexed area of a Buffer or Package
218      * 3) Store to a Method Local or Arg
219      * 4) Store to the debug object
220      * 5) Store to a constant -- a noop
221      */
222
223     switch (RefDesc->Reference.OpCode)
224     {
225
226     case AML_NAME_OP:
227
228         /* Storing an object into a Name "container" */
229
230         Status = AcpiAmlStoreObjectToNode (ValDesc, RefDesc->Reference.Object,
231                         WalkState);
232         break;
233
234
235     case AML_INDEX_OP:
236
237         /* Storing to an Index (pointer into a packager or buffer) */
238
239         Status = AcpiAmlStoreObjectToIndex (ValDesc, RefDesc, WalkState);
240         break;
241
242
243     case AML_LOCAL_OP:
244
245         Status = AcpiDsMethodDataSetValue (MTH_TYPE_LOCAL,
246                         (RefDesc->Reference.Offset), ValDesc, WalkState);
247         break;
248
249
250     case AML_ARG_OP:
251
252         Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG,
253                         (RefDesc->Reference.Offset), ValDesc, WalkState);
254         break;
255
256
257     case AML_DEBUG_OP:
258
259         /*
260          * Storing to the Debug object causes the value stored to be
261          * displayed and otherwise has no effect -- see ACPI Specification
262          *
263          * TBD: print known object types "prettier".
264          */
265         DEBUG_PRINT (ACPI_INFO, ("**** Write to Debug Object: ****: \n"));
266         
267         if (ValDesc->Common.Type == ACPI_TYPE_STRING)
268         {
269             DEBUG_PRINT (ACPI_INFO, ("%s\n", ValDesc->String.Pointer));
270         }
271         else
272         {
273             DUMP_STACK_ENTRY (ValDesc);
274         }
275
276         break;
277
278
279     case AML_ZERO_OP:
280     case AML_ONE_OP:
281     case AML_ONES_OP:
282
283         /*
284          * Storing to a constant is a no-op -- see ACPI Specification
285          * Delete the reference descriptor, however
286          */
287         break;
288
289
290     default:
291
292         DEBUG_PRINT (ACPI_ERROR,
293             ("AmlExecStore: Internal error - Unknown Reference subtype %02x\n",
294             RefDesc->Reference.OpCode));
295
296         /* TBD: [Restructure] use object dump routine !! */
297
298         DUMP_BUFFER (RefDesc, sizeof (ACPI_OPERAND_OBJECT));
299
300         Status = AE_AML_INTERNAL;
301         break;
302
303     }   /* switch (RefDesc->Reference.OpCode) */
304
305
306
307     /* Always delete the reference descriptor object */
308
309     if (RefDesc)
310     {
311         AcpiCmRemoveReference (RefDesc);
312     }
313
314     return_ACPI_STATUS (Status);
315 }
316
317
318 /*******************************************************************************
319  *
320  * FUNCTION:    AcpiAmlStoreObjectToIndex
321  *
322  * PARAMETERS:  *ValDesc            - Value to be stored
323  *              *Node           - Named object to recieve the value
324  *
325  * RETURN:      Status
326  *
327  * DESCRIPTION: Store the object to the named object.
328  *
329  ******************************************************************************/
330
331 ACPI_STATUS
332 AcpiAmlStoreObjectToIndex (
333     ACPI_OPERAND_OBJECT     *ValDesc,
334     ACPI_OPERAND_OBJECT     *DestDesc,
335     ACPI_WALK_STATE         *WalkState)
336 {
337     ACPI_STATUS             Status = AE_OK;
338     ACPI_OPERAND_OBJECT     *ObjDesc;
339     UINT32                  Length;
340     UINT32                  i;
341     UINT8                   Value = 0;
342
343
344     FUNCTION_TRACE ("AcpiAmlStoreObjectToIndex");
345
346
347     /*
348      * Destination must be a reference pointer, and
349      * must point to either a buffer or a package
350      */
351
352     switch (DestDesc->Reference.TargetType)
353     {
354     case ACPI_TYPE_PACKAGE:
355         /*
356          * Storing to a package element is not simple.  The source must be
357          * evaluated and converted to the type of the destination and then the
358          * source is copied into the destination - we can't just point to the
359          * source object.
360          */
361         if (DestDesc->Reference.TargetType == ACPI_TYPE_PACKAGE)
362         {
363             /*
364              * The object at *(DestDesc->Reference.Where) is the
365              *  element within the package that is to be modified.
366              */
367             ObjDesc = *(DestDesc->Reference.Where);
368             if (ObjDesc)
369             {
370                 /*
371                  * If the Destination element is a package, we will delete
372                  *  that object and construct a new one.
373                  *
374                  * TBD: [Investigate] Should both the src and dest be required
375                  *      to be packages?
376                  *       && (ValDesc->Common.Type == ACPI_TYPE_PACKAGE)
377                  */
378                 if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
379                 {
380                     /*
381                      * Take away the reference for being part of a package and
382                      * delete
383                      */
384                     AcpiCmRemoveReference (ObjDesc);
385                     AcpiCmRemoveReference (ObjDesc);
386
387                     ObjDesc = NULL;
388                 }
389             }
390
391             if (!ObjDesc)
392             {
393                 /*
394                  * If the ObjDesc is NULL, it means that an uninitialized package
395                  * element has been used as a destination (this is OK), therefore, 
396                  * we must create the destination element to match the type of the 
397                  * source element NOTE: ValDesc can be of any type.
398                  */
399                 ObjDesc = AcpiCmCreateInternalObject (ValDesc->Common.Type);
400                 if (!ObjDesc)
401                 {
402                     return_ACPI_STATUS (AE_NO_MEMORY);
403                 }
404
405                 /*
406                  * If the source is a package, copy the source to the new dest
407                  */
408                 if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
409                 {
410                     Status = AcpiCmCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState);
411                     if (ACPI_FAILURE (Status))
412                     {
413                         AcpiCmRemoveReference (ObjDesc);
414                         return_ACPI_STATUS (Status);
415                     }
416                 }
417
418                 /*
419                  * Install the new descriptor into the package and add a
420                  * reference to the newly created descriptor for now being
421                  * part of the parent package
422                  */
423
424                 *(DestDesc->Reference.Where) = ObjDesc;
425                 AcpiCmAddReference (ObjDesc);
426             }
427
428             if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type)
429             {
430                 /*
431                  * The destination element is not a package, so we need to
432                  * convert the contents of the source (ValDesc) and copy into
433                  * the destination (ObjDesc)
434                  */
435                 Status = AcpiAmlStoreObjectToObject (ValDesc, ObjDesc,
436                                                         WalkState);
437                 if (ACPI_FAILURE (Status))
438                 {
439                     /*
440                      * An error occurrered when copying the internal object
441                      * so delete the reference.
442                      */
443                     DEBUG_PRINT (ACPI_ERROR,
444                         ("AmlExecStore/Index: Unable to copy the internal object\n"));
445                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
446                 }
447             }
448         }
449         break;
450
451
452     case ACPI_TYPE_BUFFER_FIELD:
453         /*
454          * Storing into a buffer at a location defined by an Index.
455          *
456          * Each 8-bit element of the source object is written to the
457          * 8-bit Buffer Field of the Index destination object.
458          */
459
460         /*
461          * Set the ObjDesc to the destination object and type check.
462          */
463         ObjDesc = DestDesc->Reference.Object;
464         if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER)
465         {
466             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
467         }
468
469         /*
470          * The assignment of the individual elements will be slightly
471          * different for each source type.
472          */
473
474         switch (ValDesc->Common.Type)
475         {
476         /*
477          * If the type is Integer, assign bytewise
478          * This loop to assign each of the elements is somewhat
479          * backward because of the Big Endian-ness of IA-64
480          */
481         case ACPI_TYPE_INTEGER:
482             Length = sizeof (ACPI_INTEGER);
483             for (i = Length; i != 0; i--)
484             {
485                 Value = (UINT8)(ValDesc->Integer.Value >> (MUL_8 (i - 1)));
486                 ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
487             }
488             break;
489
490         /*
491          * If the type is Buffer, the Length is in the structure.
492          * Just loop through the elements and assign each one in turn.
493          */
494         case ACPI_TYPE_BUFFER:
495             Length = ValDesc->Buffer.Length;
496             for (i = 0; i < Length; i++)
497             {
498                 Value = *(ValDesc->Buffer.Pointer + i);
499                 ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
500             }
501             break;
502
503         /*
504          * If the type is String, the Length is in the structure.
505          * Just loop through the elements and assign each one in turn.
506          */
507         case ACPI_TYPE_STRING:
508             Length = ValDesc->String.Length;
509             for (i = 0; i < Length; i++)
510             {
511                 Value = *(ValDesc->String.Pointer + i);
512                 ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
513             }
514             break;
515
516         /*
517          * If source is not a valid type so return an error.
518          */
519         default:
520             DEBUG_PRINT (ACPI_ERROR,
521                 ("AmlExecStore/Index: Source must be Number/Buffer/String type, not %X\n",
522                 ValDesc->Common.Type));
523             Status = AE_AML_OPERAND_TYPE;
524             break;
525         }
526         break;
527
528
529     default:
530         DEBUG_PRINT (ACPI_ERROR,
531             ("AmlExecStoreIndex: Target is not a Package or BufferField\n"));
532         Status = AE_AML_OPERAND_TYPE;
533         break;
534     }
535
536
537     return_ACPI_STATUS (Status);
538 }
539
540
541
542
543
544 /*******************************************************************************
545  *
546  * FUNCTION:    AcpiAmlStoreObjectToNode
547  *
548  * PARAMETERS:  *SourceDesc            - Value to be stored
549  *              *Node               - Named object to recieve the value
550  *
551  * RETURN:      Status
552  *
553  * DESCRIPTION: Store the object to the named object.
554  *
555  *              The Assignment of an object to a named object is handled here
556  *              The val passed in will replace the current value (if any)
557  *              with the input value.
558  *
559  *              When storing into an object the data is converted to the
560  *              target object type then stored in the object.  This means
561  *              that the target object type (for an initialized target) will
562  *              not be changed by a store operation.
563  *
564  *              NOTE: the global lock is acquired early.  This will result
565  *              in the global lock being held a bit longer.  Also, if the
566  *              function fails during set up we may get the lock when we
567  *              don't really need it.  I don't think we care.
568  *
569  ******************************************************************************/
570
571 ACPI_STATUS
572 AcpiAmlStoreObjectToNode (
573     ACPI_OPERAND_OBJECT     *SourceDesc,
574     ACPI_NAMESPACE_NODE     *Node,
575     ACPI_WALK_STATE         *WalkState)
576 {
577     ACPI_STATUS             Status = AE_OK;
578     ACPI_OPERAND_OBJECT     *TargetDesc;
579     OBJECT_TYPE_INTERNAL    TargetType = ACPI_TYPE_ANY;
580
581
582     FUNCTION_TRACE ("AmlStoreObjectToNode");
583
584     /*
585      * Assuming the parameters were already validated
586      */
587     ACPI_ASSERT((Node) && (SourceDesc));
588
589
590     /*
591      * Get current type of the node, and object attached to Node
592      */
593     TargetType = AcpiNsGetType (Node);
594     TargetDesc = AcpiNsGetAttachedObject (Node);
595
596     DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToNode: Storing %p(%s) into node %p(%s)\n",
597         Node, AcpiCmGetTypeName (SourceDesc->Common.Type),
598         SourceDesc, AcpiCmGetTypeName (TargetType)));
599
600
601     /*
602      * Resolve the source object to an actual value
603      * (If it is a reference object) 
604      */
605     Status = AcpiAmlResolveObject (&SourceDesc, TargetType, WalkState);
606     if (ACPI_FAILURE (Status))
607     {
608         return_ACPI_STATUS (Status);
609     }
610
611
612     /*
613      * Do the actual store operation 
614      */
615     switch (TargetType)
616     {
617     case INTERNAL_TYPE_DEF_FIELD:
618
619         /* Raw data copy for target types Integer/String/Buffer */
620
621         Status = AcpiAmlCopyDataToNamedField (SourceDesc, Node);
622         break;
623
624
625     case ACPI_TYPE_INTEGER:
626     case ACPI_TYPE_STRING:
627     case ACPI_TYPE_BUFFER:
628     case INTERNAL_TYPE_BANK_FIELD:
629     case INTERNAL_TYPE_INDEX_FIELD:
630     case ACPI_TYPE_FIELD_UNIT:
631
632         /* 
633          * These target types are all of type Integer/String/Buffer, and
634          * therefore support implicit conversion before the store.
635          * 
636          * Copy and/or convert the source object to a new target object 
637          */
638         Status = AcpiAmlStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState);
639         if (ACPI_FAILURE (Status))
640         {
641             return_ACPI_STATUS (Status);
642         }
643
644         /*
645          * Store the new TargetDesc as the new value of the Name, and set
646          * the Name's type to that of the value being stored in it.
647          * SourceDesc reference count is incremented by AttachObject.
648          */
649         Status = AcpiNsAttachObject (Node, TargetDesc, TargetType);
650         DEBUG_PRINT (ACPI_INFO,
651             ("AmlStoreObjectToNode: Store %s into %s via Convert/Attach\n",
652             AcpiCmGetTypeName (TargetDesc->Common.Type),
653             AcpiCmGetTypeName (TargetType)));
654         break;
655     
656
657     default:
658
659         /* No conversions for all other types.  Just attach the source object */
660
661         Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type);
662         
663         DEBUG_PRINT (ACPI_INFO,
664             ("AmlStoreObjectToNode: Store %s into %s via Attach only\n",
665             AcpiCmGetTypeName (SourceDesc->Common.Type),
666             AcpiCmGetTypeName (SourceDesc->Common.Type)));
667         break;
668     }
669
670
671     return_ACPI_STATUS (Status);
672 }
673
674
675
676 /*******************************************************************************
677  *
678  * FUNCTION:    AcpiAmlStoreObjectToObject
679  *
680  * PARAMETERS:  *SourceDesc            - Value to be stored
681  *              *DestDesc           - Object to receive the value
682  *
683  * RETURN:      Status
684  *
685  * DESCRIPTION: Store an object to another object.
686  *
687  *              The Assignment of an object to another (not named) object
688  *              is handled here.
689  *              The val passed in will replace the current value (if any)
690  *              with the input value.
691  *
692  *              When storing into an object the data is converted to the
693  *              target object type then stored in the object.  This means
694  *              that the target object type (for an initialized target) will
695  *              not be changed by a store operation.
696  *
697  *              This module allows destination types of Number, String,
698  *              and Buffer.
699  *
700  ******************************************************************************/
701
702 ACPI_STATUS
703 AcpiAmlStoreObjectToObject (
704     ACPI_OPERAND_OBJECT     *SourceDesc,
705     ACPI_OPERAND_OBJECT     *DestDesc,
706     ACPI_WALK_STATE         *WalkState)
707 {
708     ACPI_STATUS             Status = AE_OK;
709     OBJECT_TYPE_INTERNAL    DestinationType = DestDesc->Common.Type;
710
711
712     FUNCTION_TRACE ("AmlStoreObjectToObject");
713
714
715     /*
716      *  Assuming the parameters are valid!
717      */
718     ACPI_ASSERT((DestDesc) && (SourceDesc));
719
720     DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to %p(%s)\n",
721                     SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type),
722                     DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type)));
723
724
725     /*
726      * From this interface, we only support Integers/Strings/Buffers
727      */
728     switch (DestinationType)
729     {
730     case ACPI_TYPE_INTEGER:
731     case ACPI_TYPE_STRING:
732     case ACPI_TYPE_BUFFER:
733         break;
734
735     default:
736         DEBUG_PRINT (ACPI_WARN,
737             ("AmlStoreObjectToObject: Store into %s not implemented\n",
738             AcpiCmGetTypeName (DestDesc->Common.Type)));
739
740         return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
741     }
742
743
744
745     /*
746      * Resolve the source object to an actual value
747      * (If it is a reference object) 
748      */
749     Status = AcpiAmlResolveObject (&SourceDesc, DestinationType, WalkState);
750     if (ACPI_FAILURE (Status))
751     {
752         return_ACPI_STATUS (Status);
753     }
754
755
756     /*
757      * Copy and/or convert the source object to the destination object 
758      */
759     Status = AcpiAmlStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState);
760
761
762     return_ACPI_STATUS (Status);
763 }
764