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