Print this page
update to acpica-unix2-20131218
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c
          +++ new/usr/src/common/acpica/components/dispatcher/dswexec.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: dswexec - Dispatcher method execution callbacks;
   4    4   *                        dispatch to interpreter.
   5    5   *
   6    6   *****************************************************************************/
   7    7  
   8    8  /*
   9      - * Copyright (C) 2000 - 2011, Intel Corp.
        9 + * Copyright (C) 2000 - 2013, Intel Corp.
  10   10   * All rights reserved.
  11   11   *
  12   12   * Redistribution and use in source and binary forms, with or without
  13   13   * modification, are permitted provided that the following conditions
  14   14   * are met:
  15   15   * 1. Redistributions of source code must retain the above copyright
  16   16   *    notice, this list of conditions, and the following disclaimer,
  17   17   *    without modification.
  18   18   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19   19   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 137 lines elided ↑ open up ↑
 157  157          ACPI_ERROR ((AE_INFO,
 158  158              "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
 159  159              ObjDesc, WalkState, ObjDesc->Common.Type));
 160  160  
 161  161          Status = AE_AML_OPERAND_TYPE;
 162  162          goto Cleanup;
 163  163      }
 164  164  
 165  165      /* Truncate the predicate to 32-bits if necessary */
 166  166  
 167      -    AcpiExTruncateFor32bitTable (LocalObjDesc);
      167 +    (void) AcpiExTruncateFor32bitTable (LocalObjDesc);
 168  168  
 169  169      /*
 170  170       * Save the result of the predicate evaluation on
 171  171       * the control stack
 172  172       */
 173  173      if (LocalObjDesc->Integer.Value)
 174  174      {
 175  175          WalkState->ControlState->Common.Value = TRUE;
 176  176      }
 177  177      else
