xref: /titanic_51/usr/src/uts/intel/io/acpica/parser/psobject.c (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
1*385cc6b4SJerry Jelinek /******************************************************************************
2*385cc6b4SJerry Jelinek  *
3*385cc6b4SJerry Jelinek  * Module Name: psobject - Support for parse objects
4*385cc6b4SJerry Jelinek  *
5*385cc6b4SJerry Jelinek  *****************************************************************************/
6*385cc6b4SJerry Jelinek 
7*385cc6b4SJerry Jelinek /*
8*385cc6b4SJerry Jelinek  * Copyright (C) 2000 - 2016, Intel Corp.
9*385cc6b4SJerry Jelinek  * All rights reserved.
10*385cc6b4SJerry Jelinek  *
11*385cc6b4SJerry Jelinek  * Redistribution and use in source and binary forms, with or without
12*385cc6b4SJerry Jelinek  * modification, are permitted provided that the following conditions
13*385cc6b4SJerry Jelinek  * are met:
14*385cc6b4SJerry Jelinek  * 1. Redistributions of source code must retain the above copyright
15*385cc6b4SJerry Jelinek  *    notice, this list of conditions, and the following disclaimer,
16*385cc6b4SJerry Jelinek  *    without modification.
17*385cc6b4SJerry Jelinek  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*385cc6b4SJerry Jelinek  *    substantially similar to the "NO WARRANTY" disclaimer below
19*385cc6b4SJerry Jelinek  *    ("Disclaimer") and any redistribution must be conditioned upon
20*385cc6b4SJerry Jelinek  *    including a substantially similar Disclaimer requirement for further
21*385cc6b4SJerry Jelinek  *    binary redistribution.
22*385cc6b4SJerry Jelinek  * 3. Neither the names of the above-listed copyright holders nor the names
23*385cc6b4SJerry Jelinek  *    of any contributors may be used to endorse or promote products derived
24*385cc6b4SJerry Jelinek  *    from this software without specific prior written permission.
25*385cc6b4SJerry Jelinek  *
26*385cc6b4SJerry Jelinek  * Alternatively, this software may be distributed under the terms of the
27*385cc6b4SJerry Jelinek  * GNU General Public License ("GPL") version 2 as published by the Free
28*385cc6b4SJerry Jelinek  * Software Foundation.
29*385cc6b4SJerry Jelinek  *
30*385cc6b4SJerry Jelinek  * NO WARRANTY
31*385cc6b4SJerry Jelinek  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*385cc6b4SJerry Jelinek  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*385cc6b4SJerry Jelinek  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*385cc6b4SJerry Jelinek  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*385cc6b4SJerry Jelinek  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*385cc6b4SJerry Jelinek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*385cc6b4SJerry Jelinek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*385cc6b4SJerry Jelinek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*385cc6b4SJerry Jelinek  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*385cc6b4SJerry Jelinek  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*385cc6b4SJerry Jelinek  * POSSIBILITY OF SUCH DAMAGES.
42*385cc6b4SJerry Jelinek  */
43*385cc6b4SJerry Jelinek 
44*385cc6b4SJerry Jelinek #include "acpi.h"
45*385cc6b4SJerry Jelinek #include "accommon.h"
46*385cc6b4SJerry Jelinek #include "acparser.h"
47*385cc6b4SJerry Jelinek #include "amlcode.h"
48*385cc6b4SJerry Jelinek 
49*385cc6b4SJerry Jelinek #define _COMPONENT          ACPI_PARSER
50*385cc6b4SJerry Jelinek         ACPI_MODULE_NAME    ("psobject")
51*385cc6b4SJerry Jelinek 
52*385cc6b4SJerry Jelinek 
53*385cc6b4SJerry Jelinek /* Local prototypes */
54*385cc6b4SJerry Jelinek 
55*385cc6b4SJerry Jelinek static ACPI_STATUS
56*385cc6b4SJerry Jelinek AcpiPsGetAmlOpcode (
57*385cc6b4SJerry Jelinek     ACPI_WALK_STATE         *WalkState);
58*385cc6b4SJerry Jelinek 
59*385cc6b4SJerry Jelinek 
60*385cc6b4SJerry Jelinek /*******************************************************************************
61*385cc6b4SJerry Jelinek  *
62*385cc6b4SJerry Jelinek  * FUNCTION:    AcpiPsGetAmlOpcode
63*385cc6b4SJerry Jelinek  *
64*385cc6b4SJerry Jelinek  * PARAMETERS:  WalkState           - Current state
65*385cc6b4SJerry Jelinek  *
66*385cc6b4SJerry Jelinek  * RETURN:      Status
67*385cc6b4SJerry Jelinek  *
68*385cc6b4SJerry Jelinek  * DESCRIPTION: Extract the next AML opcode from the input stream.
69*385cc6b4SJerry Jelinek  *
70*385cc6b4SJerry Jelinek  ******************************************************************************/
71*385cc6b4SJerry Jelinek 
72*385cc6b4SJerry Jelinek static ACPI_STATUS
73*385cc6b4SJerry Jelinek AcpiPsGetAmlOpcode (
74*385cc6b4SJerry Jelinek     ACPI_WALK_STATE         *WalkState)
75*385cc6b4SJerry Jelinek {
76*385cc6b4SJerry Jelinek     UINT32                  AmlOffset;
77*385cc6b4SJerry Jelinek 
78*385cc6b4SJerry Jelinek 
79*385cc6b4SJerry Jelinek     ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
80*385cc6b4SJerry Jelinek 
81*385cc6b4SJerry Jelinek 
82*385cc6b4SJerry Jelinek     WalkState->Aml = WalkState->ParserState.Aml;
83*385cc6b4SJerry Jelinek     WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
84*385cc6b4SJerry Jelinek 
85*385cc6b4SJerry Jelinek     /*
86*385cc6b4SJerry Jelinek      * First cut to determine what we have found:
87*385cc6b4SJerry Jelinek      * 1) A valid AML opcode
88*385cc6b4SJerry Jelinek      * 2) A name string
89*385cc6b4SJerry Jelinek      * 3) An unknown/invalid opcode
90*385cc6b4SJerry Jelinek      */
91*385cc6b4SJerry Jelinek     WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
92*385cc6b4SJerry Jelinek 
93*385cc6b4SJerry Jelinek     switch (WalkState->OpInfo->Class)
94*385cc6b4SJerry Jelinek     {
95*385cc6b4SJerry Jelinek     case AML_CLASS_ASCII:
96*385cc6b4SJerry Jelinek     case AML_CLASS_PREFIX:
97*385cc6b4SJerry Jelinek         /*
98*385cc6b4SJerry Jelinek          * Starts with a valid prefix or ASCII char, this is a name
99*385cc6b4SJerry Jelinek          * string. Convert the bare name string to a namepath.
100*385cc6b4SJerry Jelinek          */
101*385cc6b4SJerry Jelinek         WalkState->Opcode = AML_INT_NAMEPATH_OP;
102*385cc6b4SJerry Jelinek         WalkState->ArgTypes = ARGP_NAMESTRING;
103*385cc6b4SJerry Jelinek         break;
104*385cc6b4SJerry Jelinek 
105*385cc6b4SJerry Jelinek     case AML_CLASS_UNKNOWN:
106*385cc6b4SJerry Jelinek 
107*385cc6b4SJerry Jelinek         /* The opcode is unrecognized. Complain and skip unknown opcodes */
108*385cc6b4SJerry Jelinek 
109*385cc6b4SJerry Jelinek         if (WalkState->PassNumber == 2)
110*385cc6b4SJerry Jelinek         {
111*385cc6b4SJerry Jelinek             AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
112*385cc6b4SJerry Jelinek                 WalkState->ParserState.AmlStart);
113*385cc6b4SJerry Jelinek 
114*385cc6b4SJerry Jelinek             ACPI_ERROR ((AE_INFO,
115*385cc6b4SJerry Jelinek                 "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
116*385cc6b4SJerry Jelinek                 WalkState->Opcode,
117*385cc6b4SJerry Jelinek                 (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))));
118*385cc6b4SJerry Jelinek 
119*385cc6b4SJerry Jelinek             ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);
120*385cc6b4SJerry Jelinek 
121*385cc6b4SJerry Jelinek #ifdef ACPI_ASL_COMPILER
122*385cc6b4SJerry Jelinek             /*
123*385cc6b4SJerry Jelinek              * This is executed for the disassembler only. Output goes
124*385cc6b4SJerry Jelinek              * to the disassembled ASL output file.
125*385cc6b4SJerry Jelinek              */
126*385cc6b4SJerry Jelinek             AcpiOsPrintf (
127*385cc6b4SJerry Jelinek                 "/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
128*385cc6b4SJerry Jelinek                 WalkState->Opcode,
129*385cc6b4SJerry Jelinek                 (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)));
130*385cc6b4SJerry Jelinek 
131*385cc6b4SJerry Jelinek             /* Dump the context surrounding the invalid opcode */
132*385cc6b4SJerry Jelinek 
133*385cc6b4SJerry Jelinek             AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
134*385cc6b4SJerry Jelinek                 48, DB_BYTE_DISPLAY,
135*385cc6b4SJerry Jelinek                 (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
136*385cc6b4SJerry Jelinek             AcpiOsPrintf (" */\n");
137*385cc6b4SJerry Jelinek #endif
138*385cc6b4SJerry Jelinek         }
139*385cc6b4SJerry Jelinek 
140*385cc6b4SJerry Jelinek         /* Increment past one-byte or two-byte opcode */
141*385cc6b4SJerry Jelinek 
142*385cc6b4SJerry Jelinek         WalkState->ParserState.Aml++;
143*385cc6b4SJerry Jelinek         if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */
144*385cc6b4SJerry Jelinek         {
145*385cc6b4SJerry Jelinek             WalkState->ParserState.Aml++;
146*385cc6b4SJerry Jelinek         }
147*385cc6b4SJerry Jelinek 
148*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
149*385cc6b4SJerry Jelinek 
150*385cc6b4SJerry Jelinek     default:
151*385cc6b4SJerry Jelinek 
152*385cc6b4SJerry Jelinek         /* Found opcode info, this is a normal opcode */
153*385cc6b4SJerry Jelinek 
154*385cc6b4SJerry Jelinek         WalkState->ParserState.Aml +=
155*385cc6b4SJerry Jelinek             AcpiPsGetOpcodeSize (WalkState->Opcode);
156*385cc6b4SJerry Jelinek         WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
157*385cc6b4SJerry Jelinek         break;
158*385cc6b4SJerry Jelinek     }
159*385cc6b4SJerry Jelinek 
160*385cc6b4SJerry Jelinek     return_ACPI_STATUS (AE_OK);
161*385cc6b4SJerry Jelinek }
162*385cc6b4SJerry Jelinek 
163*385cc6b4SJerry Jelinek 
164*385cc6b4SJerry Jelinek /*******************************************************************************
165*385cc6b4SJerry Jelinek  *
166*385cc6b4SJerry Jelinek  * FUNCTION:    AcpiPsBuildNamedOp
167*385cc6b4SJerry Jelinek  *
168*385cc6b4SJerry Jelinek  * PARAMETERS:  WalkState           - Current state
169*385cc6b4SJerry Jelinek  *              AmlOpStart          - Begin of named Op in AML
170*385cc6b4SJerry Jelinek  *              UnnamedOp           - Early Op (not a named Op)
171*385cc6b4SJerry Jelinek  *              Op                  - Returned Op
172*385cc6b4SJerry Jelinek  *
173*385cc6b4SJerry Jelinek  * RETURN:      Status
174*385cc6b4SJerry Jelinek  *
175*385cc6b4SJerry Jelinek  * DESCRIPTION: Parse a named Op
176*385cc6b4SJerry Jelinek  *
177*385cc6b4SJerry Jelinek  ******************************************************************************/
178*385cc6b4SJerry Jelinek 
179*385cc6b4SJerry Jelinek ACPI_STATUS
180*385cc6b4SJerry Jelinek AcpiPsBuildNamedOp (
181*385cc6b4SJerry Jelinek     ACPI_WALK_STATE         *WalkState,
182*385cc6b4SJerry Jelinek     UINT8                   *AmlOpStart,
183*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       *UnnamedOp,
184*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       **Op)
185*385cc6b4SJerry Jelinek {
186*385cc6b4SJerry Jelinek     ACPI_STATUS             Status = AE_OK;
187*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       *Arg = NULL;
188*385cc6b4SJerry Jelinek 
189*385cc6b4SJerry Jelinek 
190*385cc6b4SJerry Jelinek     ACPI_FUNCTION_TRACE_PTR (PsBuildNamedOp, WalkState);
191*385cc6b4SJerry Jelinek 
192*385cc6b4SJerry Jelinek 
193*385cc6b4SJerry Jelinek     UnnamedOp->Common.Value.Arg = NULL;
194*385cc6b4SJerry Jelinek     UnnamedOp->Common.ArgListLength = 0;
195*385cc6b4SJerry Jelinek     UnnamedOp->Common.AmlOpcode = WalkState->Opcode;
196*385cc6b4SJerry Jelinek 
197*385cc6b4SJerry Jelinek     /*
198*385cc6b4SJerry Jelinek      * Get and append arguments until we find the node that contains
199*385cc6b4SJerry Jelinek      * the name (the type ARGP_NAME).
200*385cc6b4SJerry Jelinek      */
201*385cc6b4SJerry Jelinek     while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
202*385cc6b4SJerry Jelinek           (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
203*385cc6b4SJerry Jelinek     {
204*385cc6b4SJerry Jelinek         Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
205*385cc6b4SJerry Jelinek             GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
206*385cc6b4SJerry Jelinek         if (ACPI_FAILURE (Status))
207*385cc6b4SJerry Jelinek         {
208*385cc6b4SJerry Jelinek             return_ACPI_STATUS (Status);
209*385cc6b4SJerry Jelinek         }
210*385cc6b4SJerry Jelinek 
211*385cc6b4SJerry Jelinek         AcpiPsAppendArg (UnnamedOp, Arg);
212*385cc6b4SJerry Jelinek         INCREMENT_ARG_LIST (WalkState->ArgTypes);
213*385cc6b4SJerry Jelinek     }
214*385cc6b4SJerry Jelinek 
215*385cc6b4SJerry Jelinek     /*
216*385cc6b4SJerry Jelinek      * Make sure that we found a NAME and didn't run out of arguments
217*385cc6b4SJerry Jelinek      */
218*385cc6b4SJerry Jelinek     if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
219*385cc6b4SJerry Jelinek     {
220*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_AML_NO_OPERAND);
221*385cc6b4SJerry Jelinek     }
222*385cc6b4SJerry Jelinek 
223*385cc6b4SJerry Jelinek     /* We know that this arg is a name, move to next arg */
224*385cc6b4SJerry Jelinek 
225*385cc6b4SJerry Jelinek     INCREMENT_ARG_LIST (WalkState->ArgTypes);
226*385cc6b4SJerry Jelinek 
227*385cc6b4SJerry Jelinek     /*
228*385cc6b4SJerry Jelinek      * Find the object. This will either insert the object into
229*385cc6b4SJerry Jelinek      * the namespace or simply look it up
230*385cc6b4SJerry Jelinek      */
231*385cc6b4SJerry Jelinek     WalkState->Op = NULL;
232*385cc6b4SJerry Jelinek 
233*385cc6b4SJerry Jelinek     Status = WalkState->DescendingCallback (WalkState, Op);
234*385cc6b4SJerry Jelinek     if (ACPI_FAILURE (Status))
235*385cc6b4SJerry Jelinek     {
236*385cc6b4SJerry Jelinek         if (Status != AE_CTRL_TERMINATE)
237*385cc6b4SJerry Jelinek         {
238*385cc6b4SJerry Jelinek             ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog"));
239*385cc6b4SJerry Jelinek         }
240*385cc6b4SJerry Jelinek         return_ACPI_STATUS (Status);
241*385cc6b4SJerry Jelinek     }
242*385cc6b4SJerry Jelinek 
243*385cc6b4SJerry Jelinek     if (!*Op)
244*385cc6b4SJerry Jelinek     {
245*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
246*385cc6b4SJerry Jelinek     }
247*385cc6b4SJerry Jelinek 
248*385cc6b4SJerry Jelinek     Status = AcpiPsNextParseState (WalkState, *Op, Status);
249*385cc6b4SJerry Jelinek     if (ACPI_FAILURE (Status))
250*385cc6b4SJerry Jelinek     {
251*385cc6b4SJerry Jelinek         if (Status == AE_CTRL_PENDING)
252*385cc6b4SJerry Jelinek         {
253*385cc6b4SJerry Jelinek             Status = AE_CTRL_PARSE_PENDING;
254*385cc6b4SJerry Jelinek         }
255*385cc6b4SJerry Jelinek         return_ACPI_STATUS (Status);
256*385cc6b4SJerry Jelinek     }
257*385cc6b4SJerry Jelinek 
258*385cc6b4SJerry Jelinek     AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
259*385cc6b4SJerry Jelinek 
260*385cc6b4SJerry Jelinek     if ((*Op)->Common.AmlOpcode == AML_REGION_OP ||
261*385cc6b4SJerry Jelinek         (*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)
262*385cc6b4SJerry Jelinek     {
263*385cc6b4SJerry Jelinek         /*
264*385cc6b4SJerry Jelinek          * Defer final parsing of an OperationRegion body, because we don't
265*385cc6b4SJerry Jelinek          * have enough info in the first pass to parse it correctly (i.e.,
266*385cc6b4SJerry Jelinek          * there may be method calls within the TermArg elements of the body.)
267*385cc6b4SJerry Jelinek          *
268*385cc6b4SJerry Jelinek          * However, we must continue parsing because the opregion is not a
269*385cc6b4SJerry Jelinek          * standalone package -- we don't know where the end is at this point.
270*385cc6b4SJerry Jelinek          *
271*385cc6b4SJerry Jelinek          * (Length is unknown until parse of the body complete)
272*385cc6b4SJerry Jelinek          */
273*385cc6b4SJerry Jelinek         (*Op)->Named.Data = AmlOpStart;
274*385cc6b4SJerry Jelinek         (*Op)->Named.Length = 0;
275*385cc6b4SJerry Jelinek     }
276*385cc6b4SJerry Jelinek 
277*385cc6b4SJerry Jelinek     return_ACPI_STATUS (AE_OK);
278*385cc6b4SJerry Jelinek }
279*385cc6b4SJerry Jelinek 
280*385cc6b4SJerry Jelinek 
281*385cc6b4SJerry Jelinek /*******************************************************************************
282*385cc6b4SJerry Jelinek  *
283*385cc6b4SJerry Jelinek  * FUNCTION:    AcpiPsCreateOp
284*385cc6b4SJerry Jelinek  *
285*385cc6b4SJerry Jelinek  * PARAMETERS:  WalkState           - Current state
286*385cc6b4SJerry Jelinek  *              AmlOpStart          - Op start in AML
287*385cc6b4SJerry Jelinek  *              NewOp               - Returned Op
288*385cc6b4SJerry Jelinek  *
289*385cc6b4SJerry Jelinek  * RETURN:      Status
290*385cc6b4SJerry Jelinek  *
291*385cc6b4SJerry Jelinek  * DESCRIPTION: Get Op from AML
292*385cc6b4SJerry Jelinek  *
293*385cc6b4SJerry Jelinek  ******************************************************************************/
294*385cc6b4SJerry Jelinek 
295*385cc6b4SJerry Jelinek ACPI_STATUS
296*385cc6b4SJerry Jelinek AcpiPsCreateOp (
297*385cc6b4SJerry Jelinek     ACPI_WALK_STATE         *WalkState,
298*385cc6b4SJerry Jelinek     UINT8                   *AmlOpStart,
299*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       **NewOp)
300*385cc6b4SJerry Jelinek {
301*385cc6b4SJerry Jelinek     ACPI_STATUS             Status = AE_OK;
302*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       *Op;
303*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       *NamedOp = NULL;
304*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       *ParentScope;
305*385cc6b4SJerry Jelinek     UINT8                   ArgumentCount;
306*385cc6b4SJerry Jelinek     const ACPI_OPCODE_INFO  *OpInfo;
307*385cc6b4SJerry Jelinek 
308*385cc6b4SJerry Jelinek 
309*385cc6b4SJerry Jelinek     ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState);
310*385cc6b4SJerry Jelinek 
311*385cc6b4SJerry Jelinek 
312*385cc6b4SJerry Jelinek     Status = AcpiPsGetAmlOpcode (WalkState);
313*385cc6b4SJerry Jelinek     if (Status == AE_CTRL_PARSE_CONTINUE)
314*385cc6b4SJerry Jelinek     {
315*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
316*385cc6b4SJerry Jelinek     }
317*385cc6b4SJerry Jelinek 
318*385cc6b4SJerry Jelinek     /* Create Op structure and append to parent's argument list */
319*385cc6b4SJerry Jelinek 
320*385cc6b4SJerry Jelinek     WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
321*385cc6b4SJerry Jelinek     Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart);
322*385cc6b4SJerry Jelinek     if (!Op)
323*385cc6b4SJerry Jelinek     {
324*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_NO_MEMORY);
325*385cc6b4SJerry Jelinek     }
326*385cc6b4SJerry Jelinek 
327*385cc6b4SJerry Jelinek     if (WalkState->OpInfo->Flags & AML_NAMED)
328*385cc6b4SJerry Jelinek     {
329*385cc6b4SJerry Jelinek         Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);
330*385cc6b4SJerry Jelinek         AcpiPsFreeOp (Op);
331*385cc6b4SJerry Jelinek         if (ACPI_FAILURE (Status))
332*385cc6b4SJerry Jelinek         {
333*385cc6b4SJerry Jelinek             return_ACPI_STATUS (Status);
334*385cc6b4SJerry Jelinek         }
335*385cc6b4SJerry Jelinek 
336*385cc6b4SJerry Jelinek         *NewOp = NamedOp;
337*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_OK);
338*385cc6b4SJerry Jelinek     }
339*385cc6b4SJerry Jelinek 
340*385cc6b4SJerry Jelinek     /* Not a named opcode, just allocate Op and append to parent */
341*385cc6b4SJerry Jelinek 
342*385cc6b4SJerry Jelinek     if (WalkState->OpInfo->Flags & AML_CREATE)
343*385cc6b4SJerry Jelinek     {
344*385cc6b4SJerry Jelinek         /*
345*385cc6b4SJerry Jelinek          * Backup to beginning of CreateXXXfield declaration
346*385cc6b4SJerry Jelinek          * BodyLength is unknown until we parse the body
347*385cc6b4SJerry Jelinek          */
348*385cc6b4SJerry Jelinek         Op->Named.Data = AmlOpStart;
349*385cc6b4SJerry Jelinek         Op->Named.Length = 0;
350*385cc6b4SJerry Jelinek     }
351*385cc6b4SJerry Jelinek 
352*385cc6b4SJerry Jelinek     if (WalkState->Opcode == AML_BANK_FIELD_OP)
353*385cc6b4SJerry Jelinek     {
354*385cc6b4SJerry Jelinek         /*
355*385cc6b4SJerry Jelinek          * Backup to beginning of BankField declaration
356*385cc6b4SJerry Jelinek          * BodyLength is unknown until we parse the body
357*385cc6b4SJerry Jelinek          */
358*385cc6b4SJerry Jelinek         Op->Named.Data = AmlOpStart;
359*385cc6b4SJerry Jelinek         Op->Named.Length = 0;
360*385cc6b4SJerry Jelinek     }
361*385cc6b4SJerry Jelinek 
362*385cc6b4SJerry Jelinek     ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState));
363*385cc6b4SJerry Jelinek     AcpiPsAppendArg (ParentScope, Op);
364*385cc6b4SJerry Jelinek 
365*385cc6b4SJerry Jelinek     if (ParentScope)
366*385cc6b4SJerry Jelinek     {
367*385cc6b4SJerry Jelinek         OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode);
368*385cc6b4SJerry Jelinek         if (OpInfo->Flags & AML_HAS_TARGET)
369*385cc6b4SJerry Jelinek         {
370*385cc6b4SJerry Jelinek             ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type);
371*385cc6b4SJerry Jelinek             if (ParentScope->Common.ArgListLength > ArgumentCount)
372*385cc6b4SJerry Jelinek             {
373*385cc6b4SJerry Jelinek                 Op->Common.Flags |= ACPI_PARSEOP_TARGET;
374*385cc6b4SJerry Jelinek             }
375*385cc6b4SJerry Jelinek         }
376*385cc6b4SJerry Jelinek         else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP)
377*385cc6b4SJerry Jelinek         {
378*385cc6b4SJerry Jelinek             Op->Common.Flags |= ACPI_PARSEOP_TARGET;
379*385cc6b4SJerry Jelinek         }
380*385cc6b4SJerry Jelinek     }
381*385cc6b4SJerry Jelinek 
382*385cc6b4SJerry Jelinek     if (WalkState->DescendingCallback != NULL)
383*385cc6b4SJerry Jelinek     {
384*385cc6b4SJerry Jelinek         /*
385*385cc6b4SJerry Jelinek          * Find the object. This will either insert the object into
386*385cc6b4SJerry Jelinek          * the namespace or simply look it up
387*385cc6b4SJerry Jelinek          */
388*385cc6b4SJerry Jelinek         WalkState->Op = *NewOp = Op;
389*385cc6b4SJerry Jelinek 
390*385cc6b4SJerry Jelinek         Status = WalkState->DescendingCallback (WalkState, &Op);
391*385cc6b4SJerry Jelinek         Status = AcpiPsNextParseState (WalkState, Op, Status);
392*385cc6b4SJerry Jelinek         if (Status == AE_CTRL_PENDING)
393*385cc6b4SJerry Jelinek         {
394*385cc6b4SJerry Jelinek             Status = AE_CTRL_PARSE_PENDING;
395*385cc6b4SJerry Jelinek         }
396*385cc6b4SJerry Jelinek     }
397*385cc6b4SJerry Jelinek 
398*385cc6b4SJerry Jelinek     return_ACPI_STATUS (Status);
399*385cc6b4SJerry Jelinek }
400*385cc6b4SJerry Jelinek 
401*385cc6b4SJerry Jelinek 
402*385cc6b4SJerry Jelinek /*******************************************************************************
403*385cc6b4SJerry Jelinek  *
404*385cc6b4SJerry Jelinek  * FUNCTION:    AcpiPsCompleteOp
405*385cc6b4SJerry Jelinek  *
406*385cc6b4SJerry Jelinek  * PARAMETERS:  WalkState           - Current state
407*385cc6b4SJerry Jelinek  *              Op                  - Returned Op
408*385cc6b4SJerry Jelinek  *              Status              - Parse status before complete Op
409*385cc6b4SJerry Jelinek  *
410*385cc6b4SJerry Jelinek  * RETURN:      Status
411*385cc6b4SJerry Jelinek  *
412*385cc6b4SJerry Jelinek  * DESCRIPTION: Complete Op
413*385cc6b4SJerry Jelinek  *
414*385cc6b4SJerry Jelinek  ******************************************************************************/
415*385cc6b4SJerry Jelinek 
416*385cc6b4SJerry Jelinek ACPI_STATUS
417*385cc6b4SJerry Jelinek AcpiPsCompleteOp (
418*385cc6b4SJerry Jelinek     ACPI_WALK_STATE         *WalkState,
419*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       **Op,
420*385cc6b4SJerry Jelinek     ACPI_STATUS             Status)
421*385cc6b4SJerry Jelinek {
422*385cc6b4SJerry Jelinek     ACPI_STATUS             Status2;
423*385cc6b4SJerry Jelinek 
424*385cc6b4SJerry Jelinek 
425*385cc6b4SJerry Jelinek     ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState);
426*385cc6b4SJerry Jelinek 
427*385cc6b4SJerry Jelinek 
428*385cc6b4SJerry Jelinek     /*
429*385cc6b4SJerry Jelinek      * Finished one argument of the containing scope
430*385cc6b4SJerry Jelinek      */
431*385cc6b4SJerry Jelinek     WalkState->ParserState.Scope->ParseScope.ArgCount--;
432*385cc6b4SJerry Jelinek 
433*385cc6b4SJerry Jelinek     /* Close this Op (will result in parse subtree deletion) */
434*385cc6b4SJerry Jelinek 
435*385cc6b4SJerry Jelinek     Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
436*385cc6b4SJerry Jelinek     if (ACPI_FAILURE (Status2))
437*385cc6b4SJerry Jelinek     {
438*385cc6b4SJerry Jelinek         return_ACPI_STATUS (Status2);
439*385cc6b4SJerry Jelinek     }
440*385cc6b4SJerry Jelinek 
441*385cc6b4SJerry Jelinek     *Op = NULL;
442*385cc6b4SJerry Jelinek 
443*385cc6b4SJerry Jelinek     switch (Status)
444*385cc6b4SJerry Jelinek     {
445*385cc6b4SJerry Jelinek     case AE_OK:
446*385cc6b4SJerry Jelinek 
447*385cc6b4SJerry Jelinek         break;
448*385cc6b4SJerry Jelinek 
449*385cc6b4SJerry Jelinek     case AE_CTRL_TRANSFER:
450*385cc6b4SJerry Jelinek 
451*385cc6b4SJerry Jelinek         /* We are about to transfer to a called method */
452*385cc6b4SJerry Jelinek 
453*385cc6b4SJerry Jelinek         WalkState->PrevOp = NULL;
454*385cc6b4SJerry Jelinek         WalkState->PrevArgTypes = WalkState->ArgTypes;
455*385cc6b4SJerry Jelinek         return_ACPI_STATUS (Status);
456*385cc6b4SJerry Jelinek 
457*385cc6b4SJerry Jelinek     case AE_CTRL_END:
458*385cc6b4SJerry Jelinek 
459*385cc6b4SJerry Jelinek         AcpiPsPopScope (&(WalkState->ParserState), Op,
460*385cc6b4SJerry Jelinek             &WalkState->ArgTypes, &WalkState->ArgCount);
461*385cc6b4SJerry Jelinek 
462*385cc6b4SJerry Jelinek         if (*Op)
463*385cc6b4SJerry Jelinek         {
464*385cc6b4SJerry Jelinek             WalkState->Op = *Op;
465*385cc6b4SJerry Jelinek             WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
466*385cc6b4SJerry Jelinek             WalkState->Opcode = (*Op)->Common.AmlOpcode;
467*385cc6b4SJerry Jelinek 
468*385cc6b4SJerry Jelinek             Status = WalkState->AscendingCallback (WalkState);
469*385cc6b4SJerry Jelinek             Status = AcpiPsNextParseState (WalkState, *Op, Status);
470*385cc6b4SJerry Jelinek 
471*385cc6b4SJerry Jelinek             Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
472*385cc6b4SJerry Jelinek             if (ACPI_FAILURE (Status2))
473*385cc6b4SJerry Jelinek             {
474*385cc6b4SJerry Jelinek                 return_ACPI_STATUS (Status2);
475*385cc6b4SJerry Jelinek             }
476*385cc6b4SJerry Jelinek         }
477*385cc6b4SJerry Jelinek 
478*385cc6b4SJerry Jelinek         Status = AE_OK;
479*385cc6b4SJerry Jelinek         break;
480*385cc6b4SJerry Jelinek 
481*385cc6b4SJerry Jelinek     case AE_CTRL_BREAK:
482*385cc6b4SJerry Jelinek     case AE_CTRL_CONTINUE:
483*385cc6b4SJerry Jelinek 
484*385cc6b4SJerry Jelinek         /* Pop off scopes until we find the While */
485*385cc6b4SJerry Jelinek 
486*385cc6b4SJerry Jelinek         while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP))
487*385cc6b4SJerry Jelinek         {
488*385cc6b4SJerry Jelinek             AcpiPsPopScope (&(WalkState->ParserState), Op,
489*385cc6b4SJerry Jelinek                 &WalkState->ArgTypes, &WalkState->ArgCount);
490*385cc6b4SJerry Jelinek         }
491*385cc6b4SJerry Jelinek 
492*385cc6b4SJerry Jelinek         /* Close this iteration of the While loop */
493*385cc6b4SJerry Jelinek 
494*385cc6b4SJerry Jelinek         WalkState->Op = *Op;
495*385cc6b4SJerry Jelinek         WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
496*385cc6b4SJerry Jelinek         WalkState->Opcode = (*Op)->Common.AmlOpcode;
497*385cc6b4SJerry Jelinek 
498*385cc6b4SJerry Jelinek         Status = WalkState->AscendingCallback (WalkState);
499*385cc6b4SJerry Jelinek         Status = AcpiPsNextParseState (WalkState, *Op, Status);
500*385cc6b4SJerry Jelinek 
501*385cc6b4SJerry Jelinek         Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
502*385cc6b4SJerry Jelinek         if (ACPI_FAILURE (Status2))
503*385cc6b4SJerry Jelinek         {
504*385cc6b4SJerry Jelinek             return_ACPI_STATUS (Status2);
505*385cc6b4SJerry Jelinek         }
506*385cc6b4SJerry Jelinek 
507*385cc6b4SJerry Jelinek         Status = AE_OK;
508*385cc6b4SJerry Jelinek         break;
509*385cc6b4SJerry Jelinek 
510*385cc6b4SJerry Jelinek     case AE_CTRL_TERMINATE:
511*385cc6b4SJerry Jelinek 
512*385cc6b4SJerry Jelinek         /* Clean up */
513*385cc6b4SJerry Jelinek         do
514*385cc6b4SJerry Jelinek         {
515*385cc6b4SJerry Jelinek             if (*Op)
516*385cc6b4SJerry Jelinek             {
517*385cc6b4SJerry Jelinek                 Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
518*385cc6b4SJerry Jelinek                 if (ACPI_FAILURE (Status2))
519*385cc6b4SJerry Jelinek                 {
520*385cc6b4SJerry Jelinek                     return_ACPI_STATUS (Status2);
521*385cc6b4SJerry Jelinek                 }
522*385cc6b4SJerry Jelinek 
523*385cc6b4SJerry Jelinek                 AcpiUtDeleteGenericState (
524*385cc6b4SJerry Jelinek                     AcpiUtPopGenericState (&WalkState->ControlState));
525*385cc6b4SJerry Jelinek             }
526*385cc6b4SJerry Jelinek 
527*385cc6b4SJerry Jelinek             AcpiPsPopScope (&(WalkState->ParserState), Op,
528*385cc6b4SJerry Jelinek                 &WalkState->ArgTypes, &WalkState->ArgCount);
529*385cc6b4SJerry Jelinek 
530*385cc6b4SJerry Jelinek         } while (*Op);
531*385cc6b4SJerry Jelinek 
532*385cc6b4SJerry Jelinek         return_ACPI_STATUS (AE_OK);
533*385cc6b4SJerry Jelinek 
534*385cc6b4SJerry Jelinek     default:  /* All other non-AE_OK status */
535*385cc6b4SJerry Jelinek 
536*385cc6b4SJerry Jelinek         do
537*385cc6b4SJerry Jelinek         {
538*385cc6b4SJerry Jelinek             if (*Op)
539*385cc6b4SJerry Jelinek             {
540*385cc6b4SJerry Jelinek                 Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
541*385cc6b4SJerry Jelinek                 if (ACPI_FAILURE (Status2))
542*385cc6b4SJerry Jelinek                 {
543*385cc6b4SJerry Jelinek                     return_ACPI_STATUS (Status2);
544*385cc6b4SJerry Jelinek                 }
545*385cc6b4SJerry Jelinek             }
546*385cc6b4SJerry Jelinek 
547*385cc6b4SJerry Jelinek             AcpiPsPopScope (&(WalkState->ParserState), Op,
548*385cc6b4SJerry Jelinek                 &WalkState->ArgTypes, &WalkState->ArgCount);
549*385cc6b4SJerry Jelinek 
550*385cc6b4SJerry Jelinek         } while (*Op);
551*385cc6b4SJerry Jelinek 
552*385cc6b4SJerry Jelinek 
553*385cc6b4SJerry Jelinek #if 0
554*385cc6b4SJerry Jelinek         /*
555*385cc6b4SJerry Jelinek          * TBD: Cleanup parse ops on error
556*385cc6b4SJerry Jelinek          */
557*385cc6b4SJerry Jelinek         if (*Op == NULL)
558*385cc6b4SJerry Jelinek         {
559*385cc6b4SJerry Jelinek             AcpiPsPopScope (ParserState, Op,
560*385cc6b4SJerry Jelinek                 &WalkState->ArgTypes, &WalkState->ArgCount);
561*385cc6b4SJerry Jelinek         }
562*385cc6b4SJerry Jelinek #endif
563*385cc6b4SJerry Jelinek         WalkState->PrevOp = NULL;
564*385cc6b4SJerry Jelinek         WalkState->PrevArgTypes = WalkState->ArgTypes;
565*385cc6b4SJerry Jelinek         return_ACPI_STATUS (Status);
566*385cc6b4SJerry Jelinek     }
567*385cc6b4SJerry Jelinek 
568*385cc6b4SJerry Jelinek     /* This scope complete? */
569*385cc6b4SJerry Jelinek 
570*385cc6b4SJerry Jelinek     if (AcpiPsHasCompletedScope (&(WalkState->ParserState)))
571*385cc6b4SJerry Jelinek     {
572*385cc6b4SJerry Jelinek         AcpiPsPopScope (&(WalkState->ParserState), Op,
573*385cc6b4SJerry Jelinek             &WalkState->ArgTypes, &WalkState->ArgCount);
574*385cc6b4SJerry Jelinek         ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *Op));
575*385cc6b4SJerry Jelinek     }
576*385cc6b4SJerry Jelinek     else
577*385cc6b4SJerry Jelinek     {
578*385cc6b4SJerry Jelinek         *Op = NULL;
579*385cc6b4SJerry Jelinek     }
580*385cc6b4SJerry Jelinek 
581*385cc6b4SJerry Jelinek     return_ACPI_STATUS (AE_OK);
582*385cc6b4SJerry Jelinek }
583*385cc6b4SJerry Jelinek 
584*385cc6b4SJerry Jelinek 
585*385cc6b4SJerry Jelinek /*******************************************************************************
586*385cc6b4SJerry Jelinek  *
587*385cc6b4SJerry Jelinek  * FUNCTION:    AcpiPsCompleteFinalOp
588*385cc6b4SJerry Jelinek  *
589*385cc6b4SJerry Jelinek  * PARAMETERS:  WalkState           - Current state
590*385cc6b4SJerry Jelinek  *              Op                  - Current Op
591*385cc6b4SJerry Jelinek  *              Status              - Current parse status before complete last
592*385cc6b4SJerry Jelinek  *                                    Op
593*385cc6b4SJerry Jelinek  *
594*385cc6b4SJerry Jelinek  * RETURN:      Status
595*385cc6b4SJerry Jelinek  *
596*385cc6b4SJerry Jelinek  * DESCRIPTION: Complete last Op.
597*385cc6b4SJerry Jelinek  *
598*385cc6b4SJerry Jelinek  ******************************************************************************/
599*385cc6b4SJerry Jelinek 
600*385cc6b4SJerry Jelinek ACPI_STATUS
601*385cc6b4SJerry Jelinek AcpiPsCompleteFinalOp (
602*385cc6b4SJerry Jelinek     ACPI_WALK_STATE         *WalkState,
603*385cc6b4SJerry Jelinek     ACPI_PARSE_OBJECT       *Op,
604*385cc6b4SJerry Jelinek     ACPI_STATUS             Status)
605*385cc6b4SJerry Jelinek {
606*385cc6b4SJerry Jelinek     ACPI_STATUS             Status2;
607*385cc6b4SJerry Jelinek 
608*385cc6b4SJerry Jelinek 
609*385cc6b4SJerry Jelinek     ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState);
610*385cc6b4SJerry Jelinek 
611*385cc6b4SJerry Jelinek 
612*385cc6b4SJerry Jelinek     /*
613*385cc6b4SJerry Jelinek      * Complete the last Op (if not completed), and clear the scope stack.
614*385cc6b4SJerry Jelinek      * It is easily possible to end an AML "package" with an unbounded number
615*385cc6b4SJerry Jelinek      * of open scopes (such as when several ASL blocks are closed with
616*385cc6b4SJerry Jelinek      * sequential closing braces). We want to terminate each one cleanly.
617*385cc6b4SJerry Jelinek      */
618*385cc6b4SJerry Jelinek     ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
619*385cc6b4SJerry Jelinek     do
620*385cc6b4SJerry Jelinek     {
621*385cc6b4SJerry Jelinek         if (Op)
622*385cc6b4SJerry Jelinek         {
623*385cc6b4SJerry Jelinek             if (WalkState->AscendingCallback != NULL)
624*385cc6b4SJerry Jelinek             {
625*385cc6b4SJerry Jelinek                 WalkState->Op = Op;
626*385cc6b4SJerry Jelinek                 WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
627*385cc6b4SJerry Jelinek                 WalkState->Opcode = Op->Common.AmlOpcode;
628*385cc6b4SJerry Jelinek 
629*385cc6b4SJerry Jelinek                 Status = WalkState->AscendingCallback (WalkState);
630*385cc6b4SJerry Jelinek                 Status = AcpiPsNextParseState (WalkState, Op, Status);
631*385cc6b4SJerry Jelinek                 if (Status == AE_CTRL_PENDING)
632*385cc6b4SJerry Jelinek                 {
633*385cc6b4SJerry Jelinek                     Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK);
634*385cc6b4SJerry Jelinek                     if (ACPI_FAILURE (Status))
635*385cc6b4SJerry Jelinek                     {
636*385cc6b4SJerry Jelinek                         return_ACPI_STATUS (Status);
637*385cc6b4SJerry Jelinek                     }
638*385cc6b4SJerry Jelinek                 }
639*385cc6b4SJerry Jelinek 
640*385cc6b4SJerry Jelinek                 if (Status == AE_CTRL_TERMINATE)
641*385cc6b4SJerry Jelinek                 {
642*385cc6b4SJerry Jelinek                     Status = AE_OK;
643*385cc6b4SJerry Jelinek 
644*385cc6b4SJerry Jelinek                     /* Clean up */
645*385cc6b4SJerry Jelinek                     do
646*385cc6b4SJerry Jelinek                     {
647*385cc6b4SJerry Jelinek                         if (Op)
648*385cc6b4SJerry Jelinek                         {
649*385cc6b4SJerry Jelinek                             Status2 = AcpiPsCompleteThisOp (WalkState, Op);
650*385cc6b4SJerry Jelinek                             if (ACPI_FAILURE (Status2))
651*385cc6b4SJerry Jelinek                             {
652*385cc6b4SJerry Jelinek                                 return_ACPI_STATUS (Status2);
653*385cc6b4SJerry Jelinek                             }
654*385cc6b4SJerry Jelinek                         }
655*385cc6b4SJerry Jelinek 
656*385cc6b4SJerry Jelinek                         AcpiPsPopScope (&(WalkState->ParserState), &Op,
657*385cc6b4SJerry Jelinek                             &WalkState->ArgTypes, &WalkState->ArgCount);
658*385cc6b4SJerry Jelinek 
659*385cc6b4SJerry Jelinek                     } while (Op);
660*385cc6b4SJerry Jelinek 
661*385cc6b4SJerry Jelinek                     return_ACPI_STATUS (Status);
662*385cc6b4SJerry Jelinek                 }
663*385cc6b4SJerry Jelinek 
664*385cc6b4SJerry Jelinek                 else if (ACPI_FAILURE (Status))
665*385cc6b4SJerry Jelinek                 {
666*385cc6b4SJerry Jelinek                     /* First error is most important */
667*385cc6b4SJerry Jelinek 
668*385cc6b4SJerry Jelinek                     (void) AcpiPsCompleteThisOp (WalkState, Op);
669*385cc6b4SJerry Jelinek                     return_ACPI_STATUS (Status);
670*385cc6b4SJerry Jelinek                 }
671*385cc6b4SJerry Jelinek             }
672*385cc6b4SJerry Jelinek 
673*385cc6b4SJerry Jelinek             Status2 = AcpiPsCompleteThisOp (WalkState, Op);
674*385cc6b4SJerry Jelinek             if (ACPI_FAILURE (Status2))
675*385cc6b4SJerry Jelinek             {
676*385cc6b4SJerry Jelinek                 return_ACPI_STATUS (Status2);
677*385cc6b4SJerry Jelinek             }
678*385cc6b4SJerry Jelinek         }
679*385cc6b4SJerry Jelinek 
680*385cc6b4SJerry Jelinek         AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes,
681*385cc6b4SJerry Jelinek             &WalkState->ArgCount);
682*385cc6b4SJerry Jelinek 
683*385cc6b4SJerry Jelinek     } while (Op);
684*385cc6b4SJerry Jelinek 
685*385cc6b4SJerry Jelinek     return_ACPI_STATUS (Status);
686*385cc6b4SJerry Jelinek }
687