psloop.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /******************************************************************************
  3. *
  4. * Module Name: psloop - Main AML parse loop
  5. *
  6. * Copyright (C) 2000 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. /*
  10. * Parse the AML and build an operation tree as most interpreters, (such as
  11. * Perl) do. Parsing is done by hand rather than with a YACC generated parser
  12. * to tightly constrain stack and dynamic memory usage. Parsing is kept
  13. * flexible and the code fairly compact by parsing based on a list of AML
  14. * opcode templates in aml_op_info[].
  15. */
  16. #include <acpi/acpi.h>
  17. #include "accommon.h"
  18. #include "acinterp.h"
  19. #include "acparser.h"
  20. #include "acdispat.h"
  21. #include "amlcode.h"
  22. #include "acconvert.h"
  23. #include "acnamesp.h"
  24. #define _COMPONENT ACPI_PARSER
  25. ACPI_MODULE_NAME("psloop")
  26. /* Local prototypes */
  27. static acpi_status
  28. acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
  29. u8 * aml_op_start, union acpi_parse_object *op);
  30. static void
  31. acpi_ps_link_module_code(union acpi_parse_object *parent_op,
  32. u8 *aml_start, u32 aml_length, acpi_owner_id owner_id);
  33. /*******************************************************************************
  34. *
  35. * FUNCTION: acpi_ps_get_arguments
  36. *
  37. * PARAMETERS: walk_state - Current state
  38. * aml_op_start - Op start in AML
  39. * op - Current Op
  40. *
  41. * RETURN: Status
  42. *
  43. * DESCRIPTION: Get arguments for passed Op.
  44. *
  45. ******************************************************************************/
  46. static acpi_status
  47. acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
  48. u8 * aml_op_start, union acpi_parse_object *op)
  49. {
  50. acpi_status status = AE_OK;
  51. union acpi_parse_object *arg = NULL;
  52. const struct acpi_opcode_info *op_info;
  53. ACPI_FUNCTION_TRACE_PTR(ps_get_arguments, walk_state);
  54. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  55. "Get arguments for opcode [%s]\n",
  56. op->common.aml_op_name));
  57. switch (op->common.aml_opcode) {
  58. case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
  59. case AML_WORD_OP: /* AML_WORDDATA_ARG */
  60. case AML_DWORD_OP: /* AML_DWORDATA_ARG */
  61. case AML_QWORD_OP: /* AML_QWORDATA_ARG */
  62. case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
  63. /* Fill in constant or string argument directly */
  64. acpi_ps_get_next_simple_arg(&(walk_state->parser_state),
  65. GET_CURRENT_ARG_TYPE(walk_state->
  66. arg_types),
  67. op);
  68. break;
  69. case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
  70. status = acpi_ps_get_next_namepath(walk_state,
  71. &(walk_state->parser_state),
  72. op,
  73. ACPI_POSSIBLE_METHOD_CALL);
  74. if (ACPI_FAILURE(status)) {
  75. return_ACPI_STATUS(status);
  76. }
  77. walk_state->arg_types = 0;
  78. break;
  79. default:
  80. /*
  81. * Op is not a constant or string, append each argument to the Op
  82. */
  83. while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) &&
  84. !walk_state->arg_count) {
  85. walk_state->aml = walk_state->parser_state.aml;
  86. switch (op->common.aml_opcode) {
  87. case AML_METHOD_OP:
  88. case AML_BUFFER_OP:
  89. case AML_PACKAGE_OP:
  90. case AML_VARIABLE_PACKAGE_OP:
  91. case AML_WHILE_OP:
  92. break;
  93. default:
  94. ASL_CV_CAPTURE_COMMENTS(walk_state);
  95. break;
  96. }
  97. status =
  98. acpi_ps_get_next_arg(walk_state,
  99. &(walk_state->parser_state),
  100. GET_CURRENT_ARG_TYPE
  101. (walk_state->arg_types), &arg);
  102. if (ACPI_FAILURE(status)) {
  103. return_ACPI_STATUS(status);
  104. }
  105. if (arg) {
  106. acpi_ps_append_arg(op, arg);
  107. }
  108. INCREMENT_ARG_LIST(walk_state->arg_types);
  109. }
  110. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  111. "Final argument count: %8.8X pass %u\n",
  112. walk_state->arg_count,
  113. walk_state->pass_number));
  114. /*
  115. * This case handles the legacy option that groups all module-level
  116. * code blocks together and defers execution until all of the tables
  117. * are loaded. Execute all of these blocks at this time.
  118. * Execute any module-level code that was detected during the table
  119. * load phase.
  120. *
  121. * Note: this option is deprecated and will be eliminated in the
  122. * future. Use of this option can cause problems with AML code that
  123. * depends upon in-order immediate execution of module-level code.
  124. */
  125. if (acpi_gbl_group_module_level_code &&
  126. (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2) &&
  127. ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
  128. /*
  129. * We want to skip If/Else/While constructs during Pass1 because we
  130. * want to actually conditionally execute the code during Pass2.
  131. *
  132. * Except for disassembly, where we always want to walk the
  133. * If/Else/While packages
  134. */
  135. switch (op->common.aml_opcode) {
  136. case AML_IF_OP:
  137. case AML_ELSE_OP:
  138. case AML_WHILE_OP:
  139. /*
  140. * Currently supported module-level opcodes are:
  141. * IF/ELSE/WHILE. These appear to be the most common,
  142. * and easiest to support since they open an AML
  143. * package.
  144. */
  145. if (walk_state->pass_number ==
  146. ACPI_IMODE_LOAD_PASS1) {
  147. acpi_ps_link_module_code(op->common.
  148. parent,
  149. aml_op_start,
  150. (u32)
  151. (walk_state->
  152. parser_state.
  153. pkg_end -
  154. aml_op_start),
  155. walk_state->
  156. owner_id);
  157. }
  158. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  159. "Pass1: Skipping an If/Else/While body\n"));
  160. /* Skip body of if/else/while in pass 1 */
  161. walk_state->parser_state.aml =
  162. walk_state->parser_state.pkg_end;
  163. walk_state->arg_count = 0;
  164. break;
  165. default:
  166. /*
  167. * Check for an unsupported executable opcode at module
  168. * level. We must be in PASS1, the parent must be a SCOPE,
  169. * The opcode class must be EXECUTE, and the opcode must
  170. * not be an argument to another opcode.
  171. */
  172. if ((walk_state->pass_number ==
  173. ACPI_IMODE_LOAD_PASS1)
  174. && (op->common.parent->common.aml_opcode ==
  175. AML_SCOPE_OP)) {
  176. op_info =
  177. acpi_ps_get_opcode_info(op->common.
  178. aml_opcode);
  179. if ((op_info->class ==
  180. AML_CLASS_EXECUTE) && (!arg)) {
  181. ACPI_WARNING((AE_INFO,
  182. "Unsupported module-level executable opcode "
  183. "0x%.2X at table offset 0x%.4X",
  184. op->common.
  185. aml_opcode,
  186. (u32)
  187. (ACPI_PTR_DIFF
  188. (aml_op_start,
  189. walk_state->
  190. parser_state.
  191. aml_start) +
  192. sizeof(struct
  193. acpi_table_header))));
  194. }
  195. }
  196. break;
  197. }
  198. }
  199. /* Special processing for certain opcodes */
  200. switch (op->common.aml_opcode) {
  201. case AML_METHOD_OP:
  202. /*
  203. * Skip parsing of control method because we don't have enough
  204. * info in the first pass to parse it correctly.
  205. *
  206. * Save the length and address of the body
  207. */
  208. op->named.data = walk_state->parser_state.aml;
  209. op->named.length = (u32)
  210. (walk_state->parser_state.pkg_end -
  211. walk_state->parser_state.aml);
  212. /* Skip body of method */
  213. walk_state->parser_state.aml =
  214. walk_state->parser_state.pkg_end;
  215. walk_state->arg_count = 0;
  216. break;
  217. case AML_BUFFER_OP:
  218. case AML_PACKAGE_OP:
  219. case AML_VARIABLE_PACKAGE_OP:
  220. if ((op->common.parent) &&
  221. (op->common.parent->common.aml_opcode ==
  222. AML_NAME_OP)
  223. && (walk_state->pass_number <=
  224. ACPI_IMODE_LOAD_PASS2)) {
  225. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  226. "Setup Package/Buffer: Pass %u, AML Ptr: %p\n",
  227. walk_state->pass_number,
  228. aml_op_start));
  229. /*
  230. * Skip parsing of Buffers and Packages because we don't have
  231. * enough info in the first pass to parse them correctly.
  232. */
  233. op->named.data = aml_op_start;
  234. op->named.length = (u32)
  235. (walk_state->parser_state.pkg_end -
  236. aml_op_start);
  237. /* Skip body */
  238. walk_state->parser_state.aml =
  239. walk_state->parser_state.pkg_end;
  240. walk_state->arg_count = 0;
  241. }
  242. break;
  243. case AML_WHILE_OP:
  244. if (walk_state->control_state) {
  245. walk_state->control_state->control.package_end =
  246. walk_state->parser_state.pkg_end;
  247. }
  248. break;
  249. default:
  250. /* No action for all other opcodes */
  251. break;
  252. }
  253. break;
  254. }
  255. return_ACPI_STATUS(AE_OK);
  256. }
  257. /*******************************************************************************
  258. *
  259. * FUNCTION: acpi_ps_link_module_code
  260. *
  261. * PARAMETERS: parent_op - Parent parser op
  262. * aml_start - Pointer to the AML
  263. * aml_length - Length of executable AML
  264. * owner_id - owner_id of module level code
  265. *
  266. * RETURN: None.
  267. *
  268. * DESCRIPTION: Wrap the module-level code with a method object and link the
  269. * object to the global list. Note, the mutex field of the method
  270. * object is used to link multiple module-level code objects.
  271. *
  272. * NOTE: In this legacy option, each block of detected executable AML
  273. * code that is outside of any control method is wrapped with a temporary
  274. * control method object and placed on a global list below.
  275. *
  276. * This function executes the module-level code for all tables only after
  277. * all of the tables have been loaded. It is a legacy option and is
  278. * not compatible with other ACPI implementations. See acpi_ns_load_table.
  279. *
  280. * This function will be removed when the legacy option is removed.
  281. *
  282. ******************************************************************************/
  283. static void
  284. acpi_ps_link_module_code(union acpi_parse_object *parent_op,
  285. u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
  286. {
  287. union acpi_operand_object *prev;
  288. union acpi_operand_object *next;
  289. union acpi_operand_object *method_obj;
  290. struct acpi_namespace_node *parent_node;
  291. ACPI_FUNCTION_TRACE(ps_link_module_code);
  292. /* Get the tail of the list */
  293. prev = next = acpi_gbl_module_code_list;
  294. while (next) {
  295. prev = next;
  296. next = next->method.mutex;
  297. }
  298. /*
  299. * Insert the module level code into the list. Merge it if it is
  300. * adjacent to the previous element.
  301. */
  302. if (!prev ||
  303. ((prev->method.aml_start + prev->method.aml_length) != aml_start)) {
  304. /* Create, initialize, and link a new temporary method object */
  305. method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
  306. if (!method_obj) {
  307. return_VOID;
  308. }
  309. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  310. "Create/Link new code block: %p\n",
  311. method_obj));
  312. if (parent_op->common.node) {
  313. parent_node = parent_op->common.node;
  314. } else {
  315. parent_node = acpi_gbl_root_node;
  316. }
  317. method_obj->method.aml_start = aml_start;
  318. method_obj->method.aml_length = aml_length;
  319. method_obj->method.owner_id = owner_id;
  320. method_obj->method.info_flags |= ACPI_METHOD_MODULE_LEVEL;
  321. /*
  322. * Save the parent node in next_object. This is cheating, but we
  323. * don't want to expand the method object.
  324. */
  325. method_obj->method.next_object =
  326. ACPI_CAST_PTR(union acpi_operand_object, parent_node);
  327. if (!prev) {
  328. acpi_gbl_module_code_list = method_obj;
  329. } else {
  330. prev->method.mutex = method_obj;
  331. }
  332. } else {
  333. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  334. "Appending to existing code block: %p\n",
  335. prev));
  336. prev->method.aml_length += aml_length;
  337. }
  338. return_VOID;
  339. }
  340. /*******************************************************************************
  341. *
  342. * FUNCTION: acpi_ps_parse_loop
  343. *
  344. * PARAMETERS: walk_state - Current state
  345. *
  346. * RETURN: Status
  347. *
  348. * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
  349. * a tree of ops.
  350. *
  351. ******************************************************************************/
  352. acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
  353. {
  354. acpi_status status = AE_OK;
  355. union acpi_parse_object *op = NULL; /* current op */
  356. struct acpi_parse_state *parser_state;
  357. u8 *aml_op_start = NULL;
  358. ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state);
  359. if (walk_state->descending_callback == NULL) {
  360. return_ACPI_STATUS(AE_BAD_PARAMETER);
  361. }
  362. parser_state = &walk_state->parser_state;
  363. walk_state->arg_types = 0;
  364. #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
  365. if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
  366. /* We are restarting a preempted control method */
  367. if (acpi_ps_has_completed_scope(parser_state)) {
  368. /*
  369. * We must check if a predicate to an IF or WHILE statement
  370. * was just completed
  371. */
  372. if ((parser_state->scope->parse_scope.op) &&
  373. ((parser_state->scope->parse_scope.op->common.
  374. aml_opcode == AML_IF_OP)
  375. || (parser_state->scope->parse_scope.op->common.
  376. aml_opcode == AML_WHILE_OP))
  377. && (walk_state->control_state)
  378. && (walk_state->control_state->common.state ==
  379. ACPI_CONTROL_PREDICATE_EXECUTING)) {
  380. /*
  381. * A predicate was just completed, get the value of the
  382. * predicate and branch based on that value
  383. */
  384. walk_state->op = NULL;
  385. status =
  386. acpi_ds_get_predicate_value(walk_state,
  387. ACPI_TO_POINTER
  388. (TRUE));
  389. if (ACPI_FAILURE(status)
  390. && ((status & AE_CODE_MASK) !=
  391. AE_CODE_CONTROL)) {
  392. if (status == AE_AML_NO_RETURN_VALUE) {
  393. ACPI_EXCEPTION((AE_INFO, status,
  394. "Invoked method did not return a value"));
  395. }
  396. ACPI_EXCEPTION((AE_INFO, status,
  397. "GetPredicate Failed"));
  398. return_ACPI_STATUS(status);
  399. }
  400. status =
  401. acpi_ps_next_parse_state(walk_state, op,
  402. status);
  403. }
  404. acpi_ps_pop_scope(parser_state, &op,
  405. &walk_state->arg_types,
  406. &walk_state->arg_count);
  407. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  408. "Popped scope, Op=%p\n", op));
  409. } else if (walk_state->prev_op) {
  410. /* We were in the middle of an op */
  411. op = walk_state->prev_op;
  412. walk_state->arg_types = walk_state->prev_arg_types;
  413. }
  414. }
  415. #endif
  416. /* Iterative parsing loop, while there is more AML to process: */
  417. while ((parser_state->aml < parser_state->aml_end) || (op)) {
  418. ASL_CV_CAPTURE_COMMENTS(walk_state);
  419. aml_op_start = parser_state->aml;
  420. if (!op) {
  421. status =
  422. acpi_ps_create_op(walk_state, aml_op_start, &op);
  423. if (ACPI_FAILURE(status)) {
  424. /*
  425. * ACPI_PARSE_MODULE_LEVEL means that we are loading a table by
  426. * executing it as a control method. However, if we encounter
  427. * an error while loading the table, we need to keep trying to
  428. * load the table rather than aborting the table load. Set the
  429. * status to AE_OK to proceed with the table load.
  430. */
  431. if ((walk_state->
  432. parse_flags & ACPI_PARSE_MODULE_LEVEL)
  433. && status == AE_ALREADY_EXISTS) {
  434. status = AE_OK;
  435. }
  436. if (status == AE_CTRL_PARSE_CONTINUE) {
  437. continue;
  438. }
  439. if (status == AE_CTRL_PARSE_PENDING) {
  440. status = AE_OK;
  441. }
  442. if (status == AE_CTRL_TERMINATE) {
  443. return_ACPI_STATUS(status);
  444. }
  445. status =
  446. acpi_ps_complete_op(walk_state, &op,
  447. status);
  448. if (ACPI_FAILURE(status)) {
  449. return_ACPI_STATUS(status);
  450. }
  451. if (acpi_ns_opens_scope
  452. (acpi_ps_get_opcode_info
  453. (walk_state->opcode)->object_type)) {
  454. /*
  455. * If the scope/device op fails to parse, skip the body of
  456. * the scope op because the parse failure indicates that
  457. * the device may not exist.
  458. */
  459. ACPI_ERROR((AE_INFO,
  460. "Skip parsing opcode %s",
  461. acpi_ps_get_opcode_name
  462. (walk_state->opcode)));
  463. walk_state->parser_state.aml =
  464. walk_state->aml + 1;
  465. walk_state->parser_state.aml =
  466. acpi_ps_get_next_package_end
  467. (&walk_state->parser_state);
  468. walk_state->aml =
  469. walk_state->parser_state.aml;
  470. }
  471. continue;
  472. }
  473. acpi_ex_start_trace_opcode(op, walk_state);
  474. }
  475. /*
  476. * Start arg_count at zero because we don't know if there are
  477. * any args yet
  478. */
  479. walk_state->arg_count = 0;
  480. switch (op->common.aml_opcode) {
  481. case AML_BYTE_OP:
  482. case AML_WORD_OP:
  483. case AML_DWORD_OP:
  484. case AML_QWORD_OP:
  485. break;
  486. default:
  487. ASL_CV_CAPTURE_COMMENTS(walk_state);
  488. break;
  489. }
  490. /* Are there any arguments that must be processed? */
  491. if (walk_state->arg_types) {
  492. /* Get arguments */
  493. status =
  494. acpi_ps_get_arguments(walk_state, aml_op_start, op);
  495. if (ACPI_FAILURE(status)) {
  496. status =
  497. acpi_ps_complete_op(walk_state, &op,
  498. status);
  499. if (ACPI_FAILURE(status)) {
  500. return_ACPI_STATUS(status);
  501. }
  502. if ((walk_state->control_state) &&
  503. ((walk_state->control_state->control.
  504. opcode == AML_IF_OP)
  505. || (walk_state->control_state->control.
  506. opcode == AML_WHILE_OP))) {
  507. /*
  508. * If the if/while op fails to parse, we will skip parsing
  509. * the body of the op.
  510. */
  511. parser_state->aml =
  512. walk_state->control_state->control.
  513. aml_predicate_start + 1;
  514. parser_state->aml =
  515. acpi_ps_get_next_package_end
  516. (parser_state);
  517. walk_state->aml = parser_state->aml;
  518. ACPI_ERROR((AE_INFO,
  519. "Skipping While/If block"));
  520. if (*walk_state->aml == AML_ELSE_OP) {
  521. ACPI_ERROR((AE_INFO,
  522. "Skipping Else block"));
  523. walk_state->parser_state.aml =
  524. walk_state->aml + 1;
  525. walk_state->parser_state.aml =
  526. acpi_ps_get_next_package_end
  527. (parser_state);
  528. walk_state->aml =
  529. parser_state->aml;
  530. }
  531. ACPI_FREE(acpi_ut_pop_generic_state
  532. (&walk_state->control_state));
  533. }
  534. op = NULL;
  535. continue;
  536. }
  537. }
  538. /* Check for arguments that need to be processed */
  539. ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
  540. "Parseloop: argument count: %8.8X\n",
  541. walk_state->arg_count));
  542. if (walk_state->arg_count) {
  543. /*
  544. * There are arguments (complex ones), push Op and
  545. * prepare for argument
  546. */
  547. status = acpi_ps_push_scope(parser_state, op,
  548. walk_state->arg_types,
  549. walk_state->arg_count);
  550. if (ACPI_FAILURE(status)) {
  551. status =
  552. acpi_ps_complete_op(walk_state, &op,
  553. status);
  554. if (ACPI_FAILURE(status)) {
  555. return_ACPI_STATUS(status);
  556. }
  557. continue;
  558. }
  559. op = NULL;
  560. continue;
  561. }
  562. /*
  563. * All arguments have been processed -- Op is complete,
  564. * prepare for next
  565. */
  566. walk_state->op_info =
  567. acpi_ps_get_opcode_info(op->common.aml_opcode);
  568. if (walk_state->op_info->flags & AML_NAMED) {
  569. if (op->common.aml_opcode == AML_REGION_OP ||
  570. op->common.aml_opcode == AML_DATA_REGION_OP) {
  571. /*
  572. * Skip parsing of control method or opregion body,
  573. * because we don't have enough info in the first pass
  574. * to parse them correctly.
  575. *
  576. * Completed parsing an op_region declaration, we now
  577. * know the length.
  578. */
  579. op->named.length =
  580. (u32) (parser_state->aml - op->named.data);
  581. }
  582. }
  583. if (walk_state->op_info->flags & AML_CREATE) {
  584. /*
  585. * Backup to beginning of create_XXXfield declaration (1 for
  586. * Opcode)
  587. *
  588. * body_length is unknown until we parse the body
  589. */
  590. op->named.length =
  591. (u32) (parser_state->aml - op->named.data);
  592. }
  593. if (op->common.aml_opcode == AML_BANK_FIELD_OP) {
  594. /*
  595. * Backup to beginning of bank_field declaration
  596. *
  597. * body_length is unknown until we parse the body
  598. */
  599. op->named.length =
  600. (u32) (parser_state->aml - op->named.data);
  601. }
  602. /* This op complete, notify the dispatcher */
  603. if (walk_state->ascending_callback != NULL) {
  604. walk_state->op = op;
  605. walk_state->opcode = op->common.aml_opcode;
  606. status = walk_state->ascending_callback(walk_state);
  607. status =
  608. acpi_ps_next_parse_state(walk_state, op, status);
  609. if (status == AE_CTRL_PENDING) {
  610. status = AE_OK;
  611. } else
  612. if ((walk_state->
  613. parse_flags & ACPI_PARSE_MODULE_LEVEL)
  614. && (ACPI_AML_EXCEPTION(status)
  615. || status == AE_ALREADY_EXISTS
  616. || status == AE_NOT_FOUND)) {
  617. /*
  618. * ACPI_PARSE_MODULE_LEVEL flag means that we
  619. * are currently loading a table by executing
  620. * it as a control method. However, if we
  621. * encounter an error while loading the table,
  622. * we need to keep trying to load the table
  623. * rather than aborting the table load (setting
  624. * the status to AE_OK continues the table
  625. * load). If we get a failure at this point, it
  626. * means that the dispatcher got an error while
  627. * trying to execute the Op.
  628. */
  629. status = AE_OK;
  630. }
  631. }
  632. status = acpi_ps_complete_op(walk_state, &op, status);
  633. if (ACPI_FAILURE(status)) {
  634. return_ACPI_STATUS(status);
  635. }
  636. } /* while parser_state->Aml */
  637. status = acpi_ps_complete_final_op(walk_state, op, status);
  638. return_ACPI_STATUS(status);
  639. }