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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/dispatcher/dscontrol.c
          +++ new/usr/src/common/acpica/components/dispatcher/dscontrol.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: dscontrol - Support for execution control opcodes -
   4    4   *                          if/else/while/return
   5    5   *
   6    6   *****************************************************************************/
   7    7  
   8    8  /*
   9      - * Copyright (C) 2000 - 2011, Intel Corp.
        9 + * Copyright (C) 2000 - 2014, 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 ↓ 59 lines elided ↑ open up ↑
  79   79  
  80   80      ACPI_FUNCTION_NAME (DsExecBeginControlOp);
  81   81  
  82   82  
  83   83      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n",
  84   84          Op, Op->Common.AmlOpcode, WalkState));
  85   85  
  86   86      switch (Op->Common.AmlOpcode)
  87   87      {
  88   88      case AML_WHILE_OP:
  89      -
  90   89          /*
  91   90           * If this is an additional iteration of a while loop, continue.
  92   91           * There is no need to allocate a new control state.
  93   92           */
  94   93          if (WalkState->ControlState)
  95   94          {
  96   95              if (WalkState->ControlState->Control.AmlPredicateStart ==
  97   96                  (WalkState->ParserState.Aml - 1))
  98   97              {
  99   98                  /* Reset the state to start-of-loop */
 100   99  
 101  100                  WalkState->ControlState->Common.State =
 102  101                      ACPI_CONTROL_CONDITIONAL_EXECUTING;
 103  102                  break;
 104  103              }
 105  104          }
 106  105  
 107  106          /*lint -fallthrough */
 108  107  
 109  108      case AML_IF_OP:
 110      -
 111  109          /*
 112  110           * IF/WHILE: Create a new control state to manage these
 113  111           * constructs. We need to manage these as a stack, in order
 114  112           * to handle nesting.
 115  113           */
 116  114          ControlState = AcpiUtCreateControlState ();
 117  115          if (!ControlState)
 118  116          {
 119  117              Status = AE_NO_MEMORY;
 120  118              break;
↓ open down ↓ 22 lines elided ↑ open up ↑
 143  141              Status = AE_CTRL_TRUE;
 144  142          }
 145  143  
 146  144          break;
 147  145  
 148  146      case AML_RETURN_OP:
 149  147  
 150  148          break;
 151  149  
 152  150      default:
      151 +
 153  152          break;
 154  153      }
 155  154  
 156  155      return (Status);
 157  156  }
 158  157  
 159  158  
 160  159  /*******************************************************************************
 161  160   *
 162  161   * FUNCTION:    AcpiDsExecEndControlOp
↓ open down ↓ 34 lines elided ↑ open up ↑
 197  196              (BOOLEAN) WalkState->ControlState->Common.Value;
 198  197  
 199  198          /*
 200  199           * Pop the control state that was created at the start
 201  200           * of the IF and free it
 202  201           */
 203  202          ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
 204  203          AcpiUtDeleteGenericState (ControlState);
 205  204          break;
 206  205  
 207      -
 208  206      case AML_ELSE_OP:
 209  207  
 210  208          break;
 211  209  
 212      -
 213  210      case AML_WHILE_OP:
 214  211  
 215  212          ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
 216  213  
 217  214          ControlState = WalkState->ControlState;
 218  215          if (ControlState->Common.Value)
 219  216          {
 220  217              /* Predicate was true, the body of the loop was just executed */
 221  218  
 222  219              /*
↓ open down ↓ 22 lines elided ↑ open up ↑
 245  242  
 246  243          ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 247  244              "[WHILE_OP] termination! Op=%p\n",Op));
 248  245  
 249  246          /* Pop this control state and free it */
 250  247  
 251  248          ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
 252  249          AcpiUtDeleteGenericState (ControlState);
 253  250          break;
 254  251  
 255      -
 256  252      case AML_RETURN_OP:
 257  253  
 258  254          ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 259  255              "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
 260  256  
 261  257          /*
 262  258           * One optional operand -- the return value
 263  259           * It can be either an immediate operand or a result that
 264  260           * has been bubbled up the tree
 265  261           */
↓ open down ↓ 17 lines elided ↑ open up ↑
 283  279               * cease to exist at the end of the method.
 284  280               */
 285  281              Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
 286  282              if (ACPI_FAILURE (Status))
 287  283              {
 288  284                  return (Status);
 289  285              }
 290  286  
 291  287              /*
 292  288               * Get the return value and save as the last result
 293      -             * value.  This is the only place where WalkState->ReturnDesc
      289 +             * value. This is the only place where WalkState->ReturnDesc
 294  290               * is set to anything other than zero!
 295  291               */
 296  292              WalkState->ReturnDesc = WalkState->Operands[0];
 297  293          }
 298  294          else if (WalkState->ResultCount)
 299  295          {
 300  296              /* Since we have a real Return(), delete any implicit return */
 301  297  
 302  298              AcpiDsClearImplicitReturn (WalkState);
 303  299  
↓ open down ↓ 37 lines elided ↑ open up ↑
 341  337  
 342  338          ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 343  339              "Completed RETURN_OP State=%p, RetVal=%p\n",
 344  340              WalkState, WalkState->ReturnDesc));
 345  341  
 346  342          /* End the control method execution right now */
 347  343  
 348  344          Status = AE_CTRL_TERMINATE;
 349  345          break;
 350  346  
 351      -
 352  347      case AML_NOOP_OP:
 353  348  
 354  349          /* Just do nothing! */
      350 +
 355  351          break;
 356  352  
 357      -
 358  353      case AML_BREAK_POINT_OP:
 359  354  
 360  355          /*
 361  356           * Set the single-step flag. This will cause the debugger (if present)
 362  357           * to break to the console within the AML debugger at the start of the
 363  358           * next AML instruction.
 364  359           */
 365  360          ACPI_DEBUGGER_EXEC (
 366  361              AcpiGbl_CmSingleStep = TRUE);
 367  362          ACPI_DEBUGGER_EXEC (
 368  363              AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
 369  364  
 370  365          /* Call to the OSL in case OS wants a piece of the action */
 371  366  
 372  367          Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
 373  368                      "Executed AML Breakpoint opcode");
 374  369          break;
 375  370  
 376      -
 377  371      case AML_BREAK_OP:
 378  372      case AML_CONTINUE_OP: /* ACPI 2.0 */
 379  373  
 380      -
 381  374          /* Pop and delete control states until we find a while */
 382  375  
 383  376          while (WalkState->ControlState &&
 384  377                  (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
 385  378          {
 386  379              ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
 387  380              AcpiUtDeleteGenericState (ControlState);
 388  381          }
 389  382  
 390  383          /* No while found? */
↓ open down ↓ 12 lines elided ↑ open up ↑
 403  396          if (Op->Common.AmlOpcode == AML_BREAK_OP)
 404  397          {
 405  398              Status = AE_CTRL_BREAK;
 406  399          }
 407  400          else
 408  401          {
 409  402              Status = AE_CTRL_CONTINUE;
 410  403          }
 411  404          break;
 412  405  
 413      -
 414  406      default:
 415  407  
 416  408          ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
 417  409              Op->Common.AmlOpcode, Op));
 418  410  
 419  411          Status = AE_AML_BAD_OPCODE;
 420  412          break;
 421  413      }
 422  414  
 423  415      return (Status);
 424  416  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX