exresop.c revision 151937
1
2/******************************************************************************
3 *
4 * Module Name: exresop - AML Interpreter operand/object resolution
5 *              $Revision: 1.86 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999 - 2005, 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 __EXRESOP_C__
119
120#include <contrib/dev/acpica/acpi.h>
121#include <contrib/dev/acpica/amlcode.h>
122#include <contrib/dev/acpica/acparser.h>
123#include <contrib/dev/acpica/acinterp.h>
124
125
126#define _COMPONENT          ACPI_EXECUTER
127        ACPI_MODULE_NAME    ("exresop")
128
129/* Local prototypes */
130
131static ACPI_STATUS
132AcpiExCheckObjectType (
133    ACPI_OBJECT_TYPE        TypeNeeded,
134    ACPI_OBJECT_TYPE        ThisType,
135    void                    *Object);
136
137
138/*******************************************************************************
139 *
140 * FUNCTION:    AcpiExCheckObjectType
141 *
142 * PARAMETERS:  TypeNeeded          Object type needed
143 *              ThisType            Actual object type
144 *              Object              Object pointer
145 *
146 * RETURN:      Status
147 *
148 * DESCRIPTION: Check required type against actual type
149 *
150 ******************************************************************************/
151
152static ACPI_STATUS
153AcpiExCheckObjectType (
154    ACPI_OBJECT_TYPE        TypeNeeded,
155    ACPI_OBJECT_TYPE        ThisType,
156    void                    *Object)
157{
158    ACPI_FUNCTION_NAME ("ExCheckObjectType");
159
160
161    if (TypeNeeded == ACPI_TYPE_ANY)
162    {
163        /* All types OK, so we don't perform any typechecks */
164
165        return (AE_OK);
166    }
167
168    if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
169    {
170        /*
171         * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
172         * objects and thus allow them to be targets.  (As per the ACPI
173         * specification, a store to a constant is a noop.)
174         */
175        if ((ThisType == ACPI_TYPE_INTEGER) &&
176            (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
177        {
178            return (AE_OK);
179        }
180    }
181
182    if (TypeNeeded != ThisType)
183    {
184        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
185            "Needed [%s], found [%s] %p\n",
186            AcpiUtGetTypeName (TypeNeeded),
187            AcpiUtGetTypeName (ThisType), Object));
188
189        return (AE_AML_OPERAND_TYPE);
190    }
191
192    return (AE_OK);
193}
194
195
196/*******************************************************************************
197 *
198 * FUNCTION:    AcpiExResolveOperands
199 *
200 * PARAMETERS:  Opcode              - Opcode being interpreted
201 *              StackPtr            - Pointer to the operand stack to be
202 *                                    resolved
203 *              WalkState           - Current state
204 *
205 * RETURN:      Status
206 *
207 * DESCRIPTION: Convert multiple input operands to the types required by the
208 *              target operator.
209 *
210 *      Each 5-bit group in ArgTypes represents one required
211 *      operand and indicates the required Type. The corresponding operand
212 *      will be converted to the required type if possible, otherwise we
213 *      abort with an exception.
214 *
215 ******************************************************************************/
216
217ACPI_STATUS
218AcpiExResolveOperands (
219    UINT16                  Opcode,
220    ACPI_OPERAND_OBJECT     **StackPtr,
221    ACPI_WALK_STATE         *WalkState)
222{
223    ACPI_OPERAND_OBJECT     *ObjDesc;
224    ACPI_STATUS             Status = AE_OK;
225    UINT8                   ObjectType;
226    void                    *TempNode;
227    UINT32                  ArgTypes;
228    const ACPI_OPCODE_INFO  *OpInfo;
229    UINT32                  ThisArgType;
230    ACPI_OBJECT_TYPE        TypeNeeded;
231    UINT16                  TargetOp = 0;
232
233
234    ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
235
236
237    OpInfo = AcpiPsGetOpcodeInfo (Opcode);
238    if (OpInfo->Class == AML_CLASS_UNKNOWN)
239    {
240        return_ACPI_STATUS (AE_AML_BAD_OPCODE);
241    }
242
243    ArgTypes = OpInfo->RuntimeArgs;
244    if (ArgTypes == ARGI_INVALID_OPCODE)
245    {
246        ACPI_REPORT_ERROR (("ResolveOperands: %X is not a valid AML opcode\n",
247            Opcode));
248
249        return_ACPI_STATUS (AE_AML_INTERNAL);
250    }
251
252    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
253        "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
254        Opcode, OpInfo->Name, ArgTypes));
255
256    /*
257     * Normal exit is with (ArgTypes == 0) at end of argument list.
258     * Function will return an exception from within the loop upon
259     * finding an entry which is not (or cannot be converted
260     * to) the required type; if stack underflows; or upon
261     * finding a NULL stack entry (which should not happen).
262     */
263    while (GET_CURRENT_ARG_TYPE (ArgTypes))
264    {
265        if (!StackPtr || !*StackPtr)
266        {
267            ACPI_REPORT_ERROR (("ResolveOperands: Null stack entry at %p\n",
268                StackPtr));
269
270            return_ACPI_STATUS (AE_AML_INTERNAL);
271        }
272
273        /* Extract useful items */
274
275        ObjDesc = *StackPtr;
276
277        /* Decode the descriptor type */
278
279        switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
280        {
281        case ACPI_DESC_TYPE_NAMED:
282
283            /* Namespace Node */
284
285            ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
286            break;
287
288
289        case ACPI_DESC_TYPE_OPERAND:
290
291            /* ACPI internal object */
292
293            ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
294
295            /* Check for bad ACPI_OBJECT_TYPE */
296
297            if (!AcpiUtValidObjectType (ObjectType))
298            {
299                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
300                    "Bad operand object type [%X]\n",
301                    ObjectType));
302
303                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
304            }
305
306            if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
307            {
308                /* Decode the Reference */
309
310                OpInfo = AcpiPsGetOpcodeInfo (Opcode);
311                if (OpInfo->Class == AML_CLASS_UNKNOWN)
312                {
313                    return_ACPI_STATUS (AE_AML_BAD_OPCODE);
314                }
315
316                switch (ObjDesc->Reference.Opcode)
317                {
318                case AML_DEBUG_OP:
319                    TargetOp = AML_DEBUG_OP;
320
321                    /*lint -fallthrough */
322
323                case AML_NAME_OP:
324                case AML_INDEX_OP:
325                case AML_REF_OF_OP:
326                case AML_ARG_OP:
327                case AML_LOCAL_OP:
328                case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
329                case AML_INT_NAMEPATH_OP: /* Reference to a named object */
330
331                    ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
332                        "Operand is a Reference, RefOpcode [%s]\n",
333                        (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name)));
334                    break;
335
336                default:
337                    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
338                        "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
339                        ObjDesc->Reference.Opcode,
340                        (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name));
341
342                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
343                }
344            }
345            break;
346
347
348        default:
349
350            /* Invalid descriptor */
351
352            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
353                    "Invalid descriptor %p [%s]\n",
354                    ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
355
356            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
357        }
358
359        /* Get one argument type, point to the next */
360
361        ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
362        INCREMENT_ARG_LIST (ArgTypes);
363
364        /*
365         * Handle cases where the object does not need to be
366         * resolved to a value
367         */
368        switch (ThisArgType)
369        {
370        case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
371
372            if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
373                (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
374            {
375                /*
376                 * String found - the string references a named object and
377                 * must be resolved to a node
378                 */
379                goto NextOperand;
380            }
381
382            /*
383             * Else not a string - fall through to the normal Reference
384             * case below
385             */
386            /*lint -fallthrough */
387
388        case ARGI_REFERENCE:            /* References: */
389        case ARGI_INTEGER_REF:
390        case ARGI_OBJECT_REF:
391        case ARGI_DEVICE_REF:
392        case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
393        case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
394        case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
395
396            /*
397             * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
398             * A Namespace Node is OK as-is
399             */
400            if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
401            {
402                goto NextOperand;
403            }
404
405            Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
406                            ObjectType, ObjDesc);
407            if (ACPI_FAILURE (Status))
408            {
409                return_ACPI_STATUS (Status);
410            }
411
412            if (ObjDesc->Reference.Opcode == AML_NAME_OP)
413            {
414                /* Convert a named reference to the actual named object */
415
416                TempNode = ObjDesc->Reference.Object;
417                AcpiUtRemoveReference (ObjDesc);
418                (*StackPtr) = TempNode;
419            }
420            goto NextOperand;
421
422
423        case ARGI_DATAREFOBJ:  /* Store operator only */
424
425            /*
426             * We don't want to resolve IndexOp reference objects during
427             * a store because this would be an implicit DeRefOf operation.
428             * Instead, we just want to store the reference object.
429             * -- All others must be resolved below.
430             */
431            if ((Opcode == AML_STORE_OP) &&
432                (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
433                ((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
434            {
435                goto NextOperand;
436            }
437            break;
438
439        default:
440            /* All cases covered above */
441            break;
442        }
443
444        /*
445         * Resolve this object to a value
446         */
447        Status = AcpiExResolveToValue (StackPtr, WalkState);
448        if (ACPI_FAILURE (Status))
449        {
450            return_ACPI_STATUS (Status);
451        }
452
453        /* Get the resolved object */
454
455        ObjDesc = *StackPtr;
456
457        /*
458         * Check the resulting object (value) type
459         */
460        switch (ThisArgType)
461        {
462        /*
463         * For the simple cases, only one type of resolved object
464         * is allowed
465         */
466        case ARGI_MUTEX:
467
468            /* Need an operand of type ACPI_TYPE_MUTEX */
469
470            TypeNeeded = ACPI_TYPE_MUTEX;
471            break;
472
473        case ARGI_EVENT:
474
475            /* Need an operand of type ACPI_TYPE_EVENT */
476
477            TypeNeeded = ACPI_TYPE_EVENT;
478            break;
479
480        case ARGI_PACKAGE:   /* Package */
481
482            /* Need an operand of type ACPI_TYPE_PACKAGE */
483
484            TypeNeeded = ACPI_TYPE_PACKAGE;
485            break;
486
487        case ARGI_ANYTYPE:
488
489            /* Any operand type will do */
490
491            TypeNeeded = ACPI_TYPE_ANY;
492            break;
493
494        case ARGI_DDBHANDLE:
495
496            /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
497
498            TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
499            break;
500
501
502        /*
503         * The more complex cases allow multiple resolved object types
504         */
505        case ARGI_INTEGER:
506
507            /*
508             * Need an operand of type ACPI_TYPE_INTEGER,
509             * But we can implicitly convert from a STRING or BUFFER
510             * Aka - "Implicit Source Operand Conversion"
511             */
512            Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
513            if (ACPI_FAILURE (Status))
514            {
515                if (Status == AE_TYPE)
516                {
517                    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
518                        "Needed [Integer/String/Buffer], found [%s] %p\n",
519                        AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
520
521                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
522                }
523
524                return_ACPI_STATUS (Status);
525            }
526
527            if (ObjDesc != *StackPtr)
528            {
529                AcpiUtRemoveReference (ObjDesc);
530            }
531            goto NextOperand;
532
533
534        case ARGI_BUFFER:
535
536            /*
537             * Need an operand of type ACPI_TYPE_BUFFER,
538             * But we can implicitly convert from a STRING or INTEGER
539             * Aka - "Implicit Source Operand Conversion"
540             */
541            Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
542            if (ACPI_FAILURE (Status))
543            {
544                if (Status == AE_TYPE)
545                {
546                    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
547                        "Needed [Integer/String/Buffer], found [%s] %p\n",
548                        AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
549
550                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
551                }
552
553                return_ACPI_STATUS (Status);
554            }
555
556            if (ObjDesc != *StackPtr)
557            {
558                AcpiUtRemoveReference (ObjDesc);
559            }
560            goto NextOperand;
561
562
563        case ARGI_STRING:
564
565            /*
566             * Need an operand of type ACPI_TYPE_STRING,
567             * But we can implicitly convert from a BUFFER or INTEGER
568             * Aka - "Implicit Source Operand Conversion"
569             */
570            Status = AcpiExConvertToString (ObjDesc, StackPtr,
571                        ACPI_IMPLICIT_CONVERT_HEX);
572            if (ACPI_FAILURE (Status))
573            {
574                if (Status == AE_TYPE)
575                {
576                    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
577                        "Needed [Integer/String/Buffer], found [%s] %p\n",
578                        AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
579
580                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
581                }
582
583                return_ACPI_STATUS (Status);
584            }
585
586            if (ObjDesc != *StackPtr)
587            {
588                AcpiUtRemoveReference (ObjDesc);
589            }
590            goto NextOperand;
591
592
593        case ARGI_COMPUTEDATA:
594
595            /* Need an operand of type INTEGER, STRING or BUFFER */
596
597            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
598            {
599            case ACPI_TYPE_INTEGER:
600            case ACPI_TYPE_STRING:
601            case ACPI_TYPE_BUFFER:
602
603                /* Valid operand */
604               break;
605
606            default:
607                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
608                    "Needed [Integer/String/Buffer], found [%s] %p\n",
609                    AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
610
611                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
612            }
613            goto NextOperand;
614
615
616        case ARGI_BUFFER_OR_STRING:
617
618            /* Need an operand of type STRING or BUFFER */
619
620            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
621            {
622            case ACPI_TYPE_STRING:
623            case ACPI_TYPE_BUFFER:
624
625                /* Valid operand */
626               break;
627
628            case ACPI_TYPE_INTEGER:
629
630                /* Highest priority conversion is to type Buffer */
631
632                Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
633                if (ACPI_FAILURE (Status))
634                {
635                    return_ACPI_STATUS (Status);
636                }
637
638                if (ObjDesc != *StackPtr)
639                {
640                    AcpiUtRemoveReference (ObjDesc);
641                }
642                break;
643
644            default:
645                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
646                    "Needed [Integer/String/Buffer], found [%s] %p\n",
647                    AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
648
649                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
650            }
651            goto NextOperand;
652
653
654        case ARGI_DATAOBJECT:
655            /*
656             * ARGI_DATAOBJECT is only used by the SizeOf operator.
657             * Need a buffer, string, package, or RefOf reference.
658             *
659             * The only reference allowed here is a direct reference to
660             * a namespace node.
661             */
662            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
663            {
664            case ACPI_TYPE_PACKAGE:
665            case ACPI_TYPE_STRING:
666            case ACPI_TYPE_BUFFER:
667            case ACPI_TYPE_LOCAL_REFERENCE:
668
669                /* Valid operand */
670                break;
671
672            default:
673                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
674                    "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
675                    AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
676
677                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
678            }
679            goto NextOperand;
680
681
682        case ARGI_COMPLEXOBJ:
683
684            /* Need a buffer or package or (ACPI 2.0) String */
685
686            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
687            {
688            case ACPI_TYPE_PACKAGE:
689            case ACPI_TYPE_STRING:
690            case ACPI_TYPE_BUFFER:
691
692                /* Valid operand */
693                break;
694
695            default:
696                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
697                    "Needed [Buffer/String/Package], found [%s] %p\n",
698                    AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
699
700                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
701            }
702            goto NextOperand;
703
704
705        case ARGI_REGION_OR_FIELD:
706
707            /* Need an operand of type REGION or a FIELD in a region */
708
709            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
710            {
711            case ACPI_TYPE_REGION:
712            case ACPI_TYPE_LOCAL_REGION_FIELD:
713            case ACPI_TYPE_LOCAL_BANK_FIELD:
714            case ACPI_TYPE_LOCAL_INDEX_FIELD:
715
716                /* Valid operand */
717                break;
718
719            default:
720                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
721                    "Needed [Region/RegionField], found [%s] %p\n",
722                    AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
723
724                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
725            }
726            goto NextOperand;
727
728
729        case ARGI_DATAREFOBJ:
730
731            /* Used by the Store() operator only */
732
733            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
734            {
735            case ACPI_TYPE_INTEGER:
736            case ACPI_TYPE_PACKAGE:
737            case ACPI_TYPE_STRING:
738            case ACPI_TYPE_BUFFER:
739            case ACPI_TYPE_BUFFER_FIELD:
740            case ACPI_TYPE_LOCAL_REFERENCE:
741            case ACPI_TYPE_LOCAL_REGION_FIELD:
742            case ACPI_TYPE_LOCAL_BANK_FIELD:
743            case ACPI_TYPE_LOCAL_INDEX_FIELD:
744            case ACPI_TYPE_DDB_HANDLE:
745
746                /* Valid operand */
747                break;
748
749            default:
750
751                if (AcpiGbl_EnableInterpreterSlack)
752                {
753                    /*
754                     * Enable original behavior of Store(), allowing any and all
755                     * objects as the source operand.  The ACPI spec does not
756                     * allow this, however.
757                     */
758                    break;
759                }
760
761                if (TargetOp == AML_DEBUG_OP)
762                {
763                    /* Allow store of any object to the Debug object */
764
765                    break;
766                }
767
768                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
769                    "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
770                    AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
771
772                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
773            }
774            goto NextOperand;
775
776
777        default:
778
779            /* Unknown type */
780
781            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
782                "Internal - Unknown ARGI (required operand) type %X\n",
783                ThisArgType));
784
785            return_ACPI_STATUS (AE_BAD_PARAMETER);
786        }
787
788        /*
789         * Make sure that the original object was resolved to the
790         * required object type (Simple cases only).
791         */
792        Status = AcpiExCheckObjectType (TypeNeeded,
793                        ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
794        if (ACPI_FAILURE (Status))
795        {
796            return_ACPI_STATUS (Status);
797        }
798
799NextOperand:
800        /*
801         * If more operands needed, decrement StackPtr to point
802         * to next operand on stack
803         */
804        if (GET_CURRENT_ARG_TYPE (ArgTypes))
805        {
806            StackPtr--;
807        }
808    }
809
810    return_ACPI_STATUS (Status);
811}
812
813
814