psobject.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /******************************************************************************
  3. *
  4. * Module Name: psobject - Support for parse objects
  5. *
  6. * Copyright (C) 2000 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #include <acpi/acpi.h>
  10. #include "accommon.h"
  11. #include "acparser.h"
  12. #include "amlcode.h"
  13. #include "acconvert.h"
  14. #define _COMPONENT ACPI_PARSER
  15. ACPI_MODULE_NAME("psobject")
  16. /* Local prototypes */
  17. static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);
  18. /*******************************************************************************
  19. *
  20. * FUNCTION: acpi_ps_get_aml_opcode
  21. *
  22. * PARAMETERS: walk_state - Current state
  23. *
  24. * RETURN: Status
  25. *
  26. * DESCRIPTION: Extract the next AML opcode from the input stream.
  27. *
  28. ******************************************************************************/
  29. static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
  30. {
  31. ACPI_ERROR_ONLY(u32 aml_offset);
  32. ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);
  33. walk_state->aml = walk_state->parser_state.aml;
  34. walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));
  35. /*
  36. * First cut to determine what we have found:
  37. * 1) A valid AML opcode
  38. * 2) A name string
  39. * 3) An unknown/invalid opcode
  40. */
  41. walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
  42. switch (walk_state->op_info->class) {
  43. case AML_CLASS_ASCII:
  44. case AML_CLASS_PREFIX:
  45. /*
  46. * Starts with a valid prefix or ASCII char, this is a name
  47. * string. Convert the bare name string to a namepath.
  48. */
  49. walk_state->opcode = AML_INT_NAMEPATH_OP;
  50. walk_state->arg_types = ARGP_NAMESTRING;
  51. break;
  52. case AML_CLASS_UNKNOWN:
  53. /* The opcode is unrecognized. Complain and skip unknown opcodes */
  54. if (walk_state->pass_number == 2) {
  55. ACPI_ERROR_ONLY(aml_offset =
  56. (u32)ACPI_PTR_DIFF(walk_state->aml,
  57. walk_state->
  58. parser_state.
  59. aml_start));
  60. ACPI_ERROR((AE_INFO,
  61. "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
  62. walk_state->opcode,
  63. (u32)(aml_offset +
  64. sizeof(struct acpi_table_header))));
  65. ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
  66. 48);
  67. #ifdef ACPI_ASL_COMPILER
  68. /*
  69. * This is executed for the disassembler only. Output goes
  70. * to the disassembled ASL output file.
  71. */
  72. acpi_os_printf
  73. ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
  74. walk_state->opcode,
  75. (u32)(aml_offset +
  76. sizeof(struct acpi_table_header)));
  77. ACPI_ERROR((AE_INFO,
  78. "Aborting disassembly, AML byte code is corrupt"));
  79. /* Dump the context surrounding the invalid opcode */
  80. acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
  81. aml - 16), 48, DB_BYTE_DISPLAY,
  82. (aml_offset +
  83. sizeof(struct acpi_table_header) -
  84. 16));
  85. acpi_os_printf(" */\n");
  86. /*
  87. * Just abort the disassembly, cannot continue because the
  88. * parser is essentially lost. The disassembler can then
  89. * randomly fail because an ill-constructed parse tree
  90. * can result.
  91. */
  92. return_ACPI_STATUS(AE_AML_BAD_OPCODE);
  93. #endif
  94. }
  95. /* Increment past one-byte or two-byte opcode */
  96. walk_state->parser_state.aml++;
  97. if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */
  98. walk_state->parser_state.aml++;
  99. }
  100. return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
  101. default:
  102. /* Found opcode info, this is a normal opcode */
  103. walk_state->parser_state.aml +=
  104. acpi_ps_get_opcode_size(walk_state->opcode);
  105. walk_state->arg_types = walk_state->op_info->parse_args;
  106. break;
  107. }
  108. return_ACPI_STATUS(AE_OK);
  109. }
  110. /*******************************************************************************
  111. *
  112. * FUNCTION: acpi_ps_build_named_op
  113. *
  114. * PARAMETERS: walk_state - Current state
  115. * aml_op_start - Begin of named Op in AML
  116. * unnamed_op - Early Op (not a named Op)
  117. * op - Returned Op
  118. *
  119. * RETURN: Status
  120. *
  121. * DESCRIPTION: Parse a named Op
  122. *
  123. ******************************************************************************/
  124. acpi_status
  125. acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
  126. u8 *aml_op_start,
  127. union acpi_parse_object *unnamed_op,
  128. union acpi_parse_object **op)
  129. {
  130. acpi_status status = AE_OK;
  131. union acpi_parse_object *arg = NULL;
  132. ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state);
  133. unnamed_op->common.value.arg = NULL;
  134. unnamed_op->common.arg_list_length = 0;
  135. unnamed_op->common.aml_opcode = walk_state->opcode;
  136. /*
  137. * Get and append arguments until we find the node that contains
  138. * the name (the type ARGP_NAME).
  139. */
  140. while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) &&
  141. (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) {
  142. ASL_CV_CAPTURE_COMMENTS(walk_state);
  143. status =
  144. acpi_ps_get_next_arg(walk_state,
  145. &(walk_state->parser_state),
  146. GET_CURRENT_ARG_TYPE(walk_state->
  147. arg_types), &arg);
  148. if (ACPI_FAILURE(status)) {
  149. return_ACPI_STATUS(status);
  150. }
  151. acpi_ps_append_arg(unnamed_op, arg);
  152. INCREMENT_ARG_LIST(walk_state->arg_types);
  153. }
  154. /* are there any inline comments associated with the name_seg?? If so, save this. */
  155. ASL_CV_CAPTURE_COMMENTS(walk_state);
  156. #ifdef ACPI_ASL_COMPILER
  157. if (acpi_gbl_current_inline_comment != NULL) {
  158. unnamed_op->common.name_comment =
  159. acpi_gbl_current_inline_comment;
  160. acpi_gbl_current_inline_comment = NULL;
  161. }
  162. #endif
  163. /*
  164. * Make sure that we found a NAME and didn't run out of arguments
  165. */
  166. if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) {
  167. return_ACPI_STATUS(AE_AML_NO_OPERAND);
  168. }
  169. /* We know that this arg is a name, move to next arg */
  170. INCREMENT_ARG_LIST(walk_state->arg_types);
  171. /*
  172. * Find the object. This will either insert the object into
  173. * the namespace or simply look it up
  174. */
  175. walk_state->op = NULL;
  176. status = walk_state->descending_callback(walk_state, op);
  177. if (ACPI_FAILURE(status)) {
  178. if (status != AE_CTRL_TERMINATE) {
  179. ACPI_EXCEPTION((AE_INFO, status,
  180. "During name lookup/catalog"));
  181. }
  182. return_ACPI_STATUS(status);
  183. }
  184. if (!*op) {
  185. return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
  186. }
  187. status = acpi_ps_next_parse_state(walk_state, *op, status);
  188. if (ACPI_FAILURE(status)) {
  189. if (status == AE_CTRL_PENDING) {
  190. status = AE_CTRL_PARSE_PENDING;
  191. }
  192. return_ACPI_STATUS(status);
  193. }
  194. acpi_ps_append_arg(*op, unnamed_op->common.value.arg);
  195. #ifdef ACPI_ASL_COMPILER
  196. /* save any comments that might be associated with unnamed_op. */
  197. (*op)->common.inline_comment = unnamed_op->common.inline_comment;
  198. (*op)->common.end_node_comment = unnamed_op->common.end_node_comment;
  199. (*op)->common.close_brace_comment =
  200. unnamed_op->common.close_brace_comment;
  201. (*op)->common.name_comment = unnamed_op->common.name_comment;
  202. (*op)->common.comment_list = unnamed_op->common.comment_list;
  203. (*op)->common.end_blk_comment = unnamed_op->common.end_blk_comment;
  204. (*op)->common.cv_filename = unnamed_op->common.cv_filename;
  205. (*op)->common.cv_parent_filename =
  206. unnamed_op->common.cv_parent_filename;
  207. (*op)->named.aml = unnamed_op->common.aml;
  208. unnamed_op->common.inline_comment = NULL;
  209. unnamed_op->common.end_node_comment = NULL;
  210. unnamed_op->common.close_brace_comment = NULL;
  211. unnamed_op->common.name_comment = NULL;
  212. unnamed_op->common.comment_list = NULL;
  213. unnamed_op->common.end_blk_comment = NULL;
  214. #endif
  215. if ((*op)->common.aml_opcode == AML_REGION_OP ||
  216. (*op)->common.aml_opcode == AML_DATA_REGION_OP) {
  217. /*
  218. * Defer final parsing of an operation_region body, because we don't
  219. * have enough info in the first pass to parse it correctly (i.e.,
  220. * there may be method calls within the term_arg elements of the body.)
  221. *
  222. * However, we must continue parsing because the opregion is not a
  223. * standalone package -- we don't know where the end is at this point.
  224. *
  225. * (Length is unknown until parse of the body complete)
  226. */
  227. (*op)->named.data = aml_op_start;
  228. (*op)->named.length = 0;
  229. }
  230. return_ACPI_STATUS(AE_OK);
  231. }
  232. /*******************************************************************************
  233. *
  234. * FUNCTION: acpi_ps_create_op
  235. *
  236. * PARAMETERS: walk_state - Current state
  237. * aml_op_start - Op start in AML
  238. * new_op - Returned Op
  239. *
  240. * RETURN: Status
  241. *
  242. * DESCRIPTION: Get Op from AML
  243. *
  244. ******************************************************************************/
  245. acpi_status
  246. acpi_ps_create_op(struct acpi_walk_state *walk_state,
  247. u8 *aml_op_start, union acpi_parse_object **new_op)
  248. {
  249. acpi_status status = AE_OK;
  250. union acpi_parse_object *op;
  251. union acpi_parse_object *named_op = NULL;
  252. union acpi_parse_object *parent_scope;
  253. u8 argument_count;
  254. const struct acpi_opcode_info *op_info;
  255. ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state);
  256. status = acpi_ps_get_aml_opcode(walk_state);
  257. if (status == AE_CTRL_PARSE_CONTINUE) {
  258. return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
  259. }
  260. if (ACPI_FAILURE(status)) {
  261. return_ACPI_STATUS(status);
  262. }
  263. /* Create Op structure and append to parent's argument list */
  264. walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
  265. op = acpi_ps_alloc_op(walk_state->opcode, aml_op_start);
  266. if (!op) {
  267. return_ACPI_STATUS(AE_NO_MEMORY);
  268. }
  269. if (walk_state->op_info->flags & AML_NAMED) {
  270. status =
  271. acpi_ps_build_named_op(walk_state, aml_op_start, op,
  272. &named_op);
  273. acpi_ps_free_op(op);
  274. #ifdef ACPI_ASL_COMPILER
  275. if (acpi_gbl_disasm_flag
  276. && walk_state->opcode == AML_EXTERNAL_OP
  277. && status == AE_NOT_FOUND) {
  278. /*
  279. * If parsing of AML_EXTERNAL_OP's name path fails, then skip
  280. * past this opcode and keep parsing. This is a much better
  281. * alternative than to abort the entire disassembler. At this
  282. * point, the parser_state is at the end of the namepath of the
  283. * external declaration opcode. Setting walk_state->Aml to
  284. * walk_state->parser_state.Aml + 2 moves increments the
  285. * walk_state->Aml past the object type and the paramcount of the
  286. * external opcode.
  287. */
  288. walk_state->aml = walk_state->parser_state.aml + 2;
  289. walk_state->parser_state.aml = walk_state->aml;
  290. return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
  291. }
  292. #endif
  293. if (ACPI_FAILURE(status)) {
  294. return_ACPI_STATUS(status);
  295. }
  296. *new_op = named_op;
  297. return_ACPI_STATUS(AE_OK);
  298. }
  299. /* Not a named opcode, just allocate Op and append to parent */
  300. if (walk_state->op_info->flags & AML_CREATE) {
  301. /*
  302. * Backup to beginning of create_XXXfield declaration
  303. * body_length is unknown until we parse the body
  304. */
  305. op->named.data = aml_op_start;
  306. op->named.length = 0;
  307. }
  308. if (walk_state->opcode == AML_BANK_FIELD_OP) {
  309. /*
  310. * Backup to beginning of bank_field declaration
  311. * body_length is unknown until we parse the body
  312. */
  313. op->named.data = aml_op_start;
  314. op->named.length = 0;
  315. }
  316. parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state));
  317. acpi_ps_append_arg(parent_scope, op);
  318. if (parent_scope) {
  319. op_info =
  320. acpi_ps_get_opcode_info(parent_scope->common.aml_opcode);
  321. if (op_info->flags & AML_HAS_TARGET) {
  322. argument_count =
  323. acpi_ps_get_argument_count(op_info->type);
  324. if (parent_scope->common.arg_list_length >
  325. argument_count) {
  326. op->common.flags |= ACPI_PARSEOP_TARGET;
  327. }
  328. }
  329. /*
  330. * Special case for both Increment() and Decrement(), where
  331. * the lone argument is both a source and a target.
  332. */
  333. else if ((parent_scope->common.aml_opcode == AML_INCREMENT_OP)
  334. || (parent_scope->common.aml_opcode ==
  335. AML_DECREMENT_OP)) {
  336. op->common.flags |= ACPI_PARSEOP_TARGET;
  337. }
  338. }
  339. if (walk_state->descending_callback != NULL) {
  340. /*
  341. * Find the object. This will either insert the object into
  342. * the namespace or simply look it up
  343. */
  344. walk_state->op = *new_op = op;
  345. status = walk_state->descending_callback(walk_state, &op);
  346. status = acpi_ps_next_parse_state(walk_state, op, status);
  347. if (status == AE_CTRL_PENDING) {
  348. status = AE_CTRL_PARSE_PENDING;
  349. }
  350. }
  351. return_ACPI_STATUS(status);
  352. }
  353. /*******************************************************************************
  354. *
  355. * FUNCTION: acpi_ps_complete_op
  356. *
  357. * PARAMETERS: walk_state - Current state
  358. * op - Returned Op
  359. * status - Parse status before complete Op
  360. *
  361. * RETURN: Status
  362. *
  363. * DESCRIPTION: Complete Op
  364. *
  365. ******************************************************************************/
  366. acpi_status
  367. acpi_ps_complete_op(struct acpi_walk_state *walk_state,
  368. union acpi_parse_object **op, acpi_status status)
  369. {
  370. acpi_status status2;
  371. ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state);
  372. /*
  373. * Finished one argument of the containing scope
  374. */
  375. walk_state->parser_state.scope->parse_scope.arg_count--;
  376. /* Close this Op (will result in parse subtree deletion) */
  377. status2 = acpi_ps_complete_this_op(walk_state, *op);
  378. if (ACPI_FAILURE(status2)) {
  379. return_ACPI_STATUS(status2);
  380. }
  381. *op = NULL;
  382. switch (status) {
  383. case AE_OK:
  384. break;
  385. case AE_CTRL_TRANSFER:
  386. /* We are about to transfer to a called method */
  387. walk_state->prev_op = NULL;
  388. walk_state->prev_arg_types = walk_state->arg_types;
  389. return_ACPI_STATUS(status);
  390. case AE_CTRL_END:
  391. acpi_ps_pop_scope(&(walk_state->parser_state), op,
  392. &walk_state->arg_types,
  393. &walk_state->arg_count);
  394. if (*op) {
  395. walk_state->op = *op;
  396. walk_state->op_info =
  397. acpi_ps_get_opcode_info((*op)->common.aml_opcode);
  398. walk_state->opcode = (*op)->common.aml_opcode;
  399. status = walk_state->ascending_callback(walk_state);
  400. status =
  401. acpi_ps_next_parse_state(walk_state, *op, status);
  402. status2 = acpi_ps_complete_this_op(walk_state, *op);
  403. if (ACPI_FAILURE(status2)) {
  404. return_ACPI_STATUS(status2);
  405. }
  406. }
  407. status = AE_OK;
  408. break;
  409. case AE_CTRL_BREAK:
  410. case AE_CTRL_CONTINUE:
  411. /* Pop off scopes until we find the While */
  412. while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) {
  413. acpi_ps_pop_scope(&(walk_state->parser_state), op,
  414. &walk_state->arg_types,
  415. &walk_state->arg_count);
  416. }
  417. /* Close this iteration of the While loop */
  418. walk_state->op = *op;
  419. walk_state->op_info =
  420. acpi_ps_get_opcode_info((*op)->common.aml_opcode);
  421. walk_state->opcode = (*op)->common.aml_opcode;
  422. status = walk_state->ascending_callback(walk_state);
  423. status = acpi_ps_next_parse_state(walk_state, *op, status);
  424. status2 = acpi_ps_complete_this_op(walk_state, *op);
  425. if (ACPI_FAILURE(status2)) {
  426. return_ACPI_STATUS(status2);
  427. }
  428. status = AE_OK;
  429. break;
  430. case AE_CTRL_TERMINATE:
  431. /* Clean up */
  432. do {
  433. if (*op) {
  434. status2 =
  435. acpi_ps_complete_this_op(walk_state, *op);
  436. if (ACPI_FAILURE(status2)) {
  437. return_ACPI_STATUS(status2);
  438. }
  439. acpi_ut_delete_generic_state
  440. (acpi_ut_pop_generic_state
  441. (&walk_state->control_state));
  442. }
  443. acpi_ps_pop_scope(&(walk_state->parser_state), op,
  444. &walk_state->arg_types,
  445. &walk_state->arg_count);
  446. } while (*op);
  447. return_ACPI_STATUS(AE_OK);
  448. default: /* All other non-AE_OK status */
  449. do {
  450. if (*op) {
  451. status2 =
  452. acpi_ps_complete_this_op(walk_state, *op);
  453. if (ACPI_FAILURE(status2)) {
  454. return_ACPI_STATUS(status2);
  455. }
  456. }
  457. acpi_ps_pop_scope(&(walk_state->parser_state), op,
  458. &walk_state->arg_types,
  459. &walk_state->arg_count);
  460. } while (*op);
  461. #if 0
  462. /*
  463. * TBD: Cleanup parse ops on error
  464. */
  465. if (*op == NULL) {
  466. acpi_ps_pop_scope(parser_state, op,
  467. &walk_state->arg_types,
  468. &walk_state->arg_count);
  469. }
  470. #endif
  471. walk_state->prev_op = NULL;
  472. walk_state->prev_arg_types = walk_state->arg_types;
  473. return_ACPI_STATUS(status);
  474. }
  475. /* This scope complete? */
  476. if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) {
  477. acpi_ps_pop_scope(&(walk_state->parser_state), op,
  478. &walk_state->arg_types,
  479. &walk_state->arg_count);
  480. ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op));
  481. } else {
  482. *op = NULL;
  483. }
  484. return_ACPI_STATUS(AE_OK);
  485. }
  486. /*******************************************************************************
  487. *
  488. * FUNCTION: acpi_ps_complete_final_op
  489. *
  490. * PARAMETERS: walk_state - Current state
  491. * op - Current Op
  492. * status - Current parse status before complete last
  493. * Op
  494. *
  495. * RETURN: Status
  496. *
  497. * DESCRIPTION: Complete last Op.
  498. *
  499. ******************************************************************************/
  500. acpi_status
  501. acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
  502. union acpi_parse_object *op, acpi_status status)
  503. {
  504. acpi_status status2;
  505. ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state);
  506. /*
  507. * Complete the last Op (if not completed), and clear the scope stack.
  508. * It is easily possible to end an AML "package" with an unbounded number
  509. * of open scopes (such as when several ASL blocks are closed with
  510. * sequential closing braces). We want to terminate each one cleanly.
  511. */
  512. ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
  513. op));
  514. do {
  515. if (op) {
  516. if (walk_state->ascending_callback != NULL) {
  517. walk_state->op = op;
  518. walk_state->op_info =
  519. acpi_ps_get_opcode_info(op->common.
  520. aml_opcode);
  521. walk_state->opcode = op->common.aml_opcode;
  522. status =
  523. walk_state->ascending_callback(walk_state);
  524. status =
  525. acpi_ps_next_parse_state(walk_state, op,
  526. status);
  527. if (status == AE_CTRL_PENDING) {
  528. status =
  529. acpi_ps_complete_op(walk_state, &op,
  530. AE_OK);
  531. if (ACPI_FAILURE(status)) {
  532. return_ACPI_STATUS(status);
  533. }
  534. }
  535. if (status == AE_CTRL_TERMINATE) {
  536. status = AE_OK;
  537. /* Clean up */
  538. do {
  539. if (op) {
  540. status2 =
  541. acpi_ps_complete_this_op
  542. (walk_state, op);
  543. if (ACPI_FAILURE
  544. (status2)) {
  545. return_ACPI_STATUS
  546. (status2);
  547. }
  548. }
  549. acpi_ps_pop_scope(&
  550. (walk_state->
  551. parser_state),
  552. &op,
  553. &walk_state->
  554. arg_types,
  555. &walk_state->
  556. arg_count);
  557. } while (op);
  558. return_ACPI_STATUS(status);
  559. }
  560. else if (ACPI_FAILURE(status)) {
  561. /* First error is most important */
  562. (void)
  563. acpi_ps_complete_this_op(walk_state,
  564. op);
  565. return_ACPI_STATUS(status);
  566. }
  567. }
  568. status2 = acpi_ps_complete_this_op(walk_state, op);
  569. if (ACPI_FAILURE(status2)) {
  570. return_ACPI_STATUS(status2);
  571. }
  572. }
  573. acpi_ps_pop_scope(&(walk_state->parser_state), &op,
  574. &walk_state->arg_types,
  575. &walk_state->arg_count);
  576. } while (op);
  577. return_ACPI_STATUS(status);
  578. }