xref: /titanic_41/usr/src/uts/intel/io/acpica/executer/exresop.c (revision 42e43e9829853ed82c9a4e268b0b15ea58be81fb)
1 
2 /******************************************************************************
3  *
4  * Module Name: exresop - AML Interpreter operand/object resolution
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #define __EXRESOP_C__
118 
119 #include "acpi.h"
120 #include "accommon.h"
121 #include "amlcode.h"
122 #include "acparser.h"
123 #include "acinterp.h"
124 #include "acnamesp.h"
125 
126 
127 #define _COMPONENT          ACPI_EXECUTER
128         ACPI_MODULE_NAME    ("exresop")
129 
130 /* Local prototypes */
131 
132 static ACPI_STATUS
133 AcpiExCheckObjectType (
134     ACPI_OBJECT_TYPE        TypeNeeded,
135     ACPI_OBJECT_TYPE        ThisType,
136     void                    *Object);
137 
138 
139 /*******************************************************************************
140  *
141  * FUNCTION:    AcpiExCheckObjectType
142  *
143  * PARAMETERS:  TypeNeeded          Object type needed
144  *              ThisType            Actual object type
145  *              Object              Object pointer
146  *
147  * RETURN:      Status
148  *
149  * DESCRIPTION: Check required type against actual type
150  *
151  ******************************************************************************/
152 
153 static ACPI_STATUS
154 AcpiExCheckObjectType (
155     ACPI_OBJECT_TYPE        TypeNeeded,
156     ACPI_OBJECT_TYPE        ThisType,
157     void                    *Object)
158 {
159     ACPI_FUNCTION_ENTRY ();
160 
161 
162     if (TypeNeeded == ACPI_TYPE_ANY)
163     {
164         /* All types OK, so we don't perform any typechecks */
165 
166         return (AE_OK);
167     }
168 
169     if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
170     {
171         /*
172          * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
173          * objects and thus allow them to be targets.  (As per the ACPI
174          * specification, a store to a constant is a noop.)
175          */
176         if ((ThisType == ACPI_TYPE_INTEGER) &&
177             (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
178         {
179             return (AE_OK);
180         }
181     }
182 
183     if (TypeNeeded != ThisType)
184     {
185         ACPI_ERROR ((AE_INFO,
186             "Needed type [%s], found [%s] %p",
187             AcpiUtGetTypeName (TypeNeeded),
188             AcpiUtGetTypeName (ThisType), Object));
189 
190         return (AE_AML_OPERAND_TYPE);
191     }
192 
193     return (AE_OK);
194 }
195 
196 
197 /*******************************************************************************
198  *
199  * FUNCTION:    AcpiExResolveOperands
200  *
201  * PARAMETERS:  Opcode              - Opcode being interpreted
202  *              StackPtr            - Pointer to the operand stack to be
203  *                                    resolved
204  *              WalkState           - Current state
205  *
206  * RETURN:      Status
207  *
208  * DESCRIPTION: Convert multiple input operands to the types required by the
209  *              target operator.
210  *
211  *      Each 5-bit group in ArgTypes represents one required
212  *      operand and indicates the required Type. The corresponding operand
213  *      will be converted to the required type if possible, otherwise we
214  *      abort with an exception.
215  *
216  ******************************************************************************/
217 
218 ACPI_STATUS
219 AcpiExResolveOperands (
220     UINT16                  Opcode,
221     ACPI_OPERAND_OBJECT     **StackPtr,
222     ACPI_WALK_STATE         *WalkState)
223 {
224     ACPI_OPERAND_OBJECT     *ObjDesc;
225     ACPI_STATUS             Status = AE_OK;
226     UINT8                   ObjectType;
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_ERROR ((AE_INFO, "Unknown AML opcode %X",
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_ERROR ((AE_INFO, "Null stack entry at %p",
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 
287             /*
288              * Resolve an alias object. The construction of these objects
289              * guarantees that there is only one level of alias indirection;
290              * thus, the attached object is always the aliased namespace node
291              */
292             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
293             {
294                 ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
295                 *StackPtr = ObjDesc;
296                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
297             }
298             break;
299 
300 
301         case ACPI_DESC_TYPE_OPERAND:
302 
303             /* ACPI internal object */
304 
305             ObjectType = ObjDesc->Common.Type;
306 
307             /* Check for bad ACPI_OBJECT_TYPE */
308 
309             if (!AcpiUtValidObjectType (ObjectType))
310             {
311                 ACPI_ERROR ((AE_INFO,
312                     "Bad operand object type [%X]", ObjectType));
313 
314                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
315             }
316 
317             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
318             {
319                 /* Validate the Reference */
320 
321                 switch (ObjDesc->Reference.Class)
322                 {
323                 case ACPI_REFCLASS_DEBUG:
324 
325                     TargetOp = AML_DEBUG_OP;
326 
327                     /*lint -fallthrough */
328 
329                 case ACPI_REFCLASS_ARG:
330                 case ACPI_REFCLASS_LOCAL:
331                 case ACPI_REFCLASS_INDEX:
332                 case ACPI_REFCLASS_REFOF:
333                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
334                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
335 
336                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
337                         "Operand is a Reference, Class [%s] %2.2X\n",
338                         AcpiUtGetReferenceName (ObjDesc),
339                         ObjDesc->Reference.Class));
340                     break;
341 
342                 default:
343 
344                     ACPI_ERROR ((AE_INFO,
345                         "Unknown Reference Class %2.2X in %p",
346                         ObjDesc->Reference.Class, ObjDesc));
347 
348                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
349                 }
350             }
351             break;
352 
353 
354         default:
355 
356             /* Invalid descriptor */
357 
358             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
359                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
360 
361             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
362         }
363 
364         /* Get one argument type, point to the next */
365 
366         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
367         INCREMENT_ARG_LIST (ArgTypes);
368 
369         /*
370          * Handle cases where the object does not need to be
371          * resolved to a value
372          */
373         switch (ThisArgType)
374         {
375         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
376 
377             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
378                 (ObjDesc->Common.Type == ACPI_TYPE_STRING))
379             {
380                 /*
381                  * String found - the string references a named object and
382                  * must be resolved to a node
383                  */
384                 goto NextOperand;
385             }
386 
387             /*
388              * Else not a string - fall through to the normal Reference
389              * case below
390              */
391             /*lint -fallthrough */
392 
393         case ARGI_REFERENCE:            /* References: */
394         case ARGI_INTEGER_REF:
395         case ARGI_OBJECT_REF:
396         case ARGI_DEVICE_REF:
397         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
398         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
399         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
400 
401             /*
402              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
403              * A Namespace Node is OK as-is
404              */
405             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
406             {
407                 goto NextOperand;
408             }
409 
410             Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
411                             ObjectType, ObjDesc);
412             if (ACPI_FAILURE (Status))
413             {
414                 return_ACPI_STATUS (Status);
415             }
416             goto NextOperand;
417 
418 
419         case ARGI_DATAREFOBJ:  /* Store operator only */
420 
421             /*
422              * We don't want to resolve IndexOp reference objects during
423              * a store because this would be an implicit DeRefOf operation.
424              * Instead, we just want to store the reference object.
425              * -- All others must be resolved below.
426              */
427             if ((Opcode == AML_STORE_OP) &&
428                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
429                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
430             {
431                 goto NextOperand;
432             }
433             break;
434 
435         default:
436             /* All cases covered above */
437             break;
438         }
439 
440         /*
441          * Resolve this object to a value
442          */
443         Status = AcpiExResolveToValue (StackPtr, WalkState);
444         if (ACPI_FAILURE (Status))
445         {
446             return_ACPI_STATUS (Status);
447         }
448 
449         /* Get the resolved object */
450 
451         ObjDesc = *StackPtr;
452 
453         /*
454          * Check the resulting object (value) type
455          */
456         switch (ThisArgType)
457         {
458         /*
459          * For the simple cases, only one type of resolved object
460          * is allowed
461          */
462         case ARGI_MUTEX:
463 
464             /* Need an operand of type ACPI_TYPE_MUTEX */
465 
466             TypeNeeded = ACPI_TYPE_MUTEX;
467             break;
468 
469         case ARGI_EVENT:
470 
471             /* Need an operand of type ACPI_TYPE_EVENT */
472 
473             TypeNeeded = ACPI_TYPE_EVENT;
474             break;
475 
476         case ARGI_PACKAGE:   /* Package */
477 
478             /* Need an operand of type ACPI_TYPE_PACKAGE */
479 
480             TypeNeeded = ACPI_TYPE_PACKAGE;
481             break;
482 
483         case ARGI_ANYTYPE:
484 
485             /* Any operand type will do */
486 
487             TypeNeeded = ACPI_TYPE_ANY;
488             break;
489 
490         case ARGI_DDBHANDLE:
491 
492             /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
493 
494             TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
495             break;
496 
497 
498         /*
499          * The more complex cases allow multiple resolved object types
500          */
501         case ARGI_INTEGER:
502 
503             /*
504              * Need an operand of type ACPI_TYPE_INTEGER,
505              * But we can implicitly convert from a STRING or BUFFER
506              * Aka - "Implicit Source Operand Conversion"
507              */
508             Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
509             if (ACPI_FAILURE (Status))
510             {
511                 if (Status == AE_TYPE)
512                 {
513                     ACPI_ERROR ((AE_INFO,
514                         "Needed [Integer/String/Buffer], found [%s] %p",
515                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
516 
517                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
518                 }
519 
520                 return_ACPI_STATUS (Status);
521             }
522 
523             if (ObjDesc != *StackPtr)
524             {
525                 AcpiUtRemoveReference (ObjDesc);
526             }
527             goto NextOperand;
528 
529 
530         case ARGI_BUFFER:
531 
532             /*
533              * Need an operand of type ACPI_TYPE_BUFFER,
534              * But we can implicitly convert from a STRING or INTEGER
535              * Aka - "Implicit Source Operand Conversion"
536              */
537             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
538             if (ACPI_FAILURE (Status))
539             {
540                 if (Status == AE_TYPE)
541                 {
542                     ACPI_ERROR ((AE_INFO,
543                         "Needed [Integer/String/Buffer], found [%s] %p",
544                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
545 
546                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
547                 }
548 
549                 return_ACPI_STATUS (Status);
550             }
551 
552             if (ObjDesc != *StackPtr)
553             {
554                 AcpiUtRemoveReference (ObjDesc);
555             }
556             goto NextOperand;
557 
558 
559         case ARGI_STRING:
560 
561             /*
562              * Need an operand of type ACPI_TYPE_STRING,
563              * But we can implicitly convert from a BUFFER or INTEGER
564              * Aka - "Implicit Source Operand Conversion"
565              */
566             Status = AcpiExConvertToString (ObjDesc, StackPtr,
567                         ACPI_IMPLICIT_CONVERT_HEX);
568             if (ACPI_FAILURE (Status))
569             {
570                 if (Status == AE_TYPE)
571                 {
572                     ACPI_ERROR ((AE_INFO,
573                         "Needed [Integer/String/Buffer], found [%s] %p",
574                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
575 
576                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
577                 }
578 
579                 return_ACPI_STATUS (Status);
580             }
581 
582             if (ObjDesc != *StackPtr)
583             {
584                 AcpiUtRemoveReference (ObjDesc);
585             }
586             goto NextOperand;
587 
588 
589         case ARGI_COMPUTEDATA:
590 
591             /* Need an operand of type INTEGER, STRING or BUFFER */
592 
593             switch (ObjDesc->Common.Type)
594             {
595             case ACPI_TYPE_INTEGER:
596             case ACPI_TYPE_STRING:
597             case ACPI_TYPE_BUFFER:
598 
599                 /* Valid operand */
600                break;
601 
602             default:
603                 ACPI_ERROR ((AE_INFO,
604                     "Needed [Integer/String/Buffer], found [%s] %p",
605                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
606 
607                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
608             }
609             goto NextOperand;
610 
611 
612         case ARGI_BUFFER_OR_STRING:
613 
614             /* Need an operand of type STRING or BUFFER */
615 
616             switch (ObjDesc->Common.Type)
617             {
618             case ACPI_TYPE_STRING:
619             case ACPI_TYPE_BUFFER:
620 
621                 /* Valid operand */
622                break;
623 
624             case ACPI_TYPE_INTEGER:
625 
626                 /* Highest priority conversion is to type Buffer */
627 
628                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
629                 if (ACPI_FAILURE (Status))
630                 {
631                     return_ACPI_STATUS (Status);
632                 }
633 
634                 if (ObjDesc != *StackPtr)
635                 {
636                     AcpiUtRemoveReference (ObjDesc);
637                 }
638                 break;
639 
640             default:
641                 ACPI_ERROR ((AE_INFO,
642                     "Needed [Integer/String/Buffer], found [%s] %p",
643                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
644 
645                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
646             }
647             goto NextOperand;
648 
649 
650         case ARGI_DATAOBJECT:
651             /*
652              * ARGI_DATAOBJECT is only used by the SizeOf operator.
653              * Need a buffer, string, package, or RefOf reference.
654              *
655              * The only reference allowed here is a direct reference to
656              * a namespace node.
657              */
658             switch (ObjDesc->Common.Type)
659             {
660             case ACPI_TYPE_PACKAGE:
661             case ACPI_TYPE_STRING:
662             case ACPI_TYPE_BUFFER:
663             case ACPI_TYPE_LOCAL_REFERENCE:
664 
665                 /* Valid operand */
666                 break;
667 
668             default:
669                 ACPI_ERROR ((AE_INFO,
670                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
671                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
672 
673                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
674             }
675             goto NextOperand;
676 
677 
678         case ARGI_COMPLEXOBJ:
679 
680             /* Need a buffer or package or (ACPI 2.0) String */
681 
682             switch (ObjDesc->Common.Type)
683             {
684             case ACPI_TYPE_PACKAGE:
685             case ACPI_TYPE_STRING:
686             case ACPI_TYPE_BUFFER:
687 
688                 /* Valid operand */
689                 break;
690 
691             default:
692                 ACPI_ERROR ((AE_INFO,
693                     "Needed [Buffer/String/Package], found [%s] %p",
694                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
695 
696                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
697             }
698             goto NextOperand;
699 
700 
701         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
702 
703             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
704 
705             switch (ObjDesc->Common.Type)
706             {
707             case ACPI_TYPE_BUFFER:
708             case ACPI_TYPE_REGION:
709 
710                 /* Valid operand */
711                 break;
712 
713             default:
714                 ACPI_ERROR ((AE_INFO,
715                     "Needed [Region/Buffer], found [%s] %p",
716                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
717 
718                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
719             }
720             goto NextOperand;
721 
722 
723         case ARGI_DATAREFOBJ:
724 
725             /* Used by the Store() operator only */
726 
727             switch (ObjDesc->Common.Type)
728             {
729             case ACPI_TYPE_INTEGER:
730             case ACPI_TYPE_PACKAGE:
731             case ACPI_TYPE_STRING:
732             case ACPI_TYPE_BUFFER:
733             case ACPI_TYPE_BUFFER_FIELD:
734             case ACPI_TYPE_LOCAL_REFERENCE:
735             case ACPI_TYPE_LOCAL_REGION_FIELD:
736             case ACPI_TYPE_LOCAL_BANK_FIELD:
737             case ACPI_TYPE_LOCAL_INDEX_FIELD:
738             case ACPI_TYPE_DDB_HANDLE:
739 
740                 /* Valid operand */
741                 break;
742 
743             default:
744 
745                 if (AcpiGbl_EnableInterpreterSlack)
746                 {
747                     /*
748                      * Enable original behavior of Store(), allowing any and all
749                      * objects as the source operand.  The ACPI spec does not
750                      * allow this, however.
751                      */
752                     break;
753                 }
754 
755                 if (TargetOp == AML_DEBUG_OP)
756                 {
757                     /* Allow store of any object to the Debug object */
758 
759                     break;
760                 }
761 
762                 ACPI_ERROR ((AE_INFO,
763                     "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
764                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
765 
766                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
767             }
768             goto NextOperand;
769 
770 
771         default:
772 
773             /* Unknown type */
774 
775             ACPI_ERROR ((AE_INFO,
776                 "Internal - Unknown ARGI (required operand) type %X",
777                 ThisArgType));
778 
779             return_ACPI_STATUS (AE_BAD_PARAMETER);
780         }
781 
782         /*
783          * Make sure that the original object was resolved to the
784          * required object type (Simple cases only).
785          */
786         Status = AcpiExCheckObjectType (TypeNeeded,
787                         (*StackPtr)->Common.Type, *StackPtr);
788         if (ACPI_FAILURE (Status))
789         {
790             return_ACPI_STATUS (Status);
791         }
792 
793 NextOperand:
794         /*
795          * If more operands needed, decrement StackPtr to point
796          * to next operand on stack
797          */
798         if (GET_CURRENT_ARG_TYPE (ArgTypes))
799         {
800             StackPtr--;
801         }
802     }
803 
804     ACPI_DUMP_OPERANDS (WalkState->Operands,
805         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
806 
807     return_ACPI_STATUS (Status);
808 }
809 
810 
811