Sync ACPICA with Intel's version 20180508 (from previously 20170831).
[dragonfly.git] / sys / contrib / dev / acpica / source / components / executer / exresop.c
blob7fd24535148384138913c08a9a3c2ee62311de4e
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 - 2018, 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_FIXED_TARGET: /* No implicit conversion before store to target */
433 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
434 case ARGI_STORE_TARGET:
437 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
438 * A Namespace Node is OK as-is
440 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
442 goto NextOperand;
445 Status = AcpiExCheckObjectType (
446 ACPI_TYPE_LOCAL_REFERENCE, ObjectType, ObjDesc);
447 if (ACPI_FAILURE (Status))
449 return_ACPI_STATUS (Status);
451 goto NextOperand;
453 case ARGI_DATAREFOBJ: /* Store operator only */
455 * We don't want to resolve IndexOp reference objects during
456 * a store because this would be an implicit DeRefOf operation.
457 * Instead, we just want to store the reference object.
458 * -- All others must be resolved below.
460 if ((Opcode == AML_STORE_OP) &&
461 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
462 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
464 goto NextOperand;
466 break;
468 default:
470 /* All cases covered above */
472 break;
476 * Resolve this object to a value
478 Status = AcpiExResolveToValue (StackPtr, WalkState);
479 if (ACPI_FAILURE (Status))
481 return_ACPI_STATUS (Status);
484 /* Get the resolved object */
486 ObjDesc = *StackPtr;
489 * Check the resulting object (value) type
491 switch (ThisArgType)
494 * For the simple cases, only one type of resolved object
495 * is allowed
497 case ARGI_MUTEX:
499 /* Need an operand of type ACPI_TYPE_MUTEX */
501 TypeNeeded = ACPI_TYPE_MUTEX;
502 break;
504 case ARGI_EVENT:
506 /* Need an operand of type ACPI_TYPE_EVENT */
508 TypeNeeded = ACPI_TYPE_EVENT;
509 break;
511 case ARGI_PACKAGE: /* Package */
513 /* Need an operand of type ACPI_TYPE_PACKAGE */
515 TypeNeeded = ACPI_TYPE_PACKAGE;
516 break;
518 case ARGI_ANYTYPE:
520 /* Any operand type will do */
522 TypeNeeded = ACPI_TYPE_ANY;
523 break;
525 case ARGI_DDBHANDLE:
527 /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
529 TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
530 break;
534 * The more complex cases allow multiple resolved object types
536 case ARGI_INTEGER:
539 * Need an operand of type ACPI_TYPE_INTEGER, but we can
540 * implicitly convert from a STRING or BUFFER.
542 * Known as "Implicit Source Operand Conversion"
544 Status = AcpiExConvertToInteger (ObjDesc, StackPtr,
545 ACPI_IMPLICIT_CONVERSION);
546 if (ACPI_FAILURE (Status))
548 if (Status == AE_TYPE)
550 ACPI_ERROR ((AE_INFO,
551 "Needed [Integer/String/Buffer], found [%s] %p",
552 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
554 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
557 return_ACPI_STATUS (Status);
560 if (ObjDesc != *StackPtr)
562 AcpiUtRemoveReference (ObjDesc);
564 goto NextOperand;
566 case ARGI_BUFFER:
568 * Need an operand of type ACPI_TYPE_BUFFER,
569 * But we can implicitly convert from a STRING or INTEGER
570 * Aka - "Implicit Source Operand Conversion"
572 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
573 if (ACPI_FAILURE (Status))
575 if (Status == AE_TYPE)
577 ACPI_ERROR ((AE_INFO,
578 "Needed [Integer/String/Buffer], found [%s] %p",
579 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
581 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
584 return_ACPI_STATUS (Status);
587 if (ObjDesc != *StackPtr)
589 AcpiUtRemoveReference (ObjDesc);
591 goto NextOperand;
593 case ARGI_STRING:
595 * Need an operand of type ACPI_TYPE_STRING,
596 * But we can implicitly convert from a BUFFER or INTEGER
597 * Aka - "Implicit Source Operand Conversion"
599 Status = AcpiExConvertToString (
600 ObjDesc, StackPtr, ACPI_IMPLICIT_CONVERT_HEX);
601 if (ACPI_FAILURE (Status))
603 if (Status == AE_TYPE)
605 ACPI_ERROR ((AE_INFO,
606 "Needed [Integer/String/Buffer], found [%s] %p",
607 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
609 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
612 return_ACPI_STATUS (Status);
615 if (ObjDesc != *StackPtr)
617 AcpiUtRemoveReference (ObjDesc);
619 goto NextOperand;
621 case ARGI_COMPUTEDATA:
623 /* Need an operand of type INTEGER, STRING or BUFFER */
625 switch (ObjDesc->Common.Type)
627 case ACPI_TYPE_INTEGER:
628 case ACPI_TYPE_STRING:
629 case ACPI_TYPE_BUFFER:
631 /* Valid operand */
632 break;
634 default:
635 ACPI_ERROR ((AE_INFO,
636 "Needed [Integer/String/Buffer], found [%s] %p",
637 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
639 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
641 goto NextOperand;
643 case ARGI_BUFFER_OR_STRING:
645 /* Need an operand of type STRING or BUFFER */
647 switch (ObjDesc->Common.Type)
649 case ACPI_TYPE_STRING:
650 case ACPI_TYPE_BUFFER:
652 /* Valid operand */
653 break;
655 case ACPI_TYPE_INTEGER:
657 /* Highest priority conversion is to type Buffer */
659 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
660 if (ACPI_FAILURE (Status))
662 return_ACPI_STATUS (Status);
665 if (ObjDesc != *StackPtr)
667 AcpiUtRemoveReference (ObjDesc);
669 break;
671 default:
672 ACPI_ERROR ((AE_INFO,
673 "Needed [Integer/String/Buffer], found [%s] %p",
674 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
676 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
678 goto NextOperand;
680 case ARGI_DATAOBJECT:
682 * ARGI_DATAOBJECT is only used by the SizeOf operator.
683 * Need a buffer, string, package, or RefOf reference.
685 * The only reference allowed here is a direct reference to
686 * a namespace node.
688 switch (ObjDesc->Common.Type)
690 case ACPI_TYPE_PACKAGE:
691 case ACPI_TYPE_STRING:
692 case ACPI_TYPE_BUFFER:
693 case ACPI_TYPE_LOCAL_REFERENCE:
695 /* Valid operand */
696 break;
698 default:
700 ACPI_ERROR ((AE_INFO,
701 "Needed [Buffer/String/Package/Reference], found [%s] %p",
702 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
704 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
706 goto NextOperand;
708 case ARGI_COMPLEXOBJ:
710 /* Need a buffer or package or (ACPI 2.0) String */
712 switch (ObjDesc->Common.Type)
714 case ACPI_TYPE_PACKAGE:
715 case ACPI_TYPE_STRING:
716 case ACPI_TYPE_BUFFER:
718 /* Valid operand */
719 break;
721 default:
723 ACPI_ERROR ((AE_INFO,
724 "Needed [Buffer/String/Package], found [%s] %p",
725 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
727 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
729 goto NextOperand;
731 case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
734 * Need an operand of type REGION or a BUFFER
735 * (which could be a resolved region field)
737 switch (ObjDesc->Common.Type)
739 case ACPI_TYPE_BUFFER:
740 case ACPI_TYPE_REGION:
742 /* Valid operand */
743 break;
745 default:
747 ACPI_ERROR ((AE_INFO,
748 "Needed [Region/Buffer], found [%s] %p",
749 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
751 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
753 goto NextOperand;
755 case ARGI_DATAREFOBJ:
757 /* Used by the Store() operator only */
759 switch (ObjDesc->Common.Type)
761 case ACPI_TYPE_INTEGER:
762 case ACPI_TYPE_PACKAGE:
763 case ACPI_TYPE_STRING:
764 case ACPI_TYPE_BUFFER:
765 case ACPI_TYPE_BUFFER_FIELD:
766 case ACPI_TYPE_LOCAL_REFERENCE:
767 case ACPI_TYPE_LOCAL_REGION_FIELD:
768 case ACPI_TYPE_LOCAL_BANK_FIELD:
769 case ACPI_TYPE_LOCAL_INDEX_FIELD:
770 case ACPI_TYPE_DDB_HANDLE:
772 /* Valid operand */
773 break;
775 default:
777 if (AcpiGbl_EnableInterpreterSlack)
780 * Enable original behavior of Store(), allowing any
781 * and all objects as the source operand. The ACPI
782 * spec does not allow this, however.
784 break;
787 if (TargetOp == AML_DEBUG_OP)
789 /* Allow store of any object to the Debug object */
791 break;
794 ACPI_ERROR ((AE_INFO,
795 "Needed Integer/Buffer/String/Package/Ref/Ddb]"
796 ", found [%s] %p",
797 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
799 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
801 goto NextOperand;
803 default:
805 /* Unknown type */
807 ACPI_ERROR ((AE_INFO,
808 "Internal - Unknown ARGI (required operand) type 0x%X",
809 ThisArgType));
811 return_ACPI_STATUS (AE_BAD_PARAMETER);
815 * Make sure that the original object was resolved to the
816 * required object type (Simple cases only).
818 Status = AcpiExCheckObjectType (
819 TypeNeeded, (*StackPtr)->Common.Type, *StackPtr);
820 if (ACPI_FAILURE (Status))
822 return_ACPI_STATUS (Status);
825 NextOperand:
827 * If more operands needed, decrement StackPtr to point
828 * to next operand on stack
830 if (GET_CURRENT_ARG_TYPE (ArgTypes))
832 StackPtr--;
836 ACPI_DUMP_OPERANDS (WalkState->Operands,
837 AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
839 return_ACPI_STATUS (Status);