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