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