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

exresop.c
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  *
00004  * Module Name: exresop - AML Interpreter operand/object resolution
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 __EXRESOP_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "amlcode.h"
00122 #include "acparser.h"
00123 #include "acinterp.h"
00124 #include "acnamesp.h"
00125 
00126 
00127 #define _COMPONENT          ACPI_EXECUTER
00128         ACPI_MODULE_NAME    ("exresop")
00129 
00130 /* Local prototypes */
00131 
00132 static ACPI_STATUS
00133 AcpiExCheckObjectType (
00134     ACPI_OBJECT_TYPE        TypeNeeded,
00135     ACPI_OBJECT_TYPE        ThisType,
00136     void                    *Object);
00137 
00138 
00139 /*******************************************************************************
00140  *
00141  * FUNCTION:    AcpiExCheckObjectType
00142  *
00143  * PARAMETERS:  TypeNeeded          Object type needed
00144  *              ThisType            Actual object type
00145  *              Object              Object pointer
00146  *
00147  * RETURN:      Status
00148  *
00149  * DESCRIPTION: Check required type against actual type
00150  *
00151  ******************************************************************************/
00152 
00153 static ACPI_STATUS
00154 AcpiExCheckObjectType (
00155     ACPI_OBJECT_TYPE        TypeNeeded,
00156     ACPI_OBJECT_TYPE        ThisType,
00157     void                    *Object)
00158 {
00159     ACPI_FUNCTION_ENTRY ();
00160 
00161 
00162     if (TypeNeeded == ACPI_TYPE_ANY)
00163     {
00164         /* All types OK, so we don't perform any typechecks */
00165 
00166         return (AE_OK);
00167     }
00168 
00169     if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
00170     {
00171         /*
00172          * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
00173          * objects and thus allow them to be targets.  (As per the ACPI
00174          * specification, a store to a constant is a noop.)
00175          */
00176         if ((ThisType == ACPI_TYPE_INTEGER) &&
00177             (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
00178         {
00179             return (AE_OK);
00180         }
00181     }
00182 
00183     if (TypeNeeded != ThisType)
00184     {
00185         ACPI_ERROR ((AE_INFO,
00186             "Needed type [%s], found [%s] %p",
00187             AcpiUtGetTypeName (TypeNeeded),
00188             AcpiUtGetTypeName (ThisType), Object));
00189 
00190         return (AE_AML_OPERAND_TYPE);
00191     }
00192 
00193     return (AE_OK);
00194 }
00195 
00196 
00197 /*******************************************************************************
00198  *
00199  * FUNCTION:    AcpiExResolveOperands
00200  *
00201  * PARAMETERS:  Opcode              - Opcode being interpreted
00202  *              StackPtr            - Pointer to the operand stack to be
00203  *                                    resolved
00204  *              WalkState           - Current state
00205  *
00206  * RETURN:      Status
00207  *
00208  * DESCRIPTION: Convert multiple input operands to the types required by the
00209  *              target operator.
00210  *
00211  *      Each 5-bit group in ArgTypes represents one required
00212  *      operand and indicates the required Type. The corresponding operand
00213  *      will be converted to the required type if possible, otherwise we
00214  *      abort with an exception.
00215  *
00216  ******************************************************************************/
00217 
00218 ACPI_STATUS
00219 AcpiExResolveOperands (
00220     UINT16                  Opcode,
00221     ACPI_OPERAND_OBJECT     **StackPtr,
00222     ACPI_WALK_STATE         *WalkState)
00223 {
00224     ACPI_OPERAND_OBJECT     *ObjDesc;
00225     ACPI_STATUS             Status = AE_OK;
00226     UINT8                   ObjectType;
00227     UINT32                  ArgTypes;
00228     const ACPI_OPCODE_INFO  *OpInfo;
00229     UINT32                  ThisArgType;
00230     ACPI_OBJECT_TYPE        TypeNeeded;
00231     UINT16                  TargetOp = 0;
00232 
00233 
00234     ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
00235 
00236 
00237     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
00238     if (OpInfo->Class == AML_CLASS_UNKNOWN)
00239     {
00240         return_ACPI_STATUS (AE_AML_BAD_OPCODE);
00241     }
00242 
00243     ArgTypes = OpInfo->RuntimeArgs;
00244     if (ArgTypes == ARGI_INVALID_OPCODE)
00245     {
00246         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
00247             Opcode));
00248 
00249         return_ACPI_STATUS (AE_AML_INTERNAL);
00250     }
00251 
00252     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00253         "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
00254         Opcode, OpInfo->Name, ArgTypes));
00255 
00256     /*
00257      * Normal exit is with (ArgTypes == 0) at end of argument list.
00258      * Function will return an exception from within the loop upon
00259      * finding an entry which is not (or cannot be converted
00260      * to) the required type; if stack underflows; or upon
00261      * finding a NULL stack entry (which should not happen).
00262      */
00263     while (GET_CURRENT_ARG_TYPE (ArgTypes))
00264     {
00265         if (!StackPtr || !*StackPtr)
00266         {
00267             ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
00268                 StackPtr));
00269 
00270             return_ACPI_STATUS (AE_AML_INTERNAL);
00271         }
00272 
00273         /* Extract useful items */
00274 
00275         ObjDesc = *StackPtr;
00276 
00277         /* Decode the descriptor type */
00278 
00279         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
00280         {
00281         case ACPI_DESC_TYPE_NAMED:
00282 
00283             /* Namespace Node */
00284 
00285             ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
00286 
00287             /*
00288              * Resolve an alias object. The construction of these objects
00289              * guarantees that there is only one level of alias indirection;
00290              * thus, the attached object is always the aliased namespace node
00291              */
00292             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
00293             {
00294                 ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
00295                 *StackPtr = ObjDesc;
00296                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
00297             }
00298             break;
00299 
00300 
00301         case ACPI_DESC_TYPE_OPERAND:
00302 
00303             /* ACPI internal object */
00304 
00305             ObjectType = ObjDesc->Common.Type;
00306 
00307             /* Check for bad ACPI_OBJECT_TYPE */
00308 
00309             if (!AcpiUtValidObjectType (ObjectType))
00310             {
00311                 ACPI_ERROR ((AE_INFO,
00312                     "Bad operand object type [0x%X]", ObjectType));
00313 
00314                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00315             }
00316 
00317             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
00318             {
00319                 /* Validate the Reference */
00320 
00321                 switch (ObjDesc->Reference.Class)
00322                 {
00323                 case ACPI_REFCLASS_DEBUG:
00324 
00325                     TargetOp = AML_DEBUG_OP;
00326 
00327                     /*lint -fallthrough */
00328 
00329                 case ACPI_REFCLASS_ARG:
00330                 case ACPI_REFCLASS_LOCAL:
00331                 case ACPI_REFCLASS_INDEX:
00332                 case ACPI_REFCLASS_REFOF:
00333                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
00334                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
00335 
00336                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00337                         "Operand is a Reference, Class [%s] %2.2X\n",
00338                         AcpiUtGetReferenceName (ObjDesc),
00339                         ObjDesc->Reference.Class));
00340                     break;
00341 
00342                 default:
00343 
00344                     ACPI_ERROR ((AE_INFO,
00345                         "Unknown Reference Class 0x%2.2X in %p",
00346                         ObjDesc->Reference.Class, ObjDesc));
00347 
00348                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00349                 }
00350             }
00351             break;
00352 
00353 
00354         default:
00355 
00356             /* Invalid descriptor */
00357 
00358             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
00359                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
00360 
00361             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00362         }
00363 
00364         /* Get one argument type, point to the next */
00365 
00366         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
00367         INCREMENT_ARG_LIST (ArgTypes);
00368 
00369         /*
00370          * Handle cases where the object does not need to be
00371          * resolved to a value
00372          */
00373         switch (ThisArgType)
00374         {
00375         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
00376 
00377             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
00378                 (ObjDesc->Common.Type == ACPI_TYPE_STRING))
00379             {
00380                 /*
00381                  * String found - the string references a named object and
00382                  * must be resolved to a node
00383                  */
00384                 goto NextOperand;
00385             }
00386 
00387             /*
00388              * Else not a string - fall through to the normal Reference
00389              * case below
00390              */
00391             /*lint -fallthrough */
00392 
00393         case ARGI_REFERENCE:            /* References: */
00394         case ARGI_INTEGER_REF:
00395         case ARGI_OBJECT_REF:
00396         case ARGI_DEVICE_REF:
00397         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
00398         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
00399         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
00400 
00401             /*
00402              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
00403              * A Namespace Node is OK as-is
00404              */
00405             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
00406             {
00407                 goto NextOperand;
00408             }
00409 
00410             Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
00411                             ObjectType, ObjDesc);
00412             if (ACPI_FAILURE (Status))
00413             {
00414                 return_ACPI_STATUS (Status);
00415             }
00416             goto NextOperand;
00417 
00418 
00419         case ARGI_DATAREFOBJ:  /* Store operator only */
00420 
00421             /*
00422              * We don't want to resolve IndexOp reference objects during
00423              * a store because this would be an implicit DeRefOf operation.
00424              * Instead, we just want to store the reference object.
00425              * -- All others must be resolved below.
00426              */
00427             if ((Opcode == AML_STORE_OP) &&
00428                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
00429                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
00430             {
00431                 goto NextOperand;
00432             }
00433             break;
00434 
00435         default:
00436             /* All cases covered above */
00437             break;
00438         }
00439 
00440         /*
00441          * Resolve this object to a value
00442          */
00443         Status = AcpiExResolveToValue (StackPtr, WalkState);
00444         if (ACPI_FAILURE (Status))
00445         {
00446             return_ACPI_STATUS (Status);
00447         }
00448 
00449         /* Get the resolved object */
00450 
00451         ObjDesc = *StackPtr;
00452 
00453         /*
00454          * Check the resulting object (value) type
00455          */
00456         switch (ThisArgType)
00457         {
00458         /*
00459          * For the simple cases, only one type of resolved object
00460          * is allowed
00461          */
00462         case ARGI_MUTEX:
00463 
00464             /* Need an operand of type ACPI_TYPE_MUTEX */
00465 
00466             TypeNeeded = ACPI_TYPE_MUTEX;
00467             break;
00468 
00469         case ARGI_EVENT:
00470 
00471             /* Need an operand of type ACPI_TYPE_EVENT */
00472 
00473             TypeNeeded = ACPI_TYPE_EVENT;
00474             break;
00475 
00476         case ARGI_PACKAGE:   /* Package */
00477 
00478             /* Need an operand of type ACPI_TYPE_PACKAGE */
00479 
00480             TypeNeeded = ACPI_TYPE_PACKAGE;
00481             break;
00482 
00483         case ARGI_ANYTYPE:
00484 
00485             /* Any operand type will do */
00486 
00487             TypeNeeded = ACPI_TYPE_ANY;
00488             break;
00489 
00490         case ARGI_DDBHANDLE:
00491 
00492             /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
00493 
00494             TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
00495             break;
00496 
00497 
00498         /*
00499          * The more complex cases allow multiple resolved object types
00500          */
00501         case ARGI_INTEGER:
00502 
00503             /*
00504              * Need an operand of type ACPI_TYPE_INTEGER,
00505              * But we can implicitly convert from a STRING or BUFFER
00506              * Aka - "Implicit Source Operand Conversion"
00507              */
00508             Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
00509             if (ACPI_FAILURE (Status))
00510             {
00511                 if (Status == AE_TYPE)
00512                 {
00513                     ACPI_ERROR ((AE_INFO,
00514                         "Needed [Integer/String/Buffer], found [%s] %p",
00515                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00516 
00517                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00518                 }
00519 
00520                 return_ACPI_STATUS (Status);
00521             }
00522 
00523             if (ObjDesc != *StackPtr)
00524             {
00525                 AcpiUtRemoveReference (ObjDesc);
00526             }
00527             goto NextOperand;
00528 
00529 
00530         case ARGI_BUFFER:
00531 
00532             /*
00533              * Need an operand of type ACPI_TYPE_BUFFER,
00534              * But we can implicitly convert from a STRING or INTEGER
00535              * Aka - "Implicit Source Operand Conversion"
00536              */
00537             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
00538             if (ACPI_FAILURE (Status))
00539             {
00540                 if (Status == AE_TYPE)
00541                 {
00542                     ACPI_ERROR ((AE_INFO,
00543                         "Needed [Integer/String/Buffer], found [%s] %p",
00544                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00545 
00546                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00547                 }
00548 
00549                 return_ACPI_STATUS (Status);
00550             }
00551 
00552             if (ObjDesc != *StackPtr)
00553             {
00554                 AcpiUtRemoveReference (ObjDesc);
00555             }
00556             goto NextOperand;
00557 
00558 
00559         case ARGI_STRING:
00560 
00561             /*
00562              * Need an operand of type ACPI_TYPE_STRING,
00563              * But we can implicitly convert from a BUFFER or INTEGER
00564              * Aka - "Implicit Source Operand Conversion"
00565              */
00566             Status = AcpiExConvertToString (ObjDesc, StackPtr,
00567                         ACPI_IMPLICIT_CONVERT_HEX);
00568             if (ACPI_FAILURE (Status))
00569             {
00570                 if (Status == AE_TYPE)
00571                 {
00572                     ACPI_ERROR ((AE_INFO,
00573                         "Needed [Integer/String/Buffer], found [%s] %p",
00574                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00575 
00576                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00577                 }
00578 
00579                 return_ACPI_STATUS (Status);
00580             }
00581 
00582             if (ObjDesc != *StackPtr)
00583             {
00584                 AcpiUtRemoveReference (ObjDesc);
00585             }
00586             goto NextOperand;
00587 
00588 
00589         case ARGI_COMPUTEDATA:
00590 
00591             /* Need an operand of type INTEGER, STRING or BUFFER */
00592 
00593             switch (ObjDesc->Common.Type)
00594             {
00595             case ACPI_TYPE_INTEGER:
00596             case ACPI_TYPE_STRING:
00597             case ACPI_TYPE_BUFFER:
00598 
00599                 /* Valid operand */
00600                break;
00601 
00602             default:
00603                 ACPI_ERROR ((AE_INFO,
00604                     "Needed [Integer/String/Buffer], found [%s] %p",
00605                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00606 
00607                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00608             }
00609             goto NextOperand;
00610 
00611 
00612         case ARGI_BUFFER_OR_STRING:
00613 
00614             /* Need an operand of type STRING or BUFFER */
00615 
00616             switch (ObjDesc->Common.Type)
00617             {
00618             case ACPI_TYPE_STRING:
00619             case ACPI_TYPE_BUFFER:
00620 
00621                 /* Valid operand */
00622                break;
00623 
00624             case ACPI_TYPE_INTEGER:
00625 
00626                 /* Highest priority conversion is to type Buffer */
00627 
00628                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
00629                 if (ACPI_FAILURE (Status))
00630                 {
00631                     return_ACPI_STATUS (Status);
00632                 }
00633 
00634                 if (ObjDesc != *StackPtr)
00635                 {
00636                     AcpiUtRemoveReference (ObjDesc);
00637                 }
00638                 break;
00639 
00640             default:
00641                 ACPI_ERROR ((AE_INFO,
00642                     "Needed [Integer/String/Buffer], found [%s] %p",
00643                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00644 
00645                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00646             }
00647             goto NextOperand;
00648 
00649 
00650         case ARGI_DATAOBJECT:
00651             /*
00652              * ARGI_DATAOBJECT is only used by the SizeOf operator.
00653              * Need a buffer, string, package, or RefOf reference.
00654              *
00655              * The only reference allowed here is a direct reference to
00656              * a namespace node.
00657              */
00658             switch (ObjDesc->Common.Type)
00659             {
00660             case ACPI_TYPE_PACKAGE:
00661             case ACPI_TYPE_STRING:
00662             case ACPI_TYPE_BUFFER:
00663             case ACPI_TYPE_LOCAL_REFERENCE:
00664 
00665                 /* Valid operand */
00666                 break;
00667 
00668             default:
00669                 ACPI_ERROR ((AE_INFO,
00670                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
00671                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00672 
00673                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00674             }
00675             goto NextOperand;
00676 
00677 
00678         case ARGI_COMPLEXOBJ:
00679 
00680             /* Need a buffer or package or (ACPI 2.0) String */
00681 
00682             switch (ObjDesc->Common.Type)
00683             {
00684             case ACPI_TYPE_PACKAGE:
00685             case ACPI_TYPE_STRING:
00686             case ACPI_TYPE_BUFFER:
00687 
00688                 /* Valid operand */
00689                 break;
00690 
00691             default:
00692                 ACPI_ERROR ((AE_INFO,
00693                     "Needed [Buffer/String/Package], found [%s] %p",
00694                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00695 
00696                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00697             }
00698             goto NextOperand;
00699 
00700 
00701         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
00702 
00703             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
00704 
00705             switch (ObjDesc->Common.Type)
00706             {
00707             case ACPI_TYPE_BUFFER:
00708             case ACPI_TYPE_REGION:
00709 
00710                 /* Valid operand */
00711                 break;
00712 
00713             default:
00714                 ACPI_ERROR ((AE_INFO,
00715                     "Needed [Region/Buffer], found [%s] %p",
00716                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00717 
00718                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00719             }
00720             goto NextOperand;
00721 
00722 
00723         case ARGI_DATAREFOBJ:
00724 
00725             /* Used by the Store() operator only */
00726 
00727             switch (ObjDesc->Common.Type)
00728             {
00729             case ACPI_TYPE_INTEGER:
00730             case ACPI_TYPE_PACKAGE:
00731             case ACPI_TYPE_STRING:
00732             case ACPI_TYPE_BUFFER:
00733             case ACPI_TYPE_BUFFER_FIELD:
00734             case ACPI_TYPE_LOCAL_REFERENCE:
00735             case ACPI_TYPE_LOCAL_REGION_FIELD:
00736             case ACPI_TYPE_LOCAL_BANK_FIELD:
00737             case ACPI_TYPE_LOCAL_INDEX_FIELD:
00738             case ACPI_TYPE_DDB_HANDLE:
00739 
00740                 /* Valid operand */
00741                 break;
00742 
00743             default:
00744 
00745                 if (AcpiGbl_EnableInterpreterSlack)
00746                 {
00747                     /*
00748                      * Enable original behavior of Store(), allowing any and all
00749                      * objects as the source operand.  The ACPI spec does not
00750                      * allow this, however.
00751                      */
00752                     break;
00753                 }
00754 
00755                 if (TargetOp == AML_DEBUG_OP)
00756                 {
00757                     /* Allow store of any object to the Debug object */
00758 
00759                     break;
00760                 }
00761 
00762                 ACPI_ERROR ((AE_INFO,
00763                     "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
00764                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
00765 
00766                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00767             }
00768             goto NextOperand;
00769 
00770 
00771         default:
00772 
00773             /* Unknown type */
00774 
00775             ACPI_ERROR ((AE_INFO,
00776                 "Internal - Unknown ARGI (required operand) type 0x%X",
00777                 ThisArgType));
00778 
00779             return_ACPI_STATUS (AE_BAD_PARAMETER);
00780         }
00781 
00782         /*
00783          * Make sure that the original object was resolved to the
00784          * required object type (Simple cases only).
00785          */
00786         Status = AcpiExCheckObjectType (TypeNeeded,
00787                         (*StackPtr)->Common.Type, *StackPtr);
00788         if (ACPI_FAILURE (Status))
00789         {
00790             return_ACPI_STATUS (Status);
00791         }
00792 
00793 NextOperand:
00794         /*
00795          * If more operands needed, decrement StackPtr to point
00796          * to next operand on stack
00797          */
00798         if (GET_CURRENT_ARG_TYPE (ArgTypes))
00799         {
00800             StackPtr--;
00801         }
00802     }
00803 
00804     ACPI_DUMP_OPERANDS (WalkState->Operands,
00805         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
00806 
00807     return_ACPI_STATUS (Status);
00808 }
00809 
00810 

Generated on Sat May 26 2012 04:25:47 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.