aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dswexec.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/dispatcher/dswexec.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher/dswexec.c')
-rw-r--r--drivers/acpi/dispatcher/dswexec.c519
1 files changed, 269 insertions, 250 deletions
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index 10f71318e23b..e522763bb692 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -42,7 +42,6 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45
46#include <acpi/acpi.h> 45#include <acpi/acpi.h>
47#include <acpi/acparser.h> 46#include <acpi/acparser.h>
48#include <acpi/amlcode.h> 47#include <acpi/amlcode.h>
@@ -52,27 +51,26 @@
52#include <acpi/acdebug.h> 51#include <acpi/acdebug.h>
53#include <acpi/acdisasm.h> 52#include <acpi/acdisasm.h>
54 53
55
56#define _COMPONENT ACPI_DISPATCHER 54#define _COMPONENT ACPI_DISPATCHER
57 ACPI_MODULE_NAME ("dswexec") 55ACPI_MODULE_NAME("dswexec")
58 56
59/* 57/*
60 * Dispatch table for opcode classes 58 * Dispatch table for opcode classes
61 */ 59 */
62static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { 60static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = {
63 acpi_ex_opcode_0A_0T_1R, 61 acpi_ex_opcode_0A_0T_1R,
64 acpi_ex_opcode_1A_0T_0R, 62 acpi_ex_opcode_1A_0T_0R,
65 acpi_ex_opcode_1A_0T_1R, 63 acpi_ex_opcode_1A_0T_1R,
66 acpi_ex_opcode_1A_1T_0R, 64 acpi_ex_opcode_1A_1T_0R,
67 acpi_ex_opcode_1A_1T_1R, 65 acpi_ex_opcode_1A_1T_1R,
68 acpi_ex_opcode_2A_0T_0R, 66 acpi_ex_opcode_2A_0T_0R,
69 acpi_ex_opcode_2A_0T_1R, 67 acpi_ex_opcode_2A_0T_1R,
70 acpi_ex_opcode_2A_1T_1R, 68 acpi_ex_opcode_2A_1T_1R,
71 acpi_ex_opcode_2A_2T_1R, 69 acpi_ex_opcode_2A_2T_1R,
72 acpi_ex_opcode_3A_0T_0R, 70 acpi_ex_opcode_3A_0T_0R,
73 acpi_ex_opcode_3A_1T_1R, 71 acpi_ex_opcode_3A_1T_1R,
74 acpi_ex_opcode_6A_0T_1R}; 72 acpi_ex_opcode_6A_0T_1R
75 73};
76 74
77/***************************************************************************** 75/*****************************************************************************
78 * 76 *
@@ -88,64 +86,64 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
88 ****************************************************************************/ 86 ****************************************************************************/
89 87
90acpi_status 88acpi_status
91acpi_ds_get_predicate_value ( 89acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
92 struct acpi_walk_state *walk_state, 90 union acpi_operand_object *result_obj)
93 union acpi_operand_object *result_obj) { 91{
94 acpi_status status = AE_OK; 92 acpi_status status = AE_OK;
95 union acpi_operand_object *obj_desc; 93 union acpi_operand_object *obj_desc;
96 union acpi_operand_object *local_obj_desc = NULL; 94 union acpi_operand_object *local_obj_desc = NULL;
97
98
99 ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state);
100 95
96 ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state);
101 97
102 walk_state->control_state->common.state = 0; 98 walk_state->control_state->common.state = 0;
103 99
104 if (result_obj) { 100 if (result_obj) {
105 status = acpi_ds_result_pop (&obj_desc, walk_state); 101 status = acpi_ds_result_pop(&obj_desc, walk_state);
106 if (ACPI_FAILURE (status)) { 102 if (ACPI_FAILURE(status)) {
107 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 103 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
108 "Could not get result from predicate evaluation, %s\n", 104 "Could not get result from predicate evaluation, %s\n",
109 acpi_format_exception (status))); 105 acpi_format_exception(status)));
110 106
111 return_ACPI_STATUS (status); 107 return_ACPI_STATUS(status);
112 } 108 }
113 } 109 } else {
114 else { 110 status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
115 status = acpi_ds_create_operand (walk_state, walk_state->op, 0); 111 if (ACPI_FAILURE(status)) {
116 if (ACPI_FAILURE (status)) { 112 return_ACPI_STATUS(status);
117 return_ACPI_STATUS (status);
118 } 113 }
119 114
120 status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state); 115 status =
121 if (ACPI_FAILURE (status)) { 116 acpi_ex_resolve_to_value(&walk_state->operands[0],
122 return_ACPI_STATUS (status); 117 walk_state);
118 if (ACPI_FAILURE(status)) {
119 return_ACPI_STATUS(status);
123 } 120 }
124 121
125 obj_desc = walk_state->operands [0]; 122 obj_desc = walk_state->operands[0];
126 } 123 }
127 124
128 if (!obj_desc) { 125 if (!obj_desc) {
129 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 126 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
130 "No predicate obj_desc=%p State=%p\n", 127 "No predicate obj_desc=%p State=%p\n",
131 obj_desc, walk_state)); 128 obj_desc, walk_state));
132 129
133 return_ACPI_STATUS (AE_AML_NO_OPERAND); 130 return_ACPI_STATUS(AE_AML_NO_OPERAND);
134 } 131 }
135 132
136 /* 133 /*
137 * Result of predicate evaluation must be an Integer 134 * Result of predicate evaluation must be an Integer
138 * object. Implicitly convert the argument if necessary. 135 * object. Implicitly convert the argument if necessary.
139 */ 136 */
140 status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16); 137 status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16);
141 if (ACPI_FAILURE (status)) { 138 if (ACPI_FAILURE(status)) {
142 goto cleanup; 139 goto cleanup;
143 } 140 }
144 141
145 if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) { 142 if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
146 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 143 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
147 "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", 144 "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
148 obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc))); 145 obj_desc, walk_state,
146 ACPI_GET_OBJECT_TYPE(obj_desc)));
149 147
150 status = AE_AML_OPERAND_TYPE; 148 status = AE_AML_OPERAND_TYPE;
151 goto cleanup; 149 goto cleanup;
@@ -153,7 +151,7 @@ acpi_ds_get_predicate_value (
153 151
154 /* Truncate the predicate to 32-bits if necessary */ 152 /* Truncate the predicate to 32-bits if necessary */
155 153
156 acpi_ex_truncate_for32bit_table (local_obj_desc); 154 acpi_ex_truncate_for32bit_table(local_obj_desc);
157 155
158 /* 156 /*
159 * Save the result of the predicate evaluation on 157 * Save the result of the predicate evaluation on
@@ -161,8 +159,7 @@ acpi_ds_get_predicate_value (
161 */ 159 */
162 if (local_obj_desc->integer.value) { 160 if (local_obj_desc->integer.value) {
163 walk_state->control_state->common.value = TRUE; 161 walk_state->control_state->common.value = TRUE;
164 } 162 } else {
165 else {
166 /* 163 /*
167 * Predicate is FALSE, we will just toss the 164 * Predicate is FALSE, we will just toss the
168 * rest of the package 165 * rest of the package
@@ -171,30 +168,30 @@ acpi_ds_get_predicate_value (
171 status = AE_CTRL_FALSE; 168 status = AE_CTRL_FALSE;
172 } 169 }
173 170
171 cleanup:
174 172
175cleanup: 173 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
174 walk_state->control_state->common.value,
175 walk_state->op));
176 176
177 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", 177 /* Break to debugger to display result */
178 walk_state->control_state->common.value, walk_state->op));
179 178
180 /* Break to debugger to display result */ 179 ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
181 180 (local_obj_desc, walk_state));
182 ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state));
183 181
184 /* 182 /*
185 * Delete the predicate result object (we know that 183 * Delete the predicate result object (we know that
186 * we don't need it anymore) 184 * we don't need it anymore)
187 */ 185 */
188 if (local_obj_desc != obj_desc) { 186 if (local_obj_desc != obj_desc) {
189 acpi_ut_remove_reference (local_obj_desc); 187 acpi_ut_remove_reference(local_obj_desc);
190 } 188 }
191 acpi_ut_remove_reference (obj_desc); 189 acpi_ut_remove_reference(obj_desc);
192 190
193 walk_state->control_state->common.state = ACPI_CONTROL_NORMAL; 191 walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
194 return_ACPI_STATUS (status); 192 return_ACPI_STATUS(status);
195} 193}
196 194
197
198/***************************************************************************** 195/*****************************************************************************
199 * 196 *
200 * FUNCTION: acpi_ds_exec_begin_op 197 * FUNCTION: acpi_ds_exec_begin_op
@@ -211,38 +208,39 @@ cleanup:
211 ****************************************************************************/ 208 ****************************************************************************/
212 209
213acpi_status 210acpi_status
214acpi_ds_exec_begin_op ( 211acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
215 struct acpi_walk_state *walk_state, 212 union acpi_parse_object **out_op)
216 union acpi_parse_object **out_op)
217{ 213{
218 union acpi_parse_object *op; 214 union acpi_parse_object *op;
219 acpi_status status = AE_OK; 215 acpi_status status = AE_OK;
220 u32 opcode_class; 216 u32 opcode_class;
221
222
223 ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state);
224 217
218 ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
225 219
226 op = walk_state->op; 220 op = walk_state->op;
227 if (!op) { 221 if (!op) {
228 status = acpi_ds_load2_begin_op (walk_state, out_op); 222 status = acpi_ds_load2_begin_op(walk_state, out_op);
229 if (ACPI_FAILURE (status)) { 223 if (ACPI_FAILURE(status)) {
230 return_ACPI_STATUS (status); 224 return_ACPI_STATUS(status);
231 } 225 }
232 226
233 op = *out_op; 227 op = *out_op;
234 walk_state->op = op; 228 walk_state->op = op;
235 walk_state->opcode = op->common.aml_opcode; 229 walk_state->opcode = op->common.aml_opcode;
236 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); 230 walk_state->op_info =
237 231 acpi_ps_get_opcode_info(op->common.aml_opcode);
238 if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { 232
239 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 233 if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
240 "(%s) Popping scope for Op %p\n", 234 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
241 acpi_ut_get_type_name (walk_state->op_info->object_type), op)); 235 "(%s) Popping scope for Op %p\n",
242 236 acpi_ut_get_type_name(walk_state->
243 status = acpi_ds_scope_stack_pop (walk_state); 237 op_info->
244 if (ACPI_FAILURE (status)) { 238 object_type),
245 return_ACPI_STATUS (status); 239 op));
240
241 status = acpi_ds_scope_stack_pop(walk_state);
242 if (ACPI_FAILURE(status)) {
243 return_ACPI_STATUS(status);
246 } 244 }
247 } 245 }
248 } 246 }
@@ -252,7 +250,7 @@ acpi_ds_exec_begin_op (
252 *out_op = op; 250 *out_op = op;
253 } 251 }
254 252
255 return_ACPI_STATUS (AE_OK); 253 return_ACPI_STATUS(AE_OK);
256 } 254 }
257 255
258 /* 256 /*
@@ -261,19 +259,20 @@ acpi_ds_exec_begin_op (
261 * Save this knowledge in the current scope descriptor 259 * Save this knowledge in the current scope descriptor
262 */ 260 */
263 if ((walk_state->control_state) && 261 if ((walk_state->control_state) &&
264 (walk_state->control_state->common.state == 262 (walk_state->control_state->common.state ==
265 ACPI_CONTROL_CONDITIONAL_EXECUTING)) { 263 ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
266 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", 264 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
267 op, walk_state)); 265 "Exec predicate Op=%p State=%p\n", op,
266 walk_state));
268 267
269 walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING; 268 walk_state->control_state->common.state =
269 ACPI_CONTROL_PREDICATE_EXECUTING;
270 270
271 /* Save start of predicate */ 271 /* Save start of predicate */
272 272
273 walk_state->control_state->control.predicate_op = op; 273 walk_state->control_state->control.predicate_op = op;
274 } 274 }
275 275
276
277 opcode_class = walk_state->op_info->class; 276 opcode_class = walk_state->op_info->class;
278 277
279 /* We want to send namepaths to the load code */ 278 /* We want to send namepaths to the load code */
@@ -288,15 +287,14 @@ acpi_ds_exec_begin_op (
288 switch (opcode_class) { 287 switch (opcode_class) {
289 case AML_CLASS_CONTROL: 288 case AML_CLASS_CONTROL:
290 289
291 status = acpi_ds_result_stack_push (walk_state); 290 status = acpi_ds_result_stack_push(walk_state);
292 if (ACPI_FAILURE (status)) { 291 if (ACPI_FAILURE(status)) {
293 return_ACPI_STATUS (status); 292 return_ACPI_STATUS(status);
294 } 293 }
295 294
296 status = acpi_ds_exec_begin_control_op (walk_state, op); 295 status = acpi_ds_exec_begin_control_op(walk_state, op);
297 break; 296 break;
298 297
299
300 case AML_CLASS_NAMED_OBJECT: 298 case AML_CLASS_NAMED_OBJECT:
301 299
302 if (walk_state->walk_type == ACPI_WALK_METHOD) { 300 if (walk_state->walk_type == ACPI_WALK_METHOD) {
@@ -306,15 +304,14 @@ acpi_ds_exec_begin_op (
306 * object is temporary and will be deleted upon completion of 304 * object is temporary and will be deleted upon completion of
307 * the execution of this method. 305 * the execution of this method.
308 */ 306 */
309 status = acpi_ds_load2_begin_op (walk_state, NULL); 307 status = acpi_ds_load2_begin_op(walk_state, NULL);
310 } 308 }
311 309
312 if (op->common.aml_opcode == AML_REGION_OP) { 310 if (op->common.aml_opcode == AML_REGION_OP) {
313 status = acpi_ds_result_stack_push (walk_state); 311 status = acpi_ds_result_stack_push(walk_state);
314 } 312 }
315 break; 313 break;
316 314
317
318 case AML_CLASS_EXECUTE: 315 case AML_CLASS_EXECUTE:
319 case AML_CLASS_CREATE: 316 case AML_CLASS_CREATE:
320 317
@@ -322,20 +319,18 @@ acpi_ds_exec_begin_op (
322 * Most operators with arguments. 319 * Most operators with arguments.
323 * Start a new result/operand state 320 * Start a new result/operand state
324 */ 321 */
325 status = acpi_ds_result_stack_push (walk_state); 322 status = acpi_ds_result_stack_push(walk_state);
326 break; 323 break;
327 324
328
329 default: 325 default:
330 break; 326 break;
331 } 327 }
332 328
333 /* Nothing to do here during method execution */ 329 /* Nothing to do here during method execution */
334 330
335 return_ACPI_STATUS (status); 331 return_ACPI_STATUS(status);
336} 332}
337 333
338
339/***************************************************************************** 334/*****************************************************************************
340 * 335 *
341 * FUNCTION: acpi_ds_exec_end_op 336 * FUNCTION: acpi_ds_exec_end_op
@@ -350,28 +345,25 @@ acpi_ds_exec_begin_op (
350 * 345 *
351 ****************************************************************************/ 346 ****************************************************************************/
352 347
353acpi_status 348acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
354acpi_ds_exec_end_op (
355 struct acpi_walk_state *walk_state)
356{ 349{
357 union acpi_parse_object *op; 350 union acpi_parse_object *op;
358 acpi_status status = AE_OK; 351 acpi_status status = AE_OK;
359 u32 op_type; 352 u32 op_type;
360 u32 op_class; 353 u32 op_class;
361 union acpi_parse_object *next_op; 354 union acpi_parse_object *next_op;
362 union acpi_parse_object *first_arg; 355 union acpi_parse_object *first_arg;
363 356
357 ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
364 358
365 ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state); 359 op = walk_state->op;
366
367
368 op = walk_state->op;
369 op_type = walk_state->op_info->type; 360 op_type = walk_state->op_info->type;
370 op_class = walk_state->op_info->class; 361 op_class = walk_state->op_info->class;
371 362
372 if (op_class == AML_CLASS_UNKNOWN) { 363 if (op_class == AML_CLASS_UNKNOWN) {
373 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode)); 364 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
374 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 365 op->common.aml_opcode));
366 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
375 } 367 }
376 368
377 first_arg = op->common.value.arg; 369 first_arg = op->common.value.arg;
@@ -384,29 +376,31 @@ acpi_ds_exec_end_op (
384 376
385 /* Call debugger for single step support (DEBUG build only) */ 377 /* Call debugger for single step support (DEBUG build only) */
386 378
387 ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class)); 379 ACPI_DEBUGGER_EXEC(status =
388 ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);}); 380 acpi_db_single_step(walk_state, op, op_class));
381 ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) {
382 return_ACPI_STATUS(status);}
383 ) ;
389 384
390 /* Decode the Opcode Class */ 385 /* Decode the Opcode Class */
391 386
392 switch (op_class) { 387 switch (op_class) {
393 case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ 388 case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
394 break; 389 break;
395 390
396 391 case AML_CLASS_EXECUTE: /* most operators with arguments */
397 case AML_CLASS_EXECUTE: /* most operators with arguments */
398 392
399 /* Build resolved operand stack */ 393 /* Build resolved operand stack */
400 394
401 status = acpi_ds_create_operands (walk_state, first_arg); 395 status = acpi_ds_create_operands(walk_state, first_arg);
402 if (ACPI_FAILURE (status)) { 396 if (ACPI_FAILURE(status)) {
403 goto cleanup; 397 goto cleanup;
404 } 398 }
405 399
406 /* Done with this result state (Now that operand stack is built) */ 400 /* Done with this result state (Now that operand stack is built) */
407 401
408 status = acpi_ds_result_stack_pop (walk_state); 402 status = acpi_ds_result_stack_pop(walk_state);
409 if (ACPI_FAILURE (status)) { 403 if (ACPI_FAILURE(status)) {
410 goto cleanup; 404 goto cleanup;
411 } 405 }
412 406
@@ -417,86 +411,93 @@ acpi_ds_exec_end_op (
417 if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { 411 if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
418 /* Resolve all operands */ 412 /* Resolve all operands */
419 413
420 status = acpi_ex_resolve_operands (walk_state->opcode, 414 status = acpi_ex_resolve_operands(walk_state->opcode,
421 &(walk_state->operands [walk_state->num_operands -1]), 415 &(walk_state->
422 walk_state); 416 operands
423 if (ACPI_SUCCESS (status)) { 417 [walk_state->
424 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, 418 num_operands - 1]),
425 acpi_ps_get_opcode_name (walk_state->opcode), 419 walk_state);
426 walk_state->num_operands, "after ex_resolve_operands"); 420 if (ACPI_SUCCESS(status)) {
421 ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
422 ACPI_IMODE_EXECUTE,
423 acpi_ps_get_opcode_name
424 (walk_state->opcode),
425 walk_state->num_operands,
426 "after ex_resolve_operands");
427 } 427 }
428 } 428 }
429 429
430 if (ACPI_SUCCESS (status)) { 430 if (ACPI_SUCCESS(status)) {
431 /* 431 /*
432 * Dispatch the request to the appropriate interpreter handler 432 * Dispatch the request to the appropriate interpreter handler
433 * routine. There is one routine per opcode "type" based upon the 433 * routine. There is one routine per opcode "type" based upon the
434 * number of opcode arguments and return type. 434 * number of opcode arguments and return type.
435 */ 435 */
436 status = acpi_gbl_op_type_dispatch[op_type] (walk_state); 436 status =
437 } 437 acpi_gbl_op_type_dispatch[op_type] (walk_state);
438 else { 438 } else {
439 /* 439 /*
440 * Treat constructs of the form "Store(local_x,local_x)" as noops when the 440 * Treat constructs of the form "Store(local_x,local_x)" as noops when the
441 * Local is uninitialized. 441 * Local is uninitialized.
442 */ 442 */
443 if ((status == AE_AML_UNINITIALIZED_LOCAL) && 443 if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
444 (walk_state->opcode == AML_STORE_OP) && 444 (walk_state->opcode == AML_STORE_OP) &&
445 (walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && 445 (walk_state->operands[0]->common.type ==
446 (walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && 446 ACPI_TYPE_LOCAL_REFERENCE)
447 (walk_state->operands[0]->reference.opcode == 447 && (walk_state->operands[1]->common.type ==
448 walk_state->operands[1]->reference.opcode) && 448 ACPI_TYPE_LOCAL_REFERENCE)
449 (walk_state->operands[0]->reference.offset == 449 && (walk_state->operands[0]->reference.opcode ==
450 walk_state->operands[1]->reference.offset)) { 450 walk_state->operands[1]->reference.opcode)
451 && (walk_state->operands[0]->reference.offset ==
452 walk_state->operands[1]->reference.offset)) {
451 status = AE_OK; 453 status = AE_OK;
452 } 454 } else {
453 else { 455 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
454 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 456 "[%s]: Could not resolve operands, %s\n",
455 "[%s]: Could not resolve operands, %s\n", 457 acpi_ps_get_opcode_name
456 acpi_ps_get_opcode_name (walk_state->opcode), 458 (walk_state->opcode),
457 acpi_format_exception (status))); 459 acpi_format_exception
460 (status)));
458 } 461 }
459 } 462 }
460 463
461 /* Always delete the argument objects and clear the operand stack */ 464 /* Always delete the argument objects and clear the operand stack */
462 465
463 acpi_ds_clear_operands (walk_state); 466 acpi_ds_clear_operands(walk_state);
464 467
465 /* 468 /*
466 * If a result object was returned from above, push it on the 469 * If a result object was returned from above, push it on the
467 * current result stack 470 * current result stack
468 */ 471 */
469 if (ACPI_SUCCESS (status) && 472 if (ACPI_SUCCESS(status) && walk_state->result_obj) {
470 walk_state->result_obj) { 473 status =
471 status = acpi_ds_result_push (walk_state->result_obj, walk_state); 474 acpi_ds_result_push(walk_state->result_obj,
475 walk_state);
472 } 476 }
473 477
474 break; 478 break;
475 479
476
477 default: 480 default:
478 481
479 switch (op_type) { 482 switch (op_type) {
480 case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ 483 case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
481 484
482 /* 1 Operand, 0 external_result, 0 internal_result */ 485 /* 1 Operand, 0 external_result, 0 internal_result */
483 486
484 status = acpi_ds_exec_end_control_op (walk_state, op); 487 status = acpi_ds_exec_end_control_op(walk_state, op);
485 488
486 /* Make sure to properly pop the result stack */ 489 /* Make sure to properly pop the result stack */
487 490
488 if (ACPI_SUCCESS (status)) { 491 if (ACPI_SUCCESS(status)) {
489 status = acpi_ds_result_stack_pop (walk_state); 492 status = acpi_ds_result_stack_pop(walk_state);
490 } 493 } else if (status == AE_CTRL_PENDING) {
491 else if (status == AE_CTRL_PENDING) { 494 status = acpi_ds_result_stack_pop(walk_state);
492 status = acpi_ds_result_stack_pop (walk_state); 495 if (ACPI_SUCCESS(status)) {
493 if (ACPI_SUCCESS (status)) {
494 status = AE_CTRL_PENDING; 496 status = AE_CTRL_PENDING;
495 } 497 }
496 } 498 }
497 break; 499 break;
498 500
499
500 case AML_TYPE_METHOD_CALL: 501 case AML_TYPE_METHOD_CALL:
501 502
502 /* 503 /*
@@ -505,16 +506,22 @@ acpi_ds_exec_end_op (
505 * a reference to it. 506 * a reference to it.
506 */ 507 */
507 if ((op->asl.parent) && 508 if ((op->asl.parent) &&
508 ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || 509 ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
509 (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { 510 || (op->asl.parent->asl.aml_opcode ==
510 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 511 AML_VAR_PACKAGE_OP))) {
511 "Method Reference in a Package, Op=%p\n", op)); 512 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
512 op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; 513 "Method Reference in a Package, Op=%p\n",
513 acpi_ut_add_reference (op->asl.value.arg->asl.node->object); 514 op));
514 return_ACPI_STATUS (AE_OK); 515 op->common.node =
516 (struct acpi_namespace_node *)op->asl.value.
517 arg->asl.node->object;
518 acpi_ut_add_reference(op->asl.value.arg->asl.
519 node->object);
520 return_ACPI_STATUS(AE_OK);
515 } 521 }
516 522
517 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op)); 523 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
524 "Method invocation, Op=%p\n", op));
518 525
519 /* 526 /*
520 * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains 527 * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
@@ -531,8 +538,8 @@ acpi_ds_exec_end_op (
531 /* 538 /*
532 * Get the method's arguments and put them on the operand stack 539 * Get the method's arguments and put them on the operand stack
533 */ 540 */
534 status = acpi_ds_create_operands (walk_state, next_op); 541 status = acpi_ds_create_operands(walk_state, next_op);
535 if (ACPI_FAILURE (status)) { 542 if (ACPI_FAILURE(status)) {
536 break; 543 break;
537 } 544 }
538 545
@@ -541,11 +548,11 @@ acpi_ds_exec_end_op (
541 * we must resolve all local references here (Local variables, 548 * we must resolve all local references here (Local variables,
542 * arguments to *this* method, etc.) 549 * arguments to *this* method, etc.)
543 */ 550 */
544 status = acpi_ds_resolve_operands (walk_state); 551 status = acpi_ds_resolve_operands(walk_state);
545 if (ACPI_FAILURE (status)) { 552 if (ACPI_FAILURE(status)) {
546 /* On error, clear all resolved operands */ 553 /* On error, clear all resolved operands */
547 554
548 acpi_ds_clear_operands (walk_state); 555 acpi_ds_clear_operands(walk_state);
549 break; 556 break;
550 } 557 }
551 558
@@ -559,27 +566,28 @@ acpi_ds_exec_end_op (
559 * Return now; we don't want to disturb anything, 566 * Return now; we don't want to disturb anything,
560 * especially the operand count! 567 * especially the operand count!
561 */ 568 */
562 return_ACPI_STATUS (status); 569 return_ACPI_STATUS(status);
563
564 570
565 case AML_TYPE_CREATE_FIELD: 571 case AML_TYPE_CREATE_FIELD:
566 572
567 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 573 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
568 "Executing create_field Buffer/Index Op=%p\n", op)); 574 "Executing create_field Buffer/Index Op=%p\n",
575 op));
569 576
570 status = acpi_ds_load2_end_op (walk_state); 577 status = acpi_ds_load2_end_op(walk_state);
571 if (ACPI_FAILURE (status)) { 578 if (ACPI_FAILURE(status)) {
572 break; 579 break;
573 } 580 }
574 581
575 status = acpi_ds_eval_buffer_field_operands (walk_state, op); 582 status =
583 acpi_ds_eval_buffer_field_operands(walk_state, op);
576 break; 584 break;
577 585
578
579 case AML_TYPE_CREATE_OBJECT: 586 case AML_TYPE_CREATE_OBJECT:
580 587
581 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 588 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
582 "Executing create_object (Buffer/Package) Op=%p\n", op)); 589 "Executing create_object (Buffer/Package) Op=%p\n",
590 op));
583 591
584 switch (op->common.parent->common.aml_opcode) { 592 switch (op->common.parent->common.aml_opcode) {
585 case AML_NAME_OP: 593 case AML_NAME_OP:
@@ -588,13 +596,15 @@ acpi_ds_exec_end_op (
588 * Put the Node on the object stack (Contains the ACPI Name 596 * Put the Node on the object stack (Contains the ACPI Name
589 * of this object) 597 * of this object)
590 */ 598 */
591 walk_state->operands[0] = (void *) op->common.parent->common.node; 599 walk_state->operands[0] =
600 (void *)op->common.parent->common.node;
592 walk_state->num_operands = 1; 601 walk_state->num_operands = 1;
593 602
594 status = acpi_ds_create_node (walk_state, 603 status = acpi_ds_create_node(walk_state,
595 op->common.parent->common.node, 604 op->common.parent->
596 op->common.parent); 605 common.node,
597 if (ACPI_FAILURE (status)) { 606 op->common.parent);
607 if (ACPI_FAILURE(status)) {
598 break; 608 break;
599 } 609 }
600 610
@@ -603,20 +613,26 @@ acpi_ds_exec_end_op (
603 613
604 case AML_INT_EVAL_SUBTREE_OP: 614 case AML_INT_EVAL_SUBTREE_OP:
605 615
606 status = acpi_ds_eval_data_object_operands (walk_state, op, 616 status =
607 acpi_ns_get_attached_object (op->common.parent->common.node)); 617 acpi_ds_eval_data_object_operands
618 (walk_state, op,
619 acpi_ns_get_attached_object(op->common.
620 parent->common.
621 node));
608 break; 622 break;
609 623
610 default: 624 default:
611 625
612 status = acpi_ds_eval_data_object_operands (walk_state, op, NULL); 626 status =
627 acpi_ds_eval_data_object_operands
628 (walk_state, op, NULL);
613 break; 629 break;
614 } 630 }
615 631
616 /* Done with result state (Now that operand stack is built) */ 632 /* Done with result state (Now that operand stack is built) */
617 633
618 status = acpi_ds_result_stack_pop (walk_state); 634 status = acpi_ds_result_stack_pop(walk_state);
619 if (ACPI_FAILURE (status)) { 635 if (ACPI_FAILURE(status)) {
620 goto cleanup; 636 goto cleanup;
621 } 637 }
622 638
@@ -625,56 +641,58 @@ acpi_ds_exec_end_op (
625 * current result stack 641 * current result stack
626 */ 642 */
627 if (walk_state->result_obj) { 643 if (walk_state->result_obj) {
628 status = acpi_ds_result_push (walk_state->result_obj, walk_state); 644 status =
645 acpi_ds_result_push(walk_state->result_obj,
646 walk_state);
629 } 647 }
630 break; 648 break;
631 649
632
633 case AML_TYPE_NAMED_FIELD: 650 case AML_TYPE_NAMED_FIELD:
634 case AML_TYPE_NAMED_COMPLEX: 651 case AML_TYPE_NAMED_COMPLEX:
635 case AML_TYPE_NAMED_SIMPLE: 652 case AML_TYPE_NAMED_SIMPLE:
636 case AML_TYPE_NAMED_NO_OBJ: 653 case AML_TYPE_NAMED_NO_OBJ:
637 654
638 status = acpi_ds_load2_end_op (walk_state); 655 status = acpi_ds_load2_end_op(walk_state);
639 if (ACPI_FAILURE (status)) { 656 if (ACPI_FAILURE(status)) {
640 break; 657 break;
641 } 658 }
642 659
643 if (op->common.aml_opcode == AML_REGION_OP) { 660 if (op->common.aml_opcode == AML_REGION_OP) {
644 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 661 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
645 "Executing op_region Address/Length Op=%p\n", op)); 662 "Executing op_region Address/Length Op=%p\n",
646 663 op));
647 status = acpi_ds_eval_region_operands (walk_state, op); 664
648 if (ACPI_FAILURE (status)) { 665 status =
666 acpi_ds_eval_region_operands(walk_state,
667 op);
668 if (ACPI_FAILURE(status)) {
649 break; 669 break;
650 } 670 }
651 671
652 status = acpi_ds_result_stack_pop (walk_state); 672 status = acpi_ds_result_stack_pop(walk_state);
653 } 673 }
654 674
655 break; 675 break;
656 676
657
658 case AML_TYPE_UNDEFINED: 677 case AML_TYPE_UNDEFINED:
659 678
660 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 679 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
661 "Undefined opcode type Op=%p\n", op)); 680 "Undefined opcode type Op=%p\n", op));
662 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 681 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
663
664 682
665 case AML_TYPE_BOGUS: 683 case AML_TYPE_BOGUS:
666 684
667 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 685 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
668 "Internal opcode=%X type Op=%p\n", 686 "Internal opcode=%X type Op=%p\n",
669 walk_state->opcode, op)); 687 walk_state->opcode, op));
670 break; 688 break;
671 689
672
673 default: 690 default:
674 691
675 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 692 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
676 "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", 693 "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
677 op_class, op_type, op->common.aml_opcode, op)); 694 op_class, op_type,
695 op->common.aml_opcode, op));
678 696
679 status = AE_NOT_IMPLEMENTED; 697 status = AE_NOT_IMPLEMENTED;
680 break; 698 break;
@@ -685,55 +703,58 @@ acpi_ds_exec_end_op (
685 * ACPI 2.0 support for 64-bit integers: Truncate numeric 703 * ACPI 2.0 support for 64-bit integers: Truncate numeric
686 * result value if we are executing from a 32-bit ACPI table 704 * result value if we are executing from a 32-bit ACPI table
687 */ 705 */
688 acpi_ex_truncate_for32bit_table (walk_state->result_obj); 706 acpi_ex_truncate_for32bit_table(walk_state->result_obj);
689 707
690 /* 708 /*
691 * Check if we just completed the evaluation of a 709 * Check if we just completed the evaluation of a
692 * conditional predicate 710 * conditional predicate
693 */ 711 */
694 712
695 if ((ACPI_SUCCESS (status)) && 713 if ((ACPI_SUCCESS(status)) &&
696 (walk_state->control_state) && 714 (walk_state->control_state) &&
697 (walk_state->control_state->common.state == 715 (walk_state->control_state->common.state ==
698 ACPI_CONTROL_PREDICATE_EXECUTING) && 716 ACPI_CONTROL_PREDICATE_EXECUTING) &&
699 (walk_state->control_state->control.predicate_op == op)) { 717 (walk_state->control_state->control.predicate_op == op)) {
700 status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj); 718 status =
719 acpi_ds_get_predicate_value(walk_state,
720 walk_state->result_obj);
701 walk_state->result_obj = NULL; 721 walk_state->result_obj = NULL;
702 } 722 }
703 723
704 724 cleanup:
705cleanup:
706 725
707 /* Invoke exception handler on error */ 726 /* Invoke exception handler on error */
708 727
709 if (ACPI_FAILURE (status) && 728 if (ACPI_FAILURE(status) &&
710 acpi_gbl_exception_handler && 729 acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
711 !(status & AE_CODE_CONTROL)) { 730 acpi_ex_exit_interpreter();
712 acpi_ex_exit_interpreter (); 731 status = acpi_gbl_exception_handler(status,
713 status = acpi_gbl_exception_handler (status, 732 walk_state->method_node->
714 walk_state->method_node->name.integer, walk_state->opcode, 733 name.integer,
715 walk_state->aml_offset, NULL); 734 walk_state->opcode,
716 (void) acpi_ex_enter_interpreter (); 735 walk_state->aml_offset,
736 NULL);
737 (void)acpi_ex_enter_interpreter();
717 } 738 }
718 739
719 if (walk_state->result_obj) { 740 if (walk_state->result_obj) {
720 /* Break to debugger to display result */ 741 /* Break to debugger to display result */
721 742
722 ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, 743 ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
723 walk_state)); 744 (walk_state->result_obj, walk_state));
724 745
725 /* 746 /*
726 * Delete the result op if and only if: 747 * Delete the result op if and only if:
727 * Parent will not use the result -- such as any 748 * Parent will not use the result -- such as any
728 * non-nested type2 op in a method (parent will be method) 749 * non-nested type2 op in a method (parent will be method)
729 */ 750 */
730 acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state); 751 acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
752 walk_state);
731 } 753 }
732
733#ifdef _UNDER_DEVELOPMENT 754#ifdef _UNDER_DEVELOPMENT
734 755
735 if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) { 756 if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
736 acpi_db_method_end (walk_state); 757 acpi_db_method_end(walk_state);
737 } 758 }
738#endif 759#endif
739 760
@@ -745,12 +766,10 @@ cleanup:
745 766
746 /* On error, display method locals/args */ 767 /* On error, display method locals/args */
747 768
748 if (ACPI_FAILURE (status)) { 769 if (ACPI_FAILURE(status)) {
749 acpi_dm_dump_method_info (status, walk_state, op); 770 acpi_dm_dump_method_info(status, walk_state, op);
750 } 771 }
751#endif 772#endif
752 773
753 return_ACPI_STATUS (status); 774 return_ACPI_STATUS(status);
754} 775}
755
756