dsutils.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:20k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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