exstore.c revision 71867
1
2/******************************************************************************
3 *
4 * Module Name: amstore - AML Interpreter object store support
5 *              $Revision: 121 $
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
156ACPI_STATUS
157AcpiAmlExecStore (
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
331ACPI_STATUS
332AcpiAmlStoreObjectToIndex (
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 = AcpiAmlBuildCopyInternalPackageObject (
411                                ValDesc, ObjDesc, WalkState);
412                    if (ACPI_FAILURE (Status))
413                    {
414                        AcpiCmRemoveReference (ObjDesc);
415                        return_ACPI_STATUS (Status);
416                    }
417                }
418
419                /*
420                 * Install the new descriptor into the package and add a
421                 * reference to the newly created descriptor for now being
422                 * part of the parent package
423                 */
424
425                *(DestDesc->Reference.Where) = ObjDesc;
426                AcpiCmAddReference (ObjDesc);
427            }
428
429            if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type)
430            {
431                /*
432                 * The destination element is not a package, so we need to
433                 * convert the contents of the source (ValDesc) and copy into
434                 * the destination (ObjDesc)
435                 */
436                Status = AcpiAmlStoreObjectToObject (ValDesc, ObjDesc,
437                                                        WalkState);
438                if (ACPI_FAILURE (Status))
439                {
440                    /*
441                     * An error occurrered when copying the internal object
442                     * so delete the reference.
443                     */
444                    DEBUG_PRINT (ACPI_ERROR,
445                        ("AmlExecStore/Index: Unable to copy the internal object\n"));
446                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
447                }
448            }
449        }
450        break;
451
452
453    case ACPI_TYPE_BUFFER_FIELD:
454        /*
455         * Storing into a buffer at a location defined by an Index.
456         *
457         * Each 8-bit element of the source object is written to the
458         * 8-bit Buffer Field of the Index destination object.
459         */
460
461        /*
462         * Set the ObjDesc to the destination object and type check.
463         */
464        ObjDesc = DestDesc->Reference.Object;
465        if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER)
466        {
467            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
468        }
469
470        /*
471         * The assignment of the individual elements will be slightly
472         * different for each source type.
473         */
474
475        switch (ValDesc->Common.Type)
476        {
477        /*
478         * If the type is Integer, assign bytewise
479         * This loop to assign each of the elements is somewhat
480         * backward because of the Big Endian-ness of IA-64
481         */
482        case ACPI_TYPE_INTEGER:
483            Length = sizeof (ACPI_INTEGER);
484            for (i = Length; i != 0; i--)
485            {
486                Value = (UINT8)(ValDesc->Integer.Value >> (MUL_8 (i - 1)));
487                ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
488            }
489            break;
490
491        /*
492         * If the type is Buffer, the Length is in the structure.
493         * Just loop through the elements and assign each one in turn.
494         */
495        case ACPI_TYPE_BUFFER:
496            Length = ValDesc->Buffer.Length;
497            for (i = 0; i < Length; i++)
498            {
499                Value = *(ValDesc->Buffer.Pointer + i);
500                ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
501            }
502            break;
503
504        /*
505         * If the type is String, the Length is in the structure.
506         * Just loop through the elements and assign each one in turn.
507         */
508        case ACPI_TYPE_STRING:
509            Length = ValDesc->String.Length;
510            for (i = 0; i < Length; i++)
511            {
512                Value = *(ValDesc->String.Pointer + i);
513                ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
514            }
515            break;
516
517        /*
518         * If source is not a valid type so return an error.
519         */
520        default:
521            DEBUG_PRINT (ACPI_ERROR,
522                ("AmlExecStore/Index: Source must be Number/Buffer/String type, not %X\n",
523                ValDesc->Common.Type));
524            Status = AE_AML_OPERAND_TYPE;
525            break;
526        }
527        break;
528
529
530    default:
531        DEBUG_PRINT (ACPI_ERROR,
532            ("AmlExecStoreIndex: Target is not a Package or BufferField\n"));
533        Status = AE_AML_OPERAND_TYPE;
534        break;
535    }
536
537
538    return_ACPI_STATUS (Status);
539}
540
541
542
543
544
545/*******************************************************************************
546 *
547 * FUNCTION:    AcpiAmlStoreObjectToNode
548 *
549 * PARAMETERS:  *SourceDesc            - Value to be stored
550 *              *Node               - Named object to recieve the value
551 *
552 * RETURN:      Status
553 *
554 * DESCRIPTION: Store the object to the named object.
555 *
556 *              The Assignment of an object to a named object is handled here
557 *              The val passed in will replace the current value (if any)
558 *              with the input value.
559 *
560 *              When storing into an object the data is converted to the
561 *              target object type then stored in the object.  This means
562 *              that the target object type (for an initialized target) will
563 *              not be changed by a store operation.
564 *
565 *              NOTE: the global lock is acquired early.  This will result
566 *              in the global lock being held a bit longer.  Also, if the
567 *              function fails during set up we may get the lock when we
568 *              don't really need it.  I don't think we care.
569 *
570 ******************************************************************************/
571
572ACPI_STATUS
573AcpiAmlStoreObjectToNode (
574    ACPI_OPERAND_OBJECT     *SourceDesc,
575    ACPI_NAMESPACE_NODE     *Node,
576    ACPI_WALK_STATE         *WalkState)
577{
578    ACPI_STATUS             Status = AE_OK;
579    ACPI_OPERAND_OBJECT     *TargetDesc;
580    OBJECT_TYPE_INTERNAL    TargetType = ACPI_TYPE_ANY;
581
582
583    FUNCTION_TRACE ("AmlStoreObjectToNode");
584
585    /*
586     * Assuming the parameters were already validated
587     */
588    ACPI_ASSERT((Node) && (SourceDesc));
589
590
591    /*
592     * Get current type of the node, and object attached to Node
593     */
594    TargetType = AcpiNsGetType (Node);
595    TargetDesc = AcpiNsGetAttachedObject (Node);
596
597    DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToNode: Storing %p(%s) into node %p(%s)\n",
598        Node, AcpiCmGetTypeName (SourceDesc->Common.Type),
599        SourceDesc, AcpiCmGetTypeName (TargetType)));
600
601
602    /*
603     * Resolve the source object to an actual value
604     * (If it is a reference object)
605     */
606    Status = AcpiAmlResolveObject (&SourceDesc, TargetType, WalkState);
607    if (ACPI_FAILURE (Status))
608    {
609        return_ACPI_STATUS (Status);
610    }
611
612
613    /*
614     * Do the actual store operation
615     */
616    switch (TargetType)
617    {
618    case INTERNAL_TYPE_DEF_FIELD:
619
620        /* Raw data copy for target types Integer/String/Buffer */
621
622        Status = AcpiAmlCopyDataToNamedField (SourceDesc, Node);
623        break;
624
625
626    case ACPI_TYPE_INTEGER:
627    case ACPI_TYPE_STRING:
628    case ACPI_TYPE_BUFFER:
629    case INTERNAL_TYPE_BANK_FIELD:
630    case INTERNAL_TYPE_INDEX_FIELD:
631    case ACPI_TYPE_FIELD_UNIT:
632
633        /*
634         * These target types are all of type Integer/String/Buffer, and
635         * therefore support implicit conversion before the store.
636         *
637         * Copy and/or convert the source object to a new target object
638         */
639        Status = AcpiAmlStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState);
640        if (ACPI_FAILURE (Status))
641        {
642            return_ACPI_STATUS (Status);
643        }
644
645        /*
646         * Store the new TargetDesc as the new value of the Name, and set
647         * the Name's type to that of the value being stored in it.
648         * SourceDesc reference count is incremented by AttachObject.
649         */
650        Status = AcpiNsAttachObject (Node, TargetDesc, TargetType);
651        DEBUG_PRINT (ACPI_INFO,
652            ("AmlStoreObjectToNode: Store %s into %s via Convert/Attach\n",
653            AcpiCmGetTypeName (TargetDesc->Common.Type),
654            AcpiCmGetTypeName (TargetType)));
655        break;
656
657
658    default:
659
660        /* No conversions for all other types.  Just attach the source object */
661
662        Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type);
663
664        DEBUG_PRINT (ACPI_INFO,
665            ("AmlStoreObjectToNode: Store %s into %s via Attach only\n",
666            AcpiCmGetTypeName (SourceDesc->Common.Type),
667            AcpiCmGetTypeName (SourceDesc->Common.Type)));
668        break;
669    }
670
671
672    return_ACPI_STATUS (Status);
673}
674
675
676
677/*******************************************************************************
678 *
679 * FUNCTION:    AcpiAmlStoreObjectToObject
680 *
681 * PARAMETERS:  *SourceDesc            - Value to be stored
682 *              *DestDesc           - Object to receive the value
683 *
684 * RETURN:      Status
685 *
686 * DESCRIPTION: Store an object to another object.
687 *
688 *              The Assignment of an object to another (not named) object
689 *              is handled here.
690 *              The val passed in will replace the current value (if any)
691 *              with the input value.
692 *
693 *              When storing into an object the data is converted to the
694 *              target object type then stored in the object.  This means
695 *              that the target object type (for an initialized target) will
696 *              not be changed by a store operation.
697 *
698 *              This module allows destination types of Number, String,
699 *              and Buffer.
700 *
701 ******************************************************************************/
702
703ACPI_STATUS
704AcpiAmlStoreObjectToObject (
705    ACPI_OPERAND_OBJECT     *SourceDesc,
706    ACPI_OPERAND_OBJECT     *DestDesc,
707    ACPI_WALK_STATE         *WalkState)
708{
709    ACPI_STATUS             Status = AE_OK;
710    OBJECT_TYPE_INTERNAL    DestinationType = DestDesc->Common.Type;
711
712
713    FUNCTION_TRACE ("AmlStoreObjectToObject");
714
715
716    /*
717     *  Assuming the parameters are valid!
718     */
719    ACPI_ASSERT((DestDesc) && (SourceDesc));
720
721    DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to (%p)%s\n",
722                    SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type),
723                    DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type)));
724
725
726    /*
727     * From this interface, we only support Integers/Strings/Buffers
728     */
729    switch (DestinationType)
730    {
731    case ACPI_TYPE_INTEGER:
732    case ACPI_TYPE_STRING:
733    case ACPI_TYPE_BUFFER:
734        break;
735
736    default:
737        DEBUG_PRINT (ACPI_WARN,
738            ("AmlStoreObjectToObject: Store into %s not implemented\n",
739            AcpiCmGetTypeName (DestDesc->Common.Type)));
740
741        return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
742    }
743
744
745
746    /*
747     * Resolve the source object to an actual value
748     * (If it is a reference object)
749     */
750    Status = AcpiAmlResolveObject (&SourceDesc, DestinationType, WalkState);
751    if (ACPI_FAILURE (Status))
752    {
753        return_ACPI_STATUS (Status);
754    }
755
756
757    /*
758     * Copy and/or convert the source object to the destination object
759     */
760    Status = AcpiAmlStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState);
761
762
763    return_ACPI_STATUS (Status);
764}
765
766