ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dswexec.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: dswexec - Dispatcher method execution callbacks;
00004  *                        dispatch to interpreter.
00005  *
00006  *****************************************************************************/
00007 
00008 /******************************************************************************
00009  *
00010  * 1. Copyright Notice
00011  *
00012  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00013  * All rights reserved.
00014  *
00015  * 2. License
00016  *
00017  * 2.1. This is your license from Intel Corp. under its intellectual property
00018  * rights.  You may have additional license terms from the party that provided
00019  * you this software, covering your right to use that party's intellectual
00020  * property rights.
00021  *
00022  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00023  * copy of the source code appearing in this file ("Covered Code") an
00024  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00025  * base code distributed originally by Intel ("Original Intel Code") to copy,
00026  * make derivatives, distribute, use and display any portion of the Covered
00027  * Code in any form, with the right to sublicense such rights; and
00028  *
00029  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00030  * license (with the right to sublicense), under only those claims of Intel
00031  * patents that are infringed by the Original Intel Code, to make, use, sell,
00032  * offer to sell, and import the Covered Code and derivative works thereof
00033  * solely to the minimum extent necessary to exercise the above copyright
00034  * license, and in no event shall the patent license extend to any additions
00035  * to or modifications of the Original Intel Code.  No other license or right
00036  * is granted directly or by implication, estoppel or otherwise;
00037  *
00038  * The above copyright and patent license is granted only if the following
00039  * conditions are met:
00040  *
00041  * 3. Conditions
00042  *
00043  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00044  * Redistribution of source code of any substantial portion of the Covered
00045  * Code or modification with rights to further distribute source must include
00046  * the above Copyright Notice, the above License, this list of Conditions,
00047  * and the following Disclaimer and Export Compliance provision.  In addition,
00048  * Licensee must cause all Covered Code to which Licensee contributes to
00049  * contain a file documenting the changes Licensee made to create that Covered
00050  * Code and the date of any change.  Licensee must include in that file the
00051  * documentation of any changes made by any predecessor Licensee.  Licensee
00052  * must include a prominent statement that the modification is derived,
00053  * directly or indirectly, from Original Intel Code.
00054  *
00055  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00056  * Redistribution of source code of any substantial portion of the Covered
00057  * Code or modification without rights to further distribute source must
00058  * include the following Disclaimer and Export Compliance provision in the
00059  * documentation and/or other materials provided with distribution.  In
00060  * addition, Licensee may not authorize further sublicense of source of any
00061  * portion of the Covered Code, and must include terms to the effect that the
00062  * license from Licensee to its licensee is limited to the intellectual
00063  * property embodied in the software Licensee provides to its licensee, and
00064  * not to intellectual property embodied in modifications its licensee may
00065  * make.
00066  *
00067  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00068  * substantial portion of the Covered Code or modification must reproduce the
00069  * above Copyright Notice, and the following Disclaimer and Export Compliance
00070  * provision in the documentation and/or other materials provided with the
00071  * distribution.
00072  *
00073  * 3.4. Intel retains all right, title, and interest in and to the Original
00074  * Intel Code.
00075  *
00076  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00077  * Intel shall be used in advertising or otherwise to promote the sale, use or
00078  * other dealings in products derived from or relating to the Covered Code
00079  * without prior written authorization from Intel.
00080  *
00081  * 4. Disclaimer and Export Compliance
00082  *
00083  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00084  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00085  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00086  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00087  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00088  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00089  * PARTICULAR PURPOSE.
00090  *
00091  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00092  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00093  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00094  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00095  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00096  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00097  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00098  * LIMITED REMEDY.
00099  *
00100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00101  * software or system incorporating such software without first obtaining any
00102  * required license or other approval from the U. S. Department of Commerce or
00103  * any other agency or department of the United States Government.  In the
00104  * event Licensee exports any such software from the United States or
00105  * re-exports any such software from a foreign destination, Licensee shall
00106  * ensure that the distribution and export/re-export of the software is in
00107  * compliance with all laws, regulations, orders, or other restrictions of the
00108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00109  * any of its subsidiaries will export/re-export any technical data, process,
00110  * software, or service, directly or indirectly, to any country for which the
00111  * United States government or any agency thereof requires an export license,
00112  * other governmental approval, or letter of assurance, without first obtaining
00113  * such license, approval or letter.
00114  *
00115  *****************************************************************************/
00116 
00117 #define __DSWEXEC_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "acparser.h"
00122 #include "amlcode.h"
00123 #include "acdispat.h"
00124 #include "acinterp.h"
00125 #include "acnamesp.h"
00126 #include "acdebug.h"
00127 
00128 
00129 #define _COMPONENT          ACPI_DISPATCHER
00130         ACPI_MODULE_NAME    ("dswexec")
00131 
00132 /*
00133  * Dispatch table for opcode classes
00134  */
00135 static ACPI_EXECUTE_OP      AcpiGbl_OpTypeDispatch [] =
00136 {
00137     AcpiExOpcode_0A_0T_1R,
00138     AcpiExOpcode_1A_0T_0R,
00139     AcpiExOpcode_1A_0T_1R,
00140     AcpiExOpcode_1A_1T_0R,
00141     AcpiExOpcode_1A_1T_1R,
00142     AcpiExOpcode_2A_0T_0R,
00143     AcpiExOpcode_2A_0T_1R,
00144     AcpiExOpcode_2A_1T_1R,
00145     AcpiExOpcode_2A_2T_1R,
00146     AcpiExOpcode_3A_0T_0R,
00147     AcpiExOpcode_3A_1T_1R,
00148     AcpiExOpcode_6A_0T_1R
00149 };
00150 
00151 
00152 /*****************************************************************************
00153  *
00154  * FUNCTION:    AcpiDsGetPredicateValue
00155  *
00156  * PARAMETERS:  WalkState       - Current state of the parse tree walk
00157  *              ResultObj       - if non-zero, pop result from result stack
00158  *
00159  * RETURN:      Status
00160  *
00161  * DESCRIPTION: Get the result of a predicate evaluation
00162  *
00163  ****************************************************************************/
00164 
00165 ACPI_STATUS
00166 AcpiDsGetPredicateValue (
00167     ACPI_WALK_STATE         *WalkState,
00168     ACPI_OPERAND_OBJECT     *ResultObj)
00169 {
00170     ACPI_STATUS             Status = AE_OK;
00171     ACPI_OPERAND_OBJECT     *ObjDesc;
00172     ACPI_OPERAND_OBJECT     *LocalObjDesc = NULL;
00173 
00174 
00175     ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
00176 
00177 
00178     WalkState->ControlState->Common.State = 0;
00179 
00180     if (ResultObj)
00181     {
00182         Status = AcpiDsResultPop (&ObjDesc, WalkState);
00183         if (ACPI_FAILURE (Status))
00184         {
00185             ACPI_EXCEPTION ((AE_INFO, Status,
00186                 "Could not get result from predicate evaluation"));
00187 
00188             return_ACPI_STATUS (Status);
00189         }
00190     }
00191     else
00192     {
00193         Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
00194         if (ACPI_FAILURE (Status))
00195         {
00196             return_ACPI_STATUS (Status);
00197         }
00198 
00199         Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
00200         if (ACPI_FAILURE (Status))
00201         {
00202             return_ACPI_STATUS (Status);
00203         }
00204 
00205         ObjDesc = WalkState->Operands [0];
00206     }
00207 
00208     if (!ObjDesc)
00209     {
00210         ACPI_ERROR ((AE_INFO,
00211             "No predicate ObjDesc=%p State=%p",
00212             ObjDesc, WalkState));
00213 
00214         return_ACPI_STATUS (AE_AML_NO_OPERAND);
00215     }
00216 
00217     /*
00218      * Result of predicate evaluation must be an Integer
00219      * object. Implicitly convert the argument if necessary.
00220      */
00221     Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16);
00222     if (ACPI_FAILURE (Status))
00223     {
00224         goto Cleanup;
00225     }
00226 
00227     if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
00228     {
00229         ACPI_ERROR ((AE_INFO,
00230             "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
00231             ObjDesc, WalkState, ObjDesc->Common.Type));
00232 
00233         Status = AE_AML_OPERAND_TYPE;
00234         goto Cleanup;
00235     }
00236 
00237     /* Truncate the predicate to 32-bits if necessary */
00238 
00239     AcpiExTruncateFor32bitTable (LocalObjDesc);
00240 
00241     /*
00242      * Save the result of the predicate evaluation on
00243      * the control stack
00244      */
00245     if (LocalObjDesc->Integer.Value)
00246     {
00247         WalkState->ControlState->Common.Value = TRUE;
00248     }
00249     else
00250     {
00251         /*
00252          * Predicate is FALSE, we will just toss the
00253          * rest of the package
00254          */
00255         WalkState->ControlState->Common.Value = FALSE;
00256         Status = AE_CTRL_FALSE;
00257     }
00258 
00259     /* Predicate can be used for an implicit return value */
00260 
00261     (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
00262 
00263 
00264 Cleanup:
00265 
00266     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
00267         WalkState->ControlState->Common.Value, WalkState->Op));
00268 
00269      /* Break to debugger to display result */
00270 
00271     ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState));
00272 
00273     /*
00274      * Delete the predicate result object (we know that
00275      * we don't need it anymore)
00276      */
00277     if (LocalObjDesc != ObjDesc)
00278     {
00279         AcpiUtRemoveReference (LocalObjDesc);
00280     }
00281     AcpiUtRemoveReference (ObjDesc);
00282 
00283     WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
00284     return_ACPI_STATUS (Status);
00285 }
00286 
00287 
00288 /*****************************************************************************
00289  *
00290  * FUNCTION:    AcpiDsExecBeginOp
00291  *
00292  * PARAMETERS:  WalkState       - Current state of the parse tree walk
00293  *              OutOp           - Where to return op if a new one is created
00294  *
00295  * RETURN:      Status
00296  *
00297  * DESCRIPTION: Descending callback used during the execution of control
00298  *              methods.  This is where most operators and operands are
00299  *              dispatched to the interpreter.
00300  *
00301  ****************************************************************************/
00302 
00303 ACPI_STATUS
00304 AcpiDsExecBeginOp (
00305     ACPI_WALK_STATE         *WalkState,
00306     ACPI_PARSE_OBJECT       **OutOp)
00307 {
00308     ACPI_PARSE_OBJECT       *Op;
00309     ACPI_STATUS             Status = AE_OK;
00310     UINT32                  OpcodeClass;
00311 
00312 
00313     ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
00314 
00315 
00316     Op = WalkState->Op;
00317     if (!Op)
00318     {
00319         Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
00320         if (ACPI_FAILURE (Status))
00321         {
00322             goto ErrorExit;
00323         }
00324 
00325         Op = *OutOp;
00326         WalkState->Op = Op;
00327         WalkState->Opcode = Op->Common.AmlOpcode;
00328         WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
00329 
00330         if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
00331         {
00332             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
00333                 "(%s) Popping scope for Op %p\n",
00334                 AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
00335 
00336             Status = AcpiDsScopeStackPop (WalkState);
00337             if (ACPI_FAILURE (Status))
00338             {
00339                 goto ErrorExit;
00340             }
00341         }
00342     }
00343 
00344     if (Op == WalkState->Origin)
00345     {
00346         if (OutOp)
00347         {
00348             *OutOp = Op;
00349         }
00350 
00351         return_ACPI_STATUS (AE_OK);
00352     }
00353 
00354     /*
00355      * If the previous opcode was a conditional, this opcode
00356      * must be the beginning of the associated predicate.
00357      * Save this knowledge in the current scope descriptor
00358      */
00359     if ((WalkState->ControlState) &&
00360         (WalkState->ControlState->Common.State ==
00361             ACPI_CONTROL_CONDITIONAL_EXECUTING))
00362     {
00363         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
00364                         Op, WalkState));
00365 
00366         WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING;
00367 
00368         /* Save start of predicate */
00369 
00370         WalkState->ControlState->Control.PredicateOp = Op;
00371     }
00372 
00373 
00374     OpcodeClass = WalkState->OpInfo->Class;
00375 
00376     /* We want to send namepaths to the load code */
00377 
00378     if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
00379     {
00380         OpcodeClass = AML_CLASS_NAMED_OBJECT;
00381     }
00382 
00383     /*
00384      * Handle the opcode based upon the opcode type
00385      */
00386     switch (OpcodeClass)
00387     {
00388     case AML_CLASS_CONTROL:
00389 
00390         Status = AcpiDsExecBeginControlOp (WalkState, Op);
00391         break;
00392 
00393 
00394     case AML_CLASS_NAMED_OBJECT:
00395 
00396         if (WalkState->WalkType & ACPI_WALK_METHOD)
00397         {
00398             /*
00399              * Found a named object declaration during method execution;
00400              * we must enter this object into the namespace.  The created
00401              * object is temporary and will be deleted upon completion of
00402              * the execution of this method.
00403              *
00404              * Note 10/2010: Except for the Scope() op. This opcode does
00405              * not actually create a new object, it refers to an existing
00406              * object. However, for Scope(), we want to indeed open a
00407              * new scope.
00408              */
00409             if (Op->Common.AmlOpcode != AML_SCOPE_OP)
00410             {
00411                 Status = AcpiDsLoad2BeginOp (WalkState, NULL);
00412             }
00413             else
00414             {
00415                 Status = AcpiDsScopeStackPush (Op->Named.Node,
00416                             Op->Named.Node->Type, WalkState);
00417                 if (ACPI_FAILURE (Status))
00418                 {
00419                     return_ACPI_STATUS (Status);
00420                 }
00421             }
00422         }
00423         break;
00424 
00425 
00426     case AML_CLASS_EXECUTE:
00427     case AML_CLASS_CREATE:
00428 
00429         break;
00430 
00431 
00432     default:
00433         break;
00434     }
00435 
00436     /* Nothing to do here during method execution */
00437 
00438     return_ACPI_STATUS (Status);
00439 
00440 
00441 ErrorExit:
00442     Status = AcpiDsMethodError (Status, WalkState);
00443     return_ACPI_STATUS (Status);
00444 }
00445 
00446 
00447 /*****************************************************************************
00448  *
00449  * FUNCTION:    AcpiDsExecEndOp
00450  *
00451  * PARAMETERS:  WalkState       - Current state of the parse tree walk
00452  *
00453  * RETURN:      Status
00454  *
00455  * DESCRIPTION: Ascending callback used during the execution of control
00456  *              methods.  The only thing we really need to do here is to
00457  *              notice the beginning of IF, ELSE, and WHILE blocks.
00458  *
00459  ****************************************************************************/
00460 
00461 ACPI_STATUS
00462 AcpiDsExecEndOp (
00463     ACPI_WALK_STATE         *WalkState)
00464 {
00465     ACPI_PARSE_OBJECT       *Op;
00466     ACPI_STATUS             Status = AE_OK;
00467     UINT32                  OpType;
00468     UINT32                  OpClass;
00469     ACPI_PARSE_OBJECT       *NextOp;
00470     ACPI_PARSE_OBJECT       *FirstArg;
00471 
00472 
00473     ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
00474 
00475 
00476     Op      = WalkState->Op;
00477     OpType  = WalkState->OpInfo->Type;
00478     OpClass = WalkState->OpInfo->Class;
00479 
00480     if (OpClass == AML_CLASS_UNKNOWN)
00481     {
00482         ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
00483         return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
00484     }
00485 
00486     FirstArg = Op->Common.Value.Arg;
00487 
00488     /* Init the walk state */
00489 
00490     WalkState->NumOperands = 0;
00491     WalkState->OperandIndex = 0;
00492     WalkState->ReturnDesc = NULL;
00493     WalkState->ResultObj = NULL;
00494 
00495     /* Call debugger for single step support (DEBUG build only) */
00496 
00497     ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
00498     ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
00499 
00500     /* Decode the Opcode Class */
00501 
00502     switch (OpClass)
00503     {
00504     case AML_CLASS_ARGUMENT:    /* Constants, literals, etc. */
00505 
00506         if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
00507         {
00508             Status = AcpiDsEvaluateNamePath (WalkState);
00509             if (ACPI_FAILURE (Status))
00510             {
00511                 goto Cleanup;
00512             }
00513         }
00514         break;
00515 
00516 
00517     case AML_CLASS_EXECUTE:     /* Most operators with arguments */
00518 
00519         /* Build resolved operand stack */
00520 
00521         Status = AcpiDsCreateOperands (WalkState, FirstArg);
00522         if (ACPI_FAILURE (Status))
00523         {
00524             goto Cleanup;
00525         }
00526 
00527         /*
00528          * All opcodes require operand resolution, with the only exceptions
00529          * being the ObjectType and SizeOf operators.
00530          */
00531         if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
00532         {
00533             /* Resolve all operands */
00534 
00535             Status = AcpiExResolveOperands (WalkState->Opcode,
00536                         &(WalkState->Operands [WalkState->NumOperands -1]),
00537                         WalkState);
00538         }
00539 
00540         if (ACPI_SUCCESS (Status))
00541         {
00542             /*
00543              * Dispatch the request to the appropriate interpreter handler
00544              * routine.  There is one routine per opcode "type" based upon the
00545              * number of opcode arguments and return type.
00546              */
00547             Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
00548         }
00549         else
00550         {
00551             /*
00552              * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
00553              * Local is uninitialized.
00554              */
00555             if  ((Status == AE_AML_UNINITIALIZED_LOCAL) &&
00556                 (WalkState->Opcode == AML_STORE_OP) &&
00557                 (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
00558                 (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
00559                 (WalkState->Operands[0]->Reference.Class ==
00560                  WalkState->Operands[1]->Reference.Class) &&
00561                 (WalkState->Operands[0]->Reference.Value ==
00562                  WalkState->Operands[1]->Reference.Value))
00563             {
00564                 Status = AE_OK;
00565             }
00566             else
00567             {
00568                 ACPI_EXCEPTION ((AE_INFO, Status,
00569                     "While resolving operands for [%s]",
00570                     AcpiPsGetOpcodeName (WalkState->Opcode)));
00571             }
00572         }
00573 
00574         /* Always delete the argument objects and clear the operand stack */
00575 
00576         AcpiDsClearOperands (WalkState);
00577 
00578         /*
00579          * If a result object was returned from above, push it on the
00580          * current result stack
00581          */
00582         if (ACPI_SUCCESS (Status) &&
00583             WalkState->ResultObj)
00584         {
00585             Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
00586         }
00587         break;
00588 
00589 
00590     default:
00591 
00592         switch (OpType)
00593         {
00594         case AML_TYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
00595 
00596             /* 1 Operand, 0 ExternalResult, 0 InternalResult */
00597 
00598             Status = AcpiDsExecEndControlOp (WalkState, Op);
00599 
00600             break;
00601 
00602 
00603         case AML_TYPE_METHOD_CALL:
00604 
00605             /*
00606              * If the method is referenced from within a package
00607              * declaration, it is not a invocation of the method, just
00608              * a reference to it.
00609              */
00610             if ((Op->Asl.Parent) &&
00611                ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
00612                 (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
00613             {
00614                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
00615                     "Method Reference in a Package, Op=%p\n", Op));
00616 
00617                 Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node;
00618                 AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
00619                 return_ACPI_STATUS (AE_OK);
00620             }
00621 
00622             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op));
00623 
00624             /*
00625              * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
00626              * the method Node pointer
00627              */
00628             /* NextOp points to the op that holds the method name */
00629 
00630             NextOp = FirstArg;
00631 
00632             /* NextOp points to first argument op */
00633 
00634             NextOp = NextOp->Common.Next;
00635 
00636             /*
00637              * Get the method's arguments and put them on the operand stack
00638              */
00639             Status = AcpiDsCreateOperands (WalkState, NextOp);
00640             if (ACPI_FAILURE (Status))
00641             {
00642                 break;
00643             }
00644 
00645             /*
00646              * Since the operands will be passed to another control method,
00647              * we must resolve all local references here (Local variables,
00648              * arguments to *this* method, etc.)
00649              */
00650             Status = AcpiDsResolveOperands (WalkState);
00651             if (ACPI_FAILURE (Status))
00652             {
00653                 /* On error, clear all resolved operands */
00654 
00655                 AcpiDsClearOperands (WalkState);
00656                 break;
00657             }
00658 
00659             /*
00660              * Tell the walk loop to preempt this running method and
00661              * execute the new method
00662              */
00663             Status = AE_CTRL_TRANSFER;
00664 
00665             /*
00666              * Return now; we don't want to disturb anything,
00667              * especially the operand count!
00668              */
00669             return_ACPI_STATUS (Status);
00670 
00671 
00672         case AML_TYPE_CREATE_FIELD:
00673 
00674             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00675                 "Executing CreateField Buffer/Index Op=%p\n", Op));
00676 
00677             Status = AcpiDsLoad2EndOp (WalkState);
00678             if (ACPI_FAILURE (Status))
00679             {
00680                 break;
00681             }
00682 
00683             Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
00684             break;
00685 
00686 
00687         case AML_TYPE_CREATE_OBJECT:
00688 
00689             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00690                 "Executing CreateObject (Buffer/Package) Op=%p\n", Op));
00691 
00692             switch (Op->Common.Parent->Common.AmlOpcode)
00693             {
00694             case AML_NAME_OP:
00695 
00696                 /*
00697                  * Put the Node on the object stack (Contains the ACPI Name
00698                  * of this object)
00699                  */
00700                 WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node;
00701                 WalkState->NumOperands = 1;
00702 
00703                 Status = AcpiDsCreateNode (WalkState,
00704                             Op->Common.Parent->Common.Node,
00705                             Op->Common.Parent);
00706                 if (ACPI_FAILURE (Status))
00707                 {
00708                     break;
00709                 }
00710 
00711                 /* Fall through */
00712                 /*lint -fallthrough */
00713 
00714             case AML_INT_EVAL_SUBTREE_OP:
00715 
00716                 Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
00717                             AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
00718                 break;
00719 
00720             default:
00721 
00722                 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
00723                 break;
00724             }
00725 
00726             /*
00727              * If a result object was returned from above, push it on the
00728              * current result stack
00729              */
00730             if (WalkState->ResultObj)
00731             {
00732                 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
00733             }
00734             break;
00735 
00736 
00737         case AML_TYPE_NAMED_FIELD:
00738         case AML_TYPE_NAMED_COMPLEX:
00739         case AML_TYPE_NAMED_SIMPLE:
00740         case AML_TYPE_NAMED_NO_OBJ:
00741 
00742             Status = AcpiDsLoad2EndOp (WalkState);
00743             if (ACPI_FAILURE (Status))
00744             {
00745                 break;
00746             }
00747 
00748             if (Op->Common.AmlOpcode == AML_REGION_OP)
00749             {
00750                 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00751                     "Executing OpRegion Address/Length Op=%p\n", Op));
00752 
00753                 Status = AcpiDsEvalRegionOperands (WalkState, Op);
00754                 if (ACPI_FAILURE (Status))
00755                 {
00756                     break;
00757                 }
00758             }
00759             else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
00760             {
00761                 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00762                     "Executing DataTableRegion Strings Op=%p\n", Op));
00763 
00764                 Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
00765                 if (ACPI_FAILURE (Status))
00766                 {
00767                     break;
00768                 }
00769             }
00770             else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
00771             {
00772                 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00773                     "Executing BankField Op=%p\n", Op));
00774 
00775                 Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
00776                 if (ACPI_FAILURE (Status))
00777                 {
00778                     break;
00779                 }
00780             }
00781             break;
00782 
00783 
00784         case AML_TYPE_UNDEFINED:
00785 
00786             ACPI_ERROR ((AE_INFO,
00787                 "Undefined opcode type Op=%p", Op));
00788             return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
00789 
00790 
00791         case AML_TYPE_BOGUS:
00792 
00793             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
00794                 "Internal opcode=%X type Op=%p\n",
00795                 WalkState->Opcode, Op));
00796             break;
00797 
00798 
00799         default:
00800 
00801             ACPI_ERROR ((AE_INFO,
00802                 "Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
00803                 OpClass, OpType, Op->Common.AmlOpcode, Op));
00804 
00805             Status = AE_NOT_IMPLEMENTED;
00806             break;
00807         }
00808     }
00809 
00810     /*
00811      * ACPI 2.0 support for 64-bit integers: Truncate numeric
00812      * result value if we are executing from a 32-bit ACPI table
00813      */
00814     AcpiExTruncateFor32bitTable (WalkState->ResultObj);
00815 
00816     /*
00817      * Check if we just completed the evaluation of a
00818      * conditional predicate
00819      */
00820     if ((ACPI_SUCCESS (Status)) &&
00821         (WalkState->ControlState) &&
00822         (WalkState->ControlState->Common.State ==
00823             ACPI_CONTROL_PREDICATE_EXECUTING) &&
00824         (WalkState->ControlState->Control.PredicateOp == Op))
00825     {
00826         Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
00827         WalkState->ResultObj = NULL;
00828     }
00829 
00830 
00831 Cleanup:
00832 
00833     if (WalkState->ResultObj)
00834     {
00835         /* Break to debugger to display result */
00836 
00837         ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj,
00838                                 WalkState));
00839 
00840         /*
00841          * Delete the result op if and only if:
00842          * Parent will not use the result -- such as any
00843          * non-nested type2 op in a method (parent will be method)
00844          */
00845         AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
00846     }
00847 
00848 #ifdef _UNDER_DEVELOPMENT
00849 
00850     if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
00851     {
00852         AcpiDbMethodEnd (WalkState);
00853     }
00854 #endif
00855 
00856     /* Invoke exception handler on error */
00857 
00858     if (ACPI_FAILURE (Status))
00859     {
00860         Status = AcpiDsMethodError (Status, WalkState);
00861     }
00862 
00863     /* Always clear the object stack */
00864 
00865     WalkState->NumOperands = 0;
00866     return_ACPI_STATUS (Status);
00867 }
00868 
00869 

Generated on Sun May 27 2012 04:27:15 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.