dswexec.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. /******************************************************************************
  2. *
  3. * Module Name: dswexec - Dispatcher method execution callbacks;
  4. * dispatch to interpreter.
  5. *
  6. *****************************************************************************/
  7. /*
  8. * Copyright (C) 2000 - 2005, R. Byron Moore
  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 <acpi/acparser.h>
  45. #include <acpi/amlcode.h>
  46. #include <acpi/acdispat.h>
  47. #include <acpi/acinterp.h>
  48. #include <acpi/acnamesp.h>
  49. #include <acpi/acdebug.h>
  50. #include <acpi/acdisasm.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_DEBUG_PRINT((ACPI_DB_ERROR,
  95. "Could not get result from predicate evaluation, %s\n",
  96. acpi_format_exception(status)));
  97. return_ACPI_STATUS(status);
  98. }
  99. } else {
  100. status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
  101. if (ACPI_FAILURE(status)) {
  102. return_ACPI_STATUS(status);
  103. }
  104. status =
  105. acpi_ex_resolve_to_value(&walk_state->operands[0],
  106. walk_state);
  107. if (ACPI_FAILURE(status)) {
  108. return_ACPI_STATUS(status);
  109. }
  110. obj_desc = walk_state->operands[0];
  111. }
  112. if (!obj_desc) {
  113. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  114. "No predicate obj_desc=%p State=%p\n",
  115. obj_desc, walk_state));
  116. return_ACPI_STATUS(AE_AML_NO_OPERAND);
  117. }
  118. /*
  119. * Result of predicate evaluation must be an Integer
  120. * object. Implicitly convert the argument if necessary.
  121. */
  122. status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16);
  123. if (ACPI_FAILURE(status)) {
  124. goto cleanup;
  125. }
  126. if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
  127. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  128. "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
  129. obj_desc, walk_state,
  130. ACPI_GET_OBJECT_TYPE(obj_desc)));
  131. status = AE_AML_OPERAND_TYPE;
  132. goto cleanup;
  133. }
  134. /* Truncate the predicate to 32-bits if necessary */
  135. acpi_ex_truncate_for32bit_table(local_obj_desc);
  136. /*
  137. * Save the result of the predicate evaluation on
  138. * the control stack
  139. */
  140. if (local_obj_desc->integer.value) {
  141. walk_state->control_state->common.value = TRUE;
  142. } else {
  143. /*
  144. * Predicate is FALSE, we will just toss the
  145. * rest of the package
  146. */
  147. walk_state->control_state->common.value = FALSE;
  148. status = AE_CTRL_FALSE;
  149. }
  150. cleanup:
  151. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
  152. walk_state->control_state->common.value,
  153. walk_state->op));
  154. /* Break to debugger to display result */
  155. ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
  156. (local_obj_desc, walk_state));
  157. /*
  158. * Delete the predicate result object (we know that
  159. * we don't need it anymore)
  160. */
  161. if (local_obj_desc != obj_desc) {
  162. acpi_ut_remove_reference(local_obj_desc);
  163. }
  164. acpi_ut_remove_reference(obj_desc);
  165. walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
  166. return_ACPI_STATUS(status);
  167. }
  168. /*****************************************************************************
  169. *
  170. * FUNCTION: acpi_ds_exec_begin_op
  171. *
  172. * PARAMETERS: walk_state - Current state of the parse tree walk
  173. * out_op - Where to return op if a new one is created
  174. *
  175. * RETURN: Status
  176. *
  177. * DESCRIPTION: Descending callback used during the execution of control
  178. * methods. This is where most operators and operands are
  179. * dispatched to the interpreter.
  180. *
  181. ****************************************************************************/
  182. acpi_status
  183. acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
  184. union acpi_parse_object **out_op)
  185. {
  186. union acpi_parse_object *op;
  187. acpi_status status = AE_OK;
  188. u32 opcode_class;
  189. ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
  190. op = walk_state->op;
  191. if (!op) {
  192. status = acpi_ds_load2_begin_op(walk_state, out_op);
  193. if (ACPI_FAILURE(status)) {
  194. return_ACPI_STATUS(status);
  195. }
  196. op = *out_op;
  197. walk_state->op = op;
  198. walk_state->opcode = op->common.aml_opcode;
  199. walk_state->op_info =
  200. acpi_ps_get_opcode_info(op->common.aml_opcode);
  201. if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
  202. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  203. "(%s) Popping scope for Op %p\n",
  204. acpi_ut_get_type_name(walk_state->
  205. op_info->
  206. object_type),
  207. op));
  208. status = acpi_ds_scope_stack_pop(walk_state);
  209. if (ACPI_FAILURE(status)) {
  210. return_ACPI_STATUS(status);
  211. }
  212. }
  213. }
  214. if (op == walk_state->origin) {
  215. if (out_op) {
  216. *out_op = op;
  217. }
  218. return_ACPI_STATUS(AE_OK);
  219. }
  220. /*
  221. * If the previous opcode was a conditional, this opcode
  222. * must be the beginning of the associated predicate.
  223. * Save this knowledge in the current scope descriptor
  224. */
  225. if ((walk_state->control_state) &&
  226. (walk_state->control_state->common.state ==
  227. ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
  228. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  229. "Exec predicate Op=%p State=%p\n", op,
  230. walk_state));
  231. walk_state->control_state->common.state =
  232. ACPI_CONTROL_PREDICATE_EXECUTING;
  233. /* Save start of predicate */
  234. walk_state->control_state->control.predicate_op = op;
  235. }
  236. opcode_class = walk_state->op_info->class;
  237. /* We want to send namepaths to the load code */
  238. if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
  239. opcode_class = AML_CLASS_NAMED_OBJECT;
  240. }
  241. /*
  242. * Handle the opcode based upon the opcode type
  243. */
  244. switch (opcode_class) {
  245. case AML_CLASS_CONTROL:
  246. status = acpi_ds_result_stack_push(walk_state);
  247. if (ACPI_FAILURE(status)) {
  248. return_ACPI_STATUS(status);
  249. }
  250. status = acpi_ds_exec_begin_control_op(walk_state, op);
  251. break;
  252. case AML_CLASS_NAMED_OBJECT:
  253. if (walk_state->walk_type == ACPI_WALK_METHOD) {
  254. /*
  255. * Found a named object declaration during method execution;
  256. * we must enter this object into the namespace. The created
  257. * object is temporary and will be deleted upon completion of
  258. * the execution of this method.
  259. */
  260. status = acpi_ds_load2_begin_op(walk_state, NULL);
  261. }
  262. if (op->common.aml_opcode == AML_REGION_OP) {
  263. status = acpi_ds_result_stack_push(walk_state);
  264. }
  265. break;
  266. case AML_CLASS_EXECUTE:
  267. case AML_CLASS_CREATE:
  268. /*
  269. * Most operators with arguments.
  270. * Start a new result/operand state
  271. */
  272. status = acpi_ds_result_stack_push(walk_state);
  273. break;
  274. default:
  275. break;
  276. }
  277. /* Nothing to do here during method execution */
  278. return_ACPI_STATUS(status);
  279. }
  280. /*****************************************************************************
  281. *
  282. * FUNCTION: acpi_ds_exec_end_op
  283. *
  284. * PARAMETERS: walk_state - Current state of the parse tree walk
  285. *
  286. * RETURN: Status
  287. *
  288. * DESCRIPTION: Ascending callback used during the execution of control
  289. * methods. The only thing we really need to do here is to
  290. * notice the beginning of IF, ELSE, and WHILE blocks.
  291. *
  292. ****************************************************************************/
  293. acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
  294. {
  295. union acpi_parse_object *op;
  296. acpi_status status = AE_OK;
  297. u32 op_type;
  298. u32 op_class;
  299. union acpi_parse_object *next_op;
  300. union acpi_parse_object *first_arg;
  301. ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
  302. op = walk_state->op;
  303. op_type = walk_state->op_info->type;
  304. op_class = walk_state->op_info->class;
  305. if (op_class == AML_CLASS_UNKNOWN) {
  306. ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
  307. op->common.aml_opcode));
  308. return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
  309. }
  310. first_arg = op->common.value.arg;
  311. /* Init the walk state */
  312. walk_state->num_operands = 0;
  313. walk_state->return_desc = NULL;
  314. walk_state->result_obj = NULL;
  315. /* Call debugger for single step support (DEBUG build only) */
  316. ACPI_DEBUGGER_EXEC(status =
  317. acpi_db_single_step(walk_state, op, op_class));
  318. ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) {
  319. return_ACPI_STATUS(status);}
  320. ) ;
  321. /* Decode the Opcode Class */
  322. switch (op_class) {
  323. case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
  324. break;
  325. case AML_CLASS_EXECUTE: /* most operators with arguments */
  326. /* Build resolved operand stack */
  327. status = acpi_ds_create_operands(walk_state, first_arg);
  328. if (ACPI_FAILURE(status)) {
  329. goto cleanup;
  330. }
  331. /* Done with this result state (Now that operand stack is built) */
  332. status = acpi_ds_result_stack_pop(walk_state);
  333. if (ACPI_FAILURE(status)) {
  334. goto cleanup;
  335. }
  336. /*
  337. * All opcodes require operand resolution, with the only exceptions
  338. * being the object_type and size_of operators.
  339. */
  340. if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
  341. /* Resolve all operands */
  342. status = acpi_ex_resolve_operands(walk_state->opcode,
  343. &(walk_state->
  344. operands
  345. [walk_state->
  346. num_operands - 1]),
  347. walk_state);
  348. if (ACPI_SUCCESS(status)) {
  349. ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
  350. ACPI_IMODE_EXECUTE,
  351. acpi_ps_get_opcode_name
  352. (walk_state->opcode),
  353. walk_state->num_operands,
  354. "after ex_resolve_operands");
  355. }
  356. }
  357. if (ACPI_SUCCESS(status)) {
  358. /*
  359. * Dispatch the request to the appropriate interpreter handler
  360. * routine. There is one routine per opcode "type" based upon the
  361. * number of opcode arguments and return type.
  362. */
  363. status =
  364. acpi_gbl_op_type_dispatch[op_type] (walk_state);
  365. } else {
  366. /*
  367. * Treat constructs of the form "Store(local_x,local_x)" as noops when the
  368. * Local is uninitialized.
  369. */
  370. if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
  371. (walk_state->opcode == AML_STORE_OP) &&
  372. (walk_state->operands[0]->common.type ==
  373. ACPI_TYPE_LOCAL_REFERENCE)
  374. && (walk_state->operands[1]->common.type ==
  375. ACPI_TYPE_LOCAL_REFERENCE)
  376. && (walk_state->operands[0]->reference.opcode ==
  377. walk_state->operands[1]->reference.opcode)
  378. && (walk_state->operands[0]->reference.offset ==
  379. walk_state->operands[1]->reference.offset)) {
  380. status = AE_OK;
  381. } else {
  382. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  383. "[%s]: Could not resolve operands, %s\n",
  384. acpi_ps_get_opcode_name
  385. (walk_state->opcode),
  386. acpi_format_exception
  387. (status)));
  388. }
  389. }
  390. /* Always delete the argument objects and clear the operand stack */
  391. acpi_ds_clear_operands(walk_state);
  392. /*
  393. * If a result object was returned from above, push it on the
  394. * current result stack
  395. */
  396. if (ACPI_SUCCESS(status) && walk_state->result_obj) {
  397. status =
  398. acpi_ds_result_push(walk_state->result_obj,
  399. walk_state);
  400. }
  401. break;
  402. default:
  403. switch (op_type) {
  404. case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
  405. /* 1 Operand, 0 external_result, 0 internal_result */
  406. status = acpi_ds_exec_end_control_op(walk_state, op);
  407. /* Make sure to properly pop the result stack */
  408. if (ACPI_SUCCESS(status)) {
  409. status = acpi_ds_result_stack_pop(walk_state);
  410. } else if (status == AE_CTRL_PENDING) {
  411. status = acpi_ds_result_stack_pop(walk_state);
  412. if (ACPI_SUCCESS(status)) {
  413. status = AE_CTRL_PENDING;
  414. }
  415. }
  416. break;
  417. case AML_TYPE_METHOD_CALL:
  418. /*
  419. * If the method is referenced from within a package
  420. * declaration, it is not a invocation of the method, just
  421. * a reference to it.
  422. */
  423. if ((op->asl.parent) &&
  424. ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
  425. || (op->asl.parent->asl.aml_opcode ==
  426. AML_VAR_PACKAGE_OP))) {
  427. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  428. "Method Reference in a Package, Op=%p\n",
  429. op));
  430. op->common.node =
  431. (struct acpi_namespace_node *)op->asl.value.
  432. arg->asl.node->object;
  433. acpi_ut_add_reference(op->asl.value.arg->asl.
  434. node->object);
  435. return_ACPI_STATUS(AE_OK);
  436. }
  437. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  438. "Method invocation, Op=%p\n", op));
  439. /*
  440. * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
  441. * the method Node pointer
  442. */
  443. /* next_op points to the op that holds the method name */
  444. next_op = first_arg;
  445. /* next_op points to first argument op */
  446. next_op = next_op->common.next;
  447. /*
  448. * Get the method's arguments and put them on the operand stack
  449. */
  450. status = acpi_ds_create_operands(walk_state, next_op);
  451. if (ACPI_FAILURE(status)) {
  452. break;
  453. }
  454. /*
  455. * Since the operands will be passed to another control method,
  456. * we must resolve all local references here (Local variables,
  457. * arguments to *this* method, etc.)
  458. */
  459. status = acpi_ds_resolve_operands(walk_state);
  460. if (ACPI_FAILURE(status)) {
  461. /* On error, clear all resolved operands */
  462. acpi_ds_clear_operands(walk_state);
  463. break;
  464. }
  465. /*
  466. * Tell the walk loop to preempt this running method and
  467. * execute the new method
  468. */
  469. status = AE_CTRL_TRANSFER;
  470. /*
  471. * Return now; we don't want to disturb anything,
  472. * especially the operand count!
  473. */
  474. return_ACPI_STATUS(status);
  475. case AML_TYPE_CREATE_FIELD:
  476. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  477. "Executing create_field Buffer/Index Op=%p\n",
  478. op));
  479. status = acpi_ds_load2_end_op(walk_state);
  480. if (ACPI_FAILURE(status)) {
  481. break;
  482. }
  483. status =
  484. acpi_ds_eval_buffer_field_operands(walk_state, op);
  485. break;
  486. case AML_TYPE_CREATE_OBJECT:
  487. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  488. "Executing create_object (Buffer/Package) Op=%p\n",
  489. op));
  490. switch (op->common.parent->common.aml_opcode) {
  491. case AML_NAME_OP:
  492. /*
  493. * Put the Node on the object stack (Contains the ACPI Name
  494. * of this object)
  495. */
  496. walk_state->operands[0] =
  497. (void *)op->common.parent->common.node;
  498. walk_state->num_operands = 1;
  499. status = acpi_ds_create_node(walk_state,
  500. op->common.parent->
  501. common.node,
  502. op->common.parent);
  503. if (ACPI_FAILURE(status)) {
  504. break;
  505. }
  506. /* Fall through */
  507. /*lint -fallthrough */
  508. case AML_INT_EVAL_SUBTREE_OP:
  509. status =
  510. acpi_ds_eval_data_object_operands
  511. (walk_state, op,
  512. acpi_ns_get_attached_object(op->common.
  513. parent->common.
  514. node));
  515. break;
  516. default:
  517. status =
  518. acpi_ds_eval_data_object_operands
  519. (walk_state, op, NULL);
  520. break;
  521. }
  522. /* Done with result state (Now that operand stack is built) */
  523. status = acpi_ds_result_stack_pop(walk_state);
  524. if (ACPI_FAILURE(status)) {
  525. goto cleanup;
  526. }
  527. /*
  528. * If a result object was returned from above, push it on the
  529. * current result stack
  530. */
  531. if (walk_state->result_obj) {
  532. status =
  533. acpi_ds_result_push(walk_state->result_obj,
  534. walk_state);
  535. }
  536. break;
  537. case AML_TYPE_NAMED_FIELD:
  538. case AML_TYPE_NAMED_COMPLEX:
  539. case AML_TYPE_NAMED_SIMPLE:
  540. case AML_TYPE_NAMED_NO_OBJ:
  541. status = acpi_ds_load2_end_op(walk_state);
  542. if (ACPI_FAILURE(status)) {
  543. break;
  544. }
  545. if (op->common.aml_opcode == AML_REGION_OP) {
  546. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  547. "Executing op_region Address/Length Op=%p\n",
  548. op));
  549. status =
  550. acpi_ds_eval_region_operands(walk_state,
  551. op);
  552. if (ACPI_FAILURE(status)) {
  553. break;
  554. }
  555. status = acpi_ds_result_stack_pop(walk_state);
  556. }
  557. break;
  558. case AML_TYPE_UNDEFINED:
  559. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  560. "Undefined opcode type Op=%p\n", op));
  561. return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
  562. case AML_TYPE_BOGUS:
  563. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  564. "Internal opcode=%X type Op=%p\n",
  565. walk_state->opcode, op));
  566. break;
  567. default:
  568. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  569. "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
  570. op_class, op_type,
  571. op->common.aml_opcode, op));
  572. status = AE_NOT_IMPLEMENTED;
  573. break;
  574. }
  575. }
  576. /*
  577. * ACPI 2.0 support for 64-bit integers: Truncate numeric
  578. * result value if we are executing from a 32-bit ACPI table
  579. */
  580. acpi_ex_truncate_for32bit_table(walk_state->result_obj);
  581. /*
  582. * Check if we just completed the evaluation of a
  583. * conditional predicate
  584. */
  585. if ((ACPI_SUCCESS(status)) &&
  586. (walk_state->control_state) &&
  587. (walk_state->control_state->common.state ==
  588. ACPI_CONTROL_PREDICATE_EXECUTING) &&
  589. (walk_state->control_state->control.predicate_op == op)) {
  590. status =
  591. acpi_ds_get_predicate_value(walk_state,
  592. walk_state->result_obj);
  593. walk_state->result_obj = NULL;
  594. }
  595. cleanup:
  596. /* Invoke exception handler on error */
  597. if (ACPI_FAILURE(status) &&
  598. acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
  599. acpi_ex_exit_interpreter();
  600. status = acpi_gbl_exception_handler(status,
  601. walk_state->method_node->
  602. name.integer,
  603. walk_state->opcode,
  604. walk_state->aml_offset,
  605. NULL);
  606. (void)acpi_ex_enter_interpreter();
  607. }
  608. if (walk_state->result_obj) {
  609. /* Break to debugger to display result */
  610. ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
  611. (walk_state->result_obj, walk_state));
  612. /*
  613. * Delete the result op if and only if:
  614. * Parent will not use the result -- such as any
  615. * non-nested type2 op in a method (parent will be method)
  616. */
  617. acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
  618. walk_state);
  619. }
  620. #ifdef _UNDER_DEVELOPMENT
  621. if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
  622. acpi_db_method_end(walk_state);
  623. }
  624. #endif
  625. /* Always clear the object stack */
  626. walk_state->num_operands = 0;
  627. #ifdef ACPI_DISASSEMBLER
  628. /* On error, display method locals/args */
  629. if (ACPI_FAILURE(status)) {
  630. acpi_dm_dump_method_info(status, walk_state, op);
  631. }
  632. #endif
  633. return_ACPI_STATUS(status);
  634. }