↓ open down ↓ 38 lines elided ↑ open up ↑
 216  216  /*****************************************************************************
 217  217   *
 218  218   * FUNCTION:    AcpiDsExecBeginOp
 219  219   *
 220  220   * PARAMETERS:  WalkState       - Current state of the parse tree walk
 221  221   *              OutOp           - Where to return op if a new one is created
 222  222   *
 223  223   * RETURN:      Status
 224  224   *
 225  225   * DESCRIPTION: Descending callback used during the execution of control
 226      - *              methods.  This is where most operators and operands are
      226 + *              methods. This is where most operators and operands are
 227  227   *              dispatched to the interpreter.
 228  228   *
 229  229   ****************************************************************************/
 230  230  
 231  231  ACPI_STATUS
 232  232  AcpiDsExecBeginOp (
 233  233      ACPI_WALK_STATE         *WalkState,
 234  234      ACPI_PARSE_OBJECT       **OutOp)
 235  235  {
 236  236      ACPI_PARSE_OBJECT       *Op;
↓ open down ↓ 74 lines elided ↑ open up ↑
 311  311      /*
 312  312       * Handle the opcode based upon the opcode type
 313  313       */
 314  314      switch (OpcodeClass)
 315  315      {
 316  316      case AML_CLASS_CONTROL:
 317  317  
 318  318          Status = AcpiDsExecBeginControlOp (WalkState, Op);
 319  319          break;
 320  320  
 321      -
 322  321      case AML_CLASS_NAMED_OBJECT:
 323  322  
 324  323          if (WalkState->WalkType & ACPI_WALK_METHOD)
 325  324          {
 326  325              /*
 327  326               * Found a named object declaration during method execution;
 328      -             * we must enter this object into the namespace.  The created
      327 +             * we must enter this object into the namespace. The created
 329  328               * object is temporary and will be deleted upon completion of
 330  329               * the execution of this method.
 331  330               *
 332  331               * Note 10/2010: Except for the Scope() op. This opcode does
 333  332               * not actually create a new object, it refers to an existing
 334  333               * object. However, for Scope(), we want to indeed open a
 335  334               * new scope.
 336  335               */
 337  336              if (Op->Common.AmlOpcode != AML_SCOPE_OP)
 338  337              {
↓ open down ↓ 4 lines elided ↑ open up ↑
 343  342                  Status = AcpiDsScopeStackPush (Op->Named.Node,
 344  343                              Op->Named.Node->Type, WalkState);
 345  344                  if (ACPI_FAILURE (Status))
 346  345                  {
 347  346                      return_ACPI_STATUS (Status);
 348  347                  }
 349  348              }
 350  349          }
 351  350          break;
 352  351  
 353      -
 354  352      case AML_CLASS_EXECUTE:
 355  353      case AML_CLASS_CREATE:
 356  354  
 357  355          break;
 358  356  
 359      -
 360  357      default:
      358 +
 361  359          break;
 362  360      }
 363  361  
 364  362      /* Nothing to do here during method execution */
 365  363  
 366  364      return_ACPI_STATUS (Status);
 367  365  
 368  366  
 369  367  ErrorExit:
 370  368      Status = AcpiDsMethodError (Status, WalkState);
↓ open down ↓ 3 lines elided ↑ open up ↑
 374  372  
 375  373  /*****************************************************************************
 376  374   *
 377  375   * FUNCTION:    AcpiDsExecEndOp
 378  376   *
 379  377   * PARAMETERS:  WalkState       - Current state of the parse tree walk
 380  378   *
 381  379   * RETURN:      Status
 382  380   *
 383  381   * DESCRIPTION: Ascending callback used during the execution of control
 384      - *              methods.  The only thing we really need to do here is to
      382 + *              methods. The only thing we really need to do here is to
 385  383   *              notice the beginning of IF, ELSE, and WHILE blocks.
 386  384   *
 387  385   ****************************************************************************/
 388  386  
 389  387  ACPI_STATUS
 390  388  AcpiDsExecEndOp (
 391  389      ACPI_WALK_STATE         *WalkState)
 392  390  {
 393  391      ACPI_PARSE_OBJECT       *Op;
 394  392      ACPI_STATUS             Status = AE_OK;
↓ open down ↓ 39 lines elided ↑ open up ↑
 434  432          if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
 435  433          {
 436  434              Status = AcpiDsEvaluateNamePath (WalkState);
 437  435              if (ACPI_FAILURE (Status))
 438  436              {
 439  437                  goto Cleanup;
 440  438              }
 441  439          }
 442  440          break;
 443  441  
 444      -
 445  442      case AML_CLASS_EXECUTE:     /* Most operators with arguments */
 446  443  
 447  444          /* Build resolved operand stack */
 448  445  
 449  446          Status = AcpiDsCreateOperands (WalkState, FirstArg);
 450  447          if (ACPI_FAILURE (Status))
 451  448          {
 452  449              goto Cleanup;
 453  450          }
 454  451  
↓ open down ↓ 7 lines elided ↑ open up ↑
 462  459  
 463  460              Status = AcpiExResolveOperands (WalkState->Opcode,
 464  461                          &(WalkState->Operands [WalkState->NumOperands -1]),
 465  462                          WalkState);
 466  463          }
 467  464  
 468  465          if (ACPI_SUCCESS (Status))
 469  466          {
 470  467              /*
 471  468               * Dispatch the request to the appropriate interpreter handler
 472      -             * routine.  There is one routine per opcode "type" based upon the
      469 +             * routine. There is one routine per opcode "type" based upon the
 473  470               * number of opcode arguments and return type.
 474  471               */
 475  472              Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
 476  473          }
 477  474          else
 478  475          {
 479  476              /*
 480  477               * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
 481  478               * Local is uninitialized.
 482  479               */
↓ open down ↓ 24 lines elided ↑ open up ↑
 507  504           * If a result object was returned from above, push it on the
 508  505           * current result stack
 509  506           */
 510  507          if (ACPI_SUCCESS (Status) &&
 511  508              WalkState->ResultObj)
 512  509          {
 513  510              Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
 514  511          }
 515  512          break;
 516  513  
 517      -
 518  514      default:
 519  515  
 520  516          switch (OpType)
 521  517          {
 522  518          case AML_TYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
 523  519  
 524  520              /* 1 Operand, 0 ExternalResult, 0 InternalResult */
 525  521  
 526  522              Status = AcpiDsExecEndControlOp (WalkState, Op);
 527  523  
 528  524              break;
 529  525  
 530      -
 531  526          case AML_TYPE_METHOD_CALL:
 532      -
 533  527              /*
 534  528               * If the method is referenced from within a package
 535  529               * declaration, it is not a invocation of the method, just
 536  530               * a reference to it.
 537  531               */
 538  532              if ((Op->Asl.Parent) &&
 539  533                 ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
 540  534                  (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
 541  535              {
 542  536                  ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 543  537                      "Method Reference in a Package, Op=%p\n", Op));
 544  538  
 545  539                  Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node;
 546  540                  AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
 547  541                  return_ACPI_STATUS (AE_OK);
 548  542              }
 549  543  
 550      -            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op));
      544 +            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
      545 +                "Method invocation, Op=%p\n", Op));
 551  546  
 552  547              /*
 553  548               * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
 554  549               * the method Node pointer
 555  550               */
 556  551              /* NextOp points to the op that holds the method name */
 557  552  
 558  553              NextOp = FirstArg;
 559  554  
 560  555              /* NextOp points to first argument op */
