exresop.c revision 70243
1130614Smlaier
2126353Smlaier/******************************************************************************
3126353Smlaier *
4126353Smlaier * Module Name: amresop - AML Interpreter operand/object resolution
5126353Smlaier *              $Revision: 19 $
6126353Smlaier *
7126353Smlaier *****************************************************************************/
8126353Smlaier
9126353Smlaier/******************************************************************************
10126353Smlaier *
11126353Smlaier * 1. Copyright Notice
12126353Smlaier *
13126353Smlaier * Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
14126353Smlaier * All rights reserved.
15126353Smlaier *
16126353Smlaier * 2. License
17126353Smlaier *
18126353Smlaier * 2.1. This is your license from Intel Corp. under its intellectual property
19126353Smlaier * rights.  You may have additional license terms from the party that provided
20126353Smlaier * you this software, covering your right to use that party's intellectual
21126353Smlaier * property rights.
22126353Smlaier *
23126353Smlaier * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24126353Smlaier * copy of the source code appearing in this file ("Covered Code") an
25126353Smlaier * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26126353Smlaier * base code distributed originally by Intel ("Original Intel Code") to copy,
27126353Smlaier * make derivatives, distribute, use and display any portion of the Covered
28126353Smlaier * Code in any form, with the right to sublicense such rights; and
29126353Smlaier *
30126353Smlaier * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31126353Smlaier * license (with the right to sublicense), under only those claims of Intel
32126353Smlaier * patents that are infringed by the Original Intel Code, to make, use, sell,
33130617Smlaier * offer to sell, and import the Covered Code and derivative works thereof
34130617Smlaier * solely to the minimum extent necessary to exercise the above copyright
35130617Smlaier * license, and in no event shall the patent license extend to any additions
36126353Smlaier * to or modifications of the Original Intel Code.  No other license or right
37126353Smlaier * is granted directly or by implication, estoppel or otherwise;
38130617Smlaier *
39126353Smlaier * The above copyright and patent license is granted only if the following
40126353Smlaier * conditions are met:
41126353Smlaier *
42126353Smlaier * 3. Conditions
43126353Smlaier *
44126353Smlaier * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45126353Smlaier * Redistribution of source code of any substantial portion of the Covered
46126353Smlaier * Code or modification with rights to further distribute source must include
47126353Smlaier * the above Copyright Notice, the above License, this list of Conditions,
48126353Smlaier * and the following Disclaimer and Export Compliance provision.  In addition,
49126353Smlaier * Licensee must cause all Covered Code to which Licensee contributes to
50126353Smlaier * contain a file documenting the changes Licensee made to create that Covered
51126353Smlaier * Code and the date of any change.  Licensee must include in that file the
52126353Smlaier * documentation of any changes made by any predecessor Licensee.  Licensee
53126353Smlaier * must include a prominent statement that the modification is derived,
54126353Smlaier * directly or indirectly, from Original Intel Code.
55126353Smlaier *
56126353Smlaier * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57130614Smlaier * Redistribution of source code of any substantial portion of the Covered
58126353Smlaier * Code or modification without rights to further distribute source must
59130614Smlaier * include the following Disclaimer and Export Compliance provision in the
60130614Smlaier * documentation and/or other materials provided with distribution.  In
61130614Smlaier * addition, Licensee may not authorize further sublicense of source of any
62130614Smlaier * portion of the Covered Code, and must include terms to the effect that the
63130614Smlaier * license from Licensee to its licensee is limited to the intellectual
64130614Smlaier * property embodied in the software Licensee provides to its licensee, and
65130614Smlaier * not to intellectual property embodied in modifications its licensee may
66130614Smlaier * make.
67130614Smlaier *
68130614Smlaier * 3.3. Redistribution of Executable. Redistribution in executable form of any
69130614Smlaier * substantial portion of the Covered Code or modification must reproduce the
70130614Smlaier * above Copyright Notice, and the following Disclaimer and Export Compliance
71130614Smlaier * provision in the documentation and/or other materials provided with the
72130614Smlaier * distribution.
73130614Smlaier *
74130614Smlaier * 3.4. Intel retains all right, title, and interest in and to the Original
75126353Smlaier * Intel Code.
76126353Smlaier *
77126353Smlaier * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78126353Smlaier * Intel shall be used in advertising or otherwise to promote the sale, use or
79126353Smlaier * other dealings in products derived from or relating to the Covered Code
80126353Smlaier * without prior written authorization from Intel.
81126353Smlaier *
82126353Smlaier * 4. Disclaimer and Export Compliance
83126353Smlaier *
84126353Smlaier * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85126353Smlaier * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86126353Smlaier * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87126353Smlaier * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88126353Smlaier * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89126353Smlaier * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90126353Smlaier * PARTICULAR PURPOSE.
91126353Smlaier *
92126353Smlaier * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93126353Smlaier * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94126353Smlaier * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95126353Smlaier * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96126353Smlaier * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97126353Smlaier * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98126353Smlaier * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99126353Smlaier * LIMITED REMEDY.
100126353Smlaier *
101126353Smlaier * 4.3. Licensee shall not export, either directly or indirectly, any of this
102126353Smlaier * software or system incorporating such software without first obtaining any
103126353Smlaier * required license or other approval from the U. S. Department of Commerce or
104126353Smlaier * any other agency or department of the United States Government.  In the
105126353Smlaier * event Licensee exports any such software from the United States or
106126353Smlaier * re-exports any such software from a foreign destination, Licensee shall
107130614Smlaier * ensure that the distribution and export/re-export of the software is in
108130614Smlaier * compliance with all laws, regulations, orders, or other restrictions of the
109130614Smlaier * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110130614Smlaier * any of its subsidiaries will export/re-export any technical data, process,
111126353Smlaier * software, or service, directly or indirectly, to any country for which the
112126353Smlaier * United States government or any agency thereof requires an export license,
113126353Smlaier * other governmental approval, or letter of assurance, without first obtaining
114126353Smlaier * such license, approval or letter.
115126353Smlaier *
116126353Smlaier *****************************************************************************/
117126353Smlaier
118126353Smlaier#define __AMRESOP_C__
119126353Smlaier
120126353Smlaier#include "acpi.h"
121126353Smlaier#include "amlcode.h"
122126353Smlaier#include "acparser.h"
123126353Smlaier#include "acdispat.h"
124126353Smlaier#include "acinterp.h"
125126353Smlaier#include "acnamesp.h"
126126353Smlaier#include "actables.h"
127126353Smlaier#include "acevents.h"
128126353Smlaier
129126353Smlaier
130126353Smlaier#define _COMPONENT          INTERPRETER
131126353Smlaier        MODULE_NAME         ("amresop")
132126353Smlaier
133126353Smlaier
134126353Smlaier/*******************************************************************************
135126353Smlaier *
136126353Smlaier * FUNCTION:    AcpiAmlCheckObjectType
137126353Smlaier *
138126353Smlaier * PARAMETERS:  TypeNeeded          Object type needed
139126353Smlaier *              ThisType            Actual object type
140126353Smlaier *              Object              Object pointer
141126353Smlaier *
142126353Smlaier * RETURN:      Status
143126353Smlaier *
144126353Smlaier * DESCRIPTION: Check required type against actual type
145126353Smlaier *
146126353Smlaier ******************************************************************************/
147126353Smlaier
148126353SmlaierACPI_STATUS
149126353SmlaierAcpiAmlCheckObjectType (
150126353Smlaier    ACPI_OBJECT_TYPE        TypeNeeded,
151126353Smlaier    ACPI_OBJECT_TYPE        ThisType,
152126353Smlaier    void                    *Object)
153126353Smlaier{
154126353Smlaier
155126353Smlaier
156126353Smlaier    if (TypeNeeded == ACPI_TYPE_ANY)
157126353Smlaier    {
158126353Smlaier        /* All types OK, so we don't perform any typechecks */
159126353Smlaier
160126353Smlaier        return (AE_OK);
161126353Smlaier    }
162126353Smlaier
163126353Smlaier
164126353Smlaier    if (TypeNeeded != ThisType)
165130614Smlaier    {
166126353Smlaier        DEBUG_PRINT (ACPI_INFO,
167130614Smlaier            ("AmlResolveOperands: Needed [%s], found [%s] %p\n",
168130614Smlaier            AcpiCmGetTypeName (TypeNeeded),
169126353Smlaier            AcpiCmGetTypeName (ThisType), Object));
170126353Smlaier
171126353Smlaier        return (AE_AML_OPERAND_TYPE);
172126353Smlaier    }
173126353Smlaier
174126353Smlaier
175126353Smlaier    return (AE_OK);
176126353Smlaier}
177126353Smlaier
178126353Smlaier
179126353Smlaier/*******************************************************************************
180126353Smlaier *
181126353Smlaier * FUNCTION:    AcpiAmlResolveOperands
182126353Smlaier *
183126353Smlaier * PARAMETERS:  Opcode              Opcode being interpreted
184126353Smlaier *              StackPtr            Top of operand stack
185126353Smlaier *
186126353Smlaier * RETURN:      Status
187126353Smlaier *
188126353Smlaier * DESCRIPTION: Convert stack entries to required types
189126353Smlaier *
190126353Smlaier *      Each nibble in ArgTypes represents one required operand
191126353Smlaier *      and indicates the required Type:
192126353Smlaier *
193126353Smlaier *      The corresponding stack entry will be converted to the
194126353Smlaier *      required type if possible, else return an exception
195126353Smlaier *
196126353Smlaier ******************************************************************************/
197126353Smlaier
198126353SmlaierACPI_STATUS
199126353SmlaierAcpiAmlResolveOperands (
200126353Smlaier    UINT16                  Opcode,
201126353Smlaier    ACPI_OPERAND_OBJECT     **StackPtr,
202126353Smlaier    ACPI_WALK_STATE         *WalkState)
203126353Smlaier{
204130614Smlaier    ACPI_OPERAND_OBJECT     *ObjDesc;
205126353Smlaier    ACPI_STATUS             Status = AE_OK;
206126353Smlaier    UINT8                   ObjectType;
207126353Smlaier    ACPI_HANDLE             TempHandle;
208126353Smlaier    UINT32                  ArgTypes;
209126353Smlaier    ACPI_OPCODE_INFO        *OpInfo;
210126353Smlaier    UINT32                  ThisArgType;
211126353Smlaier    ACPI_OBJECT_TYPE        TypeNeeded;
212126353Smlaier
213126353Smlaier
214126353Smlaier    FUNCTION_TRACE_U32 ("AmlResolveOperands", Opcode);
215126353Smlaier
216126353Smlaier
217126353Smlaier    OpInfo = AcpiPsGetOpcodeInfo (Opcode);
218126353Smlaier    if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
219126353Smlaier    {
220126353Smlaier        return_ACPI_STATUS (AE_AML_BAD_OPCODE);
221126353Smlaier    }
222126353Smlaier
223126353Smlaier
224126353Smlaier    ArgTypes = OpInfo->RuntimeArgs;
225126353Smlaier    if (ArgTypes == ARGI_INVALID_OPCODE)
226126353Smlaier    {
227126353Smlaier        DEBUG_PRINT (ACPI_ERROR,
228126353Smlaier            ("AmlResolveOperands: Internal error - %X is not a valid AML opcode\n", Opcode));
229126353Smlaier
230126353Smlaier        return_ACPI_STATUS (AE_AML_INTERNAL);
231126353Smlaier    }
232126353Smlaier
233126353Smlaier    DEBUG_PRINT (TRACE_EXEC,
234126353Smlaier        ("AmlResolveOperands: Opcode %X OperandTypes=%X \n",
235126353Smlaier        Opcode, ArgTypes));
236126353Smlaier
237126353Smlaier
238126353Smlaier   /*
239126353Smlaier     * Normal exit is with *Types == '\0' at end of string.
240126353Smlaier     * Function will return an exception from within the loop upon
241126353Smlaier     * finding an entry which is not, and cannot be converted
242126353Smlaier     * to, the required type; if stack underflows; or upon
243126353Smlaier     * finding a NULL stack entry (which "should never happen").
244126353Smlaier     */
245126353Smlaier
246126353Smlaier    while (GET_CURRENT_ARG_TYPE (ArgTypes))
247126353Smlaier    {
248126353Smlaier        if (!StackPtr || !*StackPtr)
249126353Smlaier        {
250126353Smlaier            DEBUG_PRINT (ACPI_ERROR,
251126353Smlaier                ("AmlResolveOperands: Internal error - null stack entry at %X\n", StackPtr));
252126353Smlaier
253126353Smlaier            return_ACPI_STATUS (AE_AML_INTERNAL);
254126353Smlaier        }
255126353Smlaier
256126353Smlaier        /* Extract useful items */
257126353Smlaier
258126353Smlaier        ObjDesc = *StackPtr;
259126353Smlaier
260126353Smlaier        /* Decode the descriptor type */
261126353Smlaier
262126353Smlaier        if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
263126353Smlaier        {
264126353Smlaier            /* Node */
265126353Smlaier
266126353Smlaier            ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
267126353Smlaier        }
268126353Smlaier
269126353Smlaier        else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
270126353Smlaier        {
271126353Smlaier            /* ACPI internal object */
272126353Smlaier
273126353Smlaier            ObjectType = ObjDesc->Common.Type;
274126353Smlaier
275126353Smlaier            /* Check for bad ACPI_OBJECT_TYPE */
276126353Smlaier
277126353Smlaier            if (!AcpiAmlValidateObjectType (ObjectType))
278126353Smlaier            {
279126353Smlaier                DEBUG_PRINT (ACPI_ERROR,
280126353Smlaier                    ("AmlResolveOperands: Bad operand object type [%X]\n",
281126353Smlaier                    ObjectType));
282126353Smlaier
283126353Smlaier                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
284130614Smlaier            }
285130614Smlaier
286130614Smlaier            if (ObjectType == (UINT8) INTERNAL_TYPE_REFERENCE)
287130614Smlaier            {
288126353Smlaier                /*
289126353Smlaier                 * Decode the Reference
290130614Smlaier                 */
291130617Smlaier
292130614Smlaier                OpInfo = AcpiPsGetOpcodeInfo (Opcode);
293130617Smlaier                if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
294130617Smlaier                {
295130617Smlaier                    return_ACPI_STATUS (AE_AML_BAD_OPCODE);
296130614Smlaier                }
297130617Smlaier
298130614Smlaier
299126353Smlaier                switch (ObjDesc->Reference.OpCode)
300126353Smlaier                {
301126353Smlaier                case AML_ZERO_OP:
302126353Smlaier                case AML_ONE_OP:
303126353Smlaier                case AML_ONES_OP:
304126353Smlaier                case AML_DEBUG_OP:
305126353Smlaier                case AML_NAME_OP:
306126353Smlaier                case AML_INDEX_OP:
307126353Smlaier                case AML_ARG_OP:
308126353Smlaier                case AML_LOCAL_OP:
309126353Smlaier
310126353Smlaier                    DEBUG_ONLY_MEMBERS (DEBUG_PRINT (ACPI_INFO,
311126353Smlaier                        ("Reference Opcode: %s\n", OpInfo->Name)));
312126353Smlaier                    break;
313126353Smlaier
314126353Smlaier                default:
315126353Smlaier                    DEBUG_PRINT (ACPI_INFO,
316126353Smlaier                        ("Reference Opcode: Unknown [%02x]\n",
317126353Smlaier                        ObjDesc->Reference.OpCode));
318
319                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
320                    break;
321                }
322            }
323        }
324
325        else
326        {
327            /* Invalid descriptor */
328
329            DEBUG_PRINT (ACPI_ERROR,
330                ("Bad descriptor type %X in Obj %p\n",
331                ObjDesc->Common.DataType, ObjDesc));
332
333            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
334        }
335
336
337        /*
338         * Get one argument type, point to the next
339         */
340
341        ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
342        INCREMENT_ARG_LIST (ArgTypes);
343
344
345        /*
346         * Handle cases where the object does not need to be
347         * resolved to a value
348         */
349
350        switch (ThisArgType)
351        {
352
353        case ARGI_REFERENCE:   /* Reference */
354        case ARGI_TARGETREF:
355
356            /* Need an operand of type INTERNAL_TYPE_REFERENCE */
357
358            if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))             /* direct name ptr OK as-is */
359            {
360                goto NextOperand;
361            }
362
363            Status = AcpiAmlCheckObjectType (INTERNAL_TYPE_REFERENCE,
364                            ObjectType, ObjDesc);
365            if (ACPI_FAILURE (Status))
366            {
367                return_ACPI_STATUS (Status);
368            }
369
370
371            if (AML_NAME_OP == ObjDesc->Reference.OpCode)
372            {
373                /*
374                 * Convert an indirect name ptr to direct name ptr and put
375                 * it on the stack
376                 */
377
378                TempHandle = ObjDesc->Reference.Object;
379                AcpiCmRemoveReference (ObjDesc);
380                (*StackPtr) = TempHandle;
381            }
382
383            goto NextOperand;
384            break;
385
386
387        case ARGI_ANYTYPE:
388
389            /*
390             * We don't want to resolve IndexOp reference objects during
391             * a store because this would be an implicit DeRefOf operation.
392             * Instead, we just want to store the reference object.
393             * -- All others must be resolved below.
394             */
395
396            if ((Opcode == AML_STORE_OP) &&
397                ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE) &&
398                ((*StackPtr)->Reference.OpCode == AML_INDEX_OP))
399            {
400                goto NextOperand;
401            }
402            break;
403        }
404
405
406        /*
407         * Resolve this object to a value
408         */
409
410        Status = AcpiAmlResolveToValue (StackPtr, WalkState);
411        if (ACPI_FAILURE (Status))
412        {
413            return_ACPI_STATUS (Status);
414        }
415
416
417        /*
418         * Check the resulting object (value) type
419         */
420        switch (ThisArgType)
421        {
422        /*
423         * For the simple cases, only one type of resolved object
424         * is allowed
425         */
426        case ARGI_NUMBER:   /* Number */
427
428            /* Need an operand of type ACPI_TYPE_NUMBER */
429
430            TypeNeeded = ACPI_TYPE_NUMBER;
431            break;
432
433        case ARGI_BUFFER:
434
435            /* Need an operand of type ACPI_TYPE_BUFFER */
436
437            TypeNeeded = ACPI_TYPE_BUFFER;
438            break;
439
440        case ARGI_MUTEX:
441
442            /* Need an operand of type ACPI_TYPE_MUTEX */
443
444            TypeNeeded = ACPI_TYPE_MUTEX;
445            break;
446
447        case ARGI_EVENT:
448
449            /* Need an operand of type ACPI_TYPE_EVENT */
450
451            TypeNeeded = ACPI_TYPE_EVENT;
452            break;
453
454        case ARGI_REGION:
455
456            /* Need an operand of type ACPI_TYPE_REGION */
457
458            TypeNeeded = ACPI_TYPE_REGION;
459            break;
460
461        case ARGI_IF:   /* If */
462
463            /* Need an operand of type INTERNAL_TYPE_IF */
464
465            TypeNeeded = INTERNAL_TYPE_IF;
466            break;
467
468        case ARGI_PACKAGE:   /* Package */
469
470            /* Need an operand of type ACPI_TYPE_PACKAGE */
471
472            TypeNeeded = ACPI_TYPE_PACKAGE;
473            break;
474
475        case ARGI_ANYTYPE:
476
477            /* Any operand type will do */
478
479            TypeNeeded = ACPI_TYPE_ANY;
480            break;
481
482
483        /*
484         * The more complex cases allow multiple resolved object types
485         */
486
487        case ARGI_STRING:
488
489            /* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */
490
491            if ((ACPI_TYPE_STRING != (*StackPtr)->Common.Type) &&
492                (ACPI_TYPE_BUFFER != (*StackPtr)->Common.Type))
493            {
494                DEBUG_PRINT (ACPI_INFO,
495                    ("AmlResolveOperands: Needed [String or Buffer], found [%s] %p\n",
496                    AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
497
498                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
499            }
500            goto NextOperand;
501            break;
502
503
504        case ARGI_DATAOBJECT:
505            /*
506             * ARGI_DATAOBJECT is only used by the SizeOf operator.
507             *
508             * The ACPI specification allows SizeOf to return the size of
509             *  a Buffer, String or Package.  However, the MS ACPI.SYS AML
510             *  Interpreter also allows an Node reference to return without
511             *  error with a size of 4.
512             */
513
514            /* Need a buffer, string, package or Node reference */
515
516            if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) &&
517                ((*StackPtr)->Common.Type != ACPI_TYPE_STRING) &&
518                ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE) &&
519                ((*StackPtr)->Common.Type != INTERNAL_TYPE_REFERENCE))
520            {
521                DEBUG_PRINT (ACPI_INFO,
522                    ("AmlResolveOperands: Needed [Buf/Str/Pkg/Ref], found [%s] %p\n",
523                    AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
524
525                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
526            }
527
528            /*
529             * If this is a reference, only allow a reference to an Node.
530             */
531            if ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE)
532            {
533                if (!(*StackPtr)->Reference.Node)
534                {
535                    DEBUG_PRINT (ACPI_INFO,
536                        ("AmlResolveOperands: Needed [Node Reference], found [%p]\n",
537                        *StackPtr));
538
539                    return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
540                }
541            }
542            goto NextOperand;
543            break;
544
545
546        case ARGI_COMPLEXOBJ:
547
548            /* Need a buffer or package */
549
550            if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) &&
551                ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE))
552            {
553                DEBUG_PRINT (ACPI_INFO,
554                    ("AmlResolveOperands: Needed [Buf/Pkg], found [%s] %p\n",
555                    AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
556
557                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
558            }
559            goto NextOperand;
560            break;
561
562
563        default:
564
565            /* Unknown type */
566
567            DEBUG_PRINT (ACPI_ERROR,
568                ("AmlResolveOperands: Internal error - Unknown ARGI type %X\n",
569                ThisArgType));
570
571            return_ACPI_STATUS (AE_BAD_PARAMETER);
572        }
573
574
575        /*
576         * Make sure that the original object was resolved to the
577         * required object type (Simple cases only).
578         */
579        Status = AcpiAmlCheckObjectType (TypeNeeded,
580                        (*StackPtr)->Common.Type, *StackPtr);
581        if (ACPI_FAILURE (Status))
582        {
583            return_ACPI_STATUS (Status);
584        }
585
586
587NextOperand:
588        /*
589         * If more operands needed, decrement StackPtr to point
590         * to next operand on stack
591         */
592        if (GET_CURRENT_ARG_TYPE (ArgTypes))
593        {
594            StackPtr--;
595        }
596
597    }   /* while (*Types) */
598
599
600    return_ACPI_STATUS (Status);
601}
602
603
604