]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/contrib/dev/acpica/exresop.c
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sys / contrib / dev / acpica / exresop.c
1
2 /******************************************************************************
3  *
4  * Module Name: exresop - AML Interpreter operand/object resolution
5  *              $Revision: 1.95 $
6  *
7  *****************************************************************************/
8
9 /******************************************************************************
10  *
11  * 1. Copyright Notice
12  *
13  * Some or all of this work - Copyright (c) 1999 - 2007, 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 #include <contrib/dev/acpica/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 = ACPI_GET_OBJECT_TYPE (ObjDesc);
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]",
313                     ObjectType));
314
315                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
316             }
317
318             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
319             {
320                 /* Decode the Reference */
321
322                 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
323                 if (OpInfo->Class == AML_CLASS_UNKNOWN)
324                 {
325                     return_ACPI_STATUS (AE_AML_BAD_OPCODE);
326                 }
327
328                 switch (ObjDesc->Reference.Opcode)
329                 {
330                 case AML_DEBUG_OP:
331                     TargetOp = AML_DEBUG_OP;
332
333                     /*lint -fallthrough */
334
335                 case AML_INDEX_OP:
336                 case AML_REF_OF_OP:
337                 case AML_ARG_OP:
338                 case AML_LOCAL_OP:
339                 case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
340                 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
341
342                     ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
343                         "Operand is a Reference, RefOpcode [%s]\n",
344                         (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name)));
345                     break;
346
347                 default:
348                     ACPI_ERROR ((AE_INFO,
349                         "Operand is a Reference, Unknown Reference Opcode: %X",
350                         ObjDesc->Reference.Opcode));
351
352                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
353                 }
354             }
355             break;
356
357
358         default:
359
360             /* Invalid descriptor */
361
362             ACPI_ERROR ((AE_INFO,
363                 "Invalid descriptor %p [%s]",
364                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
365
366             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
367         }
368
369         /* Get one argument type, point to the next */
370
371         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
372         INCREMENT_ARG_LIST (ArgTypes);
373
374         /*
375          * Handle cases where the object does not need to be
376          * resolved to a value
377          */
378         switch (ThisArgType)
379         {
380         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
381
382             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
383                 (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
384             {
385                 /*
386                  * String found - the string references a named object and
387                  * must be resolved to a node
388                  */
389                 goto NextOperand;
390             }
391
392             /*
393              * Else not a string - fall through to the normal Reference
394              * case below
395              */
396             /*lint -fallthrough */
397
398         case ARGI_REFERENCE:            /* References: */
399         case ARGI_INTEGER_REF:
400         case ARGI_OBJECT_REF:
401         case ARGI_DEVICE_REF:
402         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
403         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
404         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
405
406             /*
407              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
408              * A Namespace Node is OK as-is
409              */
410             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
411             {
412                 goto NextOperand;
413             }
414
415             Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
416                             ObjectType, ObjDesc);
417             if (ACPI_FAILURE (Status))
418             {
419                 return_ACPI_STATUS (Status);
420             }
421             goto NextOperand;
422
423
424         case ARGI_DATAREFOBJ:  /* Store operator only */
425
426             /*
427              * We don't want to resolve IndexOp reference objects during
428              * a store because this would be an implicit DeRefOf operation.
429              * Instead, we just want to store the reference object.
430              * -- All others must be resolved below.
431              */
432             if ((Opcode == AML_STORE_OP) &&
433                 (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
434                 ((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
435             {
436                 goto NextOperand;
437             }
438             break;
439
440         default:
441             /* All cases covered above */
442             break;
443         }
444
445         /*
446          * Resolve this object to a value
447          */
448         Status = AcpiExResolveToValue (StackPtr, WalkState);
449         if (ACPI_FAILURE (Status))
450         {
451             return_ACPI_STATUS (Status);
452         }
453
454         /* Get the resolved object */
455
456         ObjDesc = *StackPtr;
457
458         /*
459          * Check the resulting object (value) type
460          */
461         switch (ThisArgType)
462         {
463         /*
464          * For the simple cases, only one type of resolved object
465          * is allowed
466          */
467         case ARGI_MUTEX:
468
469             /* Need an operand of type ACPI_TYPE_MUTEX */
470
471             TypeNeeded = ACPI_TYPE_MUTEX;
472             break;
473
474         case ARGI_EVENT:
475
476             /* Need an operand of type ACPI_TYPE_EVENT */
477
478             TypeNeeded = ACPI_TYPE_EVENT;
479             break;
480
481         case ARGI_PACKAGE:   /* Package */
482
483             /* Need an operand of type ACPI_TYPE_PACKAGE */
484
485             TypeNeeded = ACPI_TYPE_PACKAGE;
486             break;
487
488         case ARGI_ANYTYPE:
489
490             /* Any operand type will do */
491
492             TypeNeeded = ACPI_TYPE_ANY;
493             break;
494
495         case ARGI_DDBHANDLE:
496
497             /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
498
499             TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
500             break;
501
502
503         /*
504          * The more complex cases allow multiple resolved object types
505          */
506         case ARGI_INTEGER:
507
508             /*
509              * Need an operand of type ACPI_TYPE_INTEGER,
510              * But we can implicitly convert from a STRING or BUFFER
511              * Aka - "Implicit Source Operand Conversion"
512              */
513             Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
514             if (ACPI_FAILURE (Status))
515             {
516                 if (Status == AE_TYPE)
517                 {
518                     ACPI_ERROR ((AE_INFO,
519                         "Needed [Integer/String/Buffer], found [%s] %p",
520                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
521
522                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
523                 }
524
525                 return_ACPI_STATUS (Status);
526             }
527
528             if (ObjDesc != *StackPtr)
529             {
530                 AcpiUtRemoveReference (ObjDesc);
531             }
532             goto NextOperand;
533
534
535         case ARGI_BUFFER:
536
537             /*
538              * Need an operand of type ACPI_TYPE_BUFFER,
539              * But we can implicitly convert from a STRING or INTEGER
540              * Aka - "Implicit Source Operand Conversion"
541              */
542             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
543             if (ACPI_FAILURE (Status))
544             {
545                 if (Status == AE_TYPE)
546                 {
547                     ACPI_ERROR ((AE_INFO,
548                         "Needed [Integer/String/Buffer], found [%s] %p",
549                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
550
551                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
552                 }
553
554                 return_ACPI_STATUS (Status);
555             }
556
557             if (ObjDesc != *StackPtr)
558             {
559                 AcpiUtRemoveReference (ObjDesc);
560             }
561             goto NextOperand;
562
563
564         case ARGI_STRING:
565
566             /*
567              * Need an operand of type ACPI_TYPE_STRING,
568              * But we can implicitly convert from a BUFFER or INTEGER
569              * Aka - "Implicit Source Operand Conversion"
570              */
571             Status = AcpiExConvertToString (ObjDesc, StackPtr,
572                         ACPI_IMPLICIT_CONVERT_HEX);
573             if (ACPI_FAILURE (Status))
574             {
575                 if (Status == AE_TYPE)
576                 {
577                     ACPI_ERROR ((AE_INFO,
578                         "Needed [Integer/String/Buffer], found [%s] %p",
579                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
580
581                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
582                 }
583
584                 return_ACPI_STATUS (Status);
585             }
586
587             if (ObjDesc != *StackPtr)
588             {
589                 AcpiUtRemoveReference (ObjDesc);
590             }
591             goto NextOperand;
592
593
594         case ARGI_COMPUTEDATA:
595
596             /* Need an operand of type INTEGER, STRING or BUFFER */
597
598             switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
599             {
600             case ACPI_TYPE_INTEGER:
601             case ACPI_TYPE_STRING:
602             case ACPI_TYPE_BUFFER:
603
604                 /* Valid operand */
605                break;
606
607             default:
608                 ACPI_ERROR ((AE_INFO,
609                     "Needed [Integer/String/Buffer], found [%s] %p",
610                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
611
612                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
613             }
614             goto NextOperand;
615
616
617         case ARGI_BUFFER_OR_STRING:
618
619             /* Need an operand of type STRING or BUFFER */
620
621             switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
622             {
623             case ACPI_TYPE_STRING:
624             case ACPI_TYPE_BUFFER:
625
626                 /* Valid operand */
627                break;
628
629             case ACPI_TYPE_INTEGER:
630
631                 /* Highest priority conversion is to type Buffer */
632
633                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
634                 if (ACPI_FAILURE (Status))
635                 {
636                     return_ACPI_STATUS (Status);
637                 }
638
639                 if (ObjDesc != *StackPtr)
640                 {
641                     AcpiUtRemoveReference (ObjDesc);
642                 }
643                 break;
644
645             default:
646                 ACPI_ERROR ((AE_INFO,
647                     "Needed [Integer/String/Buffer], found [%s] %p",
648                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
649
650                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
651             }
652             goto NextOperand;
653
654
655         case ARGI_DATAOBJECT:
656             /*
657              * ARGI_DATAOBJECT is only used by the SizeOf operator.
658              * Need a buffer, string, package, or RefOf reference.
659              *
660              * The only reference allowed here is a direct reference to
661              * a namespace node.
662              */
663             switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
664             {
665             case ACPI_TYPE_PACKAGE:
666             case ACPI_TYPE_STRING:
667             case ACPI_TYPE_BUFFER:
668             case ACPI_TYPE_LOCAL_REFERENCE:
669
670                 /* Valid operand */
671                 break;
672
673             default:
674                 ACPI_ERROR ((AE_INFO,
675                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
676                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
677
678                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
679             }
680             goto NextOperand;
681
682
683         case ARGI_COMPLEXOBJ:
684
685             /* Need a buffer or package or (ACPI 2.0) String */
686
687             switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
688             {
689             case ACPI_TYPE_PACKAGE:
690             case ACPI_TYPE_STRING:
691             case ACPI_TYPE_BUFFER:
692
693                 /* Valid operand */
694                 break;
695
696             default:
697                 ACPI_ERROR ((AE_INFO,
698                     "Needed [Buffer/String/Package], found [%s] %p",
699                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
700
701                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
702             }
703             goto NextOperand;
704
705
706         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
707
708             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
709
710             switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
711             {
712             case ACPI_TYPE_BUFFER:
713             case ACPI_TYPE_REGION:
714
715                 /* Valid operand */
716                 break;
717
718             default:
719                 ACPI_ERROR ((AE_INFO,
720                     "Needed [Region/Buffer], found [%s] %p",
721                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
722
723                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
724             }
725             goto NextOperand;
726
727
728         case ARGI_DATAREFOBJ:
729
730             /* Used by the Store() operator only */
731
732             switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
733             {
734             case ACPI_TYPE_INTEGER:
735             case ACPI_TYPE_PACKAGE:
736             case ACPI_TYPE_STRING:
737             case ACPI_TYPE_BUFFER:
738             case ACPI_TYPE_BUFFER_FIELD:
739             case ACPI_TYPE_LOCAL_REFERENCE:
740             case ACPI_TYPE_LOCAL_REGION_FIELD:
741             case ACPI_TYPE_LOCAL_BANK_FIELD:
742             case ACPI_TYPE_LOCAL_INDEX_FIELD:
743             case ACPI_TYPE_DDB_HANDLE:
744
745                 /* Valid operand */
746                 break;
747
748             default:
749
750                 if (AcpiGbl_EnableInterpreterSlack)
751                 {
752                     /*
753                      * Enable original behavior of Store(), allowing any and all
754                      * objects as the source operand.  The ACPI spec does not
755                      * allow this, however.
756                      */
757                     break;
758                 }
759
760                 if (TargetOp == AML_DEBUG_OP)
761                 {
762                     /* Allow store of any object to the Debug object */
763
764                     break;
765                 }
766
767                 ACPI_ERROR ((AE_INFO,
768                     "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
769                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
770
771                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
772             }
773             goto NextOperand;
774
775
776         default:
777
778             /* Unknown type */
779
780             ACPI_ERROR ((AE_INFO,
781                 "Internal - Unknown ARGI (required operand) type %X",
782                 ThisArgType));
783
784             return_ACPI_STATUS (AE_BAD_PARAMETER);
785         }
786
787         /*
788          * Make sure that the original object was resolved to the
789          * required object type (Simple cases only).
790          */
791         Status = AcpiExCheckObjectType (TypeNeeded,
792                         ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
793         if (ACPI_FAILURE (Status))
794         {
795             return_ACPI_STATUS (Status);
796         }
797
798 NextOperand:
799         /*
800          * If more operands needed, decrement StackPtr to point
801          * to next operand on stack
802          */
803         if (GET_CURRENT_ARG_TYPE (ArgTypes))
804         {
805             StackPtr--;
806         }
807     }
808
809     return_ACPI_STATUS (Status);
810 }
811
812