↓ open down ↓ 28 lines elided ↑ open up ↑
 589  584               * execute the new method
 590  585               */
 591  586              Status = AE_CTRL_TRANSFER;
 592  587  
 593  588              /*
 594  589               * Return now; we don't want to disturb anything,
 595  590               * especially the operand count!
 596  591               */
 597  592              return_ACPI_STATUS (Status);
 598  593  
 599      -
 600  594          case AML_TYPE_CREATE_FIELD:
 601  595  
 602  596              ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 603  597                  "Executing CreateField Buffer/Index Op=%p\n", Op));
 604  598  
 605  599              Status = AcpiDsLoad2EndOp (WalkState);
 606  600              if (ACPI_FAILURE (Status))
 607  601              {
 608  602                  break;
 609  603              }
↓ open down ↓ 3 lines elided ↑ open up ↑
 613  607  
 614  608  
 615  609          case AML_TYPE_CREATE_OBJECT:
 616  610  
 617  611              ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 618  612                  "Executing CreateObject (Buffer/Package) Op=%p\n", Op));
 619  613  
 620  614              switch (Op->Common.Parent->Common.AmlOpcode)
 621  615              {
 622  616              case AML_NAME_OP:
 623      -
 624  617                  /*
 625  618                   * Put the Node on the object stack (Contains the ACPI Name
 626  619                   * of this object)
 627  620                   */
 628  621                  WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node;
 629  622                  WalkState->NumOperands = 1;
 630  623  
 631  624                  Status = AcpiDsCreateNode (WalkState,
 632  625                              Op->Common.Parent->Common.Node,
 633  626                              Op->Common.Parent);
↓ open down ↓ 20 lines elided ↑ open up ↑
 654  647              /*
 655  648               * If a result object was returned from above, push it on the
 656  649               * current result stack
 657  650               */
 658  651              if (WalkState->ResultObj)
 659  652              {
 660  653                  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
 661  654              }
 662  655              break;
 663  656  
 664      -
 665  657          case AML_TYPE_NAMED_FIELD:
 666  658          case AML_TYPE_NAMED_COMPLEX:
 667  659          case AML_TYPE_NAMED_SIMPLE:
 668  660          case AML_TYPE_NAMED_NO_OBJ:
 669  661  
 670  662              Status = AcpiDsLoad2EndOp (WalkState);
 671  663              if (ACPI_FAILURE (Status))
 672  664              {
 673  665                  break;
 674  666              }
↓ open down ↓ 26 lines elided ↑ open up ↑
 701  693                      "Executing BankField Op=%p\n", Op));
 702  694  
 703  695                  Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
 704  696                  if (ACPI_FAILURE (Status))
 705  697                  {
 706  698                      break;
 707  699                  }
 708  700              }
 709  701              break;
 710  702  
 711      -
 712  703          case AML_TYPE_UNDEFINED:
 713  704  
 714  705              ACPI_ERROR ((AE_INFO,
 715  706                  "Undefined opcode type Op=%p", Op));
 716  707              return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
 717  708  
 718      -
 719  709          case AML_TYPE_BOGUS:
 720  710  
 721  711              ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 722  712                  "Internal opcode=%X type Op=%p\n",
 723  713                  WalkState->Opcode, Op));
 724  714              break;
 725  715  
 726      -
 727  716          default:
 728  717  
 729  718              ACPI_ERROR ((AE_INFO,
 730      -                "Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
      719 +                "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p",
 731  720                  OpClass, OpType, Op->Common.AmlOpcode, Op));
 732  721  
 733  722              Status = AE_NOT_IMPLEMENTED;
 734  723              break;
 735  724          }
 736  725      }
 737  726  
 738  727      /*
 739  728       * ACPI 2.0 support for 64-bit integers: Truncate numeric
 740  729       * result value if we are executing from a 32-bit ACPI table
 741  730       */
 742      -    AcpiExTruncateFor32bitTable (WalkState->ResultObj);
      731 +    (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);
 743  732  
 744  733      /*
 745  734       * Check if we just completed the evaluation of a
 746  735       * conditional predicate
 747  736       */
 748  737      if ((ACPI_SUCCESS (Status)) &&
 749  738          (WalkState->ControlState) &&
 750  739          (WalkState->ControlState->Common.State ==
 751  740              ACPI_CONTROL_PREDICATE_EXECUTING) &&
 752  741          (WalkState->ControlState->Control.PredicateOp == Op))
↓ open down ↓ 33 lines elided ↑ open up ↑
 786  775      if (ACPI_FAILURE (Status))
 787  776      {
 788  777          Status = AcpiDsMethodError (Status, WalkState);
 789  778      }
 790  779  
 791  780      /* Always clear the object stack */
 792  781  
 793  782      WalkState->NumOperands = 0;
 794  783      return_ACPI_STATUS (Status);
 795  784  }
 796      -
 797      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX