iwlwifi: move iwl4965_get_dma_hi_address function to iwl-helpers.h
[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 - 2007, 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 #include <acpi/acpi.h>
46 #include <acpi/amlcode.h>
47 #include <acpi/acparser.h>
48 #include <acpi/acinterp.h>
49 #include <acpi/acnamesp.h>
50
51 #define _COMPONENT          ACPI_EXECUTER
52 ACPI_MODULE_NAME("exresop")
53
54 /* Local prototypes */
55 static acpi_status
56 acpi_ex_check_object_type(acpi_object_type type_needed,
57                           acpi_object_type this_type, void *object);
58
59 /*******************************************************************************
60  *
61  * FUNCTION:    acpi_ex_check_object_type
62  *
63  * PARAMETERS:  type_needed         Object type needed
64  *              this_type           Actual object type
65  *              Object              Object pointer
66  *
67  * RETURN:      Status
68  *
69  * DESCRIPTION: Check required type against actual type
70  *
71  ******************************************************************************/
72
73 static acpi_status
74 acpi_ex_check_object_type(acpi_object_type type_needed,
75                           acpi_object_type this_type, void *object)
76 {
77         ACPI_FUNCTION_ENTRY();
78
79         if (type_needed == ACPI_TYPE_ANY) {
80
81                 /* All types OK, so we don't perform any typechecks */
82
83                 return (AE_OK);
84         }
85
86         if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) {
87                 /*
88                  * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
89                  * objects and thus allow them to be targets.  (As per the ACPI
90                  * specification, a store to a constant is a noop.)
91                  */
92                 if ((this_type == ACPI_TYPE_INTEGER) &&
93                     (((union acpi_operand_object *)object)->common.
94                      flags & AOPOBJ_AML_CONSTANT)) {
95                         return (AE_OK);
96                 }
97         }
98
99         if (type_needed != this_type) {
100                 ACPI_ERROR((AE_INFO,
101                             "Needed type [%s], found [%s] %p",
102                             acpi_ut_get_type_name(type_needed),
103                             acpi_ut_get_type_name(this_type), object));
104
105                 return (AE_AML_OPERAND_TYPE);
106         }
107
108         return (AE_OK);
109 }
110
111 /*******************************************************************************
112  *
113  * FUNCTION:    acpi_ex_resolve_operands
114  *
115  * PARAMETERS:  Opcode              - Opcode being interpreted
116  *              stack_ptr           - Pointer to the operand stack to be
117  *                                    resolved
118  *              walk_state          - Current state
119  *
120  * RETURN:      Status
121  *
122  * DESCRIPTION: Convert multiple input operands to the types required by the
123  *              target operator.
124  *
125  *      Each 5-bit group in arg_types represents one required
126  *      operand and indicates the required Type. The corresponding operand
127  *      will be converted to the required type if possible, otherwise we
128  *      abort with an exception.
129  *
130  ******************************************************************************/
131
132 acpi_status
133 acpi_ex_resolve_operands(u16 opcode,
134                          union acpi_operand_object ** stack_ptr,
135                          struct acpi_walk_state * walk_state)
136 {
137         union acpi_operand_object *obj_desc;
138         acpi_status status = AE_OK;
139         u8 object_type;
140         void *temp_node;
141         u32 arg_types;
142         const struct acpi_opcode_info *op_info;
143         u32 this_arg_type;
144         acpi_object_type type_needed;
145         u16 target_op = 0;
146
147         ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode);
148
149         op_info = acpi_ps_get_opcode_info(opcode);
150         if (op_info->class == AML_CLASS_UNKNOWN) {
151                 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
152         }
153
154         arg_types = op_info->runtime_args;
155         if (arg_types == ARGI_INVALID_OPCODE) {
156                 ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", opcode));
157
158                 return_ACPI_STATUS(AE_AML_INTERNAL);
159         }
160
161         ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
162                           "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
163                           opcode, op_info->name, arg_types));
164
165         /*
166          * Normal exit is with (arg_types == 0) at end of argument list.
167          * Function will return an exception from within the loop upon
168          * finding an entry which is not (or cannot be converted
169          * to) the required type; if stack underflows; or upon
170          * finding a NULL stack entry (which should not happen).
171          */
172         while (GET_CURRENT_ARG_TYPE(arg_types)) {
173                 if (!stack_ptr || !*stack_ptr) {
174                         ACPI_ERROR((AE_INFO, "Null stack entry at %p",
175                                     stack_ptr));
176
177                         return_ACPI_STATUS(AE_AML_INTERNAL);
178                 }
179
180                 /* Extract useful items */
181
182                 obj_desc = *stack_ptr;
183
184                 /* Decode the descriptor type */
185
186                 switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
187                 case ACPI_DESC_TYPE_NAMED:
188
189                         /* Namespace Node */
190
191                         object_type =
192                             ((struct acpi_namespace_node *)obj_desc)->type;
193
194                         /*
195                          * Resolve an alias object. The construction of these objects
196                          * guarantees that there is only one level of alias indirection;
197                          * thus, the attached object is always the aliased namespace node
198                          */
199                         if (object_type == ACPI_TYPE_LOCAL_ALIAS) {
200                                 obj_desc =
201                                     acpi_ns_get_attached_object((struct
202                                                                  acpi_namespace_node
203                                                                  *)obj_desc);
204                                 *stack_ptr = obj_desc;
205                                 object_type =
206                                     ((struct acpi_namespace_node *)obj_desc)->
207                                     type;
208                         }
209                         break;
210
211                 case ACPI_DESC_TYPE_OPERAND:
212
213                         /* ACPI internal object */
214
215                         object_type = ACPI_GET_OBJECT_TYPE(obj_desc);
216
217                         /* Check for bad acpi_object_type */
218
219                         if (!acpi_ut_valid_object_type(object_type)) {
220                                 ACPI_ERROR((AE_INFO,
221                                             "Bad operand object type [%X]",
222                                             object_type));
223
224                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
225                         }
226
227                         if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
228
229                                 /* Decode the Reference */
230
231                                 op_info = acpi_ps_get_opcode_info(opcode);
232                                 if (op_info->class == AML_CLASS_UNKNOWN) {
233                                         return_ACPI_STATUS(AE_AML_BAD_OPCODE);
234                                 }
235
236                                 switch (obj_desc->reference.opcode) {
237                                 case AML_DEBUG_OP:
238                                         target_op = AML_DEBUG_OP;
239
240                                         /*lint -fallthrough */
241
242                                 case AML_NAME_OP:
243                                 case AML_INDEX_OP:
244                                 case AML_REF_OF_OP:
245                                 case AML_ARG_OP:
246                                 case AML_LOCAL_OP:
247                                 case AML_LOAD_OP:       /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
248                                 case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
249
250                                         ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
251                                                                 ((ACPI_DB_EXEC,
252                                                                   "Operand is a Reference, RefOpcode [%s]\n",
253                                                                   (acpi_ps_get_opcode_info
254                                                                    (obj_desc->
255                                                                     reference.
256                                                                     opcode))->
257                                                                   name)));
258                                         break;
259
260                                 default:
261                                         ACPI_ERROR((AE_INFO,
262                                                     "Operand is a Reference, Unknown Reference Opcode: %X",
263                                                     obj_desc->reference.
264                                                     opcode));
265
266                                         return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
267                                 }
268                         }
269                         break;
270
271                 default:
272
273                         /* Invalid descriptor */
274
275                         ACPI_ERROR((AE_INFO,
276                                     "Invalid descriptor %p [%s]",
277                                     obj_desc,
278                                     acpi_ut_get_descriptor_name(obj_desc)));
279
280                         return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
281                 }
282
283                 /* Get one argument type, point to the next */
284
285                 this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
286                 INCREMENT_ARG_LIST(arg_types);
287
288                 /*
289                  * Handle cases where the object does not need to be
290                  * resolved to a value
291                  */
292                 switch (this_arg_type) {
293                 case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
294
295                         if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
296                              ACPI_DESC_TYPE_OPERAND)
297                             && (ACPI_GET_OBJECT_TYPE(obj_desc) ==
298                                 ACPI_TYPE_STRING)) {
299                                 /*
300                                  * String found - the string references a named object and
301                                  * must be resolved to a node
302                                  */
303                                 goto next_operand;
304                         }
305
306                         /*
307                          * Else not a string - fall through to the normal Reference
308                          * case below
309                          */
310                         /*lint -fallthrough */
311
312                 case ARGI_REFERENCE:    /* References: */
313                 case ARGI_INTEGER_REF:
314                 case ARGI_OBJECT_REF:
315                 case ARGI_DEVICE_REF:
316                 case ARGI_TARGETREF:    /* Allows implicit conversion rules before store */
317                 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
318                 case ARGI_SIMPLE_TARGET:        /* Name, Local, or Arg - no implicit conversion  */
319
320                         /*
321                          * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
322                          * A Namespace Node is OK as-is
323                          */
324                         if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
325                             ACPI_DESC_TYPE_NAMED) {
326                                 goto next_operand;
327                         }
328
329                         status =
330                             acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
331                                                       object_type, obj_desc);
332                         if (ACPI_FAILURE(status)) {
333                                 return_ACPI_STATUS(status);
334                         }
335
336                         if (obj_desc->reference.opcode == AML_NAME_OP) {
337
338                                 /* Convert a named reference to the actual named object */
339
340                                 temp_node = obj_desc->reference.object;
341                                 acpi_ut_remove_reference(obj_desc);
342                                 (*stack_ptr) = temp_node;
343                         }
344                         goto next_operand;
345
346                 case ARGI_DATAREFOBJ:   /* Store operator only */
347
348                         /*
349                          * We don't want to resolve index_op reference objects during
350                          * a store because this would be an implicit de_ref_of operation.
351                          * Instead, we just want to store the reference object.
352                          * -- All others must be resolved below.
353                          */
354                         if ((opcode == AML_STORE_OP) &&
355                             (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
356                              ACPI_TYPE_LOCAL_REFERENCE)
357                             && ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
358                                 goto next_operand;
359                         }
360                         break;
361
362                 default:
363                         /* All cases covered above */
364                         break;
365                 }
366
367                 /*
368                  * Resolve this object to a value
369                  */
370                 status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
371                 if (ACPI_FAILURE(status)) {
372                         return_ACPI_STATUS(status);
373                 }
374
375                 /* Get the resolved object */
376
377                 obj_desc = *stack_ptr;
378
379                 /*
380                  * Check the resulting object (value) type
381                  */
382                 switch (this_arg_type) {
383                         /*
384                          * For the simple cases, only one type of resolved object
385                          * is allowed
386                          */
387                 case ARGI_MUTEX:
388
389                         /* Need an operand of type ACPI_TYPE_MUTEX */
390
391                         type_needed = ACPI_TYPE_MUTEX;
392                         break;
393
394                 case ARGI_EVENT:
395
396                         /* Need an operand of type ACPI_TYPE_EVENT */
397
398                         type_needed = ACPI_TYPE_EVENT;
399                         break;
400
401                 case ARGI_PACKAGE:      /* Package */
402
403                         /* Need an operand of type ACPI_TYPE_PACKAGE */
404
405                         type_needed = ACPI_TYPE_PACKAGE;
406                         break;
407
408                 case ARGI_ANYTYPE:
409
410                         /* Any operand type will do */
411
412                         type_needed = ACPI_TYPE_ANY;
413                         break;
414
415                 case ARGI_DDBHANDLE:
416
417                         /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
418
419                         type_needed = ACPI_TYPE_LOCAL_REFERENCE;
420                         break;
421
422                         /*
423                          * The more complex cases allow multiple resolved object types
424                          */
425                 case ARGI_INTEGER:
426
427                         /*
428                          * Need an operand of type ACPI_TYPE_INTEGER,
429                          * But we can implicitly convert from a STRING or BUFFER
430                          * Aka - "Implicit Source Operand Conversion"
431                          */
432                         status =
433                             acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
434                         if (ACPI_FAILURE(status)) {
435                                 if (status == AE_TYPE) {
436                                         ACPI_ERROR((AE_INFO,
437                                                     "Needed [Integer/String/Buffer], found [%s] %p",
438                                                     acpi_ut_get_object_type_name
439                                                     (obj_desc), obj_desc));
440
441                                         return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
442                                 }
443
444                                 return_ACPI_STATUS(status);
445                         }
446
447                         if (obj_desc != *stack_ptr) {
448                                 acpi_ut_remove_reference(obj_desc);
449                         }
450                         goto next_operand;
451
452                 case ARGI_BUFFER:
453
454                         /*
455                          * Need an operand of type ACPI_TYPE_BUFFER,
456                          * But we can implicitly convert from a STRING or INTEGER
457                          * Aka - "Implicit Source Operand Conversion"
458                          */
459                         status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
460                         if (ACPI_FAILURE(status)) {
461                                 if (status == AE_TYPE) {
462                                         ACPI_ERROR((AE_INFO,
463                                                     "Needed [Integer/String/Buffer], found [%s] %p",
464                                                     acpi_ut_get_object_type_name
465                                                     (obj_desc), obj_desc));
466
467                                         return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
468                                 }
469
470                                 return_ACPI_STATUS(status);
471                         }
472
473                         if (obj_desc != *stack_ptr) {
474                                 acpi_ut_remove_reference(obj_desc);
475                         }
476                         goto next_operand;
477
478                 case ARGI_STRING:
479
480                         /*
481                          * Need an operand of type ACPI_TYPE_STRING,
482                          * But we can implicitly convert from a BUFFER or INTEGER
483                          * Aka - "Implicit Source Operand Conversion"
484                          */
485                         status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
486                                                            ACPI_IMPLICIT_CONVERT_HEX);
487                         if (ACPI_FAILURE(status)) {
488                                 if (status == AE_TYPE) {
489                                         ACPI_ERROR((AE_INFO,
490                                                     "Needed [Integer/String/Buffer], found [%s] %p",
491                                                     acpi_ut_get_object_type_name
492                                                     (obj_desc), obj_desc));
493
494                                         return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
495                                 }
496
497                                 return_ACPI_STATUS(status);
498                         }
499
500                         if (obj_desc != *stack_ptr) {
501                                 acpi_ut_remove_reference(obj_desc);
502                         }
503                         goto next_operand;
504
505                 case ARGI_COMPUTEDATA:
506
507                         /* Need an operand of type INTEGER, STRING or BUFFER */
508
509                         switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
510                         case ACPI_TYPE_INTEGER:
511                         case ACPI_TYPE_STRING:
512                         case ACPI_TYPE_BUFFER:
513
514                                 /* Valid operand */
515                                 break;
516
517                         default:
518                                 ACPI_ERROR((AE_INFO,
519                                             "Needed [Integer/String/Buffer], found [%s] %p",
520                                             acpi_ut_get_object_type_name
521                                             (obj_desc), obj_desc));
522
523                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
524                         }
525                         goto next_operand;
526
527                 case ARGI_BUFFER_OR_STRING:
528
529                         /* Need an operand of type STRING or BUFFER */
530
531                         switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
532                         case ACPI_TYPE_STRING:
533                         case ACPI_TYPE_BUFFER:
534
535                                 /* Valid operand */
536                                 break;
537
538                         case ACPI_TYPE_INTEGER:
539
540                                 /* Highest priority conversion is to type Buffer */
541
542                                 status =
543                                     acpi_ex_convert_to_buffer(obj_desc,
544                                                               stack_ptr);
545                                 if (ACPI_FAILURE(status)) {
546                                         return_ACPI_STATUS(status);
547                                 }
548
549                                 if (obj_desc != *stack_ptr) {
550                                         acpi_ut_remove_reference(obj_desc);
551                                 }
552                                 break;
553
554                         default:
555                                 ACPI_ERROR((AE_INFO,
556                                             "Needed [Integer/String/Buffer], found [%s] %p",
557                                             acpi_ut_get_object_type_name
558                                             (obj_desc), obj_desc));
559
560                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
561                         }
562                         goto next_operand;
563
564                 case ARGI_DATAOBJECT:
565                         /*
566                          * ARGI_DATAOBJECT is only used by the size_of operator.
567                          * Need a buffer, string, package, or ref_of reference.
568                          *
569                          * The only reference allowed here is a direct reference to
570                          * a namespace node.
571                          */
572                         switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
573                         case ACPI_TYPE_PACKAGE:
574                         case ACPI_TYPE_STRING:
575                         case ACPI_TYPE_BUFFER:
576                         case ACPI_TYPE_LOCAL_REFERENCE:
577
578                                 /* Valid operand */
579                                 break;
580
581                         default:
582                                 ACPI_ERROR((AE_INFO,
583                                             "Needed [Buffer/String/Package/Reference], found [%s] %p",
584                                             acpi_ut_get_object_type_name
585                                             (obj_desc), obj_desc));
586
587                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
588                         }
589                         goto next_operand;
590
591                 case ARGI_COMPLEXOBJ:
592
593                         /* Need a buffer or package or (ACPI 2.0) String */
594
595                         switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
596                         case ACPI_TYPE_PACKAGE:
597                         case ACPI_TYPE_STRING:
598                         case ACPI_TYPE_BUFFER:
599
600                                 /* Valid operand */
601                                 break;
602
603                         default:
604                                 ACPI_ERROR((AE_INFO,
605                                             "Needed [Buffer/String/Package], found [%s] %p",
606                                             acpi_ut_get_object_type_name
607                                             (obj_desc), obj_desc));
608
609                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
610                         }
611                         goto next_operand;
612
613                 case ARGI_REGION_OR_BUFFER:     /* Used by Load() only */
614
615                         /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
616
617                         switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
618                         case ACPI_TYPE_BUFFER:
619                         case ACPI_TYPE_REGION:
620
621                                 /* Valid operand */
622                                 break;
623
624                         default:
625                                 ACPI_ERROR((AE_INFO,
626                                             "Needed [Region/Buffer], found [%s] %p",
627                                             acpi_ut_get_object_type_name
628                                             (obj_desc), obj_desc));
629
630                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
631                         }
632                         goto next_operand;
633
634                 case ARGI_DATAREFOBJ:
635
636                         /* Used by the Store() operator only */
637
638                         switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
639                         case ACPI_TYPE_INTEGER:
640                         case ACPI_TYPE_PACKAGE:
641                         case ACPI_TYPE_STRING:
642                         case ACPI_TYPE_BUFFER:
643                         case ACPI_TYPE_BUFFER_FIELD:
644                         case ACPI_TYPE_LOCAL_REFERENCE:
645                         case ACPI_TYPE_LOCAL_REGION_FIELD:
646                         case ACPI_TYPE_LOCAL_BANK_FIELD:
647                         case ACPI_TYPE_LOCAL_INDEX_FIELD:
648                         case ACPI_TYPE_DDB_HANDLE:
649
650                                 /* Valid operand */
651                                 break;
652
653                         default:
654
655                                 if (acpi_gbl_enable_interpreter_slack) {
656                                         /*
657                                          * Enable original behavior of Store(), allowing any and all
658                                          * objects as the source operand.  The ACPI spec does not
659                                          * allow this, however.
660                                          */
661                                         break;
662                                 }
663
664                                 if (target_op == AML_DEBUG_OP) {
665
666                                         /* Allow store of any object to the Debug object */
667
668                                         break;
669                                 }
670
671                                 ACPI_ERROR((AE_INFO,
672                                             "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
673                                             acpi_ut_get_object_type_name
674                                             (obj_desc), obj_desc));
675
676                                 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
677                         }
678                         goto next_operand;
679
680                 default:
681
682                         /* Unknown type */
683
684                         ACPI_ERROR((AE_INFO,
685                                     "Internal - Unknown ARGI (required operand) type %X",
686                                     this_arg_type));
687
688                         return_ACPI_STATUS(AE_BAD_PARAMETER);
689                 }
690
691                 /*
692                  * Make sure that the original object was resolved to the
693                  * required object type (Simple cases only).
694                  */
695                 status = acpi_ex_check_object_type(type_needed,
696                                                    ACPI_GET_OBJECT_TYPE
697                                                    (*stack_ptr), *stack_ptr);
698                 if (ACPI_FAILURE(status)) {
699                         return_ACPI_STATUS(status);
700                 }
701
702               next_operand:
703                 /*
704                  * If more operands needed, decrement stack_ptr to point
705                  * to next operand on stack
706                  */
707                 if (GET_CURRENT_ARG_TYPE(arg_types)) {
708                         stack_ptr--;
709                 }
710         }
711
712         return_ACPI_STATUS(status);
713 }