1 /******************************************************************************
3 * Module Name: psloop - Main AML parse loop
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
119 * Parse the AML and build an operation tree as most interpreters,
120 * like Perl, do. Parsing is done by hand rather than with a YACC
121 * generated parser to tightly constrain stack and dynamic memory
122 * usage. At the same time, parsing is kept flexible and the code
123 * fairly compact by parsing based on a list of AML opcode
124 * templates in AmlOpInfo[]
127 #include <contrib/dev/acpica/acpi.h>
128 #include <contrib/dev/acpica/acparser.h>
129 #include <contrib/dev/acpica/acdispat.h>
130 #include <contrib/dev/acpica/amlcode.h>
132 #define _COMPONENT ACPI_PARSER
133 ACPI_MODULE_NAME ("psloop")
135 static UINT32 AcpiGbl_Depth = 0;
138 /*******************************************************************************
140 * FUNCTION: AcpiPsParseLoop
142 * PARAMETERS: WalkState - Current state
146 * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
149 ******************************************************************************/
153 ACPI_WALK_STATE *WalkState)
155 ACPI_STATUS Status = AE_OK;
157 ACPI_PARSE_OBJECT *Op = NULL; /* current op */
158 ACPI_PARSE_OBJECT *Arg = NULL;
159 ACPI_PARSE_OBJECT *PreOp = NULL;
160 ACPI_PARSE_STATE *ParserState;
161 UINT8 *AmlOpStart = NULL;
164 ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
166 if (WalkState->DescendingCallback == NULL)
168 return_ACPI_STATUS (AE_BAD_PARAMETER);
171 ParserState = &WalkState->ParserState;
172 WalkState->ArgTypes = 0;
174 #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
176 if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
178 /* We are restarting a preempted control method */
180 if (AcpiPsHasCompletedScope (ParserState))
183 * We must check if a predicate to an IF or WHILE statement
186 if ((ParserState->Scope->ParseScope.Op) &&
187 ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
188 (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
189 (WalkState->ControlState) &&
190 (WalkState->ControlState->Common.State ==
191 ACPI_CONTROL_PREDICATE_EXECUTING))
194 * A predicate was just completed, get the value of the
195 * predicate and branch based on that value
197 WalkState->Op = NULL;
198 Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
199 if (ACPI_FAILURE (Status) &&
200 ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
202 if (Status == AE_AML_NO_RETURN_VALUE)
204 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
205 "Invoked method did not return a value, %s\n",
206 AcpiFormatException (Status)));
209 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
210 "GetPredicate Failed, %s\n",
211 AcpiFormatException (Status)));
212 return_ACPI_STATUS (Status);
215 Status = AcpiPsNextParseState (WalkState, Op, Status);
218 AcpiPsPopScope (ParserState, &Op,
219 &WalkState->ArgTypes, &WalkState->ArgCount);
220 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
222 else if (WalkState->PrevOp)
224 /* We were in the middle of an op */
226 Op = WalkState->PrevOp;
227 WalkState->ArgTypes = WalkState->PrevArgTypes;
232 /* Iterative parsing loop, while there is more AML to process: */
234 while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
236 AmlOpStart = ParserState->Aml;
239 /* Get the next opcode from the AML stream */
241 WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
242 ParserState->AmlStart);
243 WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
246 * First cut to determine what we have found:
247 * 1) A valid AML opcode
249 * 3) An unknown/invalid opcode
251 WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
252 switch (WalkState->OpInfo->Class)
254 case AML_CLASS_ASCII:
255 case AML_CLASS_PREFIX:
257 * Starts with a valid prefix or ASCII char, this is a name
258 * string. Convert the bare name string to a namepath.
260 WalkState->Opcode = AML_INT_NAMEPATH_OP;
261 WalkState->ArgTypes = ARGP_NAMESTRING;
264 case AML_CLASS_UNKNOWN:
266 /* The opcode is unrecognized. Just skip unknown opcodes */
268 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
269 "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
270 WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
272 ACPI_DUMP_BUFFER (ParserState->Aml, 128);
274 /* Assume one-byte bad opcode */
281 /* Found opcode info, this is a normal opcode */
283 ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
284 WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
288 /* Create Op structure and append to parent's argument list */
290 if (WalkState->OpInfo->Flags & AML_NAMED)
292 /* Allocate a new PreOp if necessary */
296 PreOp = AcpiPsAllocOp (WalkState->Opcode);
299 Status = AE_NO_MEMORY;
304 PreOp->Common.Value.Arg = NULL;
305 PreOp->Common.AmlOpcode = WalkState->Opcode;
308 * Get and append arguments until we find the node that contains
309 * the name (the type ARGP_NAME).
311 while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
312 (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
314 Status = AcpiPsGetNextArg (WalkState, ParserState,
315 GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
316 if (ACPI_FAILURE (Status))
321 AcpiPsAppendArg (PreOp, Arg);
322 INCREMENT_ARG_LIST (WalkState->ArgTypes);
326 * Make sure that we found a NAME and didn't run out of
329 if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
331 Status = AE_AML_NO_OPERAND;
335 /* We know that this arg is a name, move to next arg */
337 INCREMENT_ARG_LIST (WalkState->ArgTypes);
340 * Find the object. This will either insert the object into
341 * the namespace or simply look it up
343 WalkState->Op = NULL;
345 Status = WalkState->DescendingCallback (WalkState, &Op);
346 if (ACPI_FAILURE (Status))
348 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
349 "During name lookup/catalog, %s\n",
350 AcpiFormatException (Status)));
359 Status = AcpiPsNextParseState (WalkState, Op, Status);
360 if (Status == AE_CTRL_PENDING)
366 if (ACPI_FAILURE (Status))
371 AcpiPsAppendArg (Op, PreOp->Common.Value.Arg);
374 if (Op->Common.AmlOpcode == AML_REGION_OP)
377 * Defer final parsing of an OperationRegion body,
378 * because we don't have enough info in the first pass
379 * to parse it correctly (i.e., there may be method
380 * calls within the TermArg elements of the body.)
382 * However, we must continue parsing because
383 * the opregion is not a standalone package --
384 * we don't know where the end is at this point.
386 * (Length is unknown until parse of the body complete)
388 Op->Named.Data = AmlOpStart;
389 Op->Named.Length = 0;
394 /* Not a named opcode, just allocate Op and append to parent */
396 WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
397 Op = AcpiPsAllocOp (WalkState->Opcode);
400 Status = AE_NO_MEMORY;
404 if (WalkState->OpInfo->Flags & AML_CREATE)
407 * Backup to beginning of CreateXXXfield declaration
408 * BodyLength is unknown until we parse the body
410 Op->Named.Data = AmlOpStart;
411 Op->Named.Length = 0;
414 AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
416 if ((WalkState->DescendingCallback != NULL))
419 * Find the object. This will either insert the object into
420 * the namespace or simply look it up
424 Status = WalkState->DescendingCallback (WalkState, &Op);
425 Status = AcpiPsNextParseState (WalkState, Op, Status);
426 if (Status == AE_CTRL_PENDING)
432 if (ACPI_FAILURE (Status))
439 Op->Common.AmlOffset = WalkState->AmlOffset;
441 if (WalkState->OpInfo)
443 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
444 "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
445 (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
446 Op, ParserState->Aml, Op->Common.AmlOffset));
452 * Start ArgCount at zero because we don't know if there are
455 WalkState->ArgCount = 0;
457 /* Are there any arguments that must be processed? */
459 if (WalkState->ArgTypes)
463 switch (Op->Common.AmlOpcode)
465 case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
466 case AML_WORD_OP: /* AML_WORDDATA_ARG */
467 case AML_DWORD_OP: /* AML_DWORDATA_ARG */
468 case AML_QWORD_OP: /* AML_QWORDATA_ARG */
469 case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
471 /* Fill in constant or string argument directly */
473 AcpiPsGetNextSimpleArg (ParserState,
474 GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
477 case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
479 Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1);
480 if (ACPI_FAILURE (Status))
485 WalkState->ArgTypes = 0;
490 * Op is not a constant or string, append each argument
493 while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
494 !WalkState->ArgCount)
496 WalkState->AmlOffset = (UINT32)
497 ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart);
499 Status = AcpiPsGetNextArg (WalkState, ParserState,
500 GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
502 if (ACPI_FAILURE (Status))
509 Arg->Common.AmlOffset = WalkState->AmlOffset;
510 AcpiPsAppendArg (Op, Arg);
512 INCREMENT_ARG_LIST (WalkState->ArgTypes);
516 /* Special processing for certain opcodes */
518 /* TBD (remove): Temporary mechanism to disable this code if needed */
520 #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
522 if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS1) &&
523 ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0))
526 * We want to skip If/Else/While constructs during Pass1
527 * because we want to actually conditionally execute the
530 * Except for disassembly, where we always want to
531 * walk the If/Else/While packages
533 switch (Op->Common.AmlOpcode)
539 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
540 "Pass1: Skipping an If/Else/While body\n"));
542 /* Skip body of if/else/while in pass 1 */
544 ParserState->Aml = ParserState->PkgEnd;
545 WalkState->ArgCount = 0;
553 switch (Op->Common.AmlOpcode)
558 * Skip parsing of control method
559 * because we don't have enough info in the first pass
560 * to parse it correctly.
562 * Save the length and address of the body
564 Op->Named.Data = ParserState->Aml;
565 Op->Named.Length = (UINT32) (ParserState->PkgEnd -
568 /* Skip body of method */
570 ParserState->Aml = ParserState->PkgEnd;
571 WalkState->ArgCount = 0;
576 case AML_VAR_PACKAGE_OP:
578 if ((Op->Common.Parent) &&
579 (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
580 (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
583 * Skip parsing of Buffers and Packages
584 * because we don't have enough info in the first pass
585 * to parse them correctly.
587 Op->Named.Data = AmlOpStart;
588 Op->Named.Length = (UINT32) (ParserState->PkgEnd -
593 ParserState->Aml = ParserState->PkgEnd;
594 WalkState->ArgCount = 0;
600 if (WalkState->ControlState)
602 WalkState->ControlState->Control.PackageEnd =
609 /* No action for all other opcodes */
616 /* Check for arguments that need to be processed */
618 if (WalkState->ArgCount)
621 * There are arguments (complex ones), push Op and
622 * prepare for argument
624 Status = AcpiPsPushScope (ParserState, Op,
625 WalkState->ArgTypes, WalkState->ArgCount);
626 if (ACPI_FAILURE (Status))
635 * All arguments have been processed -- Op is complete,
638 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
639 if (WalkState->OpInfo->Flags & AML_NAMED)
646 if (Op->Common.AmlOpcode == AML_REGION_OP)
649 * Skip parsing of control method or opregion body,
650 * because we don't have enough info in the first pass
651 * to parse them correctly.
653 * Completed parsing an OpRegion declaration, we now
656 Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
660 if (WalkState->OpInfo->Flags & AML_CREATE)
663 * Backup to beginning of CreateXXXfield declaration (1 for
666 * BodyLength is unknown until we parse the body
668 Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
671 /* This op complete, notify the dispatcher */
673 if (WalkState->AscendingCallback != NULL)
676 WalkState->Opcode = Op->Common.AmlOpcode;
678 Status = WalkState->AscendingCallback (WalkState);
679 Status = AcpiPsNextParseState (WalkState, Op, Status);
680 if (Status == AE_CTRL_PENDING)
690 * Finished one argument of the containing scope
692 ParserState->Scope->ParseScope.ArgCount--;
694 /* Finished with PreOp */
698 AcpiPsFreeOp (PreOp);
702 /* Close this Op (will result in parse subtree deletion) */
704 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
705 if (ACPI_FAILURE (Status2))
707 return_ACPI_STATUS (Status2);
717 case AE_CTRL_TRANSFER:
719 /* We are about to transfer to a called method. */
721 WalkState->PrevOp = Op;
722 WalkState->PrevArgTypes = WalkState->ArgTypes;
723 return_ACPI_STATUS (Status);
728 AcpiPsPopScope (ParserState, &Op,
729 &WalkState->ArgTypes, &WalkState->ArgCount);
734 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
735 WalkState->Opcode = Op->Common.AmlOpcode;
737 Status = WalkState->AscendingCallback (WalkState);
738 Status = AcpiPsNextParseState (WalkState, Op, Status);
740 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
741 if (ACPI_FAILURE (Status2))
743 return_ACPI_STATUS (Status2);
752 case AE_CTRL_CONTINUE:
754 /* Pop off scopes until we find the While */
756 while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
758 AcpiPsPopScope (ParserState, &Op,
759 &WalkState->ArgTypes, &WalkState->ArgCount);
762 /* Close this iteration of the While loop */
765 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
766 WalkState->Opcode = Op->Common.AmlOpcode;
768 Status = WalkState->AscendingCallback (WalkState);
769 Status = AcpiPsNextParseState (WalkState, Op, Status);
771 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
772 if (ACPI_FAILURE (Status2))
774 return_ACPI_STATUS (Status2);
782 case AE_CTRL_TERMINATE:
791 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
792 if (ACPI_FAILURE (Status2))
794 return_ACPI_STATUS (Status2);
797 AcpiPsPopScope (ParserState, &Op,
798 &WalkState->ArgTypes, &WalkState->ArgCount);
802 return_ACPI_STATUS (Status);
805 default: /* All other non-AE_OK status */
811 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
812 if (ACPI_FAILURE (Status2))
814 return_ACPI_STATUS (Status2);
817 AcpiPsPopScope (ParserState, &Op,
818 &WalkState->ArgTypes, &WalkState->ArgCount);
824 * TBD: Cleanup parse ops on error
829 AcpiPsPopScope (ParserState, &Op,
830 &WalkState->ArgTypes, &WalkState->ArgCount);
833 WalkState->PrevOp = Op;
834 WalkState->PrevArgTypes = WalkState->ArgTypes;
835 return_ACPI_STATUS (Status);
838 /* This scope complete? */
840 if (AcpiPsHasCompletedScope (ParserState))
842 AcpiPsPopScope (ParserState, &Op,
843 &WalkState->ArgTypes, &WalkState->ArgCount);
844 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
851 } /* while ParserState->Aml */
855 * Complete the last Op (if not completed), and clear the scope stack.
856 * It is easily possible to end an AML "package" with an unbounded number
857 * of open scopes (such as when several ASL blocks are closed with
858 * sequential closing braces). We want to terminate each one cleanly.
860 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
865 if (WalkState->AscendingCallback != NULL)
868 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
869 WalkState->Opcode = Op->Common.AmlOpcode;
871 Status = WalkState->AscendingCallback (WalkState);
872 Status = AcpiPsNextParseState (WalkState, Op, Status);
873 if (Status == AE_CTRL_PENDING)
879 if (Status == AE_CTRL_TERMINATE)
888 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
889 if (ACPI_FAILURE (Status2))
891 return_ACPI_STATUS (Status2);
895 AcpiPsPopScope (ParserState, &Op,
896 &WalkState->ArgTypes, &WalkState->ArgCount);
900 return_ACPI_STATUS (Status);
903 else if (ACPI_FAILURE (Status))
905 /* First error is most important */
907 (void) AcpiPsCompleteThisOp (WalkState, Op);
908 return_ACPI_STATUS (Status);
912 Status2 = AcpiPsCompleteThisOp (WalkState, Op);
913 if (ACPI_FAILURE (Status2))
915 return_ACPI_STATUS (Status2);
919 AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes,
920 &WalkState->ArgCount);
924 return_ACPI_STATUS (Status);