1 /****************************************************************************** 2 * 3 * Module Name: dswexec - Dispatcher method execution callbacks; 4 * dispatch to interpreter. 5 * 6 *****************************************************************************/ 7 8 /****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117 #include "acpi.h" 118 #include "accommon.h" 119 #include "acparser.h" 120 #include "amlcode.h" 121 #include "acdispat.h" 122 #include "acinterp.h" 123 #include "acnamesp.h" 124 #include "acdebug.h" 125 126 127 #define _COMPONENT ACPI_DISPATCHER 128 ACPI_MODULE_NAME ("dswexec") 129 130 /* 131 * Dispatch table for opcode classes 132 */ 133 static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = 134 { 135 AcpiExOpcode_0A_0T_1R, 136 AcpiExOpcode_1A_0T_0R, 137 AcpiExOpcode_1A_0T_1R, 138 AcpiExOpcode_1A_1T_0R, 139 AcpiExOpcode_1A_1T_1R, 140 AcpiExOpcode_2A_0T_0R, 141 AcpiExOpcode_2A_0T_1R, 142 AcpiExOpcode_2A_1T_1R, 143 AcpiExOpcode_2A_2T_1R, 144 AcpiExOpcode_3A_0T_0R, 145 AcpiExOpcode_3A_1T_1R, 146 AcpiExOpcode_6A_0T_1R 147 }; 148 149 150 /***************************************************************************** 151 * 152 * FUNCTION: AcpiDsGetPredicateValue 153 * 154 * PARAMETERS: WalkState - Current state of the parse tree walk 155 * ResultObj - if non-zero, pop result from result stack 156 * 157 * RETURN: Status 158 * 159 * DESCRIPTION: Get the result of a predicate evaluation 160 * 161 ****************************************************************************/ 162 163 ACPI_STATUS 164 AcpiDsGetPredicateValue ( 165 ACPI_WALK_STATE *WalkState, 166 ACPI_OPERAND_OBJECT *ResultObj) 167 { 168 ACPI_STATUS Status = AE_OK; 169 ACPI_OPERAND_OBJECT *ObjDesc; 170 ACPI_OPERAND_OBJECT *LocalObjDesc = NULL; 171 172 173 ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState); 174 175 176 WalkState->ControlState->Common.State = 0; 177 178 if (ResultObj) 179 { 180 Status = AcpiDsResultPop (&ObjDesc, WalkState); 181 if (ACPI_FAILURE (Status)) 182 { 183 ACPI_EXCEPTION ((AE_INFO, Status, 184 "Could not get result from predicate evaluation")); 185 186 return_ACPI_STATUS (Status); 187 } 188 } 189 else 190 { 191 Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0); 192 if (ACPI_FAILURE (Status)) 193 { 194 return_ACPI_STATUS (Status); 195 } 196 197 Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); 198 if (ACPI_FAILURE (Status)) 199 { 200 return_ACPI_STATUS (Status); 201 } 202 203 ObjDesc = WalkState->Operands [0]; 204 } 205 206 if (!ObjDesc) 207 { 208 ACPI_ERROR ((AE_INFO, 209 "No predicate ObjDesc=%p State=%p", 210 ObjDesc, WalkState)); 211 212 return_ACPI_STATUS (AE_AML_NO_OPERAND); 213 } 214 215 /* 216 * Result of predicate evaluation must be an Integer 217 * object. Implicitly convert the argument if necessary. 218 */ 219 Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16); 220 if (ACPI_FAILURE (Status)) 221 { 222 goto Cleanup; 223 } 224 225 if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER) 226 { 227 ACPI_ERROR ((AE_INFO, 228 "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X", 229 ObjDesc, WalkState, ObjDesc->Common.Type)); 230 231 Status = AE_AML_OPERAND_TYPE; 232 goto Cleanup; 233 } 234 235 /* Truncate the predicate to 32-bits if necessary */ 236 237 (void) AcpiExTruncateFor32bitTable (LocalObjDesc); 238 239 /* 240 * Save the result of the predicate evaluation on 241 * the control stack 242 */ 243 if (LocalObjDesc->Integer.Value) 244 { 245 WalkState->ControlState->Common.Value = TRUE; 246 } 247 else 248 { 249 /* 250 * Predicate is FALSE, we will just toss the 251 * rest of the package 252 */ 253 WalkState->ControlState->Common.Value = FALSE; 254 Status = AE_CTRL_FALSE; 255 } 256 257 /* Predicate can be used for an implicit return value */ 258 259 (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE); 260 261 262 Cleanup: 263 264 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 265 "Completed a predicate eval=%X Op=%p\n", 266 WalkState->ControlState->Common.Value, WalkState->Op)); 267 268 /* Break to debugger to display result */ 269 270 AcpiDbDisplayResultObject (LocalObjDesc, WalkState); 271 272 /* 273 * Delete the predicate result object (we know that 274 * we don't need it anymore) 275 */ 276 if (LocalObjDesc != ObjDesc) 277 { 278 AcpiUtRemoveReference (LocalObjDesc); 279 } 280 AcpiUtRemoveReference (ObjDesc); 281 282 WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL; 283 return_ACPI_STATUS (Status); 284 } 285 286 287 /***************************************************************************** 288 * 289 * FUNCTION: AcpiDsExecBeginOp 290 * 291 * PARAMETERS: WalkState - Current state of the parse tree walk 292 * OutOp - Where to return op if a new one is created 293 * 294 * RETURN: Status 295 * 296 * DESCRIPTION: Descending callback used during the execution of control 297 * methods. This is where most operators and operands are 298 * dispatched to the interpreter. 299 * 300 ****************************************************************************/ 301 302 ACPI_STATUS 303 AcpiDsExecBeginOp ( 304 ACPI_WALK_STATE *WalkState, 305 ACPI_PARSE_OBJECT **OutOp) 306 { 307 ACPI_PARSE_OBJECT *Op; 308 ACPI_STATUS Status = AE_OK; 309 UINT32 OpcodeClass; 310 311 312 ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState); 313 314 315 Op = WalkState->Op; 316 if (!Op) 317 { 318 Status = AcpiDsLoad2BeginOp (WalkState, OutOp); 319 if (ACPI_FAILURE (Status)) 320 { 321 goto ErrorExit; 322 } 323 324 Op = *OutOp; 325 WalkState->Op = Op; 326 WalkState->Opcode = Op->Common.AmlOpcode; 327 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 328 329 if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType)) 330 { 331 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 332 "(%s) Popping scope for Op %p\n", 333 AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op)); 334 335 Status = AcpiDsScopeStackPop (WalkState); 336 if (ACPI_FAILURE (Status)) 337 { 338 goto ErrorExit; 339 } 340 } 341 } 342 343 if (Op == WalkState->Origin) 344 { 345 if (OutOp) 346 { 347 *OutOp = Op; 348 } 349 350 return_ACPI_STATUS (AE_OK); 351 } 352 353 /* 354 * If the previous opcode was a conditional, this opcode 355 * must be the beginning of the associated predicate. 356 * Save this knowledge in the current scope descriptor 357 */ 358 if ((WalkState->ControlState) && 359 (WalkState->ControlState->Common.State == 360 ACPI_CONTROL_CONDITIONAL_EXECUTING)) 361 { 362 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 363 "Exec predicate Op=%p State=%p\n", 364 Op, WalkState)); 365 366 WalkState->ControlState->Common.State = 367 ACPI_CONTROL_PREDICATE_EXECUTING; 368 369 /* Save start of predicate */ 370 371 WalkState->ControlState->Control.PredicateOp = Op; 372 } 373 374 375 OpcodeClass = WalkState->OpInfo->Class; 376 377 /* We want to send namepaths to the load code */ 378 379 if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) 380 { 381 OpcodeClass = AML_CLASS_NAMED_OBJECT; 382 } 383 384 /* 385 * Handle the opcode based upon the opcode type 386 */ 387 switch (OpcodeClass) 388 { 389 case AML_CLASS_CONTROL: 390 391 Status = AcpiDsExecBeginControlOp (WalkState, Op); 392 break; 393 394 case AML_CLASS_NAMED_OBJECT: 395 396 if (WalkState->WalkType & ACPI_WALK_METHOD) 397 { 398 /* 399 * Found a named object declaration during method execution; 400 * we must enter this object into the namespace. The created 401 * object is temporary and will be deleted upon completion of 402 * the execution of this method. 403 * 404 * Note 10/2010: Except for the Scope() op. This opcode does 405 * not actually create a new object, it refers to an existing 406 * object. However, for Scope(), we want to indeed open a 407 * new scope. 408 */ 409 if (Op->Common.AmlOpcode != AML_SCOPE_OP) 410 { 411 Status = AcpiDsLoad2BeginOp (WalkState, NULL); 412 } 413 else 414 { 415 Status = AcpiDsScopeStackPush ( 416 Op->Named.Node, Op->Named.Node->Type, WalkState); 417 if (ACPI_FAILURE (Status)) 418 { 419 return_ACPI_STATUS (Status); 420 } 421 } 422 } 423 break; 424 425 case AML_CLASS_EXECUTE: 426 case AML_CLASS_CREATE: 427 428 break; 429 430 default: 431 432 break; 433 } 434 435 /* Nothing to do here during method execution */ 436 437 return_ACPI_STATUS (Status); 438 439 440 ErrorExit: 441 Status = AcpiDsMethodError (Status, WalkState); 442 return_ACPI_STATUS (Status); 443 } 444 445 446 /***************************************************************************** 447 * 448 * FUNCTION: AcpiDsExecEndOp 449 * 450 * PARAMETERS: WalkState - Current state of the parse tree walk 451 * 452 * RETURN: Status 453 * 454 * DESCRIPTION: Ascending callback used during the execution of control 455 * methods. The only thing we really need to do here is to 456 * notice the beginning of IF, ELSE, and WHILE blocks. 457 * 458 ****************************************************************************/ 459 460 ACPI_STATUS 461 AcpiDsExecEndOp ( 462 ACPI_WALK_STATE *WalkState) 463 { 464 ACPI_PARSE_OBJECT *Op; 465 ACPI_STATUS Status = AE_OK; 466 UINT32 OpType; 467 UINT32 OpClass; 468 ACPI_PARSE_OBJECT *NextOp; 469 ACPI_PARSE_OBJECT *FirstArg; 470 471 472 ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState); 473 474 475 Op = WalkState->Op; 476 OpType = WalkState->OpInfo->Type; 477 OpClass = WalkState->OpInfo->Class; 478 479 if (OpClass == AML_CLASS_UNKNOWN) 480 { 481 ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode)); 482 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 483 } 484 485 FirstArg = Op->Common.Value.Arg; 486 487 /* Init the walk state */ 488 489 WalkState->NumOperands = 0; 490 WalkState->OperandIndex = 0; 491 WalkState->ReturnDesc = NULL; 492 WalkState->ResultObj = NULL; 493 494 /* Call debugger for single step support (DEBUG build only) */ 495 496 Status = AcpiDbSingleStep (WalkState, Op, OpClass); 497 if (ACPI_FAILURE (Status)) 498 { 499 return_ACPI_STATUS (Status); 500 } 501 502 /* Decode the Opcode Class */ 503 504 switch (OpClass) 505 { 506 case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ 507 508 if (WalkState->Opcode == AML_INT_NAMEPATH_OP) 509 { 510 Status = AcpiDsEvaluateNamePath (WalkState); 511 if (ACPI_FAILURE (Status)) 512 { 513 goto Cleanup; 514 } 515 } 516 break; 517 518 case AML_CLASS_EXECUTE: /* Most operators with arguments */ 519 520 /* Build resolved operand stack */ 521 522 Status = AcpiDsCreateOperands (WalkState, FirstArg); 523 if (ACPI_FAILURE (Status)) 524 { 525 goto Cleanup; 526 } 527 528 /* 529 * All opcodes require operand resolution, with the only exceptions 530 * being the ObjectType and SizeOf operators. 531 */ 532 if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE)) 533 { 534 /* Resolve all operands */ 535 536 Status = AcpiExResolveOperands (WalkState->Opcode, 537 &(WalkState->Operands [WalkState->NumOperands -1]), 538 WalkState); 539 } 540 541 if (ACPI_SUCCESS (Status)) 542 { 543 /* 544 * Dispatch the request to the appropriate interpreter handler 545 * routine. There is one routine per opcode "type" based upon the 546 * number of opcode arguments and return type. 547 */ 548 Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState); 549 } 550 else 551 { 552 /* 553 * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the 554 * Local is uninitialized. 555 */ 556 if ((Status == AE_AML_UNINITIALIZED_LOCAL) && 557 (WalkState->Opcode == AML_STORE_OP) && 558 (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && 559 (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && 560 (WalkState->Operands[0]->Reference.Class == 561 WalkState->Operands[1]->Reference.Class) && 562 (WalkState->Operands[0]->Reference.Value == 563 WalkState->Operands[1]->Reference.Value)) 564 { 565 Status = AE_OK; 566 } 567 else 568 { 569 ACPI_EXCEPTION ((AE_INFO, Status, 570 "While resolving operands for [%s]", 571 AcpiPsGetOpcodeName (WalkState->Opcode))); 572 } 573 } 574 575 /* Always delete the argument objects and clear the operand stack */ 576 577 AcpiDsClearOperands (WalkState); 578 579 /* 580 * If a result object was returned from above, push it on the 581 * current result stack 582 */ 583 if (ACPI_SUCCESS (Status) && 584 WalkState->ResultObj) 585 { 586 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); 587 } 588 break; 589 590 default: 591 592 switch (OpType) 593 { 594 case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ 595 596 /* 1 Operand, 0 ExternalResult, 0 InternalResult */ 597 598 Status = AcpiDsExecEndControlOp (WalkState, Op); 599 600 break; 601 602 case AML_TYPE_METHOD_CALL: 603 /* 604 * If the method is referenced from within a package 605 * declaration, it is not a invocation of the method, just 606 * a reference to it. 607 */ 608 if ((Op->Asl.Parent) && 609 ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) || 610 (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))) 611 { 612 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 613 "Method Reference in a Package, Op=%p\n", Op)); 614 615 Op->Common.Node = (ACPI_NAMESPACE_NODE *) 616 Op->Asl.Value.Arg->Asl.Node; 617 AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); 618 return_ACPI_STATUS (AE_OK); 619 } 620 621 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 622 "Method invocation, Op=%p\n", Op)); 623 624 /* 625 * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains 626 * the method Node pointer 627 */ 628 /* NextOp points to the op that holds the method name */ 629 630 NextOp = FirstArg; 631 632 /* NextOp points to first argument op */ 633 634 NextOp = NextOp->Common.Next; 635 636 /* 637 * Get the method's arguments and put them on the operand stack 638 */ 639 Status = AcpiDsCreateOperands (WalkState, NextOp); 640 if (ACPI_FAILURE (Status)) 641 { 642 break; 643 } 644 645 /* 646 * Since the operands will be passed to another control method, 647 * we must resolve all local references here (Local variables, 648 * arguments to *this* method, etc.) 649 */ 650 Status = AcpiDsResolveOperands (WalkState); 651 if (ACPI_FAILURE (Status)) 652 { 653 /* On error, clear all resolved operands */ 654 655 AcpiDsClearOperands (WalkState); 656 break; 657 } 658 659 /* 660 * Tell the walk loop to preempt this running method and 661 * execute the new method 662 */ 663 Status = AE_CTRL_TRANSFER; 664 665 /* 666 * Return now; we don't want to disturb anything, 667 * especially the operand count! 668 */ 669 return_ACPI_STATUS (Status); 670 671 case AML_TYPE_CREATE_FIELD: 672 673 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 674 "Executing CreateField Buffer/Index Op=%p\n", Op)); 675 676 Status = AcpiDsLoad2EndOp (WalkState); 677 if (ACPI_FAILURE (Status)) 678 { 679 break; 680 } 681 682 Status = AcpiDsEvalBufferFieldOperands (WalkState, Op); 683 break; 684 685 686 case AML_TYPE_CREATE_OBJECT: 687 688 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 689 "Executing CreateObject (Buffer/Package) Op=%p\n", Op)); 690 691 switch (Op->Common.Parent->Common.AmlOpcode) 692 { 693 case AML_NAME_OP: 694 /* 695 * Put the Node on the object stack (Contains the ACPI Name 696 * of this object) 697 */ 698 WalkState->Operands[0] = (void *) 699 Op->Common.Parent->Common.Node; 700 WalkState->NumOperands = 1; 701 702 Status = AcpiDsCreateNode (WalkState, 703 Op->Common.Parent->Common.Node, Op->Common.Parent); 704 if (ACPI_FAILURE (Status)) 705 { 706 break; 707 } 708 709 /* Fall through */ 710 /*lint -fallthrough */ 711 712 case AML_INT_EVAL_SUBTREE_OP: 713 714 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, 715 AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); 716 break; 717 718 default: 719 720 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL); 721 break; 722 } 723 724 /* 725 * If a result object was returned from above, push it on the 726 * current result stack 727 */ 728 if (WalkState->ResultObj) 729 { 730 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); 731 } 732 break; 733 734 case AML_TYPE_NAMED_FIELD: 735 case AML_TYPE_NAMED_COMPLEX: 736 case AML_TYPE_NAMED_SIMPLE: 737 case AML_TYPE_NAMED_NO_OBJ: 738 739 Status = AcpiDsLoad2EndOp (WalkState); 740 if (ACPI_FAILURE (Status)) 741 { 742 break; 743 } 744 745 if (Op->Common.AmlOpcode == AML_REGION_OP) 746 { 747 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 748 "Executing OpRegion Address/Length Op=%p\n", Op)); 749 750 Status = AcpiDsEvalRegionOperands (WalkState, Op); 751 if (ACPI_FAILURE (Status)) 752 { 753 break; 754 } 755 } 756 else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) 757 { 758 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 759 "Executing DataTableRegion Strings Op=%p\n", Op)); 760 761 Status = AcpiDsEvalTableRegionOperands (WalkState, Op); 762 if (ACPI_FAILURE (Status)) 763 { 764 break; 765 } 766 } 767 else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) 768 { 769 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 770 "Executing BankField Op=%p\n", Op)); 771 772 Status = AcpiDsEvalBankFieldOperands (WalkState, Op); 773 if (ACPI_FAILURE (Status)) 774 { 775 break; 776 } 777 } 778 break; 779 780 case AML_TYPE_UNDEFINED: 781 782 ACPI_ERROR ((AE_INFO, 783 "Undefined opcode type Op=%p", Op)); 784 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 785 786 case AML_TYPE_BOGUS: 787 788 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 789 "Internal opcode=%X type Op=%p\n", 790 WalkState->Opcode, Op)); 791 break; 792 793 default: 794 795 ACPI_ERROR ((AE_INFO, 796 "Unimplemented opcode, class=0x%X " 797 "type=0x%X Opcode=0x%X Op=%p", 798 OpClass, OpType, Op->Common.AmlOpcode, Op)); 799 800 Status = AE_NOT_IMPLEMENTED; 801 break; 802 } 803 } 804 805 /* 806 * ACPI 2.0 support for 64-bit integers: Truncate numeric 807 * result value if we are executing from a 32-bit ACPI table 808 */ 809 (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj); 810 811 /* 812 * Check if we just completed the evaluation of a 813 * conditional predicate 814 */ 815 if ((ACPI_SUCCESS (Status)) && 816 (WalkState->ControlState) && 817 (WalkState->ControlState->Common.State == 818 ACPI_CONTROL_PREDICATE_EXECUTING) && 819 (WalkState->ControlState->Control.PredicateOp == Op)) 820 { 821 Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj); 822 WalkState->ResultObj = NULL; 823 } 824 825 826 Cleanup: 827 828 if (WalkState->ResultObj) 829 { 830 /* Break to debugger to display result */ 831 832 AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState); 833 834 /* 835 * Delete the result op if and only if: 836 * Parent will not use the result -- such as any 837 * non-nested type2 op in a method (parent will be method) 838 */ 839 AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState); 840 } 841 842 #ifdef _UNDER_DEVELOPMENT 843 844 if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd) 845 { 846 AcpiDbMethodEnd (WalkState); 847 } 848 #endif 849 850 /* Invoke exception handler on error */ 851 852 if (ACPI_FAILURE (Status)) 853 { 854 Status = AcpiDsMethodError (Status, WalkState); 855 } 856 857 /* Always clear the object stack */ 858 859 WalkState->NumOperands = 0; 860 return_ACPI_STATUS (Status); 861 } 862