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