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 - 2015, 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, "Completed a predicate eval=%X Op=%p\n", 265 WalkState->ControlState->Common.Value, WalkState->Op)); 266 267 /* Break to debugger to display result */ 268 269 ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState)); 270 271 /* 272 * Delete the predicate result object (we know that 273 * we don't need it anymore) 274 */ 275 if (LocalObjDesc != ObjDesc) 276 { 277 AcpiUtRemoveReference (LocalObjDesc); 278 } 279 AcpiUtRemoveReference (ObjDesc); 280 281 WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL; 282 return_ACPI_STATUS (Status); 283 } 284 285 286 /***************************************************************************** 287 * 288 * FUNCTION: AcpiDsExecBeginOp 289 * 290 * PARAMETERS: WalkState - Current state of the parse tree walk 291 * OutOp - Where to return op if a new one is created 292 * 293 * RETURN: Status 294 * 295 * DESCRIPTION: Descending callback used during the execution of control 296 * methods. This is where most operators and operands are 297 * dispatched to the interpreter. 298 * 299 ****************************************************************************/ 300 301 ACPI_STATUS 302 AcpiDsExecBeginOp ( 303 ACPI_WALK_STATE *WalkState, 304 ACPI_PARSE_OBJECT **OutOp) 305 { 306 ACPI_PARSE_OBJECT *Op; 307 ACPI_STATUS Status = AE_OK; 308 UINT32 OpcodeClass; 309 310 311 ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState); 312 313 314 Op = WalkState->Op; 315 if (!Op) 316 { 317 Status = AcpiDsLoad2BeginOp (WalkState, OutOp); 318 if (ACPI_FAILURE (Status)) 319 { 320 goto ErrorExit; 321 } 322 323 Op = *OutOp; 324 WalkState->Op = Op; 325 WalkState->Opcode = Op->Common.AmlOpcode; 326 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 327 328 if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType)) 329 { 330 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 331 "(%s) Popping scope for Op %p\n", 332 AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op)); 333 334 Status = AcpiDsScopeStackPop (WalkState); 335 if (ACPI_FAILURE (Status)) 336 { 337 goto ErrorExit; 338 } 339 } 340 } 341 342 if (Op == WalkState->Origin) 343 { 344 if (OutOp) 345 { 346 *OutOp = Op; 347 } 348 349 return_ACPI_STATUS (AE_OK); 350 } 351 352 /* 353 * If the previous opcode was a conditional, this opcode 354 * must be the beginning of the associated predicate. 355 * Save this knowledge in the current scope descriptor 356 */ 357 if ((WalkState->ControlState) && 358 (WalkState->ControlState->Common.State == 359 ACPI_CONTROL_CONDITIONAL_EXECUTING)) 360 { 361 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", 362 Op, WalkState)); 363 364 WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING; 365 366 /* Save start of predicate */ 367 368 WalkState->ControlState->Control.PredicateOp = Op; 369 } 370 371 372 OpcodeClass = WalkState->OpInfo->Class; 373 374 /* We want to send namepaths to the load code */ 375 376 if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) 377 { 378 OpcodeClass = AML_CLASS_NAMED_OBJECT; 379 } 380 381 /* 382 * Handle the opcode based upon the opcode type 383 */ 384 switch (OpcodeClass) 385 { 386 case AML_CLASS_CONTROL: 387 388 Status = AcpiDsExecBeginControlOp (WalkState, Op); 389 break; 390 391 case AML_CLASS_NAMED_OBJECT: 392 393 if (WalkState->WalkType & ACPI_WALK_METHOD) 394 { 395 /* 396 * Found a named object declaration during method execution; 397 * we must enter this object into the namespace. The created 398 * object is temporary and will be deleted upon completion of 399 * the execution of this method. 400 * 401 * Note 10/2010: Except for the Scope() op. This opcode does 402 * not actually create a new object, it refers to an existing 403 * object. However, for Scope(), we want to indeed open a 404 * new scope. 405 */ 406 if (Op->Common.AmlOpcode != AML_SCOPE_OP) 407 { 408 Status = AcpiDsLoad2BeginOp (WalkState, NULL); 409 } 410 else 411 { 412 Status = AcpiDsScopeStackPush (Op->Named.Node, 413 Op->Named.Node->Type, WalkState); 414 if (ACPI_FAILURE (Status)) 415 { 416 return_ACPI_STATUS (Status); 417 } 418 } 419 } 420 break; 421 422 case AML_CLASS_EXECUTE: 423 case AML_CLASS_CREATE: 424 425 break; 426 427 default: 428 429 break; 430 } 431 432 /* Nothing to do here during method execution */ 433 434 return_ACPI_STATUS (Status); 435 436 437 ErrorExit: 438 Status = AcpiDsMethodError (Status, WalkState); 439 return_ACPI_STATUS (Status); 440 } 441 442 443 /***************************************************************************** 444 * 445 * FUNCTION: AcpiDsExecEndOp 446 * 447 * PARAMETERS: WalkState - Current state of the parse tree walk 448 * 449 * RETURN: Status 450 * 451 * DESCRIPTION: Ascending callback used during the execution of control 452 * methods. The only thing we really need to do here is to 453 * notice the beginning of IF, ELSE, and WHILE blocks. 454 * 455 ****************************************************************************/ 456 457 ACPI_STATUS 458 AcpiDsExecEndOp ( 459 ACPI_WALK_STATE *WalkState) 460 { 461 ACPI_PARSE_OBJECT *Op; 462 ACPI_STATUS Status = AE_OK; 463 UINT32 OpType; 464 UINT32 OpClass; 465 ACPI_PARSE_OBJECT *NextOp; 466 ACPI_PARSE_OBJECT *FirstArg; 467 468 469 ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState); 470 471 472 Op = WalkState->Op; 473 OpType = WalkState->OpInfo->Type; 474 OpClass = WalkState->OpInfo->Class; 475 476 if (OpClass == AML_CLASS_UNKNOWN) 477 { 478 ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode)); 479 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 480 } 481 482 FirstArg = Op->Common.Value.Arg; 483 484 /* Init the walk state */ 485 486 WalkState->NumOperands = 0; 487 WalkState->OperandIndex = 0; 488 WalkState->ReturnDesc = NULL; 489 WalkState->ResultObj = NULL; 490 491 /* Call debugger for single step support (DEBUG build only) */ 492 493 ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass)); 494 ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);}); 495 496 /* Decode the Opcode Class */ 497 498 switch (OpClass) 499 { 500 case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ 501 502 if (WalkState->Opcode == AML_INT_NAMEPATH_OP) 503 { 504 Status = AcpiDsEvaluateNamePath (WalkState); 505 if (ACPI_FAILURE (Status)) 506 { 507 goto Cleanup; 508 } 509 } 510 break; 511 512 case AML_CLASS_EXECUTE: /* Most operators with arguments */ 513 514 /* Build resolved operand stack */ 515 516 Status = AcpiDsCreateOperands (WalkState, FirstArg); 517 if (ACPI_FAILURE (Status)) 518 { 519 goto Cleanup; 520 } 521 522 /* 523 * All opcodes require operand resolution, with the only exceptions 524 * being the ObjectType and SizeOf operators. 525 */ 526 if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE)) 527 { 528 /* Resolve all operands */ 529 530 Status = AcpiExResolveOperands (WalkState->Opcode, 531 &(WalkState->Operands [WalkState->NumOperands -1]), 532 WalkState); 533 } 534 535 if (ACPI_SUCCESS (Status)) 536 { 537 /* 538 * Dispatch the request to the appropriate interpreter handler 539 * routine. There is one routine per opcode "type" based upon the 540 * number of opcode arguments and return type. 541 */ 542 Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState); 543 } 544 else 545 { 546 /* 547 * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the 548 * Local is uninitialized. 549 */ 550 if ((Status == AE_AML_UNINITIALIZED_LOCAL) && 551 (WalkState->Opcode == AML_STORE_OP) && 552 (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && 553 (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && 554 (WalkState->Operands[0]->Reference.Class == 555 WalkState->Operands[1]->Reference.Class) && 556 (WalkState->Operands[0]->Reference.Value == 557 WalkState->Operands[1]->Reference.Value)) 558 { 559 Status = AE_OK; 560 } 561 else 562 { 563 ACPI_EXCEPTION ((AE_INFO, Status, 564 "While resolving operands for [%s]", 565 AcpiPsGetOpcodeName (WalkState->Opcode))); 566 } 567 } 568 569 /* Always delete the argument objects and clear the operand stack */ 570 571 AcpiDsClearOperands (WalkState); 572 573 /* 574 * If a result object was returned from above, push it on the 575 * current result stack 576 */ 577 if (ACPI_SUCCESS (Status) && 578 WalkState->ResultObj) 579 { 580 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); 581 } 582 break; 583 584 default: 585 586 switch (OpType) 587 { 588 case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ 589 590 /* 1 Operand, 0 ExternalResult, 0 InternalResult */ 591 592 Status = AcpiDsExecEndControlOp (WalkState, Op); 593 594 break; 595 596 case AML_TYPE_METHOD_CALL: 597 /* 598 * If the method is referenced from within a package 599 * declaration, it is not a invocation of the method, just 600 * a reference to it. 601 */ 602 if ((Op->Asl.Parent) && 603 ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) || 604 (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))) 605 { 606 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 607 "Method Reference in a Package, Op=%p\n", Op)); 608 609 Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node; 610 AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); 611 return_ACPI_STATUS (AE_OK); 612 } 613 614 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 615 "Method invocation, Op=%p\n", Op)); 616 617 /* 618 * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains 619 * the method Node pointer 620 */ 621 /* NextOp points to the op that holds the method name */ 622 623 NextOp = FirstArg; 624 625 /* NextOp points to first argument op */ 626 627 NextOp = NextOp->Common.Next; 628 629 /* 630 * Get the method's arguments and put them on the operand stack 631 */ 632 Status = AcpiDsCreateOperands (WalkState, NextOp); 633 if (ACPI_FAILURE (Status)) 634 { 635 break; 636 } 637 638 /* 639 * Since the operands will be passed to another control method, 640 * we must resolve all local references here (Local variables, 641 * arguments to *this* method, etc.) 642 */ 643 Status = AcpiDsResolveOperands (WalkState); 644 if (ACPI_FAILURE (Status)) 645 { 646 /* On error, clear all resolved operands */ 647 648 AcpiDsClearOperands (WalkState); 649 break; 650 } 651 652 /* 653 * Tell the walk loop to preempt this running method and 654 * execute the new method 655 */ 656 Status = AE_CTRL_TRANSFER; 657 658 /* 659 * Return now; we don't want to disturb anything, 660 * especially the operand count! 661 */ 662 return_ACPI_STATUS (Status); 663 664 case AML_TYPE_CREATE_FIELD: 665 666 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 667 "Executing CreateField Buffer/Index Op=%p\n", Op)); 668 669 Status = AcpiDsLoad2EndOp (WalkState); 670 if (ACPI_FAILURE (Status)) 671 { 672 break; 673 } 674 675 Status = AcpiDsEvalBufferFieldOperands (WalkState, Op); 676 break; 677 678 679 case AML_TYPE_CREATE_OBJECT: 680 681 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 682 "Executing CreateObject (Buffer/Package) Op=%p\n", Op)); 683 684 switch (Op->Common.Parent->Common.AmlOpcode) 685 { 686 case AML_NAME_OP: 687 /* 688 * Put the Node on the object stack (Contains the ACPI Name 689 * of this object) 690 */ 691 WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node; 692 WalkState->NumOperands = 1; 693 694 Status = AcpiDsCreateNode (WalkState, 695 Op->Common.Parent->Common.Node, 696 Op->Common.Parent); 697 if (ACPI_FAILURE (Status)) 698 { 699 break; 700 } 701 702 /* Fall through */ 703 /*lint -fallthrough */ 704 705 case AML_INT_EVAL_SUBTREE_OP: 706 707 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, 708 AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); 709 break; 710 711 default: 712 713 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL); 714 break; 715 } 716 717 /* 718 * If a result object was returned from above, push it on the 719 * current result stack 720 */ 721 if (WalkState->ResultObj) 722 { 723 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); 724 } 725 break; 726 727 case AML_TYPE_NAMED_FIELD: 728 case AML_TYPE_NAMED_COMPLEX: 729 case AML_TYPE_NAMED_SIMPLE: 730 case AML_TYPE_NAMED_NO_OBJ: 731 732 Status = AcpiDsLoad2EndOp (WalkState); 733 if (ACPI_FAILURE (Status)) 734 { 735 break; 736 } 737 738 if (Op->Common.AmlOpcode == AML_REGION_OP) 739 { 740 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 741 "Executing OpRegion Address/Length Op=%p\n", Op)); 742 743 Status = AcpiDsEvalRegionOperands (WalkState, Op); 744 if (ACPI_FAILURE (Status)) 745 { 746 break; 747 } 748 } 749 else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) 750 { 751 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 752 "Executing DataTableRegion Strings Op=%p\n", Op)); 753 754 Status = AcpiDsEvalTableRegionOperands (WalkState, Op); 755 if (ACPI_FAILURE (Status)) 756 { 757 break; 758 } 759 } 760 else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) 761 { 762 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 763 "Executing BankField Op=%p\n", Op)); 764 765 Status = AcpiDsEvalBankFieldOperands (WalkState, Op); 766 if (ACPI_FAILURE (Status)) 767 { 768 break; 769 } 770 } 771 break; 772 773 case AML_TYPE_UNDEFINED: 774 775 ACPI_ERROR ((AE_INFO, 776 "Undefined opcode type Op=%p", Op)); 777 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 778 779 case AML_TYPE_BOGUS: 780 781 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 782 "Internal opcode=%X type Op=%p\n", 783 WalkState->Opcode, Op)); 784 break; 785 786 default: 787 788 ACPI_ERROR ((AE_INFO, 789 "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p", 790 OpClass, OpType, Op->Common.AmlOpcode, Op)); 791 792 Status = AE_NOT_IMPLEMENTED; 793 break; 794 } 795 } 796 797 /* 798 * ACPI 2.0 support for 64-bit integers: Truncate numeric 799 * result value if we are executing from a 32-bit ACPI table 800 */ 801 (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj); 802 803 /* 804 * Check if we just completed the evaluation of a 805 * conditional predicate 806 */ 807 if ((ACPI_SUCCESS (Status)) && 808 (WalkState->ControlState) && 809 (WalkState->ControlState->Common.State == 810 ACPI_CONTROL_PREDICATE_EXECUTING) && 811 (WalkState->ControlState->Control.PredicateOp == Op)) 812 { 813 Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj); 814 WalkState->ResultObj = NULL; 815 } 816 817 818 Cleanup: 819 820 if (WalkState->ResultObj) 821 { 822 /* Break to debugger to display result */ 823 824 ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, 825 WalkState)); 826 827 /* 828 * Delete the result op if and only if: 829 * Parent will not use the result -- such as any 830 * non-nested type2 op in a method (parent will be method) 831 */ 832 AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState); 833 } 834 835 #ifdef _UNDER_DEVELOPMENT 836 837 if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd) 838 { 839 AcpiDbMethodEnd (WalkState); 840 } 841 #endif 842 843 /* Invoke exception handler on error */ 844 845 if (ACPI_FAILURE (Status)) 846 { 847 Status = AcpiDsMethodError (Status, WalkState); 848 } 849 850 /* Always clear the object stack */ 851 852 WalkState->NumOperands = 0; 853 return_ACPI_STATUS (Status); 854 } 855