Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:02

0001 /******************************************************************************
0002  *
0003  * Module Name: exresop - AML Interpreter operand/object resolution
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 #include "acpi.h"
0153 #include "accommon.h"
0154 #include "amlcode.h"
0155 #include "acparser.h"
0156 #include "acinterp.h"
0157 #include "acnamesp.h"
0158 
0159 
0160 #define _COMPONENT          ACPI_EXECUTER
0161         ACPI_MODULE_NAME    ("exresop")
0162 
0163 /* Local prototypes */
0164 
0165 static ACPI_STATUS
0166 AcpiExCheckObjectType (
0167     ACPI_OBJECT_TYPE        TypeNeeded,
0168     ACPI_OBJECT_TYPE        ThisType,
0169     void                    *Object);
0170 
0171 
0172 /*******************************************************************************
0173  *
0174  * FUNCTION:    AcpiExCheckObjectType
0175  *
0176  * PARAMETERS:  TypeNeeded          Object type needed
0177  *              ThisType            Actual object type
0178  *              Object              Object pointer
0179  *
0180  * RETURN:      Status
0181  *
0182  * DESCRIPTION: Check required type against actual type
0183  *
0184  ******************************************************************************/
0185 
0186 static ACPI_STATUS
0187 AcpiExCheckObjectType (
0188     ACPI_OBJECT_TYPE        TypeNeeded,
0189     ACPI_OBJECT_TYPE        ThisType,
0190     void                    *Object)
0191 {
0192     ACPI_FUNCTION_ENTRY ();
0193 
0194 
0195     if (TypeNeeded == ACPI_TYPE_ANY)
0196     {
0197         /* All types OK, so we don't perform any typechecks */
0198 
0199         return (AE_OK);
0200     }
0201 
0202     if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
0203     {
0204         /*
0205          * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
0206          * objects and thus allow them to be targets. (As per the ACPI
0207          * specification, a store to a constant is a noop.)
0208          */
0209         if ((ThisType == ACPI_TYPE_INTEGER) &&
0210             (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags &
0211                 AOPOBJ_AML_CONSTANT))
0212         {
0213             return (AE_OK);
0214         }
0215     }
0216 
0217     if (TypeNeeded != ThisType)
0218     {
0219         ACPI_ERROR ((AE_INFO,
0220             "Needed type [%s], found [%s] %p",
0221             AcpiUtGetTypeName (TypeNeeded),
0222             AcpiUtGetTypeName (ThisType), Object));
0223 
0224         return (AE_AML_OPERAND_TYPE);
0225     }
0226 
0227     return (AE_OK);
0228 }
0229 
0230 
0231 /*******************************************************************************
0232  *
0233  * FUNCTION:    AcpiExResolveOperands
0234  *
0235  * PARAMETERS:  Opcode              - Opcode being interpreted
0236  *              StackPtr            - Pointer to the operand stack to be
0237  *                                    resolved
0238  *              WalkState           - Current state
0239  *
0240  * RETURN:      Status
0241  *
0242  * DESCRIPTION: Convert multiple input operands to the types required by the
0243  *              target operator.
0244  *
0245  *      Each 5-bit group in ArgTypes represents one required
0246  *      operand and indicates the required Type. The corresponding operand
0247  *      will be converted to the required type if possible, otherwise we
0248  *      abort with an exception.
0249  *
0250  ******************************************************************************/
0251 
0252 ACPI_STATUS
0253 AcpiExResolveOperands (
0254     UINT16                  Opcode,
0255     ACPI_OPERAND_OBJECT     **StackPtr,
0256     ACPI_WALK_STATE         *WalkState)
0257 {
0258     ACPI_OPERAND_OBJECT     *ObjDesc;
0259     ACPI_STATUS             Status = AE_OK;
0260     UINT8                   ObjectType;
0261     UINT32                  ArgTypes;
0262     const ACPI_OPCODE_INFO  *OpInfo;
0263     UINT32                  ThisArgType;
0264     ACPI_OBJECT_TYPE        TypeNeeded;
0265     UINT16                  TargetOp = 0;
0266 
0267 
0268     ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
0269 
0270 
0271     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
0272     if (OpInfo->Class == AML_CLASS_UNKNOWN)
0273     {
0274         return_ACPI_STATUS (AE_AML_BAD_OPCODE);
0275     }
0276 
0277     ArgTypes = OpInfo->RuntimeArgs;
0278     if (ArgTypes == ARGI_INVALID_OPCODE)
0279     {
0280         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
0281             Opcode));
0282 
0283         return_ACPI_STATUS (AE_AML_INTERNAL);
0284     }
0285 
0286     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
0287         "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
0288         Opcode, OpInfo->Name, ArgTypes));
0289 
0290     /*
0291      * Normal exit is with (ArgTypes == 0) at end of argument list.
0292      * Function will return an exception from within the loop upon
0293      * finding an entry which is not (or cannot be converted
0294      * to) the required type; if stack underflows; or upon
0295      * finding a NULL stack entry (which should not happen).
0296      */
0297     while (GET_CURRENT_ARG_TYPE (ArgTypes))
0298     {
0299         if (!StackPtr || !*StackPtr)
0300         {
0301             ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
0302                 StackPtr));
0303 
0304             return_ACPI_STATUS (AE_AML_INTERNAL);
0305         }
0306 
0307         /* Extract useful items */
0308 
0309         ObjDesc = *StackPtr;
0310 
0311         /* Decode the descriptor type */
0312 
0313         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
0314         {
0315         case ACPI_DESC_TYPE_NAMED:
0316 
0317             /* Namespace Node */
0318 
0319             ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
0320 
0321             /*
0322              * Resolve an alias object. The construction of these objects
0323              * guarantees that there is only one level of alias indirection;
0324              * thus, the attached object is always the aliased namespace node
0325              */
0326             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
0327             {
0328                 ObjDesc = AcpiNsGetAttachedObject (
0329                     (ACPI_NAMESPACE_NODE *) ObjDesc);
0330                 *StackPtr = ObjDesc;
0331                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
0332             }
0333             break;
0334 
0335         case ACPI_DESC_TYPE_OPERAND:
0336 
0337             /* ACPI internal object */
0338 
0339             ObjectType = ObjDesc->Common.Type;
0340 
0341             /* Check for bad ACPI_OBJECT_TYPE */
0342 
0343             if (!AcpiUtValidObjectType (ObjectType))
0344             {
0345                 ACPI_ERROR ((AE_INFO,
0346                     "Bad operand object type [0x%X]", ObjectType));
0347 
0348                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0349             }
0350 
0351             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
0352             {
0353                 /* Validate the Reference */
0354 
0355                 switch (ObjDesc->Reference.Class)
0356                 {
0357                 case ACPI_REFCLASS_DEBUG:
0358 
0359                     TargetOp = AML_DEBUG_OP;
0360 
0361                     ACPI_FALLTHROUGH;
0362 
0363                 case ACPI_REFCLASS_ARG:
0364                 case ACPI_REFCLASS_LOCAL:
0365                 case ACPI_REFCLASS_INDEX:
0366                 case ACPI_REFCLASS_REFOF:
0367                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
0368                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
0369 
0370                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
0371                         "Operand is a Reference, Class [%s] %2.2X\n",
0372                         AcpiUtGetReferenceName (ObjDesc),
0373                         ObjDesc->Reference.Class));
0374                     break;
0375 
0376                 default:
0377 
0378                     ACPI_ERROR ((AE_INFO,
0379                         "Unknown Reference Class 0x%2.2X in %p",
0380                         ObjDesc->Reference.Class, ObjDesc));
0381 
0382                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0383                 }
0384             }
0385             break;
0386 
0387         default:
0388 
0389             /* Invalid descriptor */
0390 
0391             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
0392                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
0393 
0394             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0395         }
0396 
0397         /* Get one argument type, point to the next */
0398 
0399         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
0400         INCREMENT_ARG_LIST (ArgTypes);
0401 
0402         /*
0403          * Handle cases where the object does not need to be
0404          * resolved to a value
0405          */
0406         switch (ThisArgType)
0407         {
0408         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
0409 
0410             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) ==
0411                 ACPI_DESC_TYPE_OPERAND) &&
0412                 (ObjDesc->Common.Type == ACPI_TYPE_STRING))
0413             {
0414                 /*
0415                  * String found - the string references a named object and
0416                  * must be resolved to a node
0417                  */
0418                 goto NextOperand;
0419             }
0420 
0421             /*
0422              * Else not a string - fall through to the normal Reference
0423              * case below
0424              */
0425             ACPI_FALLTHROUGH;
0426 
0427         case ARGI_REFERENCE:            /* References: */
0428         case ARGI_INTEGER_REF:
0429         case ARGI_OBJECT_REF:
0430         case ARGI_DEVICE_REF:
0431         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
0432         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
0433         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
0434         case ARGI_STORE_TARGET:
0435 
0436             /*
0437              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
0438              * A Namespace Node is OK as-is
0439              */
0440             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
0441             {
0442                 goto NextOperand;
0443             }
0444 
0445             Status = AcpiExCheckObjectType (
0446                 ACPI_TYPE_LOCAL_REFERENCE, ObjectType, ObjDesc);
0447             if (ACPI_FAILURE (Status))
0448             {
0449                 return_ACPI_STATUS (Status);
0450             }
0451             goto NextOperand;
0452 
0453         case ARGI_DATAREFOBJ:  /* Store operator only */
0454             /*
0455              * We don't want to resolve IndexOp reference objects during
0456              * a store because this would be an implicit DeRefOf operation.
0457              * Instead, we just want to store the reference object.
0458              * -- All others must be resolved below.
0459              */
0460             if ((Opcode == AML_STORE_OP) &&
0461                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
0462                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
0463             {
0464                 goto NextOperand;
0465             }
0466             break;
0467 
0468         default:
0469 
0470             /* All cases covered above */
0471 
0472             break;
0473         }
0474 
0475         /*
0476          * Resolve this object to a value
0477          */
0478         Status = AcpiExResolveToValue (StackPtr, WalkState);
0479         if (ACPI_FAILURE (Status))
0480         {
0481             return_ACPI_STATUS (Status);
0482         }
0483 
0484         /* Get the resolved object */
0485 
0486         ObjDesc = *StackPtr;
0487 
0488         /*
0489          * Check the resulting object (value) type
0490          */
0491         switch (ThisArgType)
0492         {
0493         /*
0494          * For the simple cases, only one type of resolved object
0495          * is allowed
0496          */
0497         case ARGI_MUTEX:
0498 
0499             /* Need an operand of type ACPI_TYPE_MUTEX */
0500 
0501             TypeNeeded = ACPI_TYPE_MUTEX;
0502             break;
0503 
0504         case ARGI_EVENT:
0505 
0506             /* Need an operand of type ACPI_TYPE_EVENT */
0507 
0508             TypeNeeded = ACPI_TYPE_EVENT;
0509             break;
0510 
0511         case ARGI_PACKAGE:   /* Package */
0512 
0513             /* Need an operand of type ACPI_TYPE_PACKAGE */
0514 
0515             TypeNeeded = ACPI_TYPE_PACKAGE;
0516             break;
0517 
0518         case ARGI_ANYTYPE:
0519 
0520             /* Any operand type will do */
0521 
0522             TypeNeeded = ACPI_TYPE_ANY;
0523             break;
0524 
0525         case ARGI_DDBHANDLE:
0526 
0527             /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
0528 
0529             TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
0530             break;
0531 
0532 
0533         /*
0534          * The more complex cases allow multiple resolved object types
0535          */
0536         case ARGI_INTEGER:
0537 
0538             /*
0539              * Need an operand of type ACPI_TYPE_INTEGER, but we can
0540              * implicitly convert from a STRING or BUFFER.
0541              *
0542              * Known as "Implicit Source Operand Conversion"
0543              */
0544             Status = AcpiExConvertToInteger (ObjDesc, StackPtr,
0545                 ACPI_IMPLICIT_CONVERSION);
0546             if (ACPI_FAILURE (Status))
0547             {
0548                 if (Status == AE_TYPE)
0549                 {
0550                     ACPI_ERROR ((AE_INFO,
0551                         "Needed [Integer/String/Buffer], found [%s] %p",
0552                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0553 
0554                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0555                 }
0556 
0557                 return_ACPI_STATUS (Status);
0558             }
0559 
0560             if (ObjDesc != *StackPtr)
0561             {
0562                 AcpiUtRemoveReference (ObjDesc);
0563             }
0564             goto NextOperand;
0565 
0566         case ARGI_BUFFER:
0567             /*
0568              * Need an operand of type ACPI_TYPE_BUFFER,
0569              * But we can implicitly convert from a STRING or INTEGER
0570              * Aka - "Implicit Source Operand Conversion"
0571              */
0572             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
0573             if (ACPI_FAILURE (Status))
0574             {
0575                 if (Status == AE_TYPE)
0576                 {
0577                     ACPI_ERROR ((AE_INFO,
0578                         "Needed [Integer/String/Buffer], found [%s] %p",
0579                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0580 
0581                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0582                 }
0583 
0584                 return_ACPI_STATUS (Status);
0585             }
0586 
0587             if (ObjDesc != *StackPtr)
0588             {
0589                 AcpiUtRemoveReference (ObjDesc);
0590             }
0591             goto NextOperand;
0592 
0593         case ARGI_STRING:
0594             /*
0595              * Need an operand of type ACPI_TYPE_STRING,
0596              * But we can implicitly convert from a BUFFER or INTEGER
0597              * Aka - "Implicit Source Operand Conversion"
0598              */
0599             Status = AcpiExConvertToString (
0600                 ObjDesc, StackPtr, ACPI_IMPLICIT_CONVERT_HEX);
0601             if (ACPI_FAILURE (Status))
0602             {
0603                 if (Status == AE_TYPE)
0604                 {
0605                     ACPI_ERROR ((AE_INFO,
0606                         "Needed [Integer/String/Buffer], found [%s] %p",
0607                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0608 
0609                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0610                 }
0611 
0612                 return_ACPI_STATUS (Status);
0613             }
0614 
0615             if (ObjDesc != *StackPtr)
0616             {
0617                 AcpiUtRemoveReference (ObjDesc);
0618             }
0619             goto NextOperand;
0620 
0621         case ARGI_COMPUTEDATA:
0622 
0623             /* Need an operand of type INTEGER, STRING or BUFFER */
0624 
0625             switch (ObjDesc->Common.Type)
0626             {
0627             case ACPI_TYPE_INTEGER:
0628             case ACPI_TYPE_STRING:
0629             case ACPI_TYPE_BUFFER:
0630 
0631                 /* Valid operand */
0632                break;
0633 
0634             default:
0635                 ACPI_ERROR ((AE_INFO,
0636                     "Needed [Integer/String/Buffer], found [%s] %p",
0637                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0638 
0639                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0640             }
0641             goto NextOperand;
0642 
0643         case ARGI_BUFFER_OR_STRING:
0644 
0645             /* Need an operand of type STRING or BUFFER */
0646 
0647             switch (ObjDesc->Common.Type)
0648             {
0649             case ACPI_TYPE_STRING:
0650             case ACPI_TYPE_BUFFER:
0651 
0652                 /* Valid operand */
0653                break;
0654 
0655             case ACPI_TYPE_INTEGER:
0656 
0657                 /* Highest priority conversion is to type Buffer */
0658 
0659                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
0660                 if (ACPI_FAILURE (Status))
0661                 {
0662                     return_ACPI_STATUS (Status);
0663                 }
0664 
0665                 if (ObjDesc != *StackPtr)
0666                 {
0667                     AcpiUtRemoveReference (ObjDesc);
0668                 }
0669                 break;
0670 
0671             default:
0672                 ACPI_ERROR ((AE_INFO,
0673                     "Needed [Integer/String/Buffer], found [%s] %p",
0674                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0675 
0676                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0677             }
0678             goto NextOperand;
0679 
0680         case ARGI_DATAOBJECT:
0681             /*
0682              * ARGI_DATAOBJECT is only used by the SizeOf operator.
0683              * Need a buffer, string, package, or RefOf reference.
0684              *
0685              * The only reference allowed here is a direct reference to
0686              * a namespace node.
0687              */
0688             switch (ObjDesc->Common.Type)
0689             {
0690             case ACPI_TYPE_PACKAGE:
0691             case ACPI_TYPE_STRING:
0692             case ACPI_TYPE_BUFFER:
0693             case ACPI_TYPE_LOCAL_REFERENCE:
0694 
0695                 /* Valid operand */
0696                 break;
0697 
0698             default:
0699 
0700                 ACPI_ERROR ((AE_INFO,
0701                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
0702                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0703 
0704                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0705             }
0706             goto NextOperand;
0707 
0708         case ARGI_COMPLEXOBJ:
0709 
0710             /* Need a buffer or package or (ACPI 2.0) String */
0711 
0712             switch (ObjDesc->Common.Type)
0713             {
0714             case ACPI_TYPE_PACKAGE:
0715             case ACPI_TYPE_STRING:
0716             case ACPI_TYPE_BUFFER:
0717 
0718                 /* Valid operand */
0719                 break;
0720 
0721             default:
0722 
0723                 ACPI_ERROR ((AE_INFO,
0724                     "Needed [Buffer/String/Package], found [%s] %p",
0725                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0726 
0727                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0728             }
0729             goto NextOperand;
0730 
0731         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
0732 
0733             /*
0734              * Need an operand of type REGION or a BUFFER
0735              * (which could be a resolved region field)
0736              */
0737             switch (ObjDesc->Common.Type)
0738             {
0739             case ACPI_TYPE_BUFFER:
0740             case ACPI_TYPE_REGION:
0741 
0742                 /* Valid operand */
0743                 break;
0744 
0745             default:
0746 
0747                 ACPI_ERROR ((AE_INFO,
0748                     "Needed [Region/Buffer], found [%s] %p",
0749                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0750 
0751                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0752             }
0753             goto NextOperand;
0754 
0755         case ARGI_DATAREFOBJ:
0756 
0757             /* Used by the Store() operator only */
0758 
0759             switch (ObjDesc->Common.Type)
0760             {
0761             case ACPI_TYPE_INTEGER:
0762             case ACPI_TYPE_PACKAGE:
0763             case ACPI_TYPE_STRING:
0764             case ACPI_TYPE_BUFFER:
0765             case ACPI_TYPE_BUFFER_FIELD:
0766             case ACPI_TYPE_LOCAL_REFERENCE:
0767             case ACPI_TYPE_LOCAL_REGION_FIELD:
0768             case ACPI_TYPE_LOCAL_BANK_FIELD:
0769             case ACPI_TYPE_LOCAL_INDEX_FIELD:
0770             case ACPI_TYPE_DDB_HANDLE:
0771 
0772                 /* Valid operand */
0773                 break;
0774 
0775             default:
0776 
0777                 if (AcpiGbl_EnableInterpreterSlack)
0778                 {
0779                     /*
0780                      * Enable original behavior of Store(), allowing any
0781                      * and all objects as the source operand. The ACPI
0782                      * spec does not allow this, however.
0783                      */
0784                     break;
0785                 }
0786 
0787                 if (TargetOp == AML_DEBUG_OP)
0788                 {
0789                     /* Allow store of any object to the Debug object */
0790 
0791                     break;
0792                 }
0793 
0794                 ACPI_ERROR ((AE_INFO,
0795                     "Needed Integer/Buffer/String/Package/Ref/Ddb]"
0796                     ", found [%s] %p",
0797                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
0798 
0799                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
0800             }
0801             goto NextOperand;
0802 
0803         default:
0804 
0805             /* Unknown type */
0806 
0807             ACPI_ERROR ((AE_INFO,
0808                 "Internal - Unknown ARGI (required operand) type 0x%X",
0809                 ThisArgType));
0810 
0811             return_ACPI_STATUS (AE_BAD_PARAMETER);
0812         }
0813 
0814         /*
0815          * Make sure that the original object was resolved to the
0816          * required object type (Simple cases only).
0817          */
0818         Status = AcpiExCheckObjectType (
0819             TypeNeeded, (*StackPtr)->Common.Type, *StackPtr);
0820         if (ACPI_FAILURE (Status))
0821         {
0822             return_ACPI_STATUS (Status);
0823         }
0824 
0825 NextOperand:
0826         /*
0827          * If more operands needed, decrement StackPtr to point
0828          * to next operand on stack
0829          */
0830         if (GET_CURRENT_ARG_TYPE (ArgTypes))
0831         {
0832             StackPtr--;
0833         }
0834     }
0835 
0836     ACPI_DUMP_OPERANDS (WalkState->Operands,
0837         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
0838 
0839     return_ACPI_STATUS (Status);
0840 }