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