exstore.c revision 83174
1
2/******************************************************************************
3 *
4 * Module Name: exstore - AML Interpreter object store support
5 *              $Revision: 147 $
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 __EXSTORE_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          ACPI_EXECUTER
130        MODULE_NAME         ("exstore")
131
132
133/*******************************************************************************
134 *
135 * FUNCTION:    AcpiExStore
136 *
137 * PARAMETERS:  *ValDesc            - Value to be stored
138 *              *DestDesc           - Where to store it.  Must be an NS node
139 *                                    or an ACPI_OPERAND_OBJECT of type
140 *                                    Reference; if the latter the descriptor
141 *                                    will be either reused or deleted.
142 *
143 * RETURN:      Status
144 *
145 * DESCRIPTION: Store the value described by ValDesc into the location
146 *              described by DestDesc.  Called by various interpreter
147 *              functions to store the result of an operation into
148 *              the destination operand.
149 *
150 ******************************************************************************/
151
152ACPI_STATUS
153AcpiExStore (
154    ACPI_OPERAND_OBJECT     *ValDesc,
155    ACPI_OPERAND_OBJECT     *DestDesc,
156    ACPI_WALK_STATE         *WalkState)
157{
158    ACPI_STATUS             Status = AE_OK;
159    ACPI_OPERAND_OBJECT     *RefDesc = DestDesc;
160
161
162    FUNCTION_TRACE_PTR ("ExStore", DestDesc);
163
164
165    /* Validate parameters */
166
167    if (!ValDesc || !DestDesc)
168    {
169        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
170        return_ACPI_STATUS (AE_AML_NO_OPERAND);
171    }
172
173    /* DestDesc can be either a namespace node or an ACPI object */
174
175    if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED))
176    {
177        /*
178         * Dest is a namespace node,
179         * Storing an object into a Name "container"
180         */
181        Status = AcpiExStoreObjectToNode (ValDesc,
182                    (ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
183
184        /* All done, that's it */
185
186        return_ACPI_STATUS (Status);
187    }
188
189
190    /* Destination object must be an object of type Reference */
191
192    if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
193    {
194        /* Destination is not an Reference */
195
196        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
197            "Destination is not a ReferenceObj [%p]\n", DestDesc));
198
199        DUMP_STACK_ENTRY (ValDesc);
200        DUMP_STACK_ENTRY (DestDesc);
201        DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "ExStore",
202                        2, "Target is not a ReferenceObj");
203
204        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
205    }
206
207
208    /*
209     * Examine the Reference opcode.  These cases are handled:
210     *
211     * 1) Store to Name (Change the object associated with a name)
212     * 2) Store to an indexed area of a Buffer or Package
213     * 3) Store to a Method Local or Arg
214     * 4) Store to the debug object
215     * 5) Store to a constant -- a noop
216     */
217    switch (RefDesc->Reference.Opcode)
218    {
219
220    case AML_NAME_OP:
221
222        /* Storing an object into a Name "container" */
223
224        Status = AcpiExStoreObjectToNode (ValDesc, RefDesc->Reference.Object,
225                        WalkState);
226        break;
227
228
229    case AML_INDEX_OP:
230
231        /* Storing to an Index (pointer into a packager or buffer) */
232
233        Status = AcpiExStoreObjectToIndex (ValDesc, RefDesc, WalkState);
234        break;
235
236
237    case AML_LOCAL_OP:
238    case AML_ARG_OP:
239
240        /* Store to a method local/arg  */
241
242        Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode,
243                        RefDesc->Reference.Offset, ValDesc, WalkState);
244        break;
245
246
247    case AML_DEBUG_OP:
248
249        /*
250         * Storing to the Debug object causes the value stored to be
251         * displayed and otherwise has no effect -- see ACPI Specification
252         */
253        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Write to Debug Object: ****:\n\n"));
254
255        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
256                        AcpiUtGetTypeName (ValDesc->Common.Type)));
257
258        switch (ValDesc->Common.Type)
259        {
260        case ACPI_TYPE_INTEGER:
261
262            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X (%d)\n",
263                (UINT32) ValDesc->Integer.Value, (UINT32) ValDesc->Integer.Value));
264            break;
265
266
267        case ACPI_TYPE_BUFFER:
268
269            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%X\n",
270                (UINT32) ValDesc->Buffer.Length));
271            break;
272
273
274        case ACPI_TYPE_STRING:
275
276            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", ValDesc->String.Pointer));
277            break;
278
279
280        case ACPI_TYPE_PACKAGE:
281
282            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements - 0x%X\n",
283                (UINT32) ValDesc->Package.Elements));
284            break;
285
286
287        default:
288
289            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "@0x%p\n", ValDesc));
290            break;
291        }
292
293        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
294        break;
295
296
297    case AML_ZERO_OP:
298    case AML_ONE_OP:
299    case AML_ONES_OP:
300    case AML_REVISION_OP:
301
302        /*
303         * Storing to a constant is a no-op -- see ACPI Specification
304         * Delete the reference descriptor, however
305         */
306        break;
307
308
309    default:
310
311        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - Unknown Reference subtype %02x\n",
312            RefDesc->Reference.Opcode));
313
314        /* TBD: [Restructure] use object dump routine !! */
315
316        DUMP_BUFFER (RefDesc, sizeof (ACPI_OPERAND_OBJECT));
317
318        Status = AE_AML_INTERNAL;
319        break;
320
321    }   /* switch (RefDesc->Reference.Opcode) */
322
323
324    /* Always delete the reference descriptor object */
325
326    if (RefDesc)
327    {
328        AcpiUtRemoveReference (RefDesc);
329    }
330
331    return_ACPI_STATUS (Status);
332}
333
334
335/*******************************************************************************
336 *
337 * FUNCTION:    AcpiExStoreObjectToIndex
338 *
339 * PARAMETERS:  *ValDesc            - Value to be stored
340 *              *Node               - Named object to receive the value
341 *
342 * RETURN:      Status
343 *
344 * DESCRIPTION: Store the object to the named object.
345 *
346 ******************************************************************************/
347
348ACPI_STATUS
349AcpiExStoreObjectToIndex (
350    ACPI_OPERAND_OBJECT     *ValDesc,
351    ACPI_OPERAND_OBJECT     *DestDesc,
352    ACPI_WALK_STATE         *WalkState)
353{
354    ACPI_STATUS             Status = AE_OK;
355    ACPI_OPERAND_OBJECT     *ObjDesc;
356    UINT32                  Length;
357    UINT32                  i;
358    UINT8                   Value = 0;
359
360
361    FUNCTION_TRACE ("ExStoreObjectToIndex");
362
363
364    /*
365     * Destination must be a reference pointer, and
366     * must point to either a buffer or a package
367     */
368    switch (DestDesc->Reference.TargetType)
369    {
370    case ACPI_TYPE_PACKAGE:
371        /*
372         * Storing to a package element is not simple.  The source must be
373         * evaluated and converted to the type of the destination and then the
374         * source is copied into the destination - we can't just point to the
375         * source object.
376         */
377        if (DestDesc->Reference.TargetType == ACPI_TYPE_PACKAGE)
378        {
379            /*
380             * The object at *(DestDesc->Reference.Where) is the
381             *  element within the package that is to be modified.
382             */
383            ObjDesc = *(DestDesc->Reference.Where);
384            if (ObjDesc)
385            {
386                /*
387                 * If the Destination element is a package, we will delete
388                 *  that object and construct a new one.
389                 *
390                 * TBD: [Investigate] Should both the src and dest be required
391                 *      to be packages?
392                 *       && (ValDesc->Common.Type == ACPI_TYPE_PACKAGE)
393                 */
394                if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
395                {
396                    /*
397                     * Take away the reference for being part of a package and
398                     * delete
399                     */
400                    AcpiUtRemoveReference (ObjDesc);
401                    AcpiUtRemoveReference (ObjDesc);
402
403                    ObjDesc = NULL;
404                }
405            }
406
407            if (!ObjDesc)
408            {
409                /*
410                 * If the ObjDesc is NULL, it means that an uninitialized package
411                 * element has been used as a destination (this is OK), therefore,
412                 * we must create the destination element to match the type of the
413                 * source element NOTE: ValDesc can be of any type.
414                 */
415                ObjDesc = AcpiUtCreateInternalObject (ValDesc->Common.Type);
416                if (!ObjDesc)
417                {
418                    return_ACPI_STATUS (AE_NO_MEMORY);
419                }
420
421                /*
422                 * If the source is a package, copy the source to the new dest
423                 */
424                if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
425                {
426                    Status = AcpiUtCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState);
427                    if (ACPI_FAILURE (Status))
428                    {
429                        AcpiUtRemoveReference (ObjDesc);
430                        return_ACPI_STATUS (Status);
431                    }
432                }
433
434                /*
435                 * Install the new descriptor into the package and add a
436                 * reference to the newly created descriptor for now being
437                 * part of the parent package
438                 */
439                *(DestDesc->Reference.Where) = ObjDesc;
440                AcpiUtAddReference (ObjDesc);
441            }
442
443            if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type)
444            {
445                /*
446                 * The destination element is not a package, so we need to
447                 * convert the contents of the source (ValDesc) and copy into
448                 * the destination (ObjDesc)
449                 */
450                Status = AcpiExStoreObjectToObject (ValDesc, ObjDesc,
451                                                        WalkState);
452                if (ACPI_FAILURE (Status))
453                {
454                    /*
455                     * An error occurrered when copying the internal object
456                     * so delete the reference.
457                     */
458                    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
459                        "Unable to copy the internal object\n"));
460                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
461                }
462            }
463        }
464        break;
465
466
467    case ACPI_TYPE_BUFFER_FIELD:
468
469
470        /* TBD: can probably call the generic Buffer/Field routines */
471
472        /*
473         * Storing into a buffer at a location defined by an Index.
474         *
475         * Each 8-bit element of the source object is written to the
476         * 8-bit Buffer Field of the Index destination object.
477         */
478
479        /*
480         * Set the ObjDesc to the destination object and type check.
481         */
482        ObjDesc = DestDesc->Reference.Object;
483        if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER)
484        {
485            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
486        }
487
488        /*
489         * The assignment of the individual elements will be slightly
490         * different for each source type.
491         */
492        switch (ValDesc->Common.Type)
493        {
494        case ACPI_TYPE_INTEGER:
495            /*
496             * Type is Integer, assign bytewise
497             * This loop to assign each of the elements is somewhat
498             * backward because of the Big Endian-ness of IA-64
499             */
500            Length = sizeof (ACPI_INTEGER);
501            for (i = Length; i != 0; i--)
502            {
503                Value = (UINT8)(ValDesc->Integer.Value >> (MUL_8 (i - 1)));
504                ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
505            }
506            break;
507
508
509        case ACPI_TYPE_BUFFER:
510            /*
511             * Type is Buffer, the Length is in the structure.
512             * Just loop through the elements and assign each one in turn.
513             */
514            Length = ValDesc->Buffer.Length;
515            for (i = 0; i < Length; i++)
516            {
517                Value = ValDesc->Buffer.Pointer[i];
518                ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
519            }
520            break;
521
522
523        case ACPI_TYPE_STRING:
524            /*
525             * Type is String, the Length is in the structure.
526             * Just loop through the elements and assign each one in turn.
527             */
528            Length = ValDesc->String.Length;
529            for (i = 0; i < Length; i++)
530            {
531                Value = ValDesc->String.Pointer[i];
532                ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
533            }
534            break;
535
536
537        default:
538
539            /* Other types are invalid */
540
541            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
542                "Source must be Number/Buffer/String type, not %X\n",
543                ValDesc->Common.Type));
544            Status = AE_AML_OPERAND_TYPE;
545            break;
546        }
547        break;
548
549
550    default:
551        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Target is not a Package or BufferField\n"));
552        Status = AE_AML_OPERAND_TYPE;
553        break;
554    }
555
556
557    return_ACPI_STATUS (Status);
558}
559
560
561/*******************************************************************************
562 *
563 * FUNCTION:    AcpiExStoreObjectToNode
564 *
565 * PARAMETERS:  *SourceDesc            - Value to be stored
566 *              *Node                  - Named object to receive the value
567 *
568 * RETURN:      Status
569 *
570 * DESCRIPTION: Store the object to the named object.
571 *
572 *              The Assignment of an object to a named object is handled here
573 *              The val passed in will replace the current value (if any)
574 *              with the input value.
575 *
576 *              When storing into an object the data is converted to the
577 *              target object type then stored in the object.  This means
578 *              that the target object type (for an initialized target) will
579 *              not be changed by a store operation.
580 *
581 *              NOTE: the global lock is acquired early.  This will result
582 *              in the global lock being held a bit longer.  Also, if the
583 *              function fails during set up we may get the lock when we
584 *              don't really need it.  I don't think we care.
585 *
586 ******************************************************************************/
587
588ACPI_STATUS
589AcpiExStoreObjectToNode (
590    ACPI_OPERAND_OBJECT     *SourceDesc,
591    ACPI_NAMESPACE_NODE     *Node,
592    ACPI_WALK_STATE         *WalkState)
593{
594    ACPI_STATUS             Status = AE_OK;
595    ACPI_OPERAND_OBJECT     *TargetDesc;
596    ACPI_OBJECT_TYPE8       TargetType = ACPI_TYPE_ANY;
597
598
599    FUNCTION_TRACE ("ExStoreObjectToNode");
600
601
602    /*
603     * Assuming the parameters were already validated
604     */
605
606    /*
607     * Get current type of the node, and object attached to Node
608     */
609    TargetType = AcpiNsGetType (Node);
610    TargetDesc = AcpiNsGetAttachedObject (Node);
611
612    ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n",
613        Node, AcpiUtGetTypeName (SourceDesc->Common.Type),
614        SourceDesc, AcpiUtGetTypeName (TargetType)));
615
616
617    /*
618     * Resolve the source object to an actual value
619     * (If it is a reference object)
620     */
621    Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState);
622    if (ACPI_FAILURE (Status))
623    {
624        return_ACPI_STATUS (Status);
625    }
626
627
628    /*
629     * Do the actual store operation
630     */
631    switch (TargetType)
632    {
633    case ACPI_TYPE_BUFFER_FIELD:
634    case INTERNAL_TYPE_REGION_FIELD:
635    case INTERNAL_TYPE_BANK_FIELD:
636    case INTERNAL_TYPE_INDEX_FIELD:
637
638        /*
639         * For fields, copy the source data to the target field.
640         */
641        Status = AcpiExWriteDataToField (SourceDesc, TargetDesc);
642        break;
643
644
645    case ACPI_TYPE_INTEGER:
646    case ACPI_TYPE_STRING:
647    case ACPI_TYPE_BUFFER:
648
649        /*
650         * These target types are all of type Integer/String/Buffer, and
651         * therefore support implicit conversion before the store.
652         *
653         * Copy and/or convert the source object to a new target object
654         */
655        Status = AcpiExStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState);
656        if (ACPI_FAILURE (Status))
657        {
658            return_ACPI_STATUS (Status);
659        }
660
661        /*
662         * Store the new TargetDesc as the new value of the Name, and set
663         * the Name's type to that of the value being stored in it.
664         * SourceDesc reference count is incremented by AttachObject.
665         */
666        Status = AcpiNsAttachObject (Node, TargetDesc, TargetType);
667        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
668            "Store %s into %s via Convert/Attach\n",
669            AcpiUtGetTypeName (TargetDesc->Common.Type),
670            AcpiUtGetTypeName (TargetType)));
671        break;
672
673
674    default:
675
676        /* No conversions for all other types.  Just attach the source object */
677
678        Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type);
679
680        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
681            "Store %s into %s via Attach only\n",
682            AcpiUtGetTypeName (SourceDesc->Common.Type),
683            AcpiUtGetTypeName (SourceDesc->Common.Type)));
684        break;
685    }
686
687
688    return_ACPI_STATUS (Status);
689}
690
691
692/*******************************************************************************
693 *
694 * FUNCTION:    AcpiExStoreObjectToObject
695 *
696 * PARAMETERS:  *SourceDesc            - Value to be stored
697 *              *DestDesc           - Object to receive the value
698 *
699 * RETURN:      Status
700 *
701 * DESCRIPTION: Store an object to another object.
702 *
703 *              The Assignment of an object to another (not named) object
704 *              is handled here.
705 *              The val passed in will replace the current value (if any)
706 *              with the input value.
707 *
708 *              When storing into an object the data is converted to the
709 *              target object type then stored in the object.  This means
710 *              that the target object type (for an initialized target) will
711 *              not be changed by a store operation.
712 *
713 *              This module allows destination types of Number, String,
714 *              and Buffer.
715 *
716 ******************************************************************************/
717
718ACPI_STATUS
719AcpiExStoreObjectToObject (
720    ACPI_OPERAND_OBJECT     *SourceDesc,
721    ACPI_OPERAND_OBJECT     *DestDesc,
722    ACPI_WALK_STATE         *WalkState)
723{
724    ACPI_STATUS             Status = AE_OK;
725    ACPI_OBJECT_TYPE8       DestinationType = DestDesc->Common.Type;
726
727
728    FUNCTION_TRACE ("ExStoreObjectToObject");
729
730
731    /*
732     *  Assuming the parameters are valid!
733     */
734    ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) to %p(%s)\n",
735                    SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
736                    DestDesc, AcpiUtGetTypeName (DestDesc->Common.Type)));
737
738
739    /*
740     * From this interface, we only support Integers/Strings/Buffers
741     */
742    switch (DestinationType)
743    {
744    case ACPI_TYPE_INTEGER:
745    case ACPI_TYPE_STRING:
746    case ACPI_TYPE_BUFFER:
747        break;
748
749    default:
750        ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into %s not implemented\n",
751            AcpiUtGetTypeName (DestDesc->Common.Type)));
752
753        return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
754    }
755
756
757    /*
758     * Resolve the source object to an actual value
759     * (If it is a reference object)
760     */
761    Status = AcpiExResolveObject (&SourceDesc, DestinationType, WalkState);
762    if (ACPI_FAILURE (Status))
763    {
764        return_ACPI_STATUS (Status);
765    }
766
767
768    /*
769     * Copy and/or convert the source object to the destination object
770     */
771    Status = AcpiExStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState);
772
773
774    return_ACPI_STATUS (Status);
775}
776
777