Sync ACPICA with Intel's version 20170831.
[dragonfly.git] / sys / contrib / dev / acpica / source / components / executer / exresop.c
blobe33608c2f712db9132a67fac99fe1382fe3aff19
1 /******************************************************************************
3 * Module Name: exresop - AML Interpreter operand/object resolution
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12 * All rights reserved.
14 * 2. License
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include "acpi.h"
153 #include "accommon.h"
154 #include "amlcode.h"
155 #include "acparser.h"
156 #include "acinterp.h"
157 #include "acnamesp.h"
160 #define _COMPONENT ACPI_EXECUTER
161 ACPI_MODULE_NAME ("exresop")
163 /* Local prototypes */
165 static ACPI_STATUS
166 AcpiExCheckObjectType (
167 ACPI_OBJECT_TYPE TypeNeeded,
168 ACPI_OBJECT_TYPE ThisType,
169 void *Object);
172 /*******************************************************************************
174 * FUNCTION: AcpiExCheckObjectType
176 * PARAMETERS: TypeNeeded Object type needed
177 * ThisType Actual object type
178 * Object Object pointer
180 * RETURN: Status
182 * DESCRIPTION: Check required type against actual type
184 ******************************************************************************/
186 static ACPI_STATUS
187 AcpiExCheckObjectType (
188 ACPI_OBJECT_TYPE TypeNeeded,
189 ACPI_OBJECT_TYPE ThisType,
190 void *Object)
192 ACPI_FUNCTION_ENTRY ();
195 if (TypeNeeded == ACPI_TYPE_ANY)
197 /* All types OK, so we don't perform any typechecks */
199 return (AE_OK);
202 if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
205 * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
206 * objects and thus allow them to be targets. (As per the ACPI
207 * specification, a store to a constant is a noop.)
209 if ((ThisType == ACPI_TYPE_INTEGER) &&
210 (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags &
211 AOPOBJ_AML_CONSTANT))
213 return (AE_OK);
217 if (TypeNeeded != ThisType)
219 ACPI_ERROR ((AE_INFO,
220 "Needed type [%s], found [%s] %p",
221 AcpiUtGetTypeName (TypeNeeded),
222 AcpiUtGetTypeName (ThisType), Object));
224 return (AE_AML_OPERAND_TYPE);
227 return (AE_OK);
231 /*******************************************************************************
233 * FUNCTION: AcpiExResolveOperands
235 * PARAMETERS: Opcode - Opcode being interpreted
236 * StackPtr - Pointer to the operand stack to be
237 * resolved
238 * WalkState - Current state
240 * RETURN: Status
242 * DESCRIPTION: Convert multiple input operands to the types required by the
243 * target operator.
245 * Each 5-bit group in ArgTypes represents one required
246 * operand and indicates the required Type. The corresponding operand
247 * will be converted to the required type if possible, otherwise we
248 * abort with an exception.
250 ******************************************************************************/
252 ACPI_STATUS
253 AcpiExResolveOperands (
254 UINT16 Opcode,
255 ACPI_OPERAND_OBJECT **StackPtr,
256 ACPI_WALK_STATE *WalkState)
258 ACPI_OPERAND_OBJECT *ObjDesc;
259 ACPI_STATUS Status = AE_OK;
260 UINT8 ObjectType;
261 UINT32 ArgTypes;
262 const ACPI_OPCODE_INFO *OpInfo;
263 UINT32 ThisArgType;
264 ACPI_OBJECT_TYPE TypeNeeded;
265 UINT16 TargetOp = 0;
268 ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
271 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
272 if (OpInfo->Class == AML_CLASS_UNKNOWN)
274 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
277 ArgTypes = OpInfo->RuntimeArgs;
278 if (ArgTypes == ARGI_INVALID_OPCODE)
280 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
281 Opcode));
283 return_ACPI_STATUS (AE_AML_INTERNAL);
286 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
287 "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
288 Opcode, OpInfo->Name, ArgTypes));
291 * Normal exit is with (ArgTypes == 0) at end of argument list.
292 * Function will return an exception from within the loop upon
293 * finding an entry which is not (or cannot be converted
294 * to) the required type; if stack underflows; or upon
295 * finding a NULL stack entry (which should not happen).
297 while (GET_CURRENT_ARG_TYPE (ArgTypes))
299 if (!StackPtr || !*StackPtr)
301 ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
302 StackPtr));
304 return_ACPI_STATUS (AE_AML_INTERNAL);
307 /* Extract useful items */
309 ObjDesc = *StackPtr;
311 /* Decode the descriptor type */
313 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
315 case ACPI_DESC_TYPE_NAMED:
317 /* Namespace Node */
319 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
322 * Resolve an alias object. The construction of these objects
323 * guarantees that there is only one level of alias indirection;
324 * thus, the attached object is always the aliased namespace node
326 if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
328 ObjDesc = AcpiNsGetAttachedObject (
329 (ACPI_NAMESPACE_NODE *) ObjDesc);
330 *StackPtr = ObjDesc;
331 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
333 break;
335 case ACPI_DESC_TYPE_OPERAND:
337 /* ACPI internal object */
339 ObjectType = ObjDesc->Common.Type;
341 /* Check for bad ACPI_OBJECT_TYPE */
343 if (!AcpiUtValidObjectType (ObjectType))
345 ACPI_ERROR ((AE_INFO,
346 "Bad operand object type [0x%X]", ObjectType));
348 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
351 if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
353 /* Validate the Reference */
355 switch (ObjDesc->Reference.Class)
357 case ACPI_REFCLASS_DEBUG:
359 TargetOp = AML_DEBUG_OP;
361 /*lint -fallthrough */
363 case ACPI_REFCLASS_ARG:
364 case ACPI_REFCLASS_LOCAL:
365 case ACPI_REFCLASS_INDEX:
366 case ACPI_REFCLASS_REFOF:
367 case ACPI_REFCLASS_TABLE: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
368 case ACPI_REFCLASS_NAME: /* Reference to a named object */
370 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
371 "Operand is a Reference, Class [%s] %2.2X\n",
372 AcpiUtGetReferenceName (ObjDesc),
373 ObjDesc->Reference.Class));
374 break;
376 default:
378 ACPI_ERROR ((AE_INFO,
379 "Unknown Reference Class 0x%2.2X in %p",
380 ObjDesc->Reference.Class, ObjDesc));
382 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
385 break;
387 default:
389 /* Invalid descriptor */
391 ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
392 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
394 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
397 /* Get one argument type, point to the next */
399 ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
400 INCREMENT_ARG_LIST (ArgTypes);
403 * Handle cases where the object does not need to be
404 * resolved to a value
406 switch (ThisArgType)
408 case ARGI_REF_OR_STRING: /* Can be a String or Reference */
410 if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) ==
411 ACPI_DESC_TYPE_OPERAND) &&
412 (ObjDesc->Common.Type == ACPI_TYPE_STRING))
415 * String found - the string references a named object and
416 * must be resolved to a node
418 goto NextOperand;
422 * Else not a string - fall through to the normal Reference
423 * case below
425 /*lint -fallthrough */
427 case ARGI_REFERENCE: /* References: */
428 case ARGI_INTEGER_REF:
429 case ARGI_OBJECT_REF:
430 case ARGI_DEVICE_REF:
431 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
432 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
433 case ARGI_STORE_TARGET:
436 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
437 * A Namespace Node is OK as-is
439 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
441 goto NextOperand;
444 Status = AcpiExCheckObjectType (
445 ACPI_TYPE_LOCAL_REFERENCE, ObjectType, ObjDesc);
446 if (ACPI_FAILURE (Status))
448 return_ACPI_STATUS (Status);
450 goto NextOperand;
452 case ARGI_DATAREFOBJ: /* Store operator only */
454 * We don't want to resolve IndexOp reference objects during
455 * a store because this would be an implicit DeRefOf operation.
456 * Instead, we just want to store the reference object.
457 * -- All others must be resolved below.
459 if ((Opcode == AML_STORE_OP) &&
460 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
461 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
463 goto NextOperand;
465 break;
467 default:
469 /* All cases covered above */
471 break;
475 * Resolve this object to a value
477 Status = AcpiExResolveToValue (StackPtr, WalkState);
478 if (ACPI_FAILURE (Status))
480 return_ACPI_STATUS (Status);
483 /* Get the resolved object */
485 ObjDesc = *StackPtr;
488 * Check the resulting object (value) type
490 switch (ThisArgType)
493 * For the simple cases, only one type of resolved object
494 * is allowed
496 case ARGI_MUTEX:
498 /* Need an operand of type ACPI_TYPE_MUTEX */
500 TypeNeeded = ACPI_TYPE_MUTEX;
501 break;
503 case ARGI_EVENT:
505 /* Need an operand of type ACPI_TYPE_EVENT */
507 TypeNeeded = ACPI_TYPE_EVENT;
508 break;
510 case ARGI_PACKAGE: /* Package */
512 /* Need an operand of type ACPI_TYPE_PACKAGE */
514 TypeNeeded = ACPI_TYPE_PACKAGE;
515 break;
517 case ARGI_ANYTYPE:
519 /* Any operand type will do */
521 TypeNeeded = ACPI_TYPE_ANY;
522 break;
524 case ARGI_DDBHANDLE:
526 /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
528 TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
529 break;
533 * The more complex cases allow multiple resolved object types
535 case ARGI_INTEGER:
538 * Need an operand of type ACPI_TYPE_INTEGER, but we can
539 * implicitly convert from a STRING or BUFFER.
541 * Known as "Implicit Source Operand Conversion"
543 Status = AcpiExConvertToInteger (ObjDesc, StackPtr,
544 ACPI_IMPLICIT_CONVERSION);
545 if (ACPI_FAILURE (Status))
547 if (Status == AE_TYPE)
549 ACPI_ERROR ((AE_INFO,
550 "Needed [Integer/String/Buffer], found [%s] %p",
551 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
553 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
556 return_ACPI_STATUS (Status);
559 if (ObjDesc != *StackPtr)
561 AcpiUtRemoveReference (ObjDesc);
563 goto NextOperand;
565 case ARGI_BUFFER:
567 * Need an operand of type ACPI_TYPE_BUFFER,
568 * But we can implicitly convert from a STRING or INTEGER
569 * Aka - "Implicit Source Operand Conversion"
571 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
572 if (ACPI_FAILURE (Status))
574 if (Status == AE_TYPE)
576 ACPI_ERROR ((AE_INFO,
577 "Needed [Integer/String/Buffer], found [%s] %p",
578 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
580 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
583 return_ACPI_STATUS (Status);
586 if (ObjDesc != *StackPtr)
588 AcpiUtRemoveReference (ObjDesc);
590 goto NextOperand;
592 case ARGI_STRING:
594 * Need an operand of type ACPI_TYPE_STRING,
595 * But we can implicitly convert from a BUFFER or INTEGER
596 * Aka - "Implicit Source Operand Conversion"
598 Status = AcpiExConvertToString (
599 ObjDesc, StackPtr, ACPI_IMPLICIT_CONVERT_HEX);
600 if (ACPI_FAILURE (Status))
602 if (Status == AE_TYPE)
604 ACPI_ERROR ((AE_INFO,
605 "Needed [Integer/String/Buffer], found [%s] %p",
606 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
608 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
611 return_ACPI_STATUS (Status);
614 if (ObjDesc != *StackPtr)
616 AcpiUtRemoveReference (ObjDesc);
618 goto NextOperand;
620 case ARGI_COMPUTEDATA:
622 /* Need an operand of type INTEGER, STRING or BUFFER */
624 switch (ObjDesc->Common.Type)
626 case ACPI_TYPE_INTEGER:
627 case ACPI_TYPE_STRING:
628 case ACPI_TYPE_BUFFER:
630 /* Valid operand */
631 break;
633 default:
634 ACPI_ERROR ((AE_INFO,
635 "Needed [Integer/String/Buffer], found [%s] %p",
636 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
638 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
640 goto NextOperand;
642 case ARGI_BUFFER_OR_STRING:
644 /* Need an operand of type STRING or BUFFER */
646 switch (ObjDesc->Common.Type)
648 case ACPI_TYPE_STRING:
649 case ACPI_TYPE_BUFFER:
651 /* Valid operand */
652 break;
654 case ACPI_TYPE_INTEGER:
656 /* Highest priority conversion is to type Buffer */
658 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
659 if (ACPI_FAILURE (Status))
661 return_ACPI_STATUS (Status);
664 if (ObjDesc != *StackPtr)
666 AcpiUtRemoveReference (ObjDesc);
668 break;
670 default:
671 ACPI_ERROR ((AE_INFO,
672 "Needed [Integer/String/Buffer], found [%s] %p",
673 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
675 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
677 goto NextOperand;
679 case ARGI_DATAOBJECT:
681 * ARGI_DATAOBJECT is only used by the SizeOf operator.
682 * Need a buffer, string, package, or RefOf reference.
684 * The only reference allowed here is a direct reference to
685 * a namespace node.
687 switch (ObjDesc->Common.Type)
689 case ACPI_TYPE_PACKAGE:
690 case ACPI_TYPE_STRING:
691 case ACPI_TYPE_BUFFER:
692 case ACPI_TYPE_LOCAL_REFERENCE:
694 /* Valid operand */
695 break;
697 default:
699 ACPI_ERROR ((AE_INFO,
700 "Needed [Buffer/String/Package/Reference], found [%s] %p",
701 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
703 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
705 goto NextOperand;
707 case ARGI_COMPLEXOBJ:
709 /* Need a buffer or package or (ACPI 2.0) String */
711 switch (ObjDesc->Common.Type)
713 case ACPI_TYPE_PACKAGE:
714 case ACPI_TYPE_STRING:
715 case ACPI_TYPE_BUFFER:
717 /* Valid operand */
718 break;
720 default:
722 ACPI_ERROR ((AE_INFO,
723 "Needed [Buffer/String/Package], found [%s] %p",
724 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
726 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
728 goto NextOperand;
730 case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
733 * Need an operand of type REGION or a BUFFER
734 * (which could be a resolved region field)
736 switch (ObjDesc->Common.Type)
738 case ACPI_TYPE_BUFFER:
739 case ACPI_TYPE_REGION:
741 /* Valid operand */
742 break;
744 default:
746 ACPI_ERROR ((AE_INFO,
747 "Needed [Region/Buffer], found [%s] %p",
748 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
750 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
752 goto NextOperand;
754 case ARGI_DATAREFOBJ:
756 /* Used by the Store() operator only */
758 switch (ObjDesc->Common.Type)
760 case ACPI_TYPE_INTEGER:
761 case ACPI_TYPE_PACKAGE:
762 case ACPI_TYPE_STRING:
763 case ACPI_TYPE_BUFFER:
764 case ACPI_TYPE_BUFFER_FIELD:
765 case ACPI_TYPE_LOCAL_REFERENCE:
766 case ACPI_TYPE_LOCAL_REGION_FIELD:
767 case ACPI_TYPE_LOCAL_BANK_FIELD:
768 case ACPI_TYPE_LOCAL_INDEX_FIELD:
769 case ACPI_TYPE_DDB_HANDLE:
771 /* Valid operand */
772 break;
774 default:
776 if (AcpiGbl_EnableInterpreterSlack)
779 * Enable original behavior of Store(), allowing any
780 * and all objects as the source operand. The ACPI
781 * spec does not allow this, however.
783 break;
786 if (TargetOp == AML_DEBUG_OP)
788 /* Allow store of any object to the Debug object */
790 break;
793 ACPI_ERROR ((AE_INFO,
794 "Needed Integer/Buffer/String/Package/Ref/Ddb]"
795 ", found [%s] %p",
796 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
798 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
800 goto NextOperand;
802 default:
804 /* Unknown type */
806 ACPI_ERROR ((AE_INFO,
807 "Internal - Unknown ARGI (required operand) type 0x%X",
808 ThisArgType));
810 return_ACPI_STATUS (AE_BAD_PARAMETER);
814 * Make sure that the original object was resolved to the
815 * required object type (Simple cases only).
817 Status = AcpiExCheckObjectType (
818 TypeNeeded, (*StackPtr)->Common.Type, *StackPtr);
819 if (ACPI_FAILURE (Status))
821 return_ACPI_STATUS (Status);
824 NextOperand:
826 * If more operands needed, decrement StackPtr to point
827 * to next operand on stack
829 if (GET_CURRENT_ARG_TYPE (ArgTypes))
831 StackPtr--;
835 ACPI_DUMP_OPERANDS (WalkState->Operands,
836 AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
838 return_ACPI_STATUS (Status);