Home | History | Annotate | Line # | Download | only in dispatcher
dscontrol.c revision 1.2.2.3
      1  1.2.2.2  bouyer /******************************************************************************
      2  1.2.2.2  bouyer  *
      3  1.2.2.2  bouyer  * Module Name: dscontrol - Support for execution control opcodes -
      4  1.2.2.2  bouyer  *                          if/else/while/return
      5  1.2.2.2  bouyer  *
      6  1.2.2.2  bouyer  *****************************************************************************/
      7  1.2.2.2  bouyer 
      8  1.2.2.2  bouyer /*
      9  1.2.2.2  bouyer  * Copyright (C) 2000 - 2011, Intel Corp.
     10  1.2.2.2  bouyer  * All rights reserved.
     11  1.2.2.2  bouyer  *
     12  1.2.2.2  bouyer  * Redistribution and use in source and binary forms, with or without
     13  1.2.2.2  bouyer  * modification, are permitted provided that the following conditions
     14  1.2.2.2  bouyer  * are met:
     15  1.2.2.2  bouyer  * 1. Redistributions of source code must retain the above copyright
     16  1.2.2.2  bouyer  *    notice, this list of conditions, and the following disclaimer,
     17  1.2.2.2  bouyer  *    without modification.
     18  1.2.2.2  bouyer  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     19  1.2.2.2  bouyer  *    substantially similar to the "NO WARRANTY" disclaimer below
     20  1.2.2.2  bouyer  *    ("Disclaimer") and any redistribution must be conditioned upon
     21  1.2.2.2  bouyer  *    including a substantially similar Disclaimer requirement for further
     22  1.2.2.2  bouyer  *    binary redistribution.
     23  1.2.2.2  bouyer  * 3. Neither the names of the above-listed copyright holders nor the names
     24  1.2.2.2  bouyer  *    of any contributors may be used to endorse or promote products derived
     25  1.2.2.2  bouyer  *    from this software without specific prior written permission.
     26  1.2.2.2  bouyer  *
     27  1.2.2.2  bouyer  * Alternatively, this software may be distributed under the terms of the
     28  1.2.2.2  bouyer  * GNU General Public License ("GPL") version 2 as published by the Free
     29  1.2.2.2  bouyer  * Software Foundation.
     30  1.2.2.2  bouyer  *
     31  1.2.2.2  bouyer  * NO WARRANTY
     32  1.2.2.2  bouyer  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     33  1.2.2.2  bouyer  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     34  1.2.2.2  bouyer  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     35  1.2.2.2  bouyer  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     36  1.2.2.2  bouyer  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  1.2.2.2  bouyer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  1.2.2.2  bouyer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  1.2.2.2  bouyer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     40  1.2.2.2  bouyer  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     41  1.2.2.2  bouyer  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     42  1.2.2.2  bouyer  * POSSIBILITY OF SUCH DAMAGES.
     43  1.2.2.2  bouyer  */
     44  1.2.2.2  bouyer 
     45  1.2.2.2  bouyer #define __DSCONTROL_C__
     46  1.2.2.2  bouyer 
     47  1.2.2.2  bouyer #include "acpi.h"
     48  1.2.2.2  bouyer #include "accommon.h"
     49  1.2.2.2  bouyer #include "amlcode.h"
     50  1.2.2.2  bouyer #include "acdispat.h"
     51  1.2.2.2  bouyer #include "acinterp.h"
     52  1.2.2.2  bouyer 
     53  1.2.2.2  bouyer #define _COMPONENT          ACPI_DISPATCHER
     54  1.2.2.2  bouyer         ACPI_MODULE_NAME    ("dscontrol")
     55  1.2.2.2  bouyer 
     56  1.2.2.2  bouyer 
     57  1.2.2.2  bouyer /*******************************************************************************
     58  1.2.2.2  bouyer  *
     59  1.2.2.2  bouyer  * FUNCTION:    AcpiDsExecBeginControlOp
     60  1.2.2.2  bouyer  *
     61  1.2.2.2  bouyer  * PARAMETERS:  WalkList        - The list that owns the walk stack
     62  1.2.2.2  bouyer  *              Op              - The control Op
     63  1.2.2.2  bouyer  *
     64  1.2.2.2  bouyer  * RETURN:      Status
     65  1.2.2.2  bouyer  *
     66  1.2.2.2  bouyer  * DESCRIPTION: Handles all control ops encountered during control method
     67  1.2.2.2  bouyer  *              execution.
     68  1.2.2.2  bouyer  *
     69  1.2.2.2  bouyer  ******************************************************************************/
     70  1.2.2.2  bouyer 
     71  1.2.2.2  bouyer ACPI_STATUS
     72  1.2.2.2  bouyer AcpiDsExecBeginControlOp (
     73  1.2.2.2  bouyer     ACPI_WALK_STATE         *WalkState,
     74  1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op)
     75  1.2.2.2  bouyer {
     76  1.2.2.2  bouyer     ACPI_STATUS             Status = AE_OK;
     77  1.2.2.2  bouyer     ACPI_GENERIC_STATE      *ControlState;
     78  1.2.2.2  bouyer 
     79  1.2.2.2  bouyer 
     80  1.2.2.2  bouyer     ACPI_FUNCTION_NAME (DsExecBeginControlOp);
     81  1.2.2.2  bouyer 
     82  1.2.2.2  bouyer 
     83  1.2.2.2  bouyer     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n",
     84  1.2.2.2  bouyer         Op, Op->Common.AmlOpcode, WalkState));
     85  1.2.2.2  bouyer 
     86  1.2.2.2  bouyer     switch (Op->Common.AmlOpcode)
     87  1.2.2.2  bouyer     {
     88  1.2.2.2  bouyer     case AML_WHILE_OP:
     89  1.2.2.2  bouyer 
     90  1.2.2.2  bouyer         /*
     91  1.2.2.2  bouyer          * If this is an additional iteration of a while loop, continue.
     92  1.2.2.2  bouyer          * There is no need to allocate a new control state.
     93  1.2.2.2  bouyer          */
     94  1.2.2.2  bouyer         if (WalkState->ControlState)
     95  1.2.2.2  bouyer         {
     96  1.2.2.2  bouyer             if (WalkState->ControlState->Control.AmlPredicateStart ==
     97  1.2.2.2  bouyer                 (WalkState->ParserState.Aml - 1))
     98  1.2.2.2  bouyer             {
     99  1.2.2.2  bouyer                 /* Reset the state to start-of-loop */
    100  1.2.2.2  bouyer 
    101  1.2.2.2  bouyer                 WalkState->ControlState->Common.State =
    102  1.2.2.2  bouyer                     ACPI_CONTROL_CONDITIONAL_EXECUTING;
    103  1.2.2.2  bouyer                 break;
    104  1.2.2.2  bouyer             }
    105  1.2.2.2  bouyer         }
    106  1.2.2.2  bouyer 
    107  1.2.2.2  bouyer         /*lint -fallthrough */
    108  1.2.2.2  bouyer 
    109  1.2.2.2  bouyer     case AML_IF_OP:
    110  1.2.2.2  bouyer 
    111  1.2.2.2  bouyer         /*
    112  1.2.2.2  bouyer          * IF/WHILE: Create a new control state to manage these
    113  1.2.2.2  bouyer          * constructs. We need to manage these as a stack, in order
    114  1.2.2.2  bouyer          * to handle nesting.
    115  1.2.2.2  bouyer          */
    116  1.2.2.2  bouyer         ControlState = AcpiUtCreateControlState ();
    117  1.2.2.2  bouyer         if (!ControlState)
    118  1.2.2.2  bouyer         {
    119  1.2.2.2  bouyer             Status = AE_NO_MEMORY;
    120  1.2.2.2  bouyer             break;
    121  1.2.2.2  bouyer         }
    122  1.2.2.2  bouyer         /*
    123  1.2.2.2  bouyer          * Save a pointer to the predicate for multiple executions
    124  1.2.2.2  bouyer          * of a loop
    125  1.2.2.2  bouyer          */
    126  1.2.2.2  bouyer         ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
    127  1.2.2.2  bouyer         ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
    128  1.2.2.2  bouyer         ControlState->Control.Opcode = Op->Common.AmlOpcode;
    129  1.2.2.2  bouyer 
    130  1.2.2.2  bouyer 
    131  1.2.2.2  bouyer         /* Push the control state on this walk's control stack */
    132  1.2.2.2  bouyer 
    133  1.2.2.2  bouyer         AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
    134  1.2.2.2  bouyer         break;
    135  1.2.2.2  bouyer 
    136  1.2.2.2  bouyer     case AML_ELSE_OP:
    137  1.2.2.2  bouyer 
    138  1.2.2.2  bouyer         /* Predicate is in the state object */
    139  1.2.2.2  bouyer         /* If predicate is true, the IF was executed, ignore ELSE part */
    140  1.2.2.2  bouyer 
    141  1.2.2.2  bouyer         if (WalkState->LastPredicate)
    142  1.2.2.2  bouyer         {
    143  1.2.2.2  bouyer             Status = AE_CTRL_TRUE;
    144  1.2.2.2  bouyer         }
    145  1.2.2.2  bouyer 
    146  1.2.2.2  bouyer         break;
    147  1.2.2.2  bouyer 
    148  1.2.2.2  bouyer     case AML_RETURN_OP:
    149  1.2.2.2  bouyer 
    150  1.2.2.2  bouyer         break;
    151  1.2.2.2  bouyer 
    152  1.2.2.2  bouyer     default:
    153  1.2.2.2  bouyer         break;
    154  1.2.2.2  bouyer     }
    155  1.2.2.2  bouyer 
    156  1.2.2.2  bouyer     return (Status);
    157  1.2.2.2  bouyer }
    158  1.2.2.2  bouyer 
    159  1.2.2.2  bouyer 
    160  1.2.2.2  bouyer /*******************************************************************************
    161  1.2.2.2  bouyer  *
    162  1.2.2.2  bouyer  * FUNCTION:    AcpiDsExecEndControlOp
    163  1.2.2.2  bouyer  *
    164  1.2.2.2  bouyer  * PARAMETERS:  WalkList        - The list that owns the walk stack
    165  1.2.2.2  bouyer  *              Op              - The control Op
    166  1.2.2.2  bouyer  *
    167  1.2.2.2  bouyer  * RETURN:      Status
    168  1.2.2.2  bouyer  *
    169  1.2.2.2  bouyer  * DESCRIPTION: Handles all control ops encountered during control method
    170  1.2.2.2  bouyer  *              execution.
    171  1.2.2.2  bouyer  *
    172  1.2.2.2  bouyer  ******************************************************************************/
    173  1.2.2.2  bouyer 
    174  1.2.2.2  bouyer ACPI_STATUS
    175  1.2.2.2  bouyer AcpiDsExecEndControlOp (
    176  1.2.2.2  bouyer     ACPI_WALK_STATE         *WalkState,
    177  1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op)
    178  1.2.2.2  bouyer {
    179  1.2.2.2  bouyer     ACPI_STATUS             Status = AE_OK;
    180  1.2.2.2  bouyer     ACPI_GENERIC_STATE      *ControlState;
    181  1.2.2.2  bouyer 
    182  1.2.2.2  bouyer 
    183  1.2.2.2  bouyer     ACPI_FUNCTION_NAME (DsExecEndControlOp);
    184  1.2.2.2  bouyer 
    185  1.2.2.2  bouyer 
    186  1.2.2.2  bouyer     switch (Op->Common.AmlOpcode)
    187  1.2.2.2  bouyer     {
    188  1.2.2.2  bouyer     case AML_IF_OP:
    189  1.2.2.2  bouyer 
    190  1.2.2.2  bouyer         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));
    191  1.2.2.2  bouyer 
    192  1.2.2.2  bouyer         /*
    193  1.2.2.2  bouyer          * Save the result of the predicate in case there is an
    194  1.2.2.2  bouyer          * ELSE to come
    195  1.2.2.2  bouyer          */
    196  1.2.2.2  bouyer         WalkState->LastPredicate =
    197  1.2.2.2  bouyer             (BOOLEAN) WalkState->ControlState->Common.Value;
    198  1.2.2.2  bouyer 
    199  1.2.2.2  bouyer         /*
    200  1.2.2.2  bouyer          * Pop the control state that was created at the start
    201  1.2.2.2  bouyer          * of the IF and free it
    202  1.2.2.2  bouyer          */
    203  1.2.2.2  bouyer         ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
    204  1.2.2.2  bouyer         AcpiUtDeleteGenericState (ControlState);
    205  1.2.2.2  bouyer         break;
    206  1.2.2.2  bouyer 
    207  1.2.2.2  bouyer 
    208  1.2.2.2  bouyer     case AML_ELSE_OP:
    209  1.2.2.2  bouyer 
    210  1.2.2.2  bouyer         break;
    211  1.2.2.2  bouyer 
    212  1.2.2.2  bouyer 
    213  1.2.2.2  bouyer     case AML_WHILE_OP:
    214  1.2.2.2  bouyer 
    215  1.2.2.2  bouyer         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
    216  1.2.2.2  bouyer 
    217  1.2.2.2  bouyer         ControlState = WalkState->ControlState;
    218  1.2.2.2  bouyer         if (ControlState->Common.Value)
    219  1.2.2.2  bouyer         {
    220  1.2.2.2  bouyer             /* Predicate was true, the body of the loop was just executed */
    221  1.2.2.2  bouyer 
    222  1.2.2.2  bouyer             /*
    223  1.2.2.2  bouyer              * This loop counter mechanism allows the interpreter to escape
    224  1.2.2.2  bouyer              * possibly infinite loops. This can occur in poorly written AML
    225  1.2.2.2  bouyer              * when the hardware does not respond within a while loop and the
    226  1.2.2.2  bouyer              * loop does not implement a timeout.
    227  1.2.2.2  bouyer              */
    228  1.2.2.2  bouyer             ControlState->Control.LoopCount++;
    229  1.2.2.2  bouyer             if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
    230  1.2.2.2  bouyer             {
    231  1.2.2.2  bouyer                 Status = AE_AML_INFINITE_LOOP;
    232  1.2.2.2  bouyer                 break;
    233  1.2.2.2  bouyer             }
    234  1.2.2.2  bouyer 
    235  1.2.2.2  bouyer             /*
    236  1.2.2.2  bouyer              * Go back and evaluate the predicate and maybe execute the loop
    237  1.2.2.2  bouyer              * another time
    238  1.2.2.2  bouyer              */
    239  1.2.2.2  bouyer             Status = AE_CTRL_PENDING;
    240  1.2.2.2  bouyer             WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
    241  1.2.2.2  bouyer             break;
    242  1.2.2.2  bouyer         }
    243  1.2.2.2  bouyer 
    244  1.2.2.2  bouyer         /* Predicate was false, terminate this while loop */
    245  1.2.2.2  bouyer 
    246  1.2.2.2  bouyer         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    247  1.2.2.2  bouyer             "[WHILE_OP] termination! Op=%p\n",Op));
    248  1.2.2.2  bouyer 
    249  1.2.2.2  bouyer         /* Pop this control state and free it */
    250  1.2.2.2  bouyer 
    251  1.2.2.2  bouyer         ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
    252  1.2.2.2  bouyer         AcpiUtDeleteGenericState (ControlState);
    253  1.2.2.2  bouyer         break;
    254  1.2.2.2  bouyer 
    255  1.2.2.2  bouyer 
    256  1.2.2.2  bouyer     case AML_RETURN_OP:
    257  1.2.2.2  bouyer 
    258  1.2.2.2  bouyer         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    259  1.2.2.2  bouyer             "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
    260  1.2.2.2  bouyer 
    261  1.2.2.2  bouyer         /*
    262  1.2.2.2  bouyer          * One optional operand -- the return value
    263  1.2.2.2  bouyer          * It can be either an immediate operand or a result that
    264  1.2.2.2  bouyer          * has been bubbled up the tree
    265  1.2.2.2  bouyer          */
    266  1.2.2.2  bouyer         if (Op->Common.Value.Arg)
    267  1.2.2.2  bouyer         {
    268  1.2.2.2  bouyer             /* Since we have a real Return(), delete any implicit return */
    269  1.2.2.2  bouyer 
    270  1.2.2.2  bouyer             AcpiDsClearImplicitReturn (WalkState);
    271  1.2.2.2  bouyer 
    272  1.2.2.2  bouyer             /* Return statement has an immediate operand */
    273  1.2.2.2  bouyer 
    274  1.2.2.2  bouyer             Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
    275  1.2.2.2  bouyer             if (ACPI_FAILURE (Status))
    276  1.2.2.2  bouyer             {
    277  1.2.2.2  bouyer                 return (Status);
    278  1.2.2.2  bouyer             }
    279  1.2.2.2  bouyer 
    280  1.2.2.2  bouyer             /*
    281  1.2.2.2  bouyer              * If value being returned is a Reference (such as
    282  1.2.2.2  bouyer              * an arg or local), resolve it now because it may
    283  1.2.2.2  bouyer              * cease to exist at the end of the method.
    284  1.2.2.2  bouyer              */
    285  1.2.2.2  bouyer             Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
    286  1.2.2.2  bouyer             if (ACPI_FAILURE (Status))
    287  1.2.2.2  bouyer             {
    288  1.2.2.2  bouyer                 return (Status);
    289  1.2.2.2  bouyer             }
    290  1.2.2.2  bouyer 
    291  1.2.2.2  bouyer             /*
    292  1.2.2.2  bouyer              * Get the return value and save as the last result
    293  1.2.2.2  bouyer              * value.  This is the only place where WalkState->ReturnDesc
    294  1.2.2.2  bouyer              * is set to anything other than zero!
    295  1.2.2.2  bouyer              */
    296  1.2.2.2  bouyer             WalkState->ReturnDesc = WalkState->Operands[0];
    297  1.2.2.2  bouyer         }
    298  1.2.2.2  bouyer         else if (WalkState->ResultCount)
    299  1.2.2.2  bouyer         {
    300  1.2.2.2  bouyer             /* Since we have a real Return(), delete any implicit return */
    301  1.2.2.2  bouyer 
    302  1.2.2.2  bouyer             AcpiDsClearImplicitReturn (WalkState);
    303  1.2.2.2  bouyer 
    304  1.2.2.2  bouyer             /*
    305  1.2.2.2  bouyer              * The return value has come from a previous calculation.
    306  1.2.2.2  bouyer              *
    307  1.2.2.2  bouyer              * If value being returned is a Reference (such as
    308  1.2.2.2  bouyer              * an arg or local), resolve it now because it may
    309  1.2.2.2  bouyer              * cease to exist at the end of the method.
    310  1.2.2.2  bouyer              *
    311  1.2.2.2  bouyer              * Allow references created by the Index operator to return
    312  1.2.2.2  bouyer              * unchanged.
    313  1.2.2.2  bouyer              */
    314  1.2.2.2  bouyer             if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
    315  1.2.2.2  bouyer                 ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
    316  1.2.2.2  bouyer                 ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX))
    317  1.2.2.2  bouyer             {
    318  1.2.2.2  bouyer                 Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
    319  1.2.2.2  bouyer                 if (ACPI_FAILURE (Status))
    320  1.2.2.2  bouyer                 {
    321  1.2.2.2  bouyer                     return (Status);
    322  1.2.2.2  bouyer                 }
    323  1.2.2.2  bouyer             }
    324  1.2.2.2  bouyer 
    325  1.2.2.2  bouyer             WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
    326  1.2.2.2  bouyer         }
    327  1.2.2.2  bouyer         else
    328  1.2.2.2  bouyer         {
    329  1.2.2.2  bouyer             /* No return operand */
    330  1.2.2.2  bouyer 
    331  1.2.2.2  bouyer             if (WalkState->NumOperands)
    332  1.2.2.2  bouyer             {
    333  1.2.2.2  bouyer                 AcpiUtRemoveReference (WalkState->Operands [0]);
    334  1.2.2.2  bouyer             }
    335  1.2.2.2  bouyer 
    336  1.2.2.2  bouyer             WalkState->Operands [0]     = NULL;
    337  1.2.2.2  bouyer             WalkState->NumOperands      = 0;
    338  1.2.2.2  bouyer             WalkState->ReturnDesc       = NULL;
    339  1.2.2.2  bouyer         }
    340  1.2.2.2  bouyer 
    341  1.2.2.2  bouyer 
    342  1.2.2.2  bouyer         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    343  1.2.2.2  bouyer             "Completed RETURN_OP State=%p, RetVal=%p\n",
    344  1.2.2.2  bouyer             WalkState, WalkState->ReturnDesc));
    345  1.2.2.2  bouyer 
    346  1.2.2.2  bouyer         /* End the control method execution right now */
    347  1.2.2.2  bouyer 
    348  1.2.2.2  bouyer         Status = AE_CTRL_TERMINATE;
    349  1.2.2.2  bouyer         break;
    350  1.2.2.2  bouyer 
    351  1.2.2.2  bouyer 
    352  1.2.2.2  bouyer     case AML_NOOP_OP:
    353  1.2.2.2  bouyer 
    354  1.2.2.2  bouyer         /* Just do nothing! */
    355  1.2.2.2  bouyer         break;
    356  1.2.2.2  bouyer 
    357  1.2.2.2  bouyer 
    358  1.2.2.2  bouyer     case AML_BREAK_POINT_OP:
    359  1.2.2.2  bouyer 
    360  1.2.2.2  bouyer         /*
    361  1.2.2.2  bouyer          * Set the single-step flag. This will cause the debugger (if present)
    362  1.2.2.2  bouyer          * to break to the console within the AML debugger at the start of the
    363  1.2.2.2  bouyer          * next AML instruction.
    364  1.2.2.2  bouyer          */
    365  1.2.2.2  bouyer         ACPI_DEBUGGER_EXEC (
    366  1.2.2.2  bouyer             AcpiGbl_CmSingleStep = TRUE);
    367  1.2.2.2  bouyer         ACPI_DEBUGGER_EXEC (
    368  1.2.2.2  bouyer             AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
    369  1.2.2.2  bouyer 
    370  1.2.2.2  bouyer         /* Call to the OSL in case OS wants a piece of the action */
    371  1.2.2.2  bouyer 
    372  1.2.2.2  bouyer         Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
    373  1.2.2.3  bouyer 	    __UNCONST("Executed AML Breakpoint opcode"));
    374  1.2.2.2  bouyer         break;
    375  1.2.2.2  bouyer 
    376  1.2.2.2  bouyer 
    377  1.2.2.2  bouyer     case AML_BREAK_OP:
    378  1.2.2.2  bouyer     case AML_CONTINUE_OP: /* ACPI 2.0 */
    379  1.2.2.2  bouyer 
    380  1.2.2.2  bouyer 
    381  1.2.2.2  bouyer         /* Pop and delete control states until we find a while */
    382  1.2.2.2  bouyer 
    383  1.2.2.2  bouyer         while (WalkState->ControlState &&
    384  1.2.2.2  bouyer                 (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
    385  1.2.2.2  bouyer         {
    386  1.2.2.2  bouyer             ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
    387  1.2.2.2  bouyer             AcpiUtDeleteGenericState (ControlState);
    388  1.2.2.2  bouyer         }
    389  1.2.2.2  bouyer 
    390  1.2.2.2  bouyer         /* No while found? */
    391  1.2.2.2  bouyer 
    392  1.2.2.2  bouyer         if (!WalkState->ControlState)
    393  1.2.2.2  bouyer         {
    394  1.2.2.2  bouyer             return (AE_AML_NO_WHILE);
    395  1.2.2.2  bouyer         }
    396  1.2.2.2  bouyer 
    397  1.2.2.2  bouyer         /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
    398  1.2.2.2  bouyer 
    399  1.2.2.2  bouyer         WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;
    400  1.2.2.2  bouyer 
    401  1.2.2.2  bouyer         /* Return status depending on opcode */
    402  1.2.2.2  bouyer 
    403  1.2.2.2  bouyer         if (Op->Common.AmlOpcode == AML_BREAK_OP)
    404  1.2.2.2  bouyer         {
    405  1.2.2.2  bouyer             Status = AE_CTRL_BREAK;
    406  1.2.2.2  bouyer         }
    407  1.2.2.2  bouyer         else
    408  1.2.2.2  bouyer         {
    409  1.2.2.2  bouyer             Status = AE_CTRL_CONTINUE;
    410  1.2.2.2  bouyer         }
    411  1.2.2.2  bouyer         break;
    412  1.2.2.2  bouyer 
    413  1.2.2.2  bouyer 
    414  1.2.2.2  bouyer     default:
    415  1.2.2.2  bouyer 
    416  1.2.2.2  bouyer         ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
    417  1.2.2.2  bouyer             Op->Common.AmlOpcode, Op));
    418  1.2.2.2  bouyer 
    419  1.2.2.2  bouyer         Status = AE_AML_BAD_OPCODE;
    420  1.2.2.2  bouyer         break;
    421  1.2.2.2  bouyer     }
    422  1.2.2.2  bouyer 
    423  1.2.2.2  bouyer     return (Status);
    424  1.2.2.2  bouyer }
    425