xref: /freebsd/sys/contrib/dev/acpica/components/executer/exresop.c (revision e6e746bfb086d563bf0ad454a33ecbcab8836dbf)
1 /******************************************************************************
2  *
3  * Module Name: exresop - AML Interpreter operand/object resolution
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2015, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/amlcode.h>
47 #include <contrib/dev/acpica/include/acparser.h>
48 #include <contrib/dev/acpica/include/acinterp.h>
49 #include <contrib/dev/acpica/include/acnamesp.h>
50 
51 
52 #define _COMPONENT          ACPI_EXECUTER
53         ACPI_MODULE_NAME    ("exresop")
54 
55 /* Local prototypes */
56 
57 static ACPI_STATUS
58 AcpiExCheckObjectType (
59     ACPI_OBJECT_TYPE        TypeNeeded,
60     ACPI_OBJECT_TYPE        ThisType,
61     void                    *Object);
62 
63 
64 /*******************************************************************************
65  *
66  * FUNCTION:    AcpiExCheckObjectType
67  *
68  * PARAMETERS:  TypeNeeded          Object type needed
69  *              ThisType            Actual object type
70  *              Object              Object pointer
71  *
72  * RETURN:      Status
73  *
74  * DESCRIPTION: Check required type against actual type
75  *
76  ******************************************************************************/
77 
78 static ACPI_STATUS
79 AcpiExCheckObjectType (
80     ACPI_OBJECT_TYPE        TypeNeeded,
81     ACPI_OBJECT_TYPE        ThisType,
82     void                    *Object)
83 {
84     ACPI_FUNCTION_ENTRY ();
85 
86 
87     if (TypeNeeded == ACPI_TYPE_ANY)
88     {
89         /* All types OK, so we don't perform any typechecks */
90 
91         return (AE_OK);
92     }
93 
94     if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
95     {
96         /*
97          * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
98          * objects and thus allow them to be targets. (As per the ACPI
99          * specification, a store to a constant is a noop.)
100          */
101         if ((ThisType == ACPI_TYPE_INTEGER) &&
102             (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
103         {
104             return (AE_OK);
105         }
106     }
107 
108     if (TypeNeeded != ThisType)
109     {
110         ACPI_ERROR ((AE_INFO,
111             "Needed type [%s], found [%s] %p",
112             AcpiUtGetTypeName (TypeNeeded),
113             AcpiUtGetTypeName (ThisType), Object));
114 
115         return (AE_AML_OPERAND_TYPE);
116     }
117 
118     return (AE_OK);
119 }
120 
121 
122 /*******************************************************************************
123  *
124  * FUNCTION:    AcpiExResolveOperands
125  *
126  * PARAMETERS:  Opcode              - Opcode being interpreted
127  *              StackPtr            - Pointer to the operand stack to be
128  *                                    resolved
129  *              WalkState           - Current state
130  *
131  * RETURN:      Status
132  *
133  * DESCRIPTION: Convert multiple input operands to the types required by the
134  *              target operator.
135  *
136  *      Each 5-bit group in ArgTypes represents one required
137  *      operand and indicates the required Type. The corresponding operand
138  *      will be converted to the required type if possible, otherwise we
139  *      abort with an exception.
140  *
141  ******************************************************************************/
142 
143 ACPI_STATUS
144 AcpiExResolveOperands (
145     UINT16                  Opcode,
146     ACPI_OPERAND_OBJECT     **StackPtr,
147     ACPI_WALK_STATE         *WalkState)
148 {
149     ACPI_OPERAND_OBJECT     *ObjDesc;
150     ACPI_STATUS             Status = AE_OK;
151     UINT8                   ObjectType;
152     UINT32                  ArgTypes;
153     const ACPI_OPCODE_INFO  *OpInfo;
154     UINT32                  ThisArgType;
155     ACPI_OBJECT_TYPE        TypeNeeded;
156     UINT16                  TargetOp = 0;
157 
158 
159     ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
160 
161 
162     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
163     if (OpInfo->Class == AML_CLASS_UNKNOWN)
164     {
165         return_ACPI_STATUS (AE_AML_BAD_OPCODE);
166     }
167 
168     ArgTypes = OpInfo->RuntimeArgs;
169     if (ArgTypes == ARGI_INVALID_OPCODE)
170     {
171         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
172             Opcode));
173 
174         return_ACPI_STATUS (AE_AML_INTERNAL);
175     }
176 
177     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
178         "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
179         Opcode, OpInfo->Name, ArgTypes));
180 
181     /*
182      * Normal exit is with (ArgTypes == 0) at end of argument list.
183      * Function will return an exception from within the loop upon
184      * finding an entry which is not (or cannot be converted
185      * to) the required type; if stack underflows; or upon
186      * finding a NULL stack entry (which should not happen).
187      */
188     while (GET_CURRENT_ARG_TYPE (ArgTypes))
189     {
190         if (!StackPtr || !*StackPtr)
191         {
192             ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
193                 StackPtr));
194 
195             return_ACPI_STATUS (AE_AML_INTERNAL);
196         }
197 
198         /* Extract useful items */
199 
200         ObjDesc = *StackPtr;
201 
202         /* Decode the descriptor type */
203 
204         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
205         {
206         case ACPI_DESC_TYPE_NAMED:
207 
208             /* Namespace Node */
209 
210             ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
211 
212             /*
213              * Resolve an alias object. The construction of these objects
214              * guarantees that there is only one level of alias indirection;
215              * thus, the attached object is always the aliased namespace node
216              */
217             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
218             {
219                 ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
220                 *StackPtr = ObjDesc;
221                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
222             }
223             break;
224 
225         case ACPI_DESC_TYPE_OPERAND:
226 
227             /* ACPI internal object */
228 
229             ObjectType = ObjDesc->Common.Type;
230 
231             /* Check for bad ACPI_OBJECT_TYPE */
232 
233             if (!AcpiUtValidObjectType (ObjectType))
234             {
235                 ACPI_ERROR ((AE_INFO,
236                     "Bad operand object type [0x%X]", ObjectType));
237 
238                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
239             }
240 
241             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
242             {
243                 /* Validate the Reference */
244 
245                 switch (ObjDesc->Reference.Class)
246                 {
247                 case ACPI_REFCLASS_DEBUG:
248 
249                     TargetOp = AML_DEBUG_OP;
250 
251                     /*lint -fallthrough */
252 
253                 case ACPI_REFCLASS_ARG:
254                 case ACPI_REFCLASS_LOCAL:
255                 case ACPI_REFCLASS_INDEX:
256                 case ACPI_REFCLASS_REFOF:
257                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
258                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
259 
260                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
261                         "Operand is a Reference, Class [%s] %2.2X\n",
262                         AcpiUtGetReferenceName (ObjDesc),
263                         ObjDesc->Reference.Class));
264                     break;
265 
266                 default:
267 
268                     ACPI_ERROR ((AE_INFO,
269                         "Unknown Reference Class 0x%2.2X in %p",
270                         ObjDesc->Reference.Class, ObjDesc));
271 
272                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
273                 }
274             }
275             break;
276 
277         default:
278 
279             /* Invalid descriptor */
280 
281             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
282                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
283 
284             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
285         }
286 
287         /* Get one argument type, point to the next */
288 
289         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
290         INCREMENT_ARG_LIST (ArgTypes);
291 
292         /*
293          * Handle cases where the object does not need to be
294          * resolved to a value
295          */
296         switch (ThisArgType)
297         {
298         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
299 
300             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
301                 (ObjDesc->Common.Type == ACPI_TYPE_STRING))
302             {
303                 /*
304                  * String found - the string references a named object and
305                  * must be resolved to a node
306                  */
307                 goto NextOperand;
308             }
309 
310             /*
311              * Else not a string - fall through to the normal Reference
312              * case below
313              */
314             /*lint -fallthrough */
315 
316         case ARGI_REFERENCE:            /* References: */
317         case ARGI_INTEGER_REF:
318         case ARGI_OBJECT_REF:
319         case ARGI_DEVICE_REF:
320         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
321         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
322         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
323             /*
324              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
325              * A Namespace Node is OK as-is
326              */
327             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
328             {
329                 goto NextOperand;
330             }
331 
332             Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
333                             ObjectType, ObjDesc);
334             if (ACPI_FAILURE (Status))
335             {
336                 return_ACPI_STATUS (Status);
337             }
338             goto NextOperand;
339 
340         case ARGI_DATAREFOBJ:  /* Store operator only */
341             /*
342              * We don't want to resolve IndexOp reference objects during
343              * a store because this would be an implicit DeRefOf operation.
344              * Instead, we just want to store the reference object.
345              * -- All others must be resolved below.
346              */
347             if ((Opcode == AML_STORE_OP) &&
348                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
349                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
350             {
351                 goto NextOperand;
352             }
353             break;
354 
355         default:
356 
357             /* All cases covered above */
358 
359             break;
360         }
361 
362         /*
363          * Resolve this object to a value
364          */
365         Status = AcpiExResolveToValue (StackPtr, WalkState);
366         if (ACPI_FAILURE (Status))
367         {
368             return_ACPI_STATUS (Status);
369         }
370 
371         /* Get the resolved object */
372 
373         ObjDesc = *StackPtr;
374 
375         /*
376          * Check the resulting object (value) type
377          */
378         switch (ThisArgType)
379         {
380         /*
381          * For the simple cases, only one type of resolved object
382          * is allowed
383          */
384         case ARGI_MUTEX:
385 
386             /* Need an operand of type ACPI_TYPE_MUTEX */
387 
388             TypeNeeded = ACPI_TYPE_MUTEX;
389             break;
390 
391         case ARGI_EVENT:
392 
393             /* Need an operand of type ACPI_TYPE_EVENT */
394 
395             TypeNeeded = ACPI_TYPE_EVENT;
396             break;
397 
398         case ARGI_PACKAGE:   /* Package */
399 
400             /* Need an operand of type ACPI_TYPE_PACKAGE */
401 
402             TypeNeeded = ACPI_TYPE_PACKAGE;
403             break;
404 
405         case ARGI_ANYTYPE:
406 
407             /* Any operand type will do */
408 
409             TypeNeeded = ACPI_TYPE_ANY;
410             break;
411 
412         case ARGI_DDBHANDLE:
413 
414             /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
415 
416             TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
417             break;
418 
419 
420         /*
421          * The more complex cases allow multiple resolved object types
422          */
423         case ARGI_INTEGER:
424 
425             /*
426              * Need an operand of type ACPI_TYPE_INTEGER,
427              * But we can implicitly convert from a STRING or BUFFER
428              * Aka - "Implicit Source Operand Conversion"
429              */
430             Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
431             if (ACPI_FAILURE (Status))
432             {
433                 if (Status == AE_TYPE)
434                 {
435                     ACPI_ERROR ((AE_INFO,
436                         "Needed [Integer/String/Buffer], found [%s] %p",
437                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
438 
439                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
440                 }
441 
442                 return_ACPI_STATUS (Status);
443             }
444 
445             if (ObjDesc != *StackPtr)
446             {
447                 AcpiUtRemoveReference (ObjDesc);
448             }
449             goto NextOperand;
450 
451         case ARGI_BUFFER:
452             /*
453              * Need an operand of type ACPI_TYPE_BUFFER,
454              * But we can implicitly convert from a STRING or INTEGER
455              * Aka - "Implicit Source Operand Conversion"
456              */
457             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
458             if (ACPI_FAILURE (Status))
459             {
460                 if (Status == AE_TYPE)
461                 {
462                     ACPI_ERROR ((AE_INFO,
463                         "Needed [Integer/String/Buffer], found [%s] %p",
464                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
465 
466                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
467                 }
468 
469                 return_ACPI_STATUS (Status);
470             }
471 
472             if (ObjDesc != *StackPtr)
473             {
474                 AcpiUtRemoveReference (ObjDesc);
475             }
476             goto NextOperand;
477 
478         case ARGI_STRING:
479             /*
480              * Need an operand of type ACPI_TYPE_STRING,
481              * But we can implicitly convert from a BUFFER or INTEGER
482              * Aka - "Implicit Source Operand Conversion"
483              */
484             Status = AcpiExConvertToString (ObjDesc, StackPtr,
485                         ACPI_IMPLICIT_CONVERT_HEX);
486             if (ACPI_FAILURE (Status))
487             {
488                 if (Status == AE_TYPE)
489                 {
490                     ACPI_ERROR ((AE_INFO,
491                         "Needed [Integer/String/Buffer], found [%s] %p",
492                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
493 
494                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
495                 }
496 
497                 return_ACPI_STATUS (Status);
498             }
499 
500             if (ObjDesc != *StackPtr)
501             {
502                 AcpiUtRemoveReference (ObjDesc);
503             }
504             goto NextOperand;
505 
506         case ARGI_COMPUTEDATA:
507 
508             /* Need an operand of type INTEGER, STRING or BUFFER */
509 
510             switch (ObjDesc->Common.Type)
511             {
512             case ACPI_TYPE_INTEGER:
513             case ACPI_TYPE_STRING:
514             case ACPI_TYPE_BUFFER:
515 
516                 /* Valid operand */
517                break;
518 
519             default:
520                 ACPI_ERROR ((AE_INFO,
521                     "Needed [Integer/String/Buffer], found [%s] %p",
522                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
523 
524                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
525             }
526             goto NextOperand;
527 
528         case ARGI_BUFFER_OR_STRING:
529 
530             /* Need an operand of type STRING or BUFFER */
531 
532             switch (ObjDesc->Common.Type)
533             {
534             case ACPI_TYPE_STRING:
535             case ACPI_TYPE_BUFFER:
536 
537                 /* Valid operand */
538                break;
539 
540             case ACPI_TYPE_INTEGER:
541 
542                 /* Highest priority conversion is to type Buffer */
543 
544                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
545                 if (ACPI_FAILURE (Status))
546                 {
547                     return_ACPI_STATUS (Status);
548                 }
549 
550                 if (ObjDesc != *StackPtr)
551                 {
552                     AcpiUtRemoveReference (ObjDesc);
553                 }
554                 break;
555 
556             default:
557                 ACPI_ERROR ((AE_INFO,
558                     "Needed [Integer/String/Buffer], found [%s] %p",
559                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
560 
561                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
562             }
563             goto NextOperand;
564 
565         case ARGI_DATAOBJECT:
566             /*
567              * ARGI_DATAOBJECT is only used by the SizeOf operator.
568              * Need a buffer, string, package, or RefOf reference.
569              *
570              * The only reference allowed here is a direct reference to
571              * a namespace node.
572              */
573             switch (ObjDesc->Common.Type)
574             {
575             case ACPI_TYPE_PACKAGE:
576             case ACPI_TYPE_STRING:
577             case ACPI_TYPE_BUFFER:
578             case ACPI_TYPE_LOCAL_REFERENCE:
579 
580                 /* Valid operand */
581                 break;
582 
583             default:
584 
585                 ACPI_ERROR ((AE_INFO,
586                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
587                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
588 
589                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
590             }
591             goto NextOperand;
592 
593         case ARGI_COMPLEXOBJ:
594 
595             /* Need a buffer or package or (ACPI 2.0) String */
596 
597             switch (ObjDesc->Common.Type)
598             {
599             case ACPI_TYPE_PACKAGE:
600             case ACPI_TYPE_STRING:
601             case ACPI_TYPE_BUFFER:
602 
603                 /* Valid operand */
604                 break;
605 
606             default:
607 
608                 ACPI_ERROR ((AE_INFO,
609                     "Needed [Buffer/String/Package], found [%s] %p",
610                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
611 
612                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
613             }
614             goto NextOperand;
615 
616         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
617 
618             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
619 
620             switch (ObjDesc->Common.Type)
621             {
622             case ACPI_TYPE_BUFFER:
623             case ACPI_TYPE_REGION:
624 
625                 /* Valid operand */
626                 break;
627 
628             default:
629 
630                 ACPI_ERROR ((AE_INFO,
631                     "Needed [Region/Buffer], found [%s] %p",
632                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
633 
634                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
635             }
636             goto NextOperand;
637 
638         case ARGI_DATAREFOBJ:
639 
640             /* Used by the Store() operator only */
641 
642             switch (ObjDesc->Common.Type)
643             {
644             case ACPI_TYPE_INTEGER:
645             case ACPI_TYPE_PACKAGE:
646             case ACPI_TYPE_STRING:
647             case ACPI_TYPE_BUFFER:
648             case ACPI_TYPE_BUFFER_FIELD:
649             case ACPI_TYPE_LOCAL_REFERENCE:
650             case ACPI_TYPE_LOCAL_REGION_FIELD:
651             case ACPI_TYPE_LOCAL_BANK_FIELD:
652             case ACPI_TYPE_LOCAL_INDEX_FIELD:
653             case ACPI_TYPE_DDB_HANDLE:
654 
655                 /* Valid operand */
656                 break;
657 
658             default:
659 
660                 if (AcpiGbl_EnableInterpreterSlack)
661                 {
662                     /*
663                      * Enable original behavior of Store(), allowing any and all
664                      * objects as the source operand. The ACPI spec does not
665                      * allow this, however.
666                      */
667                     break;
668                 }
669 
670                 if (TargetOp == AML_DEBUG_OP)
671                 {
672                     /* Allow store of any object to the Debug object */
673 
674                     break;
675                 }
676 
677                 ACPI_ERROR ((AE_INFO,
678                     "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
679                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
680 
681                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
682             }
683             goto NextOperand;
684 
685         default:
686 
687             /* Unknown type */
688 
689             ACPI_ERROR ((AE_INFO,
690                 "Internal - Unknown ARGI (required operand) type 0x%X",
691                 ThisArgType));
692 
693             return_ACPI_STATUS (AE_BAD_PARAMETER);
694         }
695 
696         /*
697          * Make sure that the original object was resolved to the
698          * required object type (Simple cases only).
699          */
700         Status = AcpiExCheckObjectType (TypeNeeded,
701                         (*StackPtr)->Common.Type, *StackPtr);
702         if (ACPI_FAILURE (Status))
703         {
704             return_ACPI_STATUS (Status);
705         }
706 
707 NextOperand:
708         /*
709          * If more operands needed, decrement StackPtr to point
710          * to next operand on stack
711          */
712         if (GET_CURRENT_ARG_TYPE (ArgTypes))
713         {
714             StackPtr--;
715         }
716     }
717 
718     ACPI_DUMP_OPERANDS (WalkState->Operands,
719         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
720 
721     return_ACPI_STATUS (Status);
722 }
723