dswexec.c revision 1.1.1.2.2.2 1 1.1.1.2.2.2 bouyer /******************************************************************************
2 1.1.1.2.2.2 bouyer *
3 1.1.1.2.2.2 bouyer * Module Name: dswexec - Dispatcher method execution callbacks;
4 1.1.1.2.2.2 bouyer * dispatch to interpreter.
5 1.1.1.2.2.2 bouyer *
6 1.1.1.2.2.2 bouyer *****************************************************************************/
7 1.1.1.2.2.2 bouyer
8 1.1.1.2.2.2 bouyer /*
9 1.1.1.2.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
10 1.1.1.2.2.2 bouyer * All rights reserved.
11 1.1.1.2.2.2 bouyer *
12 1.1.1.2.2.2 bouyer * Redistribution and use in source and binary forms, with or without
13 1.1.1.2.2.2 bouyer * modification, are permitted provided that the following conditions
14 1.1.1.2.2.2 bouyer * are met:
15 1.1.1.2.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
16 1.1.1.2.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
17 1.1.1.2.2.2 bouyer * without modification.
18 1.1.1.2.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.1.1.2.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
20 1.1.1.2.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
21 1.1.1.2.2.2 bouyer * including a substantially similar Disclaimer requirement for further
22 1.1.1.2.2.2 bouyer * binary redistribution.
23 1.1.1.2.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
24 1.1.1.2.2.2 bouyer * of any contributors may be used to endorse or promote products derived
25 1.1.1.2.2.2 bouyer * from this software without specific prior written permission.
26 1.1.1.2.2.2 bouyer *
27 1.1.1.2.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
28 1.1.1.2.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
29 1.1.1.2.2.2 bouyer * Software Foundation.
30 1.1.1.2.2.2 bouyer *
31 1.1.1.2.2.2 bouyer * NO WARRANTY
32 1.1.1.2.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.1.1.2.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.1.1.2.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.1.1.2.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.1.1.2.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.1.1.2.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.1.1.2.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.1.1.2.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.1.1.2.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.1.1.2.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.1.1.2.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
43 1.1.1.2.2.2 bouyer */
44 1.1.1.2.2.2 bouyer
45 1.1.1.2.2.2 bouyer #define __DSWEXEC_C__
46 1.1.1.2.2.2 bouyer
47 1.1.1.2.2.2 bouyer #include "acpi.h"
48 1.1.1.2.2.2 bouyer #include "accommon.h"
49 1.1.1.2.2.2 bouyer #include "acparser.h"
50 1.1.1.2.2.2 bouyer #include "amlcode.h"
51 1.1.1.2.2.2 bouyer #include "acdispat.h"
52 1.1.1.2.2.2 bouyer #include "acinterp.h"
53 1.1.1.2.2.2 bouyer #include "acnamesp.h"
54 1.1.1.2.2.2 bouyer #include "acdebug.h"
55 1.1.1.2.2.2 bouyer
56 1.1.1.2.2.2 bouyer
57 1.1.1.2.2.2 bouyer #define _COMPONENT ACPI_DISPATCHER
58 1.1.1.2.2.2 bouyer ACPI_MODULE_NAME ("dswexec")
59 1.1.1.2.2.2 bouyer
60 1.1.1.2.2.2 bouyer /*
61 1.1.1.2.2.2 bouyer * Dispatch table for opcode classes
62 1.1.1.2.2.2 bouyer */
63 1.1.1.2.2.2 bouyer static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] =
64 1.1.1.2.2.2 bouyer {
65 1.1.1.2.2.2 bouyer AcpiExOpcode_0A_0T_1R,
66 1.1.1.2.2.2 bouyer AcpiExOpcode_1A_0T_0R,
67 1.1.1.2.2.2 bouyer AcpiExOpcode_1A_0T_1R,
68 1.1.1.2.2.2 bouyer AcpiExOpcode_1A_1T_0R,
69 1.1.1.2.2.2 bouyer AcpiExOpcode_1A_1T_1R,
70 1.1.1.2.2.2 bouyer AcpiExOpcode_2A_0T_0R,
71 1.1.1.2.2.2 bouyer AcpiExOpcode_2A_0T_1R,
72 1.1.1.2.2.2 bouyer AcpiExOpcode_2A_1T_1R,
73 1.1.1.2.2.2 bouyer AcpiExOpcode_2A_2T_1R,
74 1.1.1.2.2.2 bouyer AcpiExOpcode_3A_0T_0R,
75 1.1.1.2.2.2 bouyer AcpiExOpcode_3A_1T_1R,
76 1.1.1.2.2.2 bouyer AcpiExOpcode_6A_0T_1R
77 1.1.1.2.2.2 bouyer };
78 1.1.1.2.2.2 bouyer
79 1.1.1.2.2.2 bouyer
80 1.1.1.2.2.2 bouyer /*****************************************************************************
81 1.1.1.2.2.2 bouyer *
82 1.1.1.2.2.2 bouyer * FUNCTION: AcpiDsGetPredicateValue
83 1.1.1.2.2.2 bouyer *
84 1.1.1.2.2.2 bouyer * PARAMETERS: WalkState - Current state of the parse tree walk
85 1.1.1.2.2.2 bouyer * ResultObj - if non-zero, pop result from result stack
86 1.1.1.2.2.2 bouyer *
87 1.1.1.2.2.2 bouyer * RETURN: Status
88 1.1.1.2.2.2 bouyer *
89 1.1.1.2.2.2 bouyer * DESCRIPTION: Get the result of a predicate evaluation
90 1.1.1.2.2.2 bouyer *
91 1.1.1.2.2.2 bouyer ****************************************************************************/
92 1.1.1.2.2.2 bouyer
93 1.1.1.2.2.2 bouyer ACPI_STATUS
94 1.1.1.2.2.2 bouyer AcpiDsGetPredicateValue (
95 1.1.1.2.2.2 bouyer ACPI_WALK_STATE *WalkState,
96 1.1.1.2.2.2 bouyer ACPI_OPERAND_OBJECT *ResultObj)
97 1.1.1.2.2.2 bouyer {
98 1.1.1.2.2.2 bouyer ACPI_STATUS Status = AE_OK;
99 1.1.1.2.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc;
100 1.1.1.2.2.2 bouyer ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
101 1.1.1.2.2.2 bouyer
102 1.1.1.2.2.2 bouyer
103 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
104 1.1.1.2.2.2 bouyer
105 1.1.1.2.2.2 bouyer
106 1.1.1.2.2.2 bouyer WalkState->ControlState->Common.State = 0;
107 1.1.1.2.2.2 bouyer
108 1.1.1.2.2.2 bouyer if (ResultObj)
109 1.1.1.2.2.2 bouyer {
110 1.1.1.2.2.2 bouyer Status = AcpiDsResultPop (&ObjDesc, WalkState);
111 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
112 1.1.1.2.2.2 bouyer {
113 1.1.1.2.2.2 bouyer ACPI_EXCEPTION ((AE_INFO, Status,
114 1.1.1.2.2.2 bouyer "Could not get result from predicate evaluation"));
115 1.1.1.2.2.2 bouyer
116 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
117 1.1.1.2.2.2 bouyer }
118 1.1.1.2.2.2 bouyer }
119 1.1.1.2.2.2 bouyer else
120 1.1.1.2.2.2 bouyer {
121 1.1.1.2.2.2 bouyer Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
122 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
123 1.1.1.2.2.2 bouyer {
124 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
125 1.1.1.2.2.2 bouyer }
126 1.1.1.2.2.2 bouyer
127 1.1.1.2.2.2 bouyer Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
128 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
129 1.1.1.2.2.2 bouyer {
130 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
131 1.1.1.2.2.2 bouyer }
132 1.1.1.2.2.2 bouyer
133 1.1.1.2.2.2 bouyer ObjDesc = WalkState->Operands [0];
134 1.1.1.2.2.2 bouyer }
135 1.1.1.2.2.2 bouyer
136 1.1.1.2.2.2 bouyer if (!ObjDesc)
137 1.1.1.2.2.2 bouyer {
138 1.1.1.2.2.2 bouyer ACPI_ERROR ((AE_INFO,
139 1.1.1.2.2.2 bouyer "No predicate ObjDesc=%p State=%p",
140 1.1.1.2.2.2 bouyer ObjDesc, WalkState));
141 1.1.1.2.2.2 bouyer
142 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_AML_NO_OPERAND);
143 1.1.1.2.2.2 bouyer }
144 1.1.1.2.2.2 bouyer
145 1.1.1.2.2.2 bouyer /*
146 1.1.1.2.2.2 bouyer * Result of predicate evaluation must be an Integer
147 1.1.1.2.2.2 bouyer * object. Implicitly convert the argument if necessary.
148 1.1.1.2.2.2 bouyer */
149 1.1.1.2.2.2 bouyer Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16);
150 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
151 1.1.1.2.2.2 bouyer {
152 1.1.1.2.2.2 bouyer goto Cleanup;
153 1.1.1.2.2.2 bouyer }
154 1.1.1.2.2.2 bouyer
155 1.1.1.2.2.2 bouyer if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
156 1.1.1.2.2.2 bouyer {
157 1.1.1.2.2.2 bouyer ACPI_ERROR ((AE_INFO,
158 1.1.1.2.2.2 bouyer "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
159 1.1.1.2.2.2 bouyer ObjDesc, WalkState, ObjDesc->Common.Type));
160 1.1.1.2.2.2 bouyer
161 1.1.1.2.2.2 bouyer Status = AE_AML_OPERAND_TYPE;
162 1.1.1.2.2.2 bouyer goto Cleanup;
163 1.1.1.2.2.2 bouyer }
164 1.1.1.2.2.2 bouyer
165 1.1.1.2.2.2 bouyer /* Truncate the predicate to 32-bits if necessary */
166 1.1.1.2.2.2 bouyer
167 1.1.1.2.2.2 bouyer AcpiExTruncateFor32bitTable (LocalObjDesc);
168 1.1.1.2.2.2 bouyer
169 1.1.1.2.2.2 bouyer /*
170 1.1.1.2.2.2 bouyer * Save the result of the predicate evaluation on
171 1.1.1.2.2.2 bouyer * the control stack
172 1.1.1.2.2.2 bouyer */
173 1.1.1.2.2.2 bouyer if (LocalObjDesc->Integer.Value)
174 1.1.1.2.2.2 bouyer {
175 1.1.1.2.2.2 bouyer WalkState->ControlState->Common.Value = TRUE;
176 1.1.1.2.2.2 bouyer }
177 1.1.1.2.2.2 bouyer else
178 1.1.1.2.2.2 bouyer {
179 1.1.1.2.2.2 bouyer /*
180 1.1.1.2.2.2 bouyer * Predicate is FALSE, we will just toss the
181 1.1.1.2.2.2 bouyer * rest of the package
182 1.1.1.2.2.2 bouyer */
183 1.1.1.2.2.2 bouyer WalkState->ControlState->Common.Value = FALSE;
184 1.1.1.2.2.2 bouyer Status = AE_CTRL_FALSE;
185 1.1.1.2.2.2 bouyer }
186 1.1.1.2.2.2 bouyer
187 1.1.1.2.2.2 bouyer /* Predicate can be used for an implicit return value */
188 1.1.1.2.2.2 bouyer
189 1.1.1.2.2.2 bouyer (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
190 1.1.1.2.2.2 bouyer
191 1.1.1.2.2.2 bouyer
192 1.1.1.2.2.2 bouyer Cleanup:
193 1.1.1.2.2.2 bouyer
194 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
195 1.1.1.2.2.2 bouyer WalkState->ControlState->Common.Value, WalkState->Op));
196 1.1.1.2.2.2 bouyer
197 1.1.1.2.2.2 bouyer /* Break to debugger to display result */
198 1.1.1.2.2.2 bouyer
199 1.1.1.2.2.2 bouyer ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState));
200 1.1.1.2.2.2 bouyer
201 1.1.1.2.2.2 bouyer /*
202 1.1.1.2.2.2 bouyer * Delete the predicate result object (we know that
203 1.1.1.2.2.2 bouyer * we don't need it anymore)
204 1.1.1.2.2.2 bouyer */
205 1.1.1.2.2.2 bouyer if (LocalObjDesc != ObjDesc)
206 1.1.1.2.2.2 bouyer {
207 1.1.1.2.2.2 bouyer AcpiUtRemoveReference (LocalObjDesc);
208 1.1.1.2.2.2 bouyer }
209 1.1.1.2.2.2 bouyer AcpiUtRemoveReference (ObjDesc);
210 1.1.1.2.2.2 bouyer
211 1.1.1.2.2.2 bouyer WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
212 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
213 1.1.1.2.2.2 bouyer }
214 1.1.1.2.2.2 bouyer
215 1.1.1.2.2.2 bouyer
216 1.1.1.2.2.2 bouyer /*****************************************************************************
217 1.1.1.2.2.2 bouyer *
218 1.1.1.2.2.2 bouyer * FUNCTION: AcpiDsExecBeginOp
219 1.1.1.2.2.2 bouyer *
220 1.1.1.2.2.2 bouyer * PARAMETERS: WalkState - Current state of the parse tree walk
221 1.1.1.2.2.2 bouyer * OutOp - Where to return op if a new one is created
222 1.1.1.2.2.2 bouyer *
223 1.1.1.2.2.2 bouyer * RETURN: Status
224 1.1.1.2.2.2 bouyer *
225 1.1.1.2.2.2 bouyer * DESCRIPTION: Descending callback used during the execution of control
226 1.1.1.2.2.2 bouyer * methods. This is where most operators and operands are
227 1.1.1.2.2.2 bouyer * dispatched to the interpreter.
228 1.1.1.2.2.2 bouyer *
229 1.1.1.2.2.2 bouyer ****************************************************************************/
230 1.1.1.2.2.2 bouyer
231 1.1.1.2.2.2 bouyer ACPI_STATUS
232 1.1.1.2.2.2 bouyer AcpiDsExecBeginOp (
233 1.1.1.2.2.2 bouyer ACPI_WALK_STATE *WalkState,
234 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT **OutOp)
235 1.1.1.2.2.2 bouyer {
236 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op;
237 1.1.1.2.2.2 bouyer ACPI_STATUS Status = AE_OK;
238 1.1.1.2.2.2 bouyer UINT32 OpcodeClass;
239 1.1.1.2.2.2 bouyer
240 1.1.1.2.2.2 bouyer
241 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
242 1.1.1.2.2.2 bouyer
243 1.1.1.2.2.2 bouyer
244 1.1.1.2.2.2 bouyer Op = WalkState->Op;
245 1.1.1.2.2.2 bouyer if (!Op)
246 1.1.1.2.2.2 bouyer {
247 1.1.1.2.2.2 bouyer Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
248 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
249 1.1.1.2.2.2 bouyer {
250 1.1.1.2.2.2 bouyer goto ErrorExit;
251 1.1.1.2.2.2 bouyer }
252 1.1.1.2.2.2 bouyer
253 1.1.1.2.2.2 bouyer Op = *OutOp;
254 1.1.1.2.2.2 bouyer WalkState->Op = Op;
255 1.1.1.2.2.2 bouyer WalkState->Opcode = Op->Common.AmlOpcode;
256 1.1.1.2.2.2 bouyer WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
257 1.1.1.2.2.2 bouyer
258 1.1.1.2.2.2 bouyer if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
259 1.1.1.2.2.2 bouyer {
260 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
261 1.1.1.2.2.2 bouyer "(%s) Popping scope for Op %p\n",
262 1.1.1.2.2.2 bouyer AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
263 1.1.1.2.2.2 bouyer
264 1.1.1.2.2.2 bouyer Status = AcpiDsScopeStackPop (WalkState);
265 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
266 1.1.1.2.2.2 bouyer {
267 1.1.1.2.2.2 bouyer goto ErrorExit;
268 1.1.1.2.2.2 bouyer }
269 1.1.1.2.2.2 bouyer }
270 1.1.1.2.2.2 bouyer }
271 1.1.1.2.2.2 bouyer
272 1.1.1.2.2.2 bouyer if (Op == WalkState->Origin)
273 1.1.1.2.2.2 bouyer {
274 1.1.1.2.2.2 bouyer if (OutOp)
275 1.1.1.2.2.2 bouyer {
276 1.1.1.2.2.2 bouyer *OutOp = Op;
277 1.1.1.2.2.2 bouyer }
278 1.1.1.2.2.2 bouyer
279 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_OK);
280 1.1.1.2.2.2 bouyer }
281 1.1.1.2.2.2 bouyer
282 1.1.1.2.2.2 bouyer /*
283 1.1.1.2.2.2 bouyer * If the previous opcode was a conditional, this opcode
284 1.1.1.2.2.2 bouyer * must be the beginning of the associated predicate.
285 1.1.1.2.2.2 bouyer * Save this knowledge in the current scope descriptor
286 1.1.1.2.2.2 bouyer */
287 1.1.1.2.2.2 bouyer if ((WalkState->ControlState) &&
288 1.1.1.2.2.2 bouyer (WalkState->ControlState->Common.State ==
289 1.1.1.2.2.2 bouyer ACPI_CONTROL_CONDITIONAL_EXECUTING))
290 1.1.1.2.2.2 bouyer {
291 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
292 1.1.1.2.2.2 bouyer Op, WalkState));
293 1.1.1.2.2.2 bouyer
294 1.1.1.2.2.2 bouyer WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING;
295 1.1.1.2.2.2 bouyer
296 1.1.1.2.2.2 bouyer /* Save start of predicate */
297 1.1.1.2.2.2 bouyer
298 1.1.1.2.2.2 bouyer WalkState->ControlState->Control.PredicateOp = Op;
299 1.1.1.2.2.2 bouyer }
300 1.1.1.2.2.2 bouyer
301 1.1.1.2.2.2 bouyer
302 1.1.1.2.2.2 bouyer OpcodeClass = WalkState->OpInfo->Class;
303 1.1.1.2.2.2 bouyer
304 1.1.1.2.2.2 bouyer /* We want to send namepaths to the load code */
305 1.1.1.2.2.2 bouyer
306 1.1.1.2.2.2 bouyer if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
307 1.1.1.2.2.2 bouyer {
308 1.1.1.2.2.2 bouyer OpcodeClass = AML_CLASS_NAMED_OBJECT;
309 1.1.1.2.2.2 bouyer }
310 1.1.1.2.2.2 bouyer
311 1.1.1.2.2.2 bouyer /*
312 1.1.1.2.2.2 bouyer * Handle the opcode based upon the opcode type
313 1.1.1.2.2.2 bouyer */
314 1.1.1.2.2.2 bouyer switch (OpcodeClass)
315 1.1.1.2.2.2 bouyer {
316 1.1.1.2.2.2 bouyer case AML_CLASS_CONTROL:
317 1.1.1.2.2.2 bouyer
318 1.1.1.2.2.2 bouyer Status = AcpiDsExecBeginControlOp (WalkState, Op);
319 1.1.1.2.2.2 bouyer break;
320 1.1.1.2.2.2 bouyer
321 1.1.1.2.2.2 bouyer
322 1.1.1.2.2.2 bouyer case AML_CLASS_NAMED_OBJECT:
323 1.1.1.2.2.2 bouyer
324 1.1.1.2.2.2 bouyer if (WalkState->WalkType & ACPI_WALK_METHOD)
325 1.1.1.2.2.2 bouyer {
326 1.1.1.2.2.2 bouyer /*
327 1.1.1.2.2.2 bouyer * Found a named object declaration during method execution;
328 1.1.1.2.2.2 bouyer * we must enter this object into the namespace. The created
329 1.1.1.2.2.2 bouyer * object is temporary and will be deleted upon completion of
330 1.1.1.2.2.2 bouyer * the execution of this method.
331 1.1.1.2.2.2 bouyer *
332 1.1.1.2.2.2 bouyer * Note 10/2010: Except for the Scope() op. This opcode does
333 1.1.1.2.2.2 bouyer * not actually create a new object, it refers to an existing
334 1.1.1.2.2.2 bouyer * object. However, for Scope(), we want to indeed open a
335 1.1.1.2.2.2 bouyer * new scope.
336 1.1.1.2.2.2 bouyer */
337 1.1.1.2.2.2 bouyer if (Op->Common.AmlOpcode != AML_SCOPE_OP)
338 1.1.1.2.2.2 bouyer {
339 1.1.1.2.2.2 bouyer Status = AcpiDsLoad2BeginOp (WalkState, NULL);
340 1.1.1.2.2.2 bouyer }
341 1.1.1.2.2.2 bouyer else
342 1.1.1.2.2.2 bouyer {
343 1.1.1.2.2.2 bouyer Status = AcpiDsScopeStackPush (Op->Named.Node,
344 1.1.1.2.2.2 bouyer Op->Named.Node->Type, WalkState);
345 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
346 1.1.1.2.2.2 bouyer {
347 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
348 1.1.1.2.2.2 bouyer }
349 1.1.1.2.2.2 bouyer }
350 1.1.1.2.2.2 bouyer }
351 1.1.1.2.2.2 bouyer break;
352 1.1.1.2.2.2 bouyer
353 1.1.1.2.2.2 bouyer
354 1.1.1.2.2.2 bouyer case AML_CLASS_EXECUTE:
355 1.1.1.2.2.2 bouyer case AML_CLASS_CREATE:
356 1.1.1.2.2.2 bouyer
357 1.1.1.2.2.2 bouyer break;
358 1.1.1.2.2.2 bouyer
359 1.1.1.2.2.2 bouyer
360 1.1.1.2.2.2 bouyer default:
361 1.1.1.2.2.2 bouyer break;
362 1.1.1.2.2.2 bouyer }
363 1.1.1.2.2.2 bouyer
364 1.1.1.2.2.2 bouyer /* Nothing to do here during method execution */
365 1.1.1.2.2.2 bouyer
366 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
367 1.1.1.2.2.2 bouyer
368 1.1.1.2.2.2 bouyer
369 1.1.1.2.2.2 bouyer ErrorExit:
370 1.1.1.2.2.2 bouyer Status = AcpiDsMethodError (Status, WalkState);
371 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
372 1.1.1.2.2.2 bouyer }
373 1.1.1.2.2.2 bouyer
374 1.1.1.2.2.2 bouyer
375 1.1.1.2.2.2 bouyer /*****************************************************************************
376 1.1.1.2.2.2 bouyer *
377 1.1.1.2.2.2 bouyer * FUNCTION: AcpiDsExecEndOp
378 1.1.1.2.2.2 bouyer *
379 1.1.1.2.2.2 bouyer * PARAMETERS: WalkState - Current state of the parse tree walk
380 1.1.1.2.2.2 bouyer *
381 1.1.1.2.2.2 bouyer * RETURN: Status
382 1.1.1.2.2.2 bouyer *
383 1.1.1.2.2.2 bouyer * DESCRIPTION: Ascending callback used during the execution of control
384 1.1.1.2.2.2 bouyer * methods. The only thing we really need to do here is to
385 1.1.1.2.2.2 bouyer * notice the beginning of IF, ELSE, and WHILE blocks.
386 1.1.1.2.2.2 bouyer *
387 1.1.1.2.2.2 bouyer ****************************************************************************/
388 1.1.1.2.2.2 bouyer
389 1.1.1.2.2.2 bouyer ACPI_STATUS
390 1.1.1.2.2.2 bouyer AcpiDsExecEndOp (
391 1.1.1.2.2.2 bouyer ACPI_WALK_STATE *WalkState)
392 1.1.1.2.2.2 bouyer {
393 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op;
394 1.1.1.2.2.2 bouyer ACPI_STATUS Status = AE_OK;
395 1.1.1.2.2.2 bouyer UINT32 OpType;
396 1.1.1.2.2.2 bouyer UINT32 OpClass;
397 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *NextOp;
398 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *FirstArg;
399 1.1.1.2.2.2 bouyer
400 1.1.1.2.2.2 bouyer
401 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
402 1.1.1.2.2.2 bouyer
403 1.1.1.2.2.2 bouyer
404 1.1.1.2.2.2 bouyer Op = WalkState->Op;
405 1.1.1.2.2.2 bouyer OpType = WalkState->OpInfo->Type;
406 1.1.1.2.2.2 bouyer OpClass = WalkState->OpInfo->Class;
407 1.1.1.2.2.2 bouyer
408 1.1.1.2.2.2 bouyer if (OpClass == AML_CLASS_UNKNOWN)
409 1.1.1.2.2.2 bouyer {
410 1.1.1.2.2.2 bouyer ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
411 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
412 1.1.1.2.2.2 bouyer }
413 1.1.1.2.2.2 bouyer
414 1.1.1.2.2.2 bouyer FirstArg = Op->Common.Value.Arg;
415 1.1.1.2.2.2 bouyer
416 1.1.1.2.2.2 bouyer /* Init the walk state */
417 1.1.1.2.2.2 bouyer
418 1.1.1.2.2.2 bouyer WalkState->NumOperands = 0;
419 1.1.1.2.2.2 bouyer WalkState->OperandIndex = 0;
420 1.1.1.2.2.2 bouyer WalkState->ReturnDesc = NULL;
421 1.1.1.2.2.2 bouyer WalkState->ResultObj = NULL;
422 1.1.1.2.2.2 bouyer
423 1.1.1.2.2.2 bouyer /* Call debugger for single step support (DEBUG build only) */
424 1.1.1.2.2.2 bouyer
425 1.1.1.2.2.2 bouyer ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
426 1.1.1.2.2.2 bouyer ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
427 1.1.1.2.2.2 bouyer
428 1.1.1.2.2.2 bouyer /* Decode the Opcode Class */
429 1.1.1.2.2.2 bouyer
430 1.1.1.2.2.2 bouyer switch (OpClass)
431 1.1.1.2.2.2 bouyer {
432 1.1.1.2.2.2 bouyer case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
433 1.1.1.2.2.2 bouyer
434 1.1.1.2.2.2 bouyer if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
435 1.1.1.2.2.2 bouyer {
436 1.1.1.2.2.2 bouyer Status = AcpiDsEvaluateNamePath (WalkState);
437 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
438 1.1.1.2.2.2 bouyer {
439 1.1.1.2.2.2 bouyer goto Cleanup;
440 1.1.1.2.2.2 bouyer }
441 1.1.1.2.2.2 bouyer }
442 1.1.1.2.2.2 bouyer break;
443 1.1.1.2.2.2 bouyer
444 1.1.1.2.2.2 bouyer
445 1.1.1.2.2.2 bouyer case AML_CLASS_EXECUTE: /* Most operators with arguments */
446 1.1.1.2.2.2 bouyer
447 1.1.1.2.2.2 bouyer /* Build resolved operand stack */
448 1.1.1.2.2.2 bouyer
449 1.1.1.2.2.2 bouyer Status = AcpiDsCreateOperands (WalkState, FirstArg);
450 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
451 1.1.1.2.2.2 bouyer {
452 1.1.1.2.2.2 bouyer goto Cleanup;
453 1.1.1.2.2.2 bouyer }
454 1.1.1.2.2.2 bouyer
455 1.1.1.2.2.2 bouyer /*
456 1.1.1.2.2.2 bouyer * All opcodes require operand resolution, with the only exceptions
457 1.1.1.2.2.2 bouyer * being the ObjectType and SizeOf operators.
458 1.1.1.2.2.2 bouyer */
459 1.1.1.2.2.2 bouyer if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
460 1.1.1.2.2.2 bouyer {
461 1.1.1.2.2.2 bouyer /* Resolve all operands */
462 1.1.1.2.2.2 bouyer
463 1.1.1.2.2.2 bouyer Status = AcpiExResolveOperands (WalkState->Opcode,
464 1.1.1.2.2.2 bouyer &(WalkState->Operands [WalkState->NumOperands -1]),
465 1.1.1.2.2.2 bouyer WalkState);
466 1.1.1.2.2.2 bouyer }
467 1.1.1.2.2.2 bouyer
468 1.1.1.2.2.2 bouyer if (ACPI_SUCCESS (Status))
469 1.1.1.2.2.2 bouyer {
470 1.1.1.2.2.2 bouyer /*
471 1.1.1.2.2.2 bouyer * Dispatch the request to the appropriate interpreter handler
472 1.1.1.2.2.2 bouyer * routine. There is one routine per opcode "type" based upon the
473 1.1.1.2.2.2 bouyer * number of opcode arguments and return type.
474 1.1.1.2.2.2 bouyer */
475 1.1.1.2.2.2 bouyer Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
476 1.1.1.2.2.2 bouyer }
477 1.1.1.2.2.2 bouyer else
478 1.1.1.2.2.2 bouyer {
479 1.1.1.2.2.2 bouyer /*
480 1.1.1.2.2.2 bouyer * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
481 1.1.1.2.2.2 bouyer * Local is uninitialized.
482 1.1.1.2.2.2 bouyer */
483 1.1.1.2.2.2 bouyer if ((Status == AE_AML_UNINITIALIZED_LOCAL) &&
484 1.1.1.2.2.2 bouyer (WalkState->Opcode == AML_STORE_OP) &&
485 1.1.1.2.2.2 bouyer (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
486 1.1.1.2.2.2 bouyer (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
487 1.1.1.2.2.2 bouyer (WalkState->Operands[0]->Reference.Class ==
488 1.1.1.2.2.2 bouyer WalkState->Operands[1]->Reference.Class) &&
489 1.1.1.2.2.2 bouyer (WalkState->Operands[0]->Reference.Value ==
490 1.1.1.2.2.2 bouyer WalkState->Operands[1]->Reference.Value))
491 1.1.1.2.2.2 bouyer {
492 1.1.1.2.2.2 bouyer Status = AE_OK;
493 1.1.1.2.2.2 bouyer }
494 1.1.1.2.2.2 bouyer else
495 1.1.1.2.2.2 bouyer {
496 1.1.1.2.2.2 bouyer ACPI_EXCEPTION ((AE_INFO, Status,
497 1.1.1.2.2.2 bouyer "While resolving operands for [%s]",
498 1.1.1.2.2.2 bouyer AcpiPsGetOpcodeName (WalkState->Opcode)));
499 1.1.1.2.2.2 bouyer }
500 1.1.1.2.2.2 bouyer }
501 1.1.1.2.2.2 bouyer
502 1.1.1.2.2.2 bouyer /* Always delete the argument objects and clear the operand stack */
503 1.1.1.2.2.2 bouyer
504 1.1.1.2.2.2 bouyer AcpiDsClearOperands (WalkState);
505 1.1.1.2.2.2 bouyer
506 1.1.1.2.2.2 bouyer /*
507 1.1.1.2.2.2 bouyer * If a result object was returned from above, push it on the
508 1.1.1.2.2.2 bouyer * current result stack
509 1.1.1.2.2.2 bouyer */
510 1.1.1.2.2.2 bouyer if (ACPI_SUCCESS (Status) &&
511 1.1.1.2.2.2 bouyer WalkState->ResultObj)
512 1.1.1.2.2.2 bouyer {
513 1.1.1.2.2.2 bouyer Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
514 1.1.1.2.2.2 bouyer }
515 1.1.1.2.2.2 bouyer break;
516 1.1.1.2.2.2 bouyer
517 1.1.1.2.2.2 bouyer
518 1.1.1.2.2.2 bouyer default:
519 1.1.1.2.2.2 bouyer
520 1.1.1.2.2.2 bouyer switch (OpType)
521 1.1.1.2.2.2 bouyer {
522 1.1.1.2.2.2 bouyer case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
523 1.1.1.2.2.2 bouyer
524 1.1.1.2.2.2 bouyer /* 1 Operand, 0 ExternalResult, 0 InternalResult */
525 1.1.1.2.2.2 bouyer
526 1.1.1.2.2.2 bouyer Status = AcpiDsExecEndControlOp (WalkState, Op);
527 1.1.1.2.2.2 bouyer
528 1.1.1.2.2.2 bouyer break;
529 1.1.1.2.2.2 bouyer
530 1.1.1.2.2.2 bouyer
531 1.1.1.2.2.2 bouyer case AML_TYPE_METHOD_CALL:
532 1.1.1.2.2.2 bouyer
533 1.1.1.2.2.2 bouyer /*
534 1.1.1.2.2.2 bouyer * If the method is referenced from within a package
535 1.1.1.2.2.2 bouyer * declaration, it is not a invocation of the method, just
536 1.1.1.2.2.2 bouyer * a reference to it.
537 1.1.1.2.2.2 bouyer */
538 1.1.1.2.2.2 bouyer if ((Op->Asl.Parent) &&
539 1.1.1.2.2.2 bouyer ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
540 1.1.1.2.2.2 bouyer (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
541 1.1.1.2.2.2 bouyer {
542 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
543 1.1.1.2.2.2 bouyer "Method Reference in a Package, Op=%p\n", Op));
544 1.1.1.2.2.2 bouyer
545 1.1.1.2.2.2 bouyer Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node;
546 1.1.1.2.2.2 bouyer AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
547 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_OK);
548 1.1.1.2.2.2 bouyer }
549 1.1.1.2.2.2 bouyer
550 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op));
551 1.1.1.2.2.2 bouyer
552 1.1.1.2.2.2 bouyer /*
553 1.1.1.2.2.2 bouyer * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
554 1.1.1.2.2.2 bouyer * the method Node pointer
555 1.1.1.2.2.2 bouyer */
556 1.1.1.2.2.2 bouyer /* NextOp points to the op that holds the method name */
557 1.1.1.2.2.2 bouyer
558 1.1.1.2.2.2 bouyer NextOp = FirstArg;
559 1.1.1.2.2.2 bouyer
560 1.1.1.2.2.2 bouyer /* NextOp points to first argument op */
561 1.1.1.2.2.2 bouyer
562 1.1.1.2.2.2 bouyer NextOp = NextOp->Common.Next;
563 1.1.1.2.2.2 bouyer
564 1.1.1.2.2.2 bouyer /*
565 1.1.1.2.2.2 bouyer * Get the method's arguments and put them on the operand stack
566 1.1.1.2.2.2 bouyer */
567 1.1.1.2.2.2 bouyer Status = AcpiDsCreateOperands (WalkState, NextOp);
568 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
569 1.1.1.2.2.2 bouyer {
570 1.1.1.2.2.2 bouyer break;
571 1.1.1.2.2.2 bouyer }
572 1.1.1.2.2.2 bouyer
573 1.1.1.2.2.2 bouyer /*
574 1.1.1.2.2.2 bouyer * Since the operands will be passed to another control method,
575 1.1.1.2.2.2 bouyer * we must resolve all local references here (Local variables,
576 1.1.1.2.2.2 bouyer * arguments to *this* method, etc.)
577 1.1.1.2.2.2 bouyer */
578 1.1.1.2.2.2 bouyer Status = AcpiDsResolveOperands (WalkState);
579 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
580 1.1.1.2.2.2 bouyer {
581 1.1.1.2.2.2 bouyer /* On error, clear all resolved operands */
582 1.1.1.2.2.2 bouyer
583 1.1.1.2.2.2 bouyer AcpiDsClearOperands (WalkState);
584 1.1.1.2.2.2 bouyer break;
585 1.1.1.2.2.2 bouyer }
586 1.1.1.2.2.2 bouyer
587 1.1.1.2.2.2 bouyer /*
588 1.1.1.2.2.2 bouyer * Tell the walk loop to preempt this running method and
589 1.1.1.2.2.2 bouyer * execute the new method
590 1.1.1.2.2.2 bouyer */
591 1.1.1.2.2.2 bouyer Status = AE_CTRL_TRANSFER;
592 1.1.1.2.2.2 bouyer
593 1.1.1.2.2.2 bouyer /*
594 1.1.1.2.2.2 bouyer * Return now; we don't want to disturb anything,
595 1.1.1.2.2.2 bouyer * especially the operand count!
596 1.1.1.2.2.2 bouyer */
597 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
598 1.1.1.2.2.2 bouyer
599 1.1.1.2.2.2 bouyer
600 1.1.1.2.2.2 bouyer case AML_TYPE_CREATE_FIELD:
601 1.1.1.2.2.2 bouyer
602 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
603 1.1.1.2.2.2 bouyer "Executing CreateField Buffer/Index Op=%p\n", Op));
604 1.1.1.2.2.2 bouyer
605 1.1.1.2.2.2 bouyer Status = AcpiDsLoad2EndOp (WalkState);
606 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
607 1.1.1.2.2.2 bouyer {
608 1.1.1.2.2.2 bouyer break;
609 1.1.1.2.2.2 bouyer }
610 1.1.1.2.2.2 bouyer
611 1.1.1.2.2.2 bouyer Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
612 1.1.1.2.2.2 bouyer break;
613 1.1.1.2.2.2 bouyer
614 1.1.1.2.2.2 bouyer
615 1.1.1.2.2.2 bouyer case AML_TYPE_CREATE_OBJECT:
616 1.1.1.2.2.2 bouyer
617 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
618 1.1.1.2.2.2 bouyer "Executing CreateObject (Buffer/Package) Op=%p\n", Op));
619 1.1.1.2.2.2 bouyer
620 1.1.1.2.2.2 bouyer switch (Op->Common.Parent->Common.AmlOpcode)
621 1.1.1.2.2.2 bouyer {
622 1.1.1.2.2.2 bouyer case AML_NAME_OP:
623 1.1.1.2.2.2 bouyer
624 1.1.1.2.2.2 bouyer /*
625 1.1.1.2.2.2 bouyer * Put the Node on the object stack (Contains the ACPI Name
626 1.1.1.2.2.2 bouyer * of this object)
627 1.1.1.2.2.2 bouyer */
628 1.1.1.2.2.2 bouyer WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node;
629 1.1.1.2.2.2 bouyer WalkState->NumOperands = 1;
630 1.1.1.2.2.2 bouyer
631 1.1.1.2.2.2 bouyer Status = AcpiDsCreateNode (WalkState,
632 1.1.1.2.2.2 bouyer Op->Common.Parent->Common.Node,
633 1.1.1.2.2.2 bouyer Op->Common.Parent);
634 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
635 1.1.1.2.2.2 bouyer {
636 1.1.1.2.2.2 bouyer break;
637 1.1.1.2.2.2 bouyer }
638 1.1.1.2.2.2 bouyer
639 1.1.1.2.2.2 bouyer /* Fall through */
640 1.1.1.2.2.2 bouyer /*lint -fallthrough */
641 1.1.1.2.2.2 bouyer
642 1.1.1.2.2.2 bouyer case AML_INT_EVAL_SUBTREE_OP:
643 1.1.1.2.2.2 bouyer
644 1.1.1.2.2.2 bouyer Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
645 1.1.1.2.2.2 bouyer AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
646 1.1.1.2.2.2 bouyer break;
647 1.1.1.2.2.2 bouyer
648 1.1.1.2.2.2 bouyer default:
649 1.1.1.2.2.2 bouyer
650 1.1.1.2.2.2 bouyer Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
651 1.1.1.2.2.2 bouyer break;
652 1.1.1.2.2.2 bouyer }
653 1.1.1.2.2.2 bouyer
654 1.1.1.2.2.2 bouyer /*
655 1.1.1.2.2.2 bouyer * If a result object was returned from above, push it on the
656 1.1.1.2.2.2 bouyer * current result stack
657 1.1.1.2.2.2 bouyer */
658 1.1.1.2.2.2 bouyer if (WalkState->ResultObj)
659 1.1.1.2.2.2 bouyer {
660 1.1.1.2.2.2 bouyer Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
661 1.1.1.2.2.2 bouyer }
662 1.1.1.2.2.2 bouyer break;
663 1.1.1.2.2.2 bouyer
664 1.1.1.2.2.2 bouyer
665 1.1.1.2.2.2 bouyer case AML_TYPE_NAMED_FIELD:
666 1.1.1.2.2.2 bouyer case AML_TYPE_NAMED_COMPLEX:
667 1.1.1.2.2.2 bouyer case AML_TYPE_NAMED_SIMPLE:
668 1.1.1.2.2.2 bouyer case AML_TYPE_NAMED_NO_OBJ:
669 1.1.1.2.2.2 bouyer
670 1.1.1.2.2.2 bouyer Status = AcpiDsLoad2EndOp (WalkState);
671 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
672 1.1.1.2.2.2 bouyer {
673 1.1.1.2.2.2 bouyer break;
674 1.1.1.2.2.2 bouyer }
675 1.1.1.2.2.2 bouyer
676 1.1.1.2.2.2 bouyer if (Op->Common.AmlOpcode == AML_REGION_OP)
677 1.1.1.2.2.2 bouyer {
678 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
679 1.1.1.2.2.2 bouyer "Executing OpRegion Address/Length Op=%p\n", Op));
680 1.1.1.2.2.2 bouyer
681 1.1.1.2.2.2 bouyer Status = AcpiDsEvalRegionOperands (WalkState, Op);
682 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
683 1.1.1.2.2.2 bouyer {
684 1.1.1.2.2.2 bouyer break;
685 1.1.1.2.2.2 bouyer }
686 1.1.1.2.2.2 bouyer }
687 1.1.1.2.2.2 bouyer else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
688 1.1.1.2.2.2 bouyer {
689 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
690 1.1.1.2.2.2 bouyer "Executing DataTableRegion Strings Op=%p\n", Op));
691 1.1.1.2.2.2 bouyer
692 1.1.1.2.2.2 bouyer Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
693 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
694 1.1.1.2.2.2 bouyer {
695 1.1.1.2.2.2 bouyer break;
696 1.1.1.2.2.2 bouyer }
697 1.1.1.2.2.2 bouyer }
698 1.1.1.2.2.2 bouyer else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
699 1.1.1.2.2.2 bouyer {
700 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
701 1.1.1.2.2.2 bouyer "Executing BankField Op=%p\n", Op));
702 1.1.1.2.2.2 bouyer
703 1.1.1.2.2.2 bouyer Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
704 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
705 1.1.1.2.2.2 bouyer {
706 1.1.1.2.2.2 bouyer break;
707 1.1.1.2.2.2 bouyer }
708 1.1.1.2.2.2 bouyer }
709 1.1.1.2.2.2 bouyer break;
710 1.1.1.2.2.2 bouyer
711 1.1.1.2.2.2 bouyer
712 1.1.1.2.2.2 bouyer case AML_TYPE_UNDEFINED:
713 1.1.1.2.2.2 bouyer
714 1.1.1.2.2.2 bouyer ACPI_ERROR ((AE_INFO,
715 1.1.1.2.2.2 bouyer "Undefined opcode type Op=%p", Op));
716 1.1.1.2.2.2 bouyer return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
717 1.1.1.2.2.2 bouyer
718 1.1.1.2.2.2 bouyer
719 1.1.1.2.2.2 bouyer case AML_TYPE_BOGUS:
720 1.1.1.2.2.2 bouyer
721 1.1.1.2.2.2 bouyer ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
722 1.1.1.2.2.2 bouyer "Internal opcode=%X type Op=%p\n",
723 1.1.1.2.2.2 bouyer WalkState->Opcode, Op));
724 1.1.1.2.2.2 bouyer break;
725 1.1.1.2.2.2 bouyer
726 1.1.1.2.2.2 bouyer
727 1.1.1.2.2.2 bouyer default:
728 1.1.1.2.2.2 bouyer
729 1.1.1.2.2.2 bouyer ACPI_ERROR ((AE_INFO,
730 1.1.1.2.2.2 bouyer "Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
731 1.1.1.2.2.2 bouyer OpClass, OpType, Op->Common.AmlOpcode, Op));
732 1.1.1.2.2.2 bouyer
733 1.1.1.2.2.2 bouyer Status = AE_NOT_IMPLEMENTED;
734 1.1.1.2.2.2 bouyer break;
735 1.1.1.2.2.2 bouyer }
736 1.1.1.2.2.2 bouyer }
737 1.1.1.2.2.2 bouyer
738 1.1.1.2.2.2 bouyer /*
739 1.1.1.2.2.2 bouyer * ACPI 2.0 support for 64-bit integers: Truncate numeric
740 1.1.1.2.2.2 bouyer * result value if we are executing from a 32-bit ACPI table
741 1.1.1.2.2.2 bouyer */
742 1.1.1.2.2.2 bouyer AcpiExTruncateFor32bitTable (WalkState->ResultObj);
743 1.1.1.2.2.2 bouyer
744 1.1.1.2.2.2 bouyer /*
745 1.1.1.2.2.2 bouyer * Check if we just completed the evaluation of a
746 1.1.1.2.2.2 bouyer * conditional predicate
747 1.1.1.2.2.2 bouyer */
748 1.1.1.2.2.2 bouyer if ((ACPI_SUCCESS (Status)) &&
749 1.1.1.2.2.2 bouyer (WalkState->ControlState) &&
750 1.1.1.2.2.2 bouyer (WalkState->ControlState->Common.State ==
751 1.1.1.2.2.2 bouyer ACPI_CONTROL_PREDICATE_EXECUTING) &&
752 1.1.1.2.2.2 bouyer (WalkState->ControlState->Control.PredicateOp == Op))
753 1.1.1.2.2.2 bouyer {
754 1.1.1.2.2.2 bouyer Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
755 1.1.1.2.2.2 bouyer WalkState->ResultObj = NULL;
756 1.1.1.2.2.2 bouyer }
757 1.1.1.2.2.2 bouyer
758 1.1.1.2.2.2 bouyer
759 1.1.1.2.2.2 bouyer Cleanup:
760 1.1.1.2.2.2 bouyer
761 1.1.1.2.2.2 bouyer if (WalkState->ResultObj)
762 1.1.1.2.2.2 bouyer {
763 1.1.1.2.2.2 bouyer /* Break to debugger to display result */
764 1.1.1.2.2.2 bouyer
765 1.1.1.2.2.2 bouyer ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj,
766 1.1.1.2.2.2 bouyer WalkState));
767 1.1.1.2.2.2 bouyer
768 1.1.1.2.2.2 bouyer /*
769 1.1.1.2.2.2 bouyer * Delete the result op if and only if:
770 1.1.1.2.2.2 bouyer * Parent will not use the result -- such as any
771 1.1.1.2.2.2 bouyer * non-nested type2 op in a method (parent will be method)
772 1.1.1.2.2.2 bouyer */
773 1.1.1.2.2.2 bouyer AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
774 1.1.1.2.2.2 bouyer }
775 1.1.1.2.2.2 bouyer
776 1.1.1.2.2.2 bouyer #ifdef _UNDER_DEVELOPMENT
777 1.1.1.2.2.2 bouyer
778 1.1.1.2.2.2 bouyer if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
779 1.1.1.2.2.2 bouyer {
780 1.1.1.2.2.2 bouyer AcpiDbMethodEnd (WalkState);
781 1.1.1.2.2.2 bouyer }
782 1.1.1.2.2.2 bouyer #endif
783 1.1.1.2.2.2 bouyer
784 1.1.1.2.2.2 bouyer /* Invoke exception handler on error */
785 1.1.1.2.2.2 bouyer
786 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
787 1.1.1.2.2.2 bouyer {
788 1.1.1.2.2.2 bouyer Status = AcpiDsMethodError (Status, WalkState);
789 1.1.1.2.2.2 bouyer }
790 1.1.1.2.2.2 bouyer
791 1.1.1.2.2.2 bouyer /* Always clear the object stack */
792 1.1.1.2.2.2 bouyer
793 1.1.1.2.2.2 bouyer WalkState->NumOperands = 0;
794 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
795 1.1.1.2.2.2 bouyer }
796 1.1.1.2.2.2 bouyer
797 1.1.1.2.2.2 bouyer
798