import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / acpi / dispatcher / dsutils.c
1 /*******************************************************************************
2  *
3  * Module Name: dsutils - Dispatcher utilities
4  *              $Revision: 1.1.1.1 $
5  *
6  ******************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26
27 #include "acpi.h"
28 #include "acparser.h"
29 #include "amlcode.h"
30 #include "acdispat.h"
31 #include "acinterp.h"
32 #include "acnamesp.h"
33 #include "acdebug.h"
34
35 #define _COMPONENT          ACPI_DISPATCHER
36          MODULE_NAME         ("dsutils")
37
38
39 /*******************************************************************************
40  *
41  * FUNCTION:    Acpi_ds_is_result_used
42  *
43  * PARAMETERS:  Op
44  *              Result_obj
45  *              Walk_state
46  *
47  * RETURN:      Status
48  *
49  * DESCRIPTION: Check if a result object will be used by the parent
50  *
51  ******************************************************************************/
52
53 u8
54 acpi_ds_is_result_used (
55         acpi_parse_object       *op,
56         acpi_walk_state         *walk_state)
57 {
58         const acpi_opcode_info  *parent_info;
59
60
61         FUNCTION_TRACE_PTR ("Ds_is_result_used", op);
62
63
64         /* Must have both an Op and a Result Object */
65
66         if (!op) {
67                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
68                 return_VALUE (TRUE);
69         }
70
71
72         /*
73          * If there is no parent, the result can't possibly be used!
74          * (An executing method typically has no parent, since each
75          * method is parsed separately)  However, a method that is
76          * invoked from another method has a parent.
77          */
78         if (!op->parent) {
79                 return_VALUE (FALSE);
80         }
81
82
83         /*
84          * Get info on the parent.  The root Op is AML_SCOPE
85          */
86
87         parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
88         if (parent_info->class == AML_CLASS_UNKNOWN) {
89                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
90                 return_VALUE (FALSE);
91         }
92
93
94         /*
95          * Decide what to do with the result based on the parent.  If
96          * the parent opcode will not use the result, delete the object.
97          * Otherwise leave it as is, it will be deleted when it is used
98          * as an operand later.
99          */
100         switch (parent_info->class) {
101         /*
102          * In these cases, the parent will never use the return object
103          */
104         case AML_CLASS_CONTROL:        /* IF, ELSE, WHILE only */
105
106                 switch (op->parent->opcode) {
107                 case AML_RETURN_OP:
108
109                         /* Never delete the return value associated with a return opcode */
110
111                         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
112                                 "Result used, [RETURN] opcode=%X Op=%p\n", op->opcode, op));
113                         return_VALUE (TRUE);
114                         break;
115
116                 case AML_IF_OP:
117                 case AML_WHILE_OP:
118
119                         /*
120                          * If we are executing the predicate AND this is the predicate op,
121                          * we will use the return value!
122                          */
123                         if ((walk_state->control_state->common.state == CONTROL_PREDICATE_EXECUTING) &&
124                                 (walk_state->control_state->control.predicate_op == op)) {
125                                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
126                                         "Result used as a predicate, [IF/WHILE] opcode=%X Op=%p\n",
127                                         op->opcode, op));
128                                 return_VALUE (TRUE);
129                         }
130
131                         break;
132                 }
133
134
135                 /* Fall through to not used case below */
136
137
138         case AML_CLASS_NAMED_OBJECT:   /* Scope, method, etc. */
139         case AML_CLASS_CREATE:
140
141                 /*
142                  * These opcodes allow Term_arg(s) as operands and therefore
143                  * method calls.  The result is used.
144                  */
145                 if ((op->parent->opcode == AML_REGION_OP)               ||
146                         (op->parent->opcode == AML_CREATE_FIELD_OP)         ||
147                         (op->parent->opcode == AML_CREATE_BIT_FIELD_OP)     ||
148                         (op->parent->opcode == AML_CREATE_BYTE_FIELD_OP)    ||
149                         (op->parent->opcode == AML_CREATE_WORD_FIELD_OP)    ||
150                         (op->parent->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
151                         (op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
152                         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
153                                 "Result used, [Region or Create_field] opcode=%X Op=%p\n",
154                                 op->opcode, op));
155                         return_VALUE (TRUE);
156                 }
157
158                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
159                         "Result not used, Parent opcode=%X Op=%p\n", op->opcode, op));
160
161                 return_VALUE (FALSE);
162                 break;
163
164         /*
165          * In all other cases. the parent will actually use the return
166          * object, so keep it.
167          */
168         default:
169                 break;
170         }
171
172         return_VALUE (TRUE);
173 }
174
175
176 /*******************************************************************************
177  *
178  * FUNCTION:    Acpi_ds_delete_result_if_not_used
179  *
180  * PARAMETERS:  Op
181  *              Result_obj
182  *              Walk_state
183  *
184  * RETURN:      Status
185  *
186  * DESCRIPTION: Used after interpretation of an opcode.  If there is an internal
187  *              result descriptor, check if the parent opcode will actually use
188  *              this result.  If not, delete the result now so that it will
189  *              not become orphaned.
190  *
191  ******************************************************************************/
192
193 void
194 acpi_ds_delete_result_if_not_used (
195         acpi_parse_object       *op,
196         acpi_operand_object     *result_obj,
197         acpi_walk_state         *walk_state)
198 {
199         acpi_operand_object     *obj_desc;
200         acpi_status             status;
201
202
203         FUNCTION_TRACE_PTR ("Ds_delete_result_if_not_used", result_obj);
204
205
206         if (!op) {
207                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
208                 return_VOID;
209         }
210
211         if (!result_obj) {
212                 return_VOID;
213         }
214
215
216         if (!acpi_ds_is_result_used (op, walk_state)) {
217                 /*
218                  * Must pop the result stack (Obj_desc should be equal to Result_obj)
219                  */
220                 status = acpi_ds_result_pop (&obj_desc, walk_state);
221                 if (ACPI_SUCCESS (status)) {
222                         acpi_ut_remove_reference (result_obj);
223                 }
224         }
225
226         return_VOID;
227 }
228
229
230 /*******************************************************************************
231  *
232  * FUNCTION:    Acpi_ds_create_operand
233  *
234  * PARAMETERS:  Walk_state
235  *              Arg
236  *
237  * RETURN:      Status
238  *
239  * DESCRIPTION: Translate a parse tree object that is an argument to an AML
240  *              opcode to the equivalent interpreter object.  This may include
241  *              looking up a name or entering a new name into the internal
242  *              namespace.
243  *
244  ******************************************************************************/
245
246 acpi_status
247 acpi_ds_create_operand (
248         acpi_walk_state         *walk_state,
249         acpi_parse_object       *arg,
250         u32                     arg_index)
251 {
252         acpi_status             status = AE_OK;
253         NATIVE_CHAR             *name_string;
254         u32                     name_length;
255         acpi_object_type8       data_type;
256         acpi_operand_object     *obj_desc;
257         acpi_parse_object       *parent_op;
258         u16                     opcode;
259         u32                     flags;
260         operating_mode          interpreter_mode;
261         const acpi_opcode_info  *op_info;
262
263
264         FUNCTION_TRACE_PTR ("Ds_create_operand", arg);
265
266
267         /* A valid name must be looked up in the namespace */
268
269         if ((arg->opcode == AML_INT_NAMEPATH_OP) &&
270                 (arg->value.string)) {
271                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
272
273                 /* Get the entire name string from the AML stream */
274
275                 status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->value.buffer,
276                                   &name_string, &name_length);
277
278                 if (ACPI_FAILURE (status)) {
279                         return_ACPI_STATUS (status);
280                 }
281
282                 /*
283                  * All prefixes have been handled, and the name is
284                  * in Name_string
285                  */
286
287                 /*
288                  * Differentiate between a namespace "create" operation
289                  * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
290                  * IMODE_EXECUTE) in order to support the creation of
291                  * namespace objects during the execution of control methods.
292                  */
293                 parent_op = arg->parent;
294                 op_info = acpi_ps_get_opcode_info (parent_op->opcode);
295                 if ((op_info->flags & AML_NSNODE) &&
296                         (parent_op->opcode != AML_INT_METHODCALL_OP) &&
297                         (parent_op->opcode != AML_REGION_OP) &&
298                         (parent_op->opcode != AML_INT_NAMEPATH_OP)) {
299                         /* Enter name into namespace if not found */
300
301                         interpreter_mode = IMODE_LOAD_PASS2;
302                 }
303
304                 else {
305                         /* Return a failure if name not found */
306
307                         interpreter_mode = IMODE_EXECUTE;
308                 }
309
310                 status = acpi_ns_lookup (walk_state->scope_info, name_string,
311                                  ACPI_TYPE_ANY, interpreter_mode,
312                                  NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
313                                  walk_state,
314                                  (acpi_namespace_node **) &obj_desc);
315
316                 /* Free the namestring created above */
317
318                 ACPI_MEM_FREE (name_string);
319
320                 /*
321                  * The only case where we pass through (ignore) a NOT_FOUND
322                  * error is for the Cond_ref_of opcode.
323                  */
324                 if (status == AE_NOT_FOUND) {
325                         if (parent_op->opcode == AML_COND_REF_OF_OP) {
326                                 /*
327                                  * For the Conditional Reference op, it's OK if
328                                  * the name is not found;  We just need a way to
329                                  * indicate this to the interpreter, set the
330                                  * object to the root
331                                  */
332                                 obj_desc = (acpi_operand_object *) acpi_gbl_root_node;
333                                 status = AE_OK;
334                         }
335
336                         else {
337                                 /*
338                                  * We just plain didn't find it -- which is a
339                                  * very serious error at this point
340                                  */
341                                 status = AE_AML_NAME_NOT_FOUND;
342
343                                 /* TBD: Externalize Name_string and print */
344
345                                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
346                                                 "Object name was not found in namespace\n"));
347                         }
348                 }
349
350                 /* Check status from the lookup */
351
352                 if (ACPI_FAILURE (status)) {
353                         return_ACPI_STATUS (status);
354                 }
355
356                 /* Put the resulting object onto the current object stack */
357
358                 status = acpi_ds_obj_stack_push (obj_desc, walk_state);
359                 if (ACPI_FAILURE (status)) {
360                         return_ACPI_STATUS (status);
361                 }
362                 DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
363         }
364
365
366         else {
367                 /* Check for null name case */
368
369                 if (arg->opcode == AML_INT_NAMEPATH_OP) {
370                         /*
371                          * If the name is null, this means that this is an
372                          * optional result parameter that was not specified
373                          * in the original ASL.  Create an Reference for a
374                          * placeholder
375                          */
376                         opcode = AML_ZERO_OP;       /* Has no arguments! */
377
378                         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg));
379
380                         /*
381                          * TBD: [Investigate] anything else needed for the
382                          * zero op lvalue?
383                          */
384                 }
385
386                 else {
387                         opcode = arg->opcode;
388                 }
389
390
391                 /* Get the data type of the argument */
392
393                 data_type = acpi_ds_map_opcode_to_data_type (opcode, &flags);
394                 if (data_type == INTERNAL_TYPE_INVALID) {
395                         return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
396                 }
397
398                 if (flags & OP_HAS_RETURN_VALUE) {
399                         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
400                                 "Argument previously created, already stacked \n"));
401
402                         DEBUGGER_EXEC (acpi_db_display_argument_object (walk_state->operands [walk_state->num_operands - 1], walk_state));
403
404                         /*
405                          * Use value that was already previously returned
406                          * by the evaluation of this argument
407                          */
408                         status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
409                         if (ACPI_FAILURE (status)) {
410                                 /*
411                                  * Only error is underflow, and this indicates
412                                  * a missing or null operand!
413                                  */
414                                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
415                                         acpi_format_exception (status)));
416                                 return_ACPI_STATUS (status);
417                         }
418
419                 }
420
421                 else {
422                         /* Create an ACPI_INTERNAL_OBJECT for the argument */
423
424                         obj_desc = acpi_ut_create_internal_object (data_type);
425                         if (!obj_desc) {
426                                 return_ACPI_STATUS (AE_NO_MEMORY);
427                         }
428
429                         /* Initialize the new object */
430
431                         status = acpi_ds_init_object_from_op (walk_state, arg,
432                                          opcode, &obj_desc);
433                         if (ACPI_FAILURE (status)) {
434                                 acpi_ut_delete_object_desc (obj_desc);
435                                 return_ACPI_STATUS (status);
436                         }
437            }
438
439                 /* Put the operand object on the object stack */
440
441                 status = acpi_ds_obj_stack_push (obj_desc, walk_state);
442                 if (ACPI_FAILURE (status)) {
443                         return_ACPI_STATUS (status);
444                 }
445
446                 DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
447         }
448
449         return_ACPI_STATUS (AE_OK);
450 }
451
452
453 /*******************************************************************************
454  *
455  * FUNCTION:    Acpi_ds_create_operands
456  *
457  * PARAMETERS:  First_arg           - First argument of a parser argument tree
458  *
459  * RETURN:      Status
460  *
461  * DESCRIPTION: Convert an operator's arguments from a parse tree format to
462  *              namespace objects and place those argument object on the object
463  *              stack in preparation for evaluation by the interpreter.
464  *
465  ******************************************************************************/
466
467 acpi_status
468 acpi_ds_create_operands (
469         acpi_walk_state         *walk_state,
470         acpi_parse_object       *first_arg)
471 {
472         acpi_status             status = AE_OK;
473         acpi_parse_object       *arg;
474         u32                     arg_count = 0;
475
476
477         FUNCTION_TRACE_PTR ("Ds_create_operands", first_arg);
478
479
480         /* For all arguments in the list... */
481
482         arg = first_arg;
483         while (arg) {
484                 status = acpi_ds_create_operand (walk_state, arg, arg_count);
485                 if (ACPI_FAILURE (status)) {
486                         goto cleanup;
487                 }
488
489                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
490                         arg_count, arg, first_arg));
491
492                 /* Move on to next argument, if any */
493
494                 arg = arg->next;
495                 arg_count++;
496         }
497
498         return_ACPI_STATUS (status);
499
500
501 cleanup:
502         /*
503          * We must undo everything done above; meaning that we must
504          * pop everything off of the operand stack and delete those
505          * objects
506          */
507         acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
508
509         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
510                 (arg_count + 1), acpi_format_exception (status)));
511         return_ACPI_STATUS (status);
512 }
513
514
515 /*******************************************************************************
516  *
517  * FUNCTION:    Acpi_ds_resolve_operands
518  *
519  * PARAMETERS:  Walk_state          - Current walk state with operands on stack
520  *
521  * RETURN:      Status
522  *
523  * DESCRIPTION: Resolve all operands to their values.  Used to prepare
524  *              arguments to a control method invocation (a call from one
525  *              method to another.)
526  *
527  ******************************************************************************/
528
529 acpi_status
530 acpi_ds_resolve_operands (
531         acpi_walk_state         *walk_state)
532 {
533         u32                     i;
534         acpi_status             status = AE_OK;
535
536
537         FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
538
539
540         /*
541          * Attempt to resolve each of the valid operands
542          * Method arguments are passed by value, not by reference
543          */
544
545         /*
546          * TBD: [Investigate] Note from previous parser:
547          *   Ref_of problem with Acpi_ex_resolve_to_value() conversion.
548          */
549         for (i = 0; i < walk_state->num_operands; i++) {
550                 status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
551                 if (ACPI_FAILURE (status)) {
552                         break;
553                 }
554         }
555
556         return_ACPI_STATUS (status);
557 }
558
559
560 /*******************************************************************************
561  *
562  * FUNCTION:    Acpi_ds_map_opcode_to_data_type
563  *
564  * PARAMETERS:  Opcode          - AML opcode to map
565  *              Out_flags       - Additional info about the opcode
566  *
567  * RETURN:      The ACPI type associated with the opcode
568  *
569  * DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type,
570  *              if any.  If the opcode returns a value as part of the
571  *              intepreter execution, a flag is returned in Out_flags.
572  *
573  ******************************************************************************/
574
575 acpi_object_type8
576 acpi_ds_map_opcode_to_data_type (
577         u16                     opcode,
578         u32                     *out_flags)
579 {
580         acpi_object_type8       data_type = INTERNAL_TYPE_INVALID;
581         const acpi_opcode_info  *op_info;
582         u32                     flags = 0;
583
584
585         PROC_NAME ("Ds_map_opcode_to_data_type");
586
587
588         op_info = acpi_ps_get_opcode_info (opcode);
589         if (op_info->class == AML_CLASS_UNKNOWN) {
590                 /* Unknown opcode */
591
592                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", opcode));
593                 return (data_type);
594         }
595
596
597 /*
598  * TBD: Use op class
599  */
600
601         switch (op_info->type) {
602
603         case AML_TYPE_LITERAL:
604
605                 switch (opcode) {
606                 case AML_BYTE_OP:
607                 case AML_WORD_OP:
608                 case AML_DWORD_OP:
609                 case AML_QWORD_OP:
610
611                         data_type = ACPI_TYPE_INTEGER;
612                         break;
613
614
615                 case AML_STRING_OP:
616
617                         data_type = ACPI_TYPE_STRING;
618                         break;
619
620                 case AML_INT_NAMEPATH_OP:
621                         data_type = INTERNAL_TYPE_REFERENCE;
622                         break;
623
624                 default:
625                         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
626                                 "Unknown (type LITERAL) AML opcode: %x\n", opcode));
627                         break;
628                 }
629                 break;
630
631
632         case AML_TYPE_DATA_TERM:
633
634                 switch (opcode) {
635                 case AML_BUFFER_OP:
636
637                         data_type = ACPI_TYPE_BUFFER;
638                         break;
639
640                 case AML_PACKAGE_OP:
641                 case AML_VAR_PACKAGE_OP:
642
643                         data_type = ACPI_TYPE_PACKAGE;
644                         break;
645
646                 default:
647                         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
648                                 "Unknown (type DATA_TERM) AML opcode: %x\n", opcode));
649                         break;
650                 }
651                 break;
652
653
654         case AML_TYPE_CONSTANT:
655         case AML_TYPE_METHOD_ARGUMENT:
656         case AML_TYPE_LOCAL_VARIABLE:
657
658                 data_type = INTERNAL_TYPE_REFERENCE;
659                 break;
660
661
662         case AML_TYPE_EXEC_1A_0T_1R:
663         case AML_TYPE_EXEC_1A_1T_1R:
664         case AML_TYPE_EXEC_2A_0T_1R:
665         case AML_TYPE_EXEC_2A_1T_1R:
666         case AML_TYPE_EXEC_2A_2T_1R:
667         case AML_TYPE_EXEC_3A_1T_1R:
668         case AML_TYPE_EXEC_6A_0T_1R:
669         case AML_TYPE_RETURN:
670
671                 flags = OP_HAS_RETURN_VALUE;
672                 data_type = ACPI_TYPE_ANY;
673                 break;
674
675
676         case AML_TYPE_METHOD_CALL:
677
678                 flags = OP_HAS_RETURN_VALUE;
679                 data_type = ACPI_TYPE_METHOD;
680                 break;
681
682
683         case AML_TYPE_NAMED_FIELD:
684         case AML_TYPE_NAMED_SIMPLE:
685         case AML_TYPE_NAMED_COMPLEX:
686         case AML_TYPE_NAMED_NO_OBJ:
687
688                 data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
689                 break;
690
691
692         case AML_TYPE_EXEC_1A_0T_0R:
693         case AML_TYPE_EXEC_2A_0T_0R:
694         case AML_TYPE_EXEC_3A_0T_0R:
695         case AML_TYPE_EXEC_1A_1T_0R:
696         case AML_TYPE_CONTROL:
697
698                 /* No mapping needed at this time */
699
700                 break;
701
702
703         default:
704
705                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
706                         "Unimplemented data type opcode: %x\n", opcode));
707                 break;
708         }
709
710         /* Return flags to caller if requested */
711
712         if (out_flags) {
713                 *out_flags = flags;
714         }
715
716         return (data_type);
717 }
718
719
720 /*******************************************************************************
721  *
722  * FUNCTION:    Acpi_ds_map_named_opcode_to_data_type
723  *
724  * PARAMETERS:  Opcode              - The Named AML opcode to map
725  *
726  * RETURN:      The ACPI type associated with the named opcode
727  *
728  * DESCRIPTION: Convert a raw Named AML opcode to the associated data type.
729  *              Named opcodes are a subsystem of the AML opcodes.
730  *
731  ******************************************************************************/
732
733 acpi_object_type8
734 acpi_ds_map_named_opcode_to_data_type (
735         u16                     opcode)
736 {
737         acpi_object_type8       data_type;
738
739
740         FUNCTION_ENTRY ();
741
742
743         /* Decode Opcode */
744
745         switch (opcode) {
746         case AML_SCOPE_OP:
747                 data_type = INTERNAL_TYPE_SCOPE;
748                 break;
749
750         case AML_DEVICE_OP:
751                 data_type = ACPI_TYPE_DEVICE;
752                 break;
753
754         case AML_THERMAL_ZONE_OP:
755                 data_type = ACPI_TYPE_THERMAL;
756                 break;
757
758         case AML_METHOD_OP:
759                 data_type = ACPI_TYPE_METHOD;
760                 break;
761
762         case AML_POWER_RES_OP:
763                 data_type = ACPI_TYPE_POWER;
764                 break;
765
766         case AML_PROCESSOR_OP:
767                 data_type = ACPI_TYPE_PROCESSOR;
768                 break;
769
770         case AML_FIELD_OP:                              /* Field_op */
771                 data_type = INTERNAL_TYPE_FIELD_DEFN;
772                 break;
773
774         case AML_INDEX_FIELD_OP:                        /* Index_field_op */
775                 data_type = INTERNAL_TYPE_INDEX_FIELD_DEFN;
776                 break;
777
778         case AML_BANK_FIELD_OP:                         /* Bank_field_op */
779                 data_type = INTERNAL_TYPE_BANK_FIELD_DEFN;
780                 break;
781
782         case AML_INT_NAMEDFIELD_OP:                     /* NO CASE IN ORIGINAL  */
783                 data_type = ACPI_TYPE_ANY;
784                 break;
785
786         case AML_NAME_OP:                               /* Name_op - special code in original */
787         case AML_INT_NAMEPATH_OP:
788                 data_type = ACPI_TYPE_ANY;
789                 break;
790
791         case AML_ALIAS_OP:
792                 data_type = INTERNAL_TYPE_ALIAS;
793                 break;
794
795         case AML_MUTEX_OP:
796                 data_type = ACPI_TYPE_MUTEX;
797                 break;
798
799         case AML_EVENT_OP:
800                 data_type = ACPI_TYPE_EVENT;
801                 break;
802
803         case AML_DATA_REGION_OP:
804         case AML_REGION_OP:
805                 data_type = ACPI_TYPE_REGION;
806                 break;
807
808
809         default:
810                 data_type = ACPI_TYPE_ANY;
811                 break;
812
813         }
814
815         return (data_type);
816 }
817
818