aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exoparg2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exoparg2.c')
-rw-r--r--drivers/acpi/executer/exoparg2.c317
1 files changed, 140 insertions, 177 deletions
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
index 7429032c2b6c..8d70c6beef00 100644
--- a/drivers/acpi/executer/exoparg2.c
+++ b/drivers/acpi/executer/exoparg2.c
@@ -41,17 +41,14 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acparser.h> 45#include <acpi/acparser.h>
47#include <acpi/acinterp.h> 46#include <acpi/acinterp.h>
48#include <acpi/acevents.h> 47#include <acpi/acevents.h>
49#include <acpi/amlcode.h> 48#include <acpi/amlcode.h>
50 49
51
52#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exoparg2") 51ACPI_MODULE_NAME("exoparg2")
54
55 52
56/*! 53/*!
57 * Naming convention for AML interpreter execution routines. 54 * Naming convention for AML interpreter execution routines.
@@ -74,8 +71,6 @@
74 * The AcpiExOpcode* functions are called via the Dispatcher component with 71 * The AcpiExOpcode* functions are called via the Dispatcher component with
75 * fully resolved operands. 72 * fully resolved operands.
76!*/ 73!*/
77
78
79/******************************************************************************* 74/*******************************************************************************
80 * 75 *
81 * FUNCTION: acpi_ex_opcode_2A_0T_0R 76 * FUNCTION: acpi_ex_opcode_2A_0T_0R
@@ -90,29 +85,24 @@
90 * ALLOCATION: Deletes both operands 85 * ALLOCATION: Deletes both operands
91 * 86 *
92 ******************************************************************************/ 87 ******************************************************************************/
93 88acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
94acpi_status
95acpi_ex_opcode_2A_0T_0R (
96 struct acpi_walk_state *walk_state)
97{ 89{
98 union acpi_operand_object **operand = &walk_state->operands[0]; 90 union acpi_operand_object **operand = &walk_state->operands[0];
99 struct acpi_namespace_node *node; 91 struct acpi_namespace_node *node;
100 u32 value; 92 u32 value;
101 acpi_status status = AE_OK; 93 acpi_status status = AE_OK;
102
103
104 ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_0R",
105 acpi_ps_get_opcode_name (walk_state->opcode));
106 94
95 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
96 acpi_ps_get_opcode_name(walk_state->opcode));
107 97
108 /* Examine the opcode */ 98 /* Examine the opcode */
109 99
110 switch (walk_state->opcode) { 100 switch (walk_state->opcode) {
111 case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */ 101 case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */
112 102
113 /* The first operand is a namespace node */ 103 /* The first operand is a namespace node */
114 104
115 node = (struct acpi_namespace_node *) operand[0]; 105 node = (struct acpi_namespace_node *)operand[0];
116 106
117 /* Second value is the notify value */ 107 /* Second value is the notify value */
118 108
@@ -120,15 +110,14 @@ acpi_ex_opcode_2A_0T_0R (
120 110
121 /* Are notifies allowed on this object? */ 111 /* Are notifies allowed on this object? */
122 112
123 if (!acpi_ev_is_notify_object (node)) { 113 if (!acpi_ev_is_notify_object(node)) {
124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 114 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
125 "Unexpected notify object type [%s]\n", 115 "Unexpected notify object type [%s]\n",
126 acpi_ut_get_type_name (node->type))); 116 acpi_ut_get_type_name(node->type)));
127 117
128 status = AE_AML_OPERAND_TYPE; 118 status = AE_AML_OPERAND_TYPE;
129 break; 119 break;
130 } 120 }
131
132#ifdef ACPI_GPE_NOTIFY_CHECK 121#ifdef ACPI_GPE_NOTIFY_CHECK
133 /* 122 /*
134 * GPE method wake/notify check. Here, we want to ensure that we 123 * GPE method wake/notify check. Here, we want to ensure that we
@@ -144,12 +133,14 @@ acpi_ex_opcode_2A_0T_0R (
144 * If all three cases are true, this is a wake-only GPE that should 133 * If all three cases are true, this is a wake-only GPE that should
145 * be disabled at runtime. 134 * be disabled at runtime.
146 */ 135 */
147 if (value == 2) /* device_wake */ { 136 if (value == 2) { /* device_wake */
148 status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info); 137 status =
149 if (ACPI_FAILURE (status)) { 138 acpi_ev_check_for_wake_only_gpe(walk_state->
139 gpe_event_info);
140 if (ACPI_FAILURE(status)) {
150 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ 141 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
151 142
152 return_ACPI_STATUS (AE_OK) 143 return_ACPI_STATUS(AE_OK)
153 } 144 }
154 } 145 }
155#endif 146#endif
@@ -161,21 +152,18 @@ acpi_ex_opcode_2A_0T_0R (
161 * from this thread -- because handlers may in turn run other 152 * from this thread -- because handlers may in turn run other
162 * control methods. 153 * control methods.
163 */ 154 */
164 status = acpi_ev_queue_notify_request (node, value); 155 status = acpi_ev_queue_notify_request(node, value);
165 break; 156 break;
166 157
167
168 default: 158 default:
169 159
170 ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", 160 ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
171 walk_state->opcode));
172 status = AE_AML_BAD_OPCODE; 161 status = AE_AML_BAD_OPCODE;
173 } 162 }
174 163
175 return_ACPI_STATUS (status); 164 return_ACPI_STATUS(status);
176} 165}
177 166
178
179/******************************************************************************* 167/*******************************************************************************
180 * 168 *
181 * FUNCTION: acpi_ex_opcode_2A_2T_1R 169 * FUNCTION: acpi_ex_opcode_2A_2T_1R
@@ -189,19 +177,15 @@ acpi_ex_opcode_2A_0T_0R (
189 * 177 *
190 ******************************************************************************/ 178 ******************************************************************************/
191 179
192acpi_status 180acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
193acpi_ex_opcode_2A_2T_1R (
194 struct acpi_walk_state *walk_state)
195{ 181{
196 union acpi_operand_object **operand = &walk_state->operands[0]; 182 union acpi_operand_object **operand = &walk_state->operands[0];
197 union acpi_operand_object *return_desc1 = NULL; 183 union acpi_operand_object *return_desc1 = NULL;
198 union acpi_operand_object *return_desc2 = NULL; 184 union acpi_operand_object *return_desc2 = NULL;
199 acpi_status status; 185 acpi_status status;
200
201
202 ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R",
203 acpi_ps_get_opcode_name (walk_state->opcode));
204 186
187 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
188 acpi_ps_get_opcode_name(walk_state->opcode));
205 189
206 /* Execute the opcode */ 190 /* Execute the opcode */
207 191
@@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R (
210 194
211 /* Divide (Dividend, Divisor, remainder_result quotient_result) */ 195 /* Divide (Dividend, Divisor, remainder_result quotient_result) */
212 196
213 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 197 return_desc1 =
198 acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
214 if (!return_desc1) { 199 if (!return_desc1) {
215 status = AE_NO_MEMORY; 200 status = AE_NO_MEMORY;
216 goto cleanup; 201 goto cleanup;
217 } 202 }
218 203
219 return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 204 return_desc2 =
205 acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
220 if (!return_desc2) { 206 if (!return_desc2) {
221 status = AE_NO_MEMORY; 207 status = AE_NO_MEMORY;
222 goto cleanup; 208 goto cleanup;
@@ -224,33 +210,31 @@ acpi_ex_opcode_2A_2T_1R (
224 210
225 /* Quotient to return_desc1, remainder to return_desc2 */ 211 /* Quotient to return_desc1, remainder to return_desc2 */
226 212
227 status = acpi_ut_divide (operand[0]->integer.value, 213 status = acpi_ut_divide(operand[0]->integer.value,
228 operand[1]->integer.value, 214 operand[1]->integer.value,
229 &return_desc1->integer.value, 215 &return_desc1->integer.value,
230 &return_desc2->integer.value); 216 &return_desc2->integer.value);
231 if (ACPI_FAILURE (status)) { 217 if (ACPI_FAILURE(status)) {
232 goto cleanup; 218 goto cleanup;
233 } 219 }
234 break; 220 break;
235 221
236
237 default: 222 default:
238 223
239 ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", 224 ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode));
240 walk_state->opcode));
241 status = AE_AML_BAD_OPCODE; 225 status = AE_AML_BAD_OPCODE;
242 goto cleanup; 226 goto cleanup;
243 } 227 }
244 228
245 /* Store the results to the target reference operands */ 229 /* Store the results to the target reference operands */
246 230
247 status = acpi_ex_store (return_desc2, operand[2], walk_state); 231 status = acpi_ex_store(return_desc2, operand[2], walk_state);
248 if (ACPI_FAILURE (status)) { 232 if (ACPI_FAILURE(status)) {
249 goto cleanup; 233 goto cleanup;
250 } 234 }
251 235
252 status = acpi_ex_store (return_desc1, operand[3], walk_state); 236 status = acpi_ex_store(return_desc1, operand[3], walk_state);
253 if (ACPI_FAILURE (status)) { 237 if (ACPI_FAILURE(status)) {
254 goto cleanup; 238 goto cleanup;
255 } 239 }
256 240
@@ -258,24 +242,22 @@ acpi_ex_opcode_2A_2T_1R (
258 242
259 walk_state->result_obj = return_desc1; 243 walk_state->result_obj = return_desc1;
260 244
261 245 cleanup:
262cleanup:
263 /* 246 /*
264 * Since the remainder is not returned indirectly, remove a reference to 247 * Since the remainder is not returned indirectly, remove a reference to
265 * it. Only the quotient is returned indirectly. 248 * it. Only the quotient is returned indirectly.
266 */ 249 */
267 acpi_ut_remove_reference (return_desc2); 250 acpi_ut_remove_reference(return_desc2);
268 251
269 if (ACPI_FAILURE (status)) { 252 if (ACPI_FAILURE(status)) {
270 /* Delete the return object */ 253 /* Delete the return object */
271 254
272 acpi_ut_remove_reference (return_desc1); 255 acpi_ut_remove_reference(return_desc1);
273 } 256 }
274 257
275 return_ACPI_STATUS (status); 258 return_ACPI_STATUS(status);
276} 259}
277 260
278
279/******************************************************************************* 261/*******************************************************************************
280 * 262 *
281 * FUNCTION: acpi_ex_opcode_2A_1T_1R 263 * FUNCTION: acpi_ex_opcode_2A_1T_1R
@@ -289,42 +271,39 @@ cleanup:
289 * 271 *
290 ******************************************************************************/ 272 ******************************************************************************/
291 273
292acpi_status 274acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
293acpi_ex_opcode_2A_1T_1R (
294 struct acpi_walk_state *walk_state)
295{ 275{
296 union acpi_operand_object **operand = &walk_state->operands[0]; 276 union acpi_operand_object **operand = &walk_state->operands[0];
297 union acpi_operand_object *return_desc = NULL; 277 union acpi_operand_object *return_desc = NULL;
298 acpi_integer index; 278 acpi_integer index;
299 acpi_status status = AE_OK; 279 acpi_status status = AE_OK;
300 acpi_size length; 280 acpi_size length;
301
302
303 ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R",
304 acpi_ps_get_opcode_name (walk_state->opcode));
305 281
282 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
283 acpi_ps_get_opcode_name(walk_state->opcode));
306 284
307 /* Execute the opcode */ 285 /* Execute the opcode */
308 286
309 if (walk_state->op_info->flags & AML_MATH) { 287 if (walk_state->op_info->flags & AML_MATH) {
310 /* All simple math opcodes (add, etc.) */ 288 /* All simple math opcodes (add, etc.) */
311 289
312 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 290 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
313 if (!return_desc) { 291 if (!return_desc) {
314 status = AE_NO_MEMORY; 292 status = AE_NO_MEMORY;
315 goto cleanup; 293 goto cleanup;
316 } 294 }
317 295
318 return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode, 296 return_desc->integer.value =
319 operand[0]->integer.value, 297 acpi_ex_do_math_op(walk_state->opcode,
320 operand[1]->integer.value); 298 operand[0]->integer.value,
299 operand[1]->integer.value);
321 goto store_result_to_target; 300 goto store_result_to_target;
322 } 301 }
323 302
324 switch (walk_state->opcode) { 303 switch (walk_state->opcode) {
325 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ 304 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
326 305
327 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 306 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
328 if (!return_desc) { 307 if (!return_desc) {
329 status = AE_NO_MEMORY; 308 status = AE_NO_MEMORY;
330 goto cleanup; 309 goto cleanup;
@@ -332,21 +311,18 @@ acpi_ex_opcode_2A_1T_1R (
332 311
333 /* return_desc will contain the remainder */ 312 /* return_desc will contain the remainder */
334 313
335 status = acpi_ut_divide (operand[0]->integer.value, 314 status = acpi_ut_divide(operand[0]->integer.value,
336 operand[1]->integer.value, 315 operand[1]->integer.value,
337 NULL, 316 NULL, &return_desc->integer.value);
338 &return_desc->integer.value);
339 break; 317 break;
340 318
319 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
341 320
342 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ 321 status = acpi_ex_do_concatenate(operand[0], operand[1],
343 322 &return_desc, walk_state);
344 status = acpi_ex_do_concatenate (operand[0], operand[1],
345 &return_desc, walk_state);
346 break; 323 break;
347 324
348 325 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
349 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
350 326
351 /* 327 /*
352 * Input object is guaranteed to be a buffer at this point (it may have 328 * Input object is guaranteed to be a buffer at this point (it may have
@@ -365,8 +341,8 @@ acpi_ex_opcode_2A_1T_1R (
365 */ 341 */
366 length = 0; 342 length = 0;
367 while ((length < operand[0]->buffer.length) && 343 while ((length < operand[0]->buffer.length) &&
368 (length < operand[1]->integer.value) && 344 (length < operand[1]->integer.value) &&
369 (operand[0]->buffer.pointer[length])) { 345 (operand[0]->buffer.pointer[length])) {
370 length++; 346 length++;
371 if (length > ACPI_MAX_STRING_CONVERSION) { 347 if (length > ACPI_MAX_STRING_CONVERSION) {
372 status = AE_AML_STRING_LIMIT; 348 status = AE_AML_STRING_LIMIT;
@@ -376,33 +352,32 @@ acpi_ex_opcode_2A_1T_1R (
376 352
377 /* Allocate a new string object */ 353 /* Allocate a new string object */
378 354
379 return_desc = acpi_ut_create_string_object (length); 355 return_desc = acpi_ut_create_string_object(length);
380 if (!return_desc) { 356 if (!return_desc) {
381 status = AE_NO_MEMORY; 357 status = AE_NO_MEMORY;
382 goto cleanup; 358 goto cleanup;
383 } 359 }
384 360
385 /* Copy the raw buffer data with no transform. NULL terminated already*/ 361 /* Copy the raw buffer data with no transform. NULL terminated already */
386 362
387 ACPI_MEMCPY (return_desc->string.pointer, 363 ACPI_MEMCPY(return_desc->string.pointer,
388 operand[0]->buffer.pointer, length); 364 operand[0]->buffer.pointer, length);
389 break; 365 break;
390 366
391
392 case AML_CONCAT_RES_OP: 367 case AML_CONCAT_RES_OP:
393 368
394 /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ 369 /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
395 370
396 status = acpi_ex_concat_template (operand[0], operand[1], 371 status = acpi_ex_concat_template(operand[0], operand[1],
397 &return_desc, walk_state); 372 &return_desc, walk_state);
398 break; 373 break;
399 374
400 375 case AML_INDEX_OP: /* Index (Source Index Result) */
401 case AML_INDEX_OP: /* Index (Source Index Result) */
402 376
403 /* Create the internal return object */ 377 /* Create the internal return object */
404 378
405 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); 379 return_desc =
380 acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
406 if (!return_desc) { 381 if (!return_desc) {
407 status = AE_NO_MEMORY; 382 status = AE_NO_MEMORY;
408 goto cleanup; 383 goto cleanup;
@@ -412,76 +387,75 @@ acpi_ex_opcode_2A_1T_1R (
412 387
413 /* At this point, the Source operand is a Package, Buffer, or String */ 388 /* At this point, the Source operand is a Package, Buffer, or String */
414 389
415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { 390 if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) {
416 /* Object to be indexed is a Package */ 391 /* Object to be indexed is a Package */
417 392
418 if (index >= operand[0]->package.count) { 393 if (index >= operand[0]->package.count) {
419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 394 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
420 "Index value (%X%8.8X) beyond package end (%X)\n", 395 "Index value (%X%8.8X) beyond package end (%X)\n",
421 ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); 396 ACPI_FORMAT_UINT64(index),
397 operand[0]->package.count));
422 status = AE_AML_PACKAGE_LIMIT; 398 status = AE_AML_PACKAGE_LIMIT;
423 goto cleanup; 399 goto cleanup;
424 } 400 }
425 401
426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE; 402 return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
427 return_desc->reference.object = operand[0]; 403 return_desc->reference.object = operand[0];
428 return_desc->reference.where = &operand[0]->package.elements [ 404 return_desc->reference.where =
429 index]; 405 &operand[0]->package.elements[index];
430 } 406 } else {
431 else {
432 /* Object to be indexed is a Buffer/String */ 407 /* Object to be indexed is a Buffer/String */
433 408
434 if (index >= operand[0]->buffer.length) { 409 if (index >= operand[0]->buffer.length) {
435 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 410 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
436 "Index value (%X%8.8X) beyond end of buffer (%X)\n", 411 "Index value (%X%8.8X) beyond end of buffer (%X)\n",
437 ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length)); 412 ACPI_FORMAT_UINT64(index),
413 operand[0]->buffer.length));
438 status = AE_AML_BUFFER_LIMIT; 414 status = AE_AML_BUFFER_LIMIT;
439 goto cleanup; 415 goto cleanup;
440 } 416 }
441 417
442 return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD; 418 return_desc->reference.target_type =
443 return_desc->reference.object = operand[0]; 419 ACPI_TYPE_BUFFER_FIELD;
420 return_desc->reference.object = operand[0];
444 } 421 }
445 422
446 /* 423 /*
447 * Add a reference to the target package/buffer/string for the life 424 * Add a reference to the target package/buffer/string for the life
448 * of the index. 425 * of the index.
449 */ 426 */
450 acpi_ut_add_reference (operand[0]); 427 acpi_ut_add_reference(operand[0]);
451 428
452 /* Complete the Index reference object */ 429 /* Complete the Index reference object */
453 430
454 return_desc->reference.opcode = AML_INDEX_OP; 431 return_desc->reference.opcode = AML_INDEX_OP;
455 return_desc->reference.offset = (u32) index; 432 return_desc->reference.offset = (u32) index;
456 433
457 /* Store the reference to the Target */ 434 /* Store the reference to the Target */
458 435
459 status = acpi_ex_store (return_desc, operand[2], walk_state); 436 status = acpi_ex_store(return_desc, operand[2], walk_state);
460 437
461 /* Return the reference */ 438 /* Return the reference */
462 439
463 walk_state->result_obj = return_desc; 440 walk_state->result_obj = return_desc;
464 goto cleanup; 441 goto cleanup;
465 442
466
467 default: 443 default:
468 444
469 ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", 445 ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
470 walk_state->opcode));
471 status = AE_AML_BAD_OPCODE; 446 status = AE_AML_BAD_OPCODE;
472 break; 447 break;
473 } 448 }
474 449
450 store_result_to_target:
475 451
476store_result_to_target: 452 if (ACPI_SUCCESS(status)) {
477
478 if (ACPI_SUCCESS (status)) {
479 /* 453 /*
480 * Store the result of the operation (which is now in return_desc) into 454 * Store the result of the operation (which is now in return_desc) into
481 * the Target descriptor. 455 * the Target descriptor.
482 */ 456 */
483 status = acpi_ex_store (return_desc, operand[2], walk_state); 457 status = acpi_ex_store(return_desc, operand[2], walk_state);
484 if (ACPI_FAILURE (status)) { 458 if (ACPI_FAILURE(status)) {
485 goto cleanup; 459 goto cleanup;
486 } 460 }
487 461
@@ -490,19 +464,17 @@ store_result_to_target:
490 } 464 }
491 } 465 }
492 466
493 467 cleanup:
494cleanup:
495 468
496 /* Delete return object on error */ 469 /* Delete return object on error */
497 470
498 if (ACPI_FAILURE (status)) { 471 if (ACPI_FAILURE(status)) {
499 acpi_ut_remove_reference (return_desc); 472 acpi_ut_remove_reference(return_desc);
500 } 473 }
501 474
502 return_ACPI_STATUS (status); 475 return_ACPI_STATUS(status);
503} 476}
504 477
505
506/******************************************************************************* 478/*******************************************************************************
507 * 479 *
508 * FUNCTION: acpi_ex_opcode_2A_0T_1R 480 * FUNCTION: acpi_ex_opcode_2A_0T_1R
@@ -515,23 +487,19 @@ cleanup:
515 * 487 *
516 ******************************************************************************/ 488 ******************************************************************************/
517 489
518acpi_status 490acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
519acpi_ex_opcode_2A_0T_1R (
520 struct acpi_walk_state *walk_state)
521{ 491{
522 union acpi_operand_object **operand = &walk_state->operands[0]; 492 union acpi_operand_object **operand = &walk_state->operands[0];
523 union acpi_operand_object *return_desc = NULL; 493 union acpi_operand_object *return_desc = NULL;
524 acpi_status status = AE_OK; 494 acpi_status status = AE_OK;
525 u8 logical_result = FALSE; 495 u8 logical_result = FALSE;
526
527
528 ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R",
529 acpi_ps_get_opcode_name (walk_state->opcode));
530 496
497 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
498 acpi_ps_get_opcode_name(walk_state->opcode));
531 499
532 /* Create the internal return object */ 500 /* Create the internal return object */
533 501
534 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 502 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
535 if (!return_desc) { 503 if (!return_desc) {
536 status = AE_NO_MEMORY; 504 status = AE_NO_MEMORY;
537 goto cleanup; 505 goto cleanup;
@@ -542,50 +510,48 @@ acpi_ex_opcode_2A_0T_1R (
542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { 510 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
543 /* logical_op (Operand0, Operand1) */ 511 /* logical_op (Operand0, Operand1) */
544 512
545 status = acpi_ex_do_logical_numeric_op (walk_state->opcode, 513 status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
546 operand[0]->integer.value, operand[1]->integer.value, 514 operand[0]->integer.
547 &logical_result); 515 value,
516 operand[1]->integer.
517 value, &logical_result);
548 goto store_logical_result; 518 goto store_logical_result;
549 } 519 } else if (walk_state->op_info->flags & AML_LOGICAL) {
550 else if (walk_state->op_info->flags & AML_LOGICAL) {
551 /* logical_op (Operand0, Operand1) */ 520 /* logical_op (Operand0, Operand1) */
552 521
553 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], 522 status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
554 operand[1], &logical_result); 523 operand[1], &logical_result);
555 goto store_logical_result; 524 goto store_logical_result;
556 } 525 }
557 526
558 switch (walk_state->opcode) { 527 switch (walk_state->opcode) {
559 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ 528 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
560 529
561 status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state); 530 status =
531 acpi_ex_acquire_mutex(operand[1], operand[0], walk_state);
562 if (status == AE_TIME) { 532 if (status == AE_TIME) {
563 logical_result = TRUE; /* TRUE = Acquire timed out */ 533 logical_result = TRUE; /* TRUE = Acquire timed out */
564 status = AE_OK; 534 status = AE_OK;
565 } 535 }
566 break; 536 break;
567 537
538 case AML_WAIT_OP: /* Wait (event_object, Timeout) */
568 539
569 case AML_WAIT_OP: /* Wait (event_object, Timeout) */ 540 status = acpi_ex_system_wait_event(operand[1], operand[0]);
570
571 status = acpi_ex_system_wait_event (operand[1], operand[0]);
572 if (status == AE_TIME) { 541 if (status == AE_TIME) {
573 logical_result = TRUE; /* TRUE, Wait timed out */ 542 logical_result = TRUE; /* TRUE, Wait timed out */
574 status = AE_OK; 543 status = AE_OK;
575 } 544 }
576 break; 545 break;
577 546
578
579 default: 547 default:
580 548
581 ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", 549 ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
582 walk_state->opcode));
583 status = AE_AML_BAD_OPCODE; 550 status = AE_AML_BAD_OPCODE;
584 goto cleanup; 551 goto cleanup;
585 } 552 }
586 553
587 554 store_logical_result:
588store_logical_result:
589 /* 555 /*
590 * Set return value to according to logical_result. logical TRUE (all ones) 556 * Set return value to according to logical_result. logical TRUE (all ones)
591 * Default is FALSE (zero) 557 * Default is FALSE (zero)
@@ -596,16 +562,13 @@ store_logical_result:
596 562
597 walk_state->result_obj = return_desc; 563 walk_state->result_obj = return_desc;
598 564
599 565 cleanup:
600cleanup:
601 566
602 /* Delete return object on error */ 567 /* Delete return object on error */
603 568
604 if (ACPI_FAILURE (status)) { 569 if (ACPI_FAILURE(status)) {
605 acpi_ut_remove_reference (return_desc); 570 acpi_ut_remove_reference(return_desc);
606 } 571 }
607 572
608 return_ACPI_STATUS (status); 573 return_ACPI_STATUS(status);
609} 574}
610
611