dswexec.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. /******************************************************************************
  2. *
  3. * Module Name: dswexec - Dispatcher method execution callbacks;
  4. * dispatch to interpreter.
  5. *
  6. *****************************************************************************/
  7. /*
  8. * Copyright (C) 2000 - 2016, Intel Corp.
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions, and the following disclaimer,
  16. * without modification.
  17. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18. * substantially similar to the "NO WARRANTY" disclaimer below
  19. * ("Disclaimer") and any redistribution must be conditioned upon
  20. * including a substantially similar Disclaimer requirement for further
  21. * binary redistribution.
  22. * 3. Neither the names of the above-listed copyright holders nor the names
  23. * of any contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * Alternatively, this software may be distributed under the terms of the
  27. * GNU General Public License ("GPL") version 2 as published by the Free
  28. * Software Foundation.
  29. *
  30. * NO WARRANTY
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGES.
  42. */
  43. #include <acpi/acpi.h>
  44. #include "accommon.h"
  45. #include "acparser.h"
  46. #include "amlcode.h"
  47. #include "acdispat.h"
  48. #include "acinterp.h"
  49. #include "acnamesp.h"
  50. #include "acdebug.h"
  51. #define _COMPONENT ACPI_DISPATCHER
  52. ACPI_MODULE_NAME("dswexec")
  53. /*
  54. * Dispatch table for opcode classes
  55. */
  56. static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
  57. acpi_ex_opcode_0A_0T_1R,
  58. acpi_ex_opcode_1A_0T_0R,
  59. acpi_ex_opcode_1A_0T_1R,
  60. acpi_ex_opcode_1A_1T_0R,
  61. acpi_ex_opcode_1A_1T_1R,
  62. acpi_ex_opcode_2A_0T_0R,
  63. acpi_ex_opcode_2A_0T_1R,
  64. acpi_ex_opcode_2A_1T_1R,
  65. acpi_ex_opcode_2A_2T_1R,
  66. acpi_ex_opcode_3A_0T_0R,
  67. acpi_ex_opcode_3A_1T_1R,
  68. acpi_ex_opcode_6A_0T_1R
  69. };
  70. /*****************************************************************************
  71. *
  72. * FUNCTION: acpi_ds_get_predicate_value
  73. *
  74. * PARAMETERS: walk_state - Current state of the parse tree walk
  75. * result_obj - if non-zero, pop result from result stack
  76. *
  77. * RETURN: Status
  78. *
  79. * DESCRIPTION: Get the result of a predicate evaluation
  80. *
  81. ****************************************************************************/
  82. acpi_status
  83. acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
  84. union acpi_operand_object *result_obj)
  85. {
  86. acpi_status status = AE_OK;
  87. union acpi_operand_object *obj_desc;
  88. union acpi_operand_object *local_obj_desc = NULL;
  89. ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state);
  90. walk_state->control_state->common.state = 0;
  91. if (result_obj) {
  92. status = acpi_ds_result_pop(&obj_desc, walk_state);
  93. if (ACPI_FAILURE(status)) {
  94. ACPI_EXCEPTION((AE_INFO, status,
  95. "Could not get result from predicate evaluation"));
  96. return_ACPI_STATUS(status);
  97. }
  98. } else {
  99. status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
  100. if (ACPI_FAILURE(status)) {
  101. return_ACPI_STATUS(status);
  102. }
  103. status =
  104. acpi_ex_resolve_to_value(&walk_state->operands[0],
  105. walk_state);
  106. if (ACPI_FAILURE(status)) {
  107. return_ACPI_STATUS(status);
  108. }
  109. obj_desc = walk_state->operands[0];
  110. }
  111. if (!obj_desc) {
  112. ACPI_ERROR((AE_INFO,
  113. "No predicate ObjDesc=%p State=%p",
  114. obj_desc, walk_state));
  115. return_ACPI_STATUS(AE_AML_NO_OPERAND);
  116. }
  117. /*
  118. * Result of predicate evaluation must be an Integer
  119. * object. Implicitly convert the argument if necessary.
  120. */
  121. status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc,
  122. ACPI_STRTOUL_BASE16);
  123. if (ACPI_FAILURE(status)) {
  124. goto cleanup;
  125. }
  126. if (local_obj_desc->common.type != ACPI_TYPE_INTEGER) {
  127. ACPI_ERROR((AE_INFO,
  128. "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
  129. obj_desc, walk_state, obj_desc->common.type));
  130. status = AE_AML_OPERAND_TYPE;
  131. goto cleanup;
  132. }
  133. /* Truncate the predicate to 32-bits if necessary */
  134. (void)acpi_ex_truncate_for32bit_table(local_obj_desc);
  135. /*
  136. * Save the result of the predicate evaluation on
  137. * the control stack
  138. */
  139. if (local_obj_desc->integer.value) {
  140. walk_state->control_state->common.value = TRUE;
  141. } else {
  142. /*
  143. * Predicate is FALSE, we will just toss the
  144. * rest of the package
  145. */
  146. walk_state->control_state->common.value = FALSE;
  147. status = AE_CTRL_FALSE;
  148. }
  149. /* Predicate can be used for an implicit return value */
  150. (void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE);
  151. cleanup:
  152. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  153. "Completed a predicate eval=%X Op=%p\n",
  154. walk_state->control_state->common.value,
  155. walk_state->op));
  156. /* Break to debugger to display result */
  157. acpi_db_display_result_object(local_obj_desc, walk_state);
  158. /*
  159. * Delete the predicate result object (we know that
  160. * we don't need it anymore)
  161. */
  162. if (local_obj_desc != obj_desc) {
  163. acpi_ut_remove_reference(local_obj_desc);
  164. }
  165. acpi_ut_remove_reference(obj_desc);
  166. walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
  167. return_ACPI_STATUS(status);
  168. }
  169. /*****************************************************************************
  170. *
  171. * FUNCTION: acpi_ds_exec_begin_op
  172. *
  173. * PARAMETERS: walk_state - Current state of the parse tree walk
  174. * out_op - Where to return op if a new one is created
  175. *
  176. * RETURN: Status
  177. *
  178. * DESCRIPTION: Descending callback used during the execution of control
  179. * methods. This is where most operators and operands are
  180. * dispatched to the interpreter.
  181. *
  182. ****************************************************************************/
  183. acpi_status
  184. acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
  185. union acpi_parse_object **out_op)
  186. {
  187. union acpi_parse_object *op;
  188. acpi_status status = AE_OK;
  189. u32 opcode_class;
  190. ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state);
  191. op = walk_state->op;
  192. if (!op) {
  193. status = acpi_ds_load2_begin_op(walk_state, out_op);
  194. if (ACPI_FAILURE(status)) {
  195. goto error_exit;
  196. }
  197. op = *out_op;
  198. walk_state->op = op;
  199. walk_state->opcode = op->common.aml_opcode;
  200. walk_state->op_info =
  201. acpi_ps_get_opcode_info(op->common.aml_opcode);
  202. if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
  203. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  204. "(%s) Popping scope for Op %p\n",
  205. acpi_ut_get_type_name(walk_state->
  206. op_info->
  207. object_type),
  208. op));
  209. status = acpi_ds_scope_stack_pop(walk_state);
  210. if (ACPI_FAILURE(status)) {
  211. goto error_exit;
  212. }
  213. }
  214. }
  215. if (op == walk_state->origin) {
  216. if (out_op) {
  217. *out_op = op;
  218. }
  219. return_ACPI_STATUS(AE_OK);
  220. }
  221. /*
  222. * If the previous opcode was a conditional, this opcode
  223. * must be the beginning of the associated predicate.
  224. * Save this knowledge in the current scope descriptor
  225. */
  226. if ((walk_state->control_state) &&
  227. (walk_state->control_state->common.state ==
  228. ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
  229. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  230. "Exec predicate Op=%p State=%p\n",
  231. op, walk_state));
  232. walk_state->control_state->common.state =
  233. ACPI_CONTROL_PREDICATE_EXECUTING;
  234. /* Save start of predicate */
  235. walk_state->control_state->control.predicate_op = op;
  236. }
  237. opcode_class = walk_state->op_info->class;
  238. /* We want to send namepaths to the load code */
  239. if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
  240. opcode_class = AML_CLASS_NAMED_OBJECT;
  241. }
  242. /*
  243. * Handle the opcode based upon the opcode type
  244. */
  245. switch (opcode_class) {
  246. case AML_CLASS_CONTROL:
  247. status = acpi_ds_exec_begin_control_op(walk_state, op);
  248. break;
  249. case AML_CLASS_NAMED_OBJECT:
  250. if (walk_state->walk_type & ACPI_WALK_METHOD) {
  251. /*
  252. * Found a named object declaration during method execution;
  253. * we must enter this object into the namespace. The created
  254. * object is temporary and will be deleted upon completion of
  255. * the execution of this method.
  256. *
  257. * Note 10/2010: Except for the Scope() op. This opcode does
  258. * not actually create a new object, it refers to an existing
  259. * object. However, for Scope(), we want to indeed open a
  260. * new scope.
  261. */
  262. if (op->common.aml_opcode != AML_SCOPE_OP) {
  263. status =
  264. acpi_ds_load2_begin_op(walk_state, NULL);
  265. } else {
  266. status =
  267. acpi_ds_scope_stack_push(op->named.node,
  268. op->named.node->
  269. type, walk_state);
  270. if (ACPI_FAILURE(status)) {
  271. return_ACPI_STATUS(status);
  272. }
  273. }
  274. }
  275. break;
  276. case AML_CLASS_EXECUTE:
  277. case AML_CLASS_CREATE:
  278. break;
  279. default:
  280. break;
  281. }
  282. /* Nothing to do here during method execution */
  283. return_ACPI_STATUS(status);
  284. error_exit:
  285. status = acpi_ds_method_error(status, walk_state);
  286. return_ACPI_STATUS(status);
  287. }
  288. /*****************************************************************************
  289. *
  290. * FUNCTION: acpi_ds_exec_end_op
  291. *
  292. * PARAMETERS: walk_state - Current state of the parse tree walk
  293. *
  294. * RETURN: Status
  295. *
  296. * DESCRIPTION: Ascending callback used during the execution of control
  297. * methods. The only thing we really need to do here is to
  298. * notice the beginning of IF, ELSE, and WHILE blocks.
  299. *
  300. ****************************************************************************/
  301. acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
  302. {
  303. union acpi_parse_object *op;
  304. acpi_status status = AE_OK;
  305. u32 op_type;
  306. u32 op_class;
  307. union acpi_parse_object *next_op;
  308. union acpi_parse_object *first_arg;
  309. ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state);
  310. op = walk_state->op;
  311. op_type = walk_state->op_info->type;
  312. op_class = walk_state->op_info->class;
  313. if (op_class == AML_CLASS_UNKNOWN) {
  314. ACPI_ERROR((AE_INFO, "Unknown opcode 0x%X",
  315. op->common.aml_opcode));
  316. return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
  317. }
  318. first_arg = op->common.value.arg;
  319. /* Init the walk state */
  320. walk_state->num_operands = 0;
  321. walk_state->operand_index = 0;
  322. walk_state->return_desc = NULL;
  323. walk_state->result_obj = NULL;
  324. /* Call debugger for single step support (DEBUG build only) */
  325. status = acpi_db_single_step(walk_state, op, op_class);
  326. if (ACPI_FAILURE(status)) {
  327. return_ACPI_STATUS(status);
  328. }
  329. /* Decode the Opcode Class */
  330. switch (op_class) {
  331. case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
  332. if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
  333. status = acpi_ds_evaluate_name_path(walk_state);
  334. if (ACPI_FAILURE(status)) {
  335. goto cleanup;
  336. }
  337. }
  338. break;
  339. case AML_CLASS_EXECUTE: /* Most operators with arguments */
  340. /* Build resolved operand stack */
  341. status = acpi_ds_create_operands(walk_state, first_arg);
  342. if (ACPI_FAILURE(status)) {
  343. goto cleanup;
  344. }
  345. /*
  346. * All opcodes require operand resolution, with the only exceptions
  347. * being the object_type and size_of operators.
  348. */
  349. if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
  350. /* Resolve all operands */
  351. status = acpi_ex_resolve_operands(walk_state->opcode,
  352. &(walk_state->
  353. operands
  354. [walk_state->
  355. num_operands - 1]),
  356. walk_state);
  357. }
  358. if (ACPI_SUCCESS(status)) {
  359. /*
  360. * Dispatch the request to the appropriate interpreter handler
  361. * routine. There is one routine per opcode "type" based upon the
  362. * number of opcode arguments and return type.
  363. */
  364. status =
  365. acpi_gbl_op_type_dispatch[op_type] (walk_state);
  366. } else {
  367. /*
  368. * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
  369. * Local is uninitialized.
  370. */
  371. if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
  372. (walk_state->opcode == AML_STORE_OP) &&
  373. (walk_state->operands[0]->common.type ==
  374. ACPI_TYPE_LOCAL_REFERENCE)
  375. && (walk_state->operands[1]->common.type ==
  376. ACPI_TYPE_LOCAL_REFERENCE)
  377. && (walk_state->operands[0]->reference.class ==
  378. walk_state->operands[1]->reference.class)
  379. && (walk_state->operands[0]->reference.value ==
  380. walk_state->operands[1]->reference.value)) {
  381. status = AE_OK;
  382. } else {
  383. ACPI_EXCEPTION((AE_INFO, status,
  384. "While resolving operands for [%s]",
  385. acpi_ps_get_opcode_name
  386. (walk_state->opcode)));
  387. }
  388. }
  389. /* Always delete the argument objects and clear the operand stack */
  390. acpi_ds_clear_operands(walk_state);
  391. /*
  392. * If a result object was returned from above, push it on the
  393. * current result stack
  394. */
  395. if (ACPI_SUCCESS(status) && walk_state->result_obj) {
  396. status =
  397. acpi_ds_result_push(walk_state->result_obj,
  398. walk_state);
  399. }
  400. break;
  401. default:
  402. switch (op_type) {
  403. case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
  404. /* 1 Operand, 0 external_result, 0 internal_result */
  405. status = acpi_ds_exec_end_control_op(walk_state, op);
  406. break;
  407. case AML_TYPE_METHOD_CALL:
  408. /*
  409. * If the method is referenced from within a package
  410. * declaration, it is not a invocation of the method, just
  411. * a reference to it.
  412. */
  413. if ((op->asl.parent) &&
  414. ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
  415. || (op->asl.parent->asl.aml_opcode ==
  416. AML_VAR_PACKAGE_OP))) {
  417. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  418. "Method Reference in a Package, Op=%p\n",
  419. op));
  420. op->common.node = (struct acpi_namespace_node *)
  421. op->asl.value.arg->asl.node;
  422. acpi_ut_add_reference(op->asl.value.arg->asl.
  423. node->object);
  424. return_ACPI_STATUS(AE_OK);
  425. }
  426. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  427. "Method invocation, Op=%p\n", op));
  428. /*
  429. * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
  430. * the method Node pointer
  431. */
  432. /* next_op points to the op that holds the method name */
  433. next_op = first_arg;
  434. /* next_op points to first argument op */
  435. next_op = next_op->common.next;
  436. /*
  437. * Get the method's arguments and put them on the operand stack
  438. */
  439. status = acpi_ds_create_operands(walk_state, next_op);
  440. if (ACPI_FAILURE(status)) {
  441. break;
  442. }
  443. /*
  444. * Since the operands will be passed to another control method,
  445. * we must resolve all local references here (Local variables,
  446. * arguments to *this* method, etc.)
  447. */
  448. status = acpi_ds_resolve_operands(walk_state);
  449. if (ACPI_FAILURE(status)) {
  450. /* On error, clear all resolved operands */
  451. acpi_ds_clear_operands(walk_state);
  452. break;
  453. }
  454. /*
  455. * Tell the walk loop to preempt this running method and
  456. * execute the new method
  457. */
  458. status = AE_CTRL_TRANSFER;
  459. /*
  460. * Return now; we don't want to disturb anything,
  461. * especially the operand count!
  462. */
  463. return_ACPI_STATUS(status);
  464. case AML_TYPE_CREATE_FIELD:
  465. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  466. "Executing CreateField Buffer/Index Op=%p\n",
  467. op));
  468. status = acpi_ds_load2_end_op(walk_state);
  469. if (ACPI_FAILURE(status)) {
  470. break;
  471. }
  472. status =
  473. acpi_ds_eval_buffer_field_operands(walk_state, op);
  474. break;
  475. case AML_TYPE_CREATE_OBJECT:
  476. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  477. "Executing CreateObject (Buffer/Package) Op=%p\n",
  478. op));
  479. switch (op->common.parent->common.aml_opcode) {
  480. case AML_NAME_OP:
  481. /*
  482. * Put the Node on the object stack (Contains the ACPI Name
  483. * of this object)
  484. */
  485. walk_state->operands[0] = (void *)
  486. op->common.parent->common.node;
  487. walk_state->num_operands = 1;
  488. status = acpi_ds_create_node(walk_state,
  489. op->common.parent->
  490. common.node,
  491. op->common.parent);
  492. if (ACPI_FAILURE(status)) {
  493. break;
  494. }
  495. /* Fall through */
  496. /*lint -fallthrough */
  497. case AML_INT_EVAL_SUBTREE_OP:
  498. status =
  499. acpi_ds_eval_data_object_operands
  500. (walk_state, op,
  501. acpi_ns_get_attached_object(op->common.
  502. parent->common.
  503. node));
  504. break;
  505. default:
  506. status =
  507. acpi_ds_eval_data_object_operands
  508. (walk_state, op, NULL);
  509. break;
  510. }
  511. /*
  512. * If a result object was returned from above, push it on the
  513. * current result stack
  514. */
  515. if (walk_state->result_obj) {
  516. status =
  517. acpi_ds_result_push(walk_state->result_obj,
  518. walk_state);
  519. }
  520. break;
  521. case AML_TYPE_NAMED_FIELD:
  522. case AML_TYPE_NAMED_COMPLEX:
  523. case AML_TYPE_NAMED_SIMPLE:
  524. case AML_TYPE_NAMED_NO_OBJ:
  525. status = acpi_ds_load2_end_op(walk_state);
  526. if (ACPI_FAILURE(status)) {
  527. break;
  528. }
  529. if (op->common.aml_opcode == AML_REGION_OP) {
  530. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  531. "Executing OpRegion Address/Length Op=%p\n",
  532. op));
  533. status =
  534. acpi_ds_eval_region_operands(walk_state,
  535. op);
  536. if (ACPI_FAILURE(status)) {
  537. break;
  538. }
  539. } else if (op->common.aml_opcode == AML_DATA_REGION_OP) {
  540. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  541. "Executing DataTableRegion Strings Op=%p\n",
  542. op));
  543. status =
  544. acpi_ds_eval_table_region_operands
  545. (walk_state, op);
  546. if (ACPI_FAILURE(status)) {
  547. break;
  548. }
  549. } else if (op->common.aml_opcode == AML_BANK_FIELD_OP) {
  550. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  551. "Executing BankField Op=%p\n",
  552. op));
  553. status =
  554. acpi_ds_eval_bank_field_operands(walk_state,
  555. op);
  556. if (ACPI_FAILURE(status)) {
  557. break;
  558. }
  559. }
  560. break;
  561. case AML_TYPE_UNDEFINED:
  562. ACPI_ERROR((AE_INFO,
  563. "Undefined opcode type Op=%p", op));
  564. return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
  565. case AML_TYPE_BOGUS:
  566. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  567. "Internal opcode=%X type Op=%p\n",
  568. walk_state->opcode, op));
  569. break;
  570. default:
  571. ACPI_ERROR((AE_INFO,
  572. "Unimplemented opcode, class=0x%X "
  573. "type=0x%X Opcode=0x%X Op=%p",
  574. op_class, op_type, op->common.aml_opcode,
  575. op));
  576. status = AE_NOT_IMPLEMENTED;
  577. break;
  578. }
  579. }
  580. /*
  581. * ACPI 2.0 support for 64-bit integers: Truncate numeric
  582. * result value if we are executing from a 32-bit ACPI table
  583. */
  584. (void)acpi_ex_truncate_for32bit_table(walk_state->result_obj);
  585. /*
  586. * Check if we just completed the evaluation of a
  587. * conditional predicate
  588. */
  589. if ((ACPI_SUCCESS(status)) &&
  590. (walk_state->control_state) &&
  591. (walk_state->control_state->common.state ==
  592. ACPI_CONTROL_PREDICATE_EXECUTING) &&
  593. (walk_state->control_state->control.predicate_op == op)) {
  594. status =
  595. acpi_ds_get_predicate_value(walk_state,
  596. walk_state->result_obj);
  597. walk_state->result_obj = NULL;
  598. }
  599. cleanup:
  600. if (walk_state->result_obj) {
  601. /* Break to debugger to display result */
  602. acpi_db_display_result_object(walk_state->result_obj,
  603. walk_state);
  604. /*
  605. * Delete the result op if and only if:
  606. * Parent will not use the result -- such as any
  607. * non-nested type2 op in a method (parent will be method)
  608. */
  609. acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
  610. walk_state);
  611. }
  612. #ifdef _UNDER_DEVELOPMENT
  613. if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
  614. acpi_db_method_end(walk_state);
  615. }
  616. #endif
  617. /* Invoke exception handler on error */
  618. if (ACPI_FAILURE(status)) {
  619. status = acpi_ds_method_error(status, walk_state);
  620. }
  621. /* Always clear the object stack */
  622. walk_state->num_operands = 0;
  623. return_ACPI_STATUS(status);
  624. }