aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exoparg1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exoparg1.c')
-rw-r--r--drivers/acpi/executer/exoparg1.c574
1 files changed, 273 insertions, 301 deletions
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index dbdf8262ba00..97e34542f5e4 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.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/acdispat.h> 47#include <acpi/acdispat.h>
@@ -50,10 +49,8 @@
50#include <acpi/amlcode.h> 49#include <acpi/amlcode.h>
51#include <acpi/acnamesp.h> 50#include <acpi/acnamesp.h>
52 51
53
54#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exoparg1") 53ACPI_MODULE_NAME("exoparg1")
56
57 54
58/*! 55/*!
59 * Naming convention for AML interpreter execution routines. 56 * Naming convention for AML interpreter execution routines.
@@ -76,7 +73,6 @@
76 * The AcpiExOpcode* functions are called via the Dispatcher component with 73 * The AcpiExOpcode* functions are called via the Dispatcher component with
77 * fully resolved operands. 74 * fully resolved operands.
78!*/ 75!*/
79
80/******************************************************************************* 76/*******************************************************************************
81 * 77 *
82 * FUNCTION: acpi_ex_opcode_0A_0T_1R 78 * FUNCTION: acpi_ex_opcode_0A_0T_1R
@@ -88,59 +84,53 @@
88 * DESCRIPTION: Execute operator with no operands, one return value 84 * DESCRIPTION: Execute operator with no operands, one return value
89 * 85 *
90 ******************************************************************************/ 86 ******************************************************************************/
91 87acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
92acpi_status
93acpi_ex_opcode_0A_0T_1R (
94 struct acpi_walk_state *walk_state)
95{ 88{
96 acpi_status status = AE_OK; 89 acpi_status status = AE_OK;
97 union acpi_operand_object *return_desc = NULL; 90 union acpi_operand_object *return_desc = NULL;
98
99
100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R",
101 acpi_ps_get_opcode_name (walk_state->opcode));
102 91
92 ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R",
93 acpi_ps_get_opcode_name(walk_state->opcode));
103 94
104 /* Examine the AML opcode */ 95 /* Examine the AML opcode */
105 96
106 switch (walk_state->opcode) { 97 switch (walk_state->opcode) {
107 case AML_TIMER_OP: /* Timer () */ 98 case AML_TIMER_OP: /* Timer () */
108 99
109 /* Create a return object of type Integer */ 100 /* Create a return object of type Integer */
110 101
111 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 102 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
112 if (!return_desc) { 103 if (!return_desc) {
113 status = AE_NO_MEMORY; 104 status = AE_NO_MEMORY;
114 goto cleanup; 105 goto cleanup;
115 } 106 }
116 107#if ACPI_MACHINE_WIDTH != 16
117 return_desc->integer.value = acpi_os_get_timer (); 108 return_desc->integer.value = acpi_os_get_timer();
109#endif
118 break; 110 break;
119 111
120 default: /* Unknown opcode */ 112 default: /* Unknown opcode */
121 113
122 ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", 114 ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
123 walk_state->opcode));
124 status = AE_AML_BAD_OPCODE; 115 status = AE_AML_BAD_OPCODE;
125 break; 116 break;
126 } 117 }
127 118
128cleanup: 119 cleanup:
129
130 if (!walk_state->result_obj) {
131 walk_state->result_obj = return_desc;
132 }
133 120
134 /* Delete return object on error */ 121 /* Delete return object on error */
135 122
136 if (ACPI_FAILURE (status)) { 123 if ((ACPI_FAILURE(status)) || walk_state->result_obj) {
137 acpi_ut_remove_reference (return_desc); 124 acpi_ut_remove_reference(return_desc);
125 } else {
126 /* Save the return value */
127
128 walk_state->result_obj = return_desc;
138 } 129 }
139 130
140 return_ACPI_STATUS (status); 131 return_ACPI_STATUS(status);
141} 132}
142 133
143
144/******************************************************************************* 134/*******************************************************************************
145 * 135 *
146 * FUNCTION: acpi_ex_opcode_1A_0T_0R 136 * FUNCTION: acpi_ex_opcode_1A_0T_0R
@@ -154,69 +144,58 @@ cleanup:
154 * 144 *
155 ******************************************************************************/ 145 ******************************************************************************/
156 146
157acpi_status 147acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
158acpi_ex_opcode_1A_0T_0R (
159 struct acpi_walk_state *walk_state)
160{ 148{
161 union acpi_operand_object **operand = &walk_state->operands[0]; 149 union acpi_operand_object **operand = &walk_state->operands[0];
162 acpi_status status = AE_OK; 150 acpi_status status = AE_OK;
163
164
165 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R",
166 acpi_ps_get_opcode_name (walk_state->opcode));
167 151
152 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R",
153 acpi_ps_get_opcode_name(walk_state->opcode));
168 154
169 /* Examine the AML opcode */ 155 /* Examine the AML opcode */
170 156
171 switch (walk_state->opcode) { 157 switch (walk_state->opcode) {
172 case AML_RELEASE_OP: /* Release (mutex_object) */ 158 case AML_RELEASE_OP: /* Release (mutex_object) */
173 159
174 status = acpi_ex_release_mutex (operand[0], walk_state); 160 status = acpi_ex_release_mutex(operand[0], walk_state);
175 break; 161 break;
176 162
163 case AML_RESET_OP: /* Reset (event_object) */
177 164
178 case AML_RESET_OP: /* Reset (event_object) */ 165 status = acpi_ex_system_reset_event(operand[0]);
179
180 status = acpi_ex_system_reset_event (operand[0]);
181 break; 166 break;
182 167
168 case AML_SIGNAL_OP: /* Signal (event_object) */
183 169
184 case AML_SIGNAL_OP: /* Signal (event_object) */ 170 status = acpi_ex_system_signal_event(operand[0]);
185
186 status = acpi_ex_system_signal_event (operand[0]);
187 break; 171 break;
188 172
173 case AML_SLEEP_OP: /* Sleep (msec_time) */
189 174
190 case AML_SLEEP_OP: /* Sleep (msec_time) */ 175 status = acpi_ex_system_do_suspend(operand[0]->integer.value);
191
192 status = acpi_ex_system_do_suspend (operand[0]->integer.value);
193 break; 176 break;
194 177
178 case AML_STALL_OP: /* Stall (usec_time) */
195 179
196 case AML_STALL_OP: /* Stall (usec_time) */ 180 status =
197 181 acpi_ex_system_do_stall((u32) operand[0]->integer.value);
198 status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value);
199 break; 182 break;
200 183
184 case AML_UNLOAD_OP: /* Unload (Handle) */
201 185
202 case AML_UNLOAD_OP: /* Unload (Handle) */ 186 status = acpi_ex_unload_table(operand[0]);
203
204 status = acpi_ex_unload_table (operand[0]);
205 break; 187 break;
206 188
189 default: /* Unknown opcode */
207 190
208 default: /* Unknown opcode */ 191 ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
209
210 ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n",
211 walk_state->opcode));
212 status = AE_AML_BAD_OPCODE; 192 status = AE_AML_BAD_OPCODE;
213 break; 193 break;
214 } 194 }
215 195
216 return_ACPI_STATUS (status); 196 return_ACPI_STATUS(status);
217} 197}
218 198
219
220/******************************************************************************* 199/*******************************************************************************
221 * 200 *
222 * FUNCTION: acpi_ex_opcode_1A_1T_0R 201 * FUNCTION: acpi_ex_opcode_1A_1T_0R
@@ -230,41 +209,34 @@ acpi_ex_opcode_1A_0T_0R (
230 * 209 *
231 ******************************************************************************/ 210 ******************************************************************************/
232 211
233acpi_status 212acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
234acpi_ex_opcode_1A_1T_0R (
235 struct acpi_walk_state *walk_state)
236{ 213{
237 acpi_status status = AE_OK; 214 acpi_status status = AE_OK;
238 union acpi_operand_object **operand = &walk_state->operands[0]; 215 union acpi_operand_object **operand = &walk_state->operands[0];
239
240
241 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R",
242 acpi_ps_get_opcode_name (walk_state->opcode));
243 216
217 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R",
218 acpi_ps_get_opcode_name(walk_state->opcode));
244 219
245 /* Examine the AML opcode */ 220 /* Examine the AML opcode */
246 221
247 switch (walk_state->opcode) { 222 switch (walk_state->opcode) {
248 case AML_LOAD_OP: 223 case AML_LOAD_OP:
249 224
250 status = acpi_ex_load_op (operand[0], operand[1], walk_state); 225 status = acpi_ex_load_op(operand[0], operand[1], walk_state);
251 break; 226 break;
252 227
253 default: /* Unknown opcode */ 228 default: /* Unknown opcode */
254 229
255 ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", 230 ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode));
256 walk_state->opcode));
257 status = AE_AML_BAD_OPCODE; 231 status = AE_AML_BAD_OPCODE;
258 goto cleanup; 232 goto cleanup;
259 } 233 }
260 234
235 cleanup:
261 236
262cleanup: 237 return_ACPI_STATUS(status);
263
264 return_ACPI_STATUS (status);
265} 238}
266 239
267
268/******************************************************************************* 240/*******************************************************************************
269 * 241 *
270 * FUNCTION: acpi_ex_opcode_1A_1T_1R 242 * FUNCTION: acpi_ex_opcode_1A_1T_1R
@@ -278,23 +250,19 @@ cleanup:
278 * 250 *
279 ******************************************************************************/ 251 ******************************************************************************/
280 252
281acpi_status 253acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
282acpi_ex_opcode_1A_1T_1R (
283 struct acpi_walk_state *walk_state)
284{ 254{
285 acpi_status status = AE_OK; 255 acpi_status status = AE_OK;
286 union acpi_operand_object **operand = &walk_state->operands[0]; 256 union acpi_operand_object **operand = &walk_state->operands[0];
287 union acpi_operand_object *return_desc = NULL; 257 union acpi_operand_object *return_desc = NULL;
288 union acpi_operand_object *return_desc2 = NULL; 258 union acpi_operand_object *return_desc2 = NULL;
289 u32 temp32; 259 u32 temp32;
290 u32 i; 260 u32 i;
291 acpi_integer power_of_ten; 261 acpi_integer power_of_ten;
292 acpi_integer digit; 262 acpi_integer digit;
293 263
294 264 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R",
295 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", 265 acpi_ps_get_opcode_name(walk_state->opcode));
296 acpi_ps_get_opcode_name (walk_state->opcode));
297
298 266
299 /* Examine the AML opcode */ 267 /* Examine the AML opcode */
300 268
@@ -308,20 +276,19 @@ acpi_ex_opcode_1A_1T_1R (
308 276
309 /* Create a return object of type Integer for these opcodes */ 277 /* Create a return object of type Integer for these opcodes */
310 278
311 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 279 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
312 if (!return_desc) { 280 if (!return_desc) {
313 status = AE_NO_MEMORY; 281 status = AE_NO_MEMORY;
314 goto cleanup; 282 goto cleanup;
315 } 283 }
316 284
317 switch (walk_state->opcode) { 285 switch (walk_state->opcode) {
318 case AML_BIT_NOT_OP: /* Not (Operand, Result) */ 286 case AML_BIT_NOT_OP: /* Not (Operand, Result) */
319 287
320 return_desc->integer.value = ~operand[0]->integer.value; 288 return_desc->integer.value = ~operand[0]->integer.value;
321 break; 289 break;
322 290
323 291 case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */
324 case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */
325 292
326 return_desc->integer.value = operand[0]->integer.value; 293 return_desc->integer.value = operand[0]->integer.value;
327 294
@@ -330,15 +297,14 @@ acpi_ex_opcode_1A_1T_1R (
330 * endian unsigned value, so this boundary condition is valid. 297 * endian unsigned value, so this boundary condition is valid.
331 */ 298 */
332 for (temp32 = 0; return_desc->integer.value && 299 for (temp32 = 0; return_desc->integer.value &&
333 temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { 300 temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
334 return_desc->integer.value >>= 1; 301 return_desc->integer.value >>= 1;
335 } 302 }
336 303
337 return_desc->integer.value = temp32; 304 return_desc->integer.value = temp32;
338 break; 305 break;
339 306
340 307 case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
341 case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
342 308
343 return_desc->integer.value = operand[0]->integer.value; 309 return_desc->integer.value = operand[0]->integer.value;
344 310
@@ -347,18 +313,17 @@ acpi_ex_opcode_1A_1T_1R (
347 * endian unsigned value, so this boundary condition is valid. 313 * endian unsigned value, so this boundary condition is valid.
348 */ 314 */
349 for (temp32 = 0; return_desc->integer.value && 315 for (temp32 = 0; return_desc->integer.value &&
350 temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { 316 temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
351 return_desc->integer.value <<= 1; 317 return_desc->integer.value <<= 1;
352 } 318 }
353 319
354 /* Since the bit position is one-based, subtract from 33 (65) */ 320 /* Since the bit position is one-based, subtract from 33 (65) */
355 321
356 return_desc->integer.value = temp32 == 0 ? 0 : 322 return_desc->integer.value = temp32 == 0 ? 0 :
357 (ACPI_INTEGER_BIT_SIZE + 1) - temp32; 323 (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
358 break; 324 break;
359 325
360 326 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
361 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
362 327
363 /* 328 /*
364 * The 64-bit ACPI integer can hold 16 4-bit BCD characters 329 * The 64-bit ACPI integer can hold 16 4-bit BCD characters
@@ -371,7 +336,9 @@ acpi_ex_opcode_1A_1T_1R (
371 336
372 /* Convert each BCD digit (each is one nybble wide) */ 337 /* Convert each BCD digit (each is one nybble wide) */
373 338
374 for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { 339 for (i = 0;
340 (i < acpi_gbl_integer_nybble_width) && (digit > 0);
341 i++) {
375 /* Get the least significant 4-bit BCD digit */ 342 /* Get the least significant 4-bit BCD digit */
376 343
377 temp32 = ((u32) digit) & 0xF; 344 temp32 = ((u32) digit) & 0xF;
@@ -379,9 +346,9 @@ acpi_ex_opcode_1A_1T_1R (
379 /* Check the range of the digit */ 346 /* Check the range of the digit */
380 347
381 if (temp32 > 9) { 348 if (temp32 > 9) {
382 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 349 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
383 "BCD digit too large (not decimal): 0x%X\n", 350 "BCD digit too large (not decimal): 0x%X\n",
384 temp32)); 351 temp32));
385 352
386 status = AE_AML_NUMERIC_OVERFLOW; 353 status = AE_AML_NUMERIC_OVERFLOW;
387 goto cleanup; 354 goto cleanup;
@@ -389,8 +356,8 @@ acpi_ex_opcode_1A_1T_1R (
389 356
390 /* Sum the digit into the result with the current power of 10 */ 357 /* Sum the digit into the result with the current power of 10 */
391 358
392 return_desc->integer.value += (((acpi_integer) temp32) * 359 return_desc->integer.value +=
393 power_of_ten); 360 (((acpi_integer) temp32) * power_of_ten);
394 361
395 /* Shift to next BCD digit */ 362 /* Shift to next BCD digit */
396 363
@@ -402,45 +369,50 @@ acpi_ex_opcode_1A_1T_1R (
402 } 369 }
403 break; 370 break;
404 371
405 372 case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */
406 case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */
407 373
408 return_desc->integer.value = 0; 374 return_desc->integer.value = 0;
409 digit = operand[0]->integer.value; 375 digit = operand[0]->integer.value;
410 376
411 /* Each BCD digit is one nybble wide */ 377 /* Each BCD digit is one nybble wide */
412 378
413 for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { 379 for (i = 0;
414 (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); 380 (i < acpi_gbl_integer_nybble_width) && (digit > 0);
381 i++) {
382 (void)acpi_ut_short_divide(digit, 10, &digit,
383 &temp32);
415 384
416 /* 385 /*
417 * Insert the BCD digit that resides in the 386 * Insert the BCD digit that resides in the
418 * remainder from above 387 * remainder from above
419 */ 388 */
420 return_desc->integer.value |= (((acpi_integer) temp32) << 389 return_desc->integer.value |=
421 ACPI_MUL_4 (i)); 390 (((acpi_integer) temp32) << ACPI_MUL_4(i));
422 } 391 }
423 392
424 /* Overflow if there is any data left in Digit */ 393 /* Overflow if there is any data left in Digit */
425 394
426 if (digit > 0) { 395 if (digit > 0) {
427 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 396 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
428 "Integer too large to convert to BCD: %8.8X%8.8X\n", 397 "Integer too large to convert to BCD: %8.8X%8.8X\n",
429 ACPI_FORMAT_UINT64 (operand[0]->integer.value))); 398 ACPI_FORMAT_UINT64(operand
399 [0]->
400 integer.
401 value)));
430 status = AE_AML_NUMERIC_OVERFLOW; 402 status = AE_AML_NUMERIC_OVERFLOW;
431 goto cleanup; 403 goto cleanup;
432 } 404 }
433 break; 405 break;
434 406
435 407 case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */
436 case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */
437 408
438 /* 409 /*
439 * This op is a little strange because the internal return value is 410 * This op is a little strange because the internal return value is
440 * different than the return value stored in the result descriptor 411 * different than the return value stored in the result descriptor
441 * (There are really two return values) 412 * (There are really two return values)
442 */ 413 */
443 if ((struct acpi_namespace_node *) operand[0] == acpi_gbl_root_node) { 414 if ((struct acpi_namespace_node *)operand[0] ==
415 acpi_gbl_root_node) {
444 /* 416 /*
445 * This means that the object does not exist in the namespace, 417 * This means that the object does not exist in the namespace,
446 * return FALSE 418 * return FALSE
@@ -451,38 +423,38 @@ acpi_ex_opcode_1A_1T_1R (
451 423
452 /* Get the object reference, store it, and remove our reference */ 424 /* Get the object reference, store it, and remove our reference */
453 425
454 status = acpi_ex_get_object_reference (operand[0], 426 status = acpi_ex_get_object_reference(operand[0],
455 &return_desc2, walk_state); 427 &return_desc2,
456 if (ACPI_FAILURE (status)) { 428 walk_state);
429 if (ACPI_FAILURE(status)) {
457 goto cleanup; 430 goto cleanup;
458 } 431 }
459 432
460 status = acpi_ex_store (return_desc2, operand[1], walk_state); 433 status =
461 acpi_ut_remove_reference (return_desc2); 434 acpi_ex_store(return_desc2, operand[1], walk_state);
435 acpi_ut_remove_reference(return_desc2);
462 436
463 /* The object exists in the namespace, return TRUE */ 437 /* The object exists in the namespace, return TRUE */
464 438
465 return_desc->integer.value = ACPI_INTEGER_MAX; 439 return_desc->integer.value = ACPI_INTEGER_MAX;
466 goto cleanup; 440 goto cleanup;
467 441
468
469 default: 442 default:
470 /* No other opcodes get here */ 443 /* No other opcodes get here */
471 break; 444 break;
472 } 445 }
473 break; 446 break;
474 447
475 448 case AML_STORE_OP: /* Store (Source, Target) */
476 case AML_STORE_OP: /* Store (Source, Target) */
477 449
478 /* 450 /*
479 * A store operand is typically a number, string, buffer or lvalue 451 * A store operand is typically a number, string, buffer or lvalue
480 * Be careful about deleting the source object, 452 * Be careful about deleting the source object,
481 * since the object itself may have been stored. 453 * since the object itself may have been stored.
482 */ 454 */
483 status = acpi_ex_store (operand[0], operand[1], walk_state); 455 status = acpi_ex_store(operand[0], operand[1], walk_state);
484 if (ACPI_FAILURE (status)) { 456 if (ACPI_FAILURE(status)) {
485 return_ACPI_STATUS (status); 457 return_ACPI_STATUS(status);
486 } 458 }
487 459
488 /* It is possible that the Store already produced a return object */ 460 /* It is possible that the Store already produced a return object */
@@ -495,92 +467,84 @@ acpi_ex_opcode_1A_1T_1R (
495 * cancel out, and we simply don't do anything. 467 * cancel out, and we simply don't do anything.
496 */ 468 */
497 walk_state->result_obj = operand[0]; 469 walk_state->result_obj = operand[0];
498 walk_state->operands[0] = NULL; /* Prevent deletion */ 470 walk_state->operands[0] = NULL; /* Prevent deletion */
499 } 471 }
500 return_ACPI_STATUS (status); 472 return_ACPI_STATUS(status);
501 473
474 /*
475 * ACPI 2.0 Opcodes
476 */
477 case AML_COPY_OP: /* Copy (Source, Target) */
502 478
503 /* 479 status =
504 * ACPI 2.0 Opcodes 480 acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc,
505 */ 481 walk_state);
506 case AML_COPY_OP: /* Copy (Source, Target) */
507
508 status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc,
509 walk_state);
510 break; 482 break;
511 483
484 case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */
512 485
513 case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ 486 status = acpi_ex_convert_to_string(operand[0], &return_desc,
514 487 ACPI_EXPLICIT_CONVERT_DECIMAL);
515 status = acpi_ex_convert_to_string (operand[0], &return_desc,
516 ACPI_EXPLICIT_CONVERT_DECIMAL);
517 if (return_desc == operand[0]) { 488 if (return_desc == operand[0]) {
518 /* No conversion performed, add ref to handle return value */ 489 /* No conversion performed, add ref to handle return value */
519 acpi_ut_add_reference (return_desc); 490 acpi_ut_add_reference(return_desc);
520 } 491 }
521 break; 492 break;
522 493
494 case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */
523 495
524 case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ 496 status = acpi_ex_convert_to_string(operand[0], &return_desc,
525 497 ACPI_EXPLICIT_CONVERT_HEX);
526 status = acpi_ex_convert_to_string (operand[0], &return_desc,
527 ACPI_EXPLICIT_CONVERT_HEX);
528 if (return_desc == operand[0]) { 498 if (return_desc == operand[0]) {
529 /* No conversion performed, add ref to handle return value */ 499 /* No conversion performed, add ref to handle return value */
530 acpi_ut_add_reference (return_desc); 500 acpi_ut_add_reference(return_desc);
531 } 501 }
532 break; 502 break;
533 503
504 case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */
534 505
535 case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ 506 status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
536
537 status = acpi_ex_convert_to_buffer (operand[0], &return_desc);
538 if (return_desc == operand[0]) { 507 if (return_desc == operand[0]) {
539 /* No conversion performed, add ref to handle return value */ 508 /* No conversion performed, add ref to handle return value */
540 acpi_ut_add_reference (return_desc); 509 acpi_ut_add_reference(return_desc);
541 } 510 }
542 break; 511 break;
543 512
513 case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */
544 514
545 case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ 515 status = acpi_ex_convert_to_integer(operand[0], &return_desc,
546 516 ACPI_ANY_BASE);
547 status = acpi_ex_convert_to_integer (operand[0], &return_desc,
548 ACPI_ANY_BASE);
549 if (return_desc == operand[0]) { 517 if (return_desc == operand[0]) {
550 /* No conversion performed, add ref to handle return value */ 518 /* No conversion performed, add ref to handle return value */
551 acpi_ut_add_reference (return_desc); 519 acpi_ut_add_reference(return_desc);
552 } 520 }
553 break; 521 break;
554 522
555 523 case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */
556 case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ 524 case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
557 case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
558 525
559 /* These are two obsolete opcodes */ 526 /* These are two obsolete opcodes */
560 527
561 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 528 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
562 "%s is obsolete and not implemented\n", 529 "%s is obsolete and not implemented\n",
563 acpi_ps_get_opcode_name (walk_state->opcode))); 530 acpi_ps_get_opcode_name(walk_state->opcode)));
564 status = AE_SUPPORT; 531 status = AE_SUPPORT;
565 goto cleanup; 532 goto cleanup;
566 533
534 default: /* Unknown opcode */
567 535
568 default: /* Unknown opcode */ 536 ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
569
570 ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",
571 walk_state->opcode));
572 status = AE_AML_BAD_OPCODE; 537 status = AE_AML_BAD_OPCODE;
573 goto cleanup; 538 goto cleanup;
574 } 539 }
575 540
576 if (ACPI_SUCCESS (status)) { 541 if (ACPI_SUCCESS(status)) {
577 /* Store the return value computed above into the target object */ 542 /* Store the return value computed above into the target object */
578 543
579 status = acpi_ex_store (return_desc, operand[1], walk_state); 544 status = acpi_ex_store(return_desc, operand[1], walk_state);
580 } 545 }
581 546
582 547 cleanup:
583cleanup:
584 548
585 if (!walk_state->result_obj) { 549 if (!walk_state->result_obj) {
586 walk_state->result_obj = return_desc; 550 walk_state->result_obj = return_desc;
@@ -588,14 +552,13 @@ cleanup:
588 552
589 /* Delete return object on error */ 553 /* Delete return object on error */
590 554
591 if (ACPI_FAILURE (status)) { 555 if (ACPI_FAILURE(status)) {
592 acpi_ut_remove_reference (return_desc); 556 acpi_ut_remove_reference(return_desc);
593 } 557 }
594 558
595 return_ACPI_STATUS (status); 559 return_ACPI_STATUS(status);
596} 560}
597 561
598
599/******************************************************************************* 562/*******************************************************************************
600 * 563 *
601 * FUNCTION: acpi_ex_opcode_1A_0T_1R 564 * FUNCTION: acpi_ex_opcode_1A_0T_1R
@@ -608,28 +571,24 @@ cleanup:
608 * 571 *
609 ******************************************************************************/ 572 ******************************************************************************/
610 573
611acpi_status 574acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
612acpi_ex_opcode_1A_0T_1R (
613 struct acpi_walk_state *walk_state)
614{ 575{
615 union acpi_operand_object **operand = &walk_state->operands[0]; 576 union acpi_operand_object **operand = &walk_state->operands[0];
616 union acpi_operand_object *temp_desc; 577 union acpi_operand_object *temp_desc;
617 union acpi_operand_object *return_desc = NULL; 578 union acpi_operand_object *return_desc = NULL;
618 acpi_status status = AE_OK; 579 acpi_status status = AE_OK;
619 u32 type; 580 u32 type;
620 acpi_integer value; 581 acpi_integer value;
621
622
623 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R",
624 acpi_ps_get_opcode_name (walk_state->opcode));
625 582
583 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R",
584 acpi_ps_get_opcode_name(walk_state->opcode));
626 585
627 /* Examine the AML opcode */ 586 /* Examine the AML opcode */
628 587
629 switch (walk_state->opcode) { 588 switch (walk_state->opcode) {
630 case AML_LNOT_OP: /* LNot (Operand) */ 589 case AML_LNOT_OP: /* LNot (Operand) */
631 590
632 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 591 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
633 if (!return_desc) { 592 if (!return_desc) {
634 status = AE_NO_MEMORY; 593 status = AE_NO_MEMORY;
635 goto cleanup; 594 goto cleanup;
@@ -644,15 +603,14 @@ acpi_ex_opcode_1A_0T_1R (
644 } 603 }
645 break; 604 break;
646 605
647 606 case AML_DECREMENT_OP: /* Decrement (Operand) */
648 case AML_DECREMENT_OP: /* Decrement (Operand) */ 607 case AML_INCREMENT_OP: /* Increment (Operand) */
649 case AML_INCREMENT_OP: /* Increment (Operand) */
650 608
651 /* 609 /*
652 * Create a new integer. Can't just get the base integer and 610 * Create a new integer. Can't just get the base integer and
653 * increment it because it may be an Arg or Field. 611 * increment it because it may be an Arg or Field.
654 */ 612 */
655 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 613 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
656 if (!return_desc) { 614 if (!return_desc) {
657 status = AE_NO_MEMORY; 615 status = AE_NO_MEMORY;
658 goto cleanup; 616 goto cleanup;
@@ -663,10 +621,11 @@ acpi_ex_opcode_1A_0T_1R (
663 * NS Node or an internal object. 621 * NS Node or an internal object.
664 */ 622 */
665 temp_desc = operand[0]; 623 temp_desc = operand[0];
666 if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) { 624 if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
625 ACPI_DESC_TYPE_OPERAND) {
667 /* Internal reference object - prevent deletion */ 626 /* Internal reference object - prevent deletion */
668 627
669 acpi_ut_add_reference (temp_desc); 628 acpi_ut_add_reference(temp_desc);
670 } 629 }
671 630
672 /* 631 /*
@@ -676,11 +635,15 @@ acpi_ex_opcode_1A_0T_1R (
676 * NOTE: We use LNOT_OP here in order to force resolution of the 635 * NOTE: We use LNOT_OP here in order to force resolution of the
677 * reference operand to an actual integer. 636 * reference operand to an actual integer.
678 */ 637 */
679 status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state); 638 status =
680 if (ACPI_FAILURE (status)) { 639 acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc,
681 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n", 640 walk_state);
682 acpi_ps_get_opcode_name (walk_state->opcode), 641 if (ACPI_FAILURE(status)) {
683 acpi_format_exception(status))); 642 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
643 "%s: bad operand(s) %s\n",
644 acpi_ps_get_opcode_name(walk_state->
645 opcode),
646 acpi_format_exception(status)));
684 647
685 goto cleanup; 648 goto cleanup;
686 } 649 }
@@ -690,25 +653,25 @@ acpi_ex_opcode_1A_0T_1R (
690 * Perform the actual increment or decrement 653 * Perform the actual increment or decrement
691 */ 654 */
692 if (walk_state->opcode == AML_INCREMENT_OP) { 655 if (walk_state->opcode == AML_INCREMENT_OP) {
693 return_desc->integer.value = temp_desc->integer.value +1; 656 return_desc->integer.value =
694 } 657 temp_desc->integer.value + 1;
695 else { 658 } else {
696 return_desc->integer.value = temp_desc->integer.value -1; 659 return_desc->integer.value =
660 temp_desc->integer.value - 1;
697 } 661 }
698 662
699 /* Finished with this Integer object */ 663 /* Finished with this Integer object */
700 664
701 acpi_ut_remove_reference (temp_desc); 665 acpi_ut_remove_reference(temp_desc);
702 666
703 /* 667 /*
704 * Store the result back (indirectly) through the original 668 * Store the result back (indirectly) through the original
705 * Reference object 669 * Reference object
706 */ 670 */
707 status = acpi_ex_store (return_desc, operand[0], walk_state); 671 status = acpi_ex_store(return_desc, operand[0], walk_state);
708 break; 672 break;
709 673
710 674 case AML_TYPE_OP: /* object_type (source_object) */
711 case AML_TYPE_OP: /* object_type (source_object) */
712 675
713 /* 676 /*
714 * Note: The operand is not resolved at this point because we want to 677 * Note: The operand is not resolved at this point because we want to
@@ -719,13 +682,15 @@ acpi_ex_opcode_1A_0T_1R (
719 682
720 /* Get the type of the base object */ 683 /* Get the type of the base object */
721 684
722 status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL); 685 status =
723 if (ACPI_FAILURE (status)) { 686 acpi_ex_resolve_multiple(walk_state, operand[0], &type,
687 NULL);
688 if (ACPI_FAILURE(status)) {
724 goto cleanup; 689 goto cleanup;
725 } 690 }
726 /* Allocate a descriptor to hold the type. */ 691 /* Allocate a descriptor to hold the type. */
727 692
728 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 693 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
729 if (!return_desc) { 694 if (!return_desc) {
730 status = AE_NO_MEMORY; 695 status = AE_NO_MEMORY;
731 goto cleanup; 696 goto cleanup;
@@ -734,8 +699,7 @@ acpi_ex_opcode_1A_0T_1R (
734 return_desc->integer.value = type; 699 return_desc->integer.value = type;
735 break; 700 break;
736 701
737 702 case AML_SIZE_OF_OP: /* size_of (source_object) */
738 case AML_SIZE_OF_OP: /* size_of (source_object) */
739 703
740 /* 704 /*
741 * Note: The operand is not resolved at this point because we want to 705 * Note: The operand is not resolved at this point because we want to
@@ -744,9 +708,10 @@ acpi_ex_opcode_1A_0T_1R (
744 708
745 /* Get the base object */ 709 /* Get the base object */
746 710
747 status = acpi_ex_resolve_multiple (walk_state, 711 status = acpi_ex_resolve_multiple(walk_state,
748 operand[0], &type, &temp_desc); 712 operand[0], &type,
749 if (ACPI_FAILURE (status)) { 713 &temp_desc);
714 if (ACPI_FAILURE(status)) {
750 goto cleanup; 715 goto cleanup;
751 } 716 }
752 717
@@ -777,9 +742,9 @@ acpi_ex_opcode_1A_0T_1R (
777 break; 742 break;
778 743
779 default: 744 default:
780 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 745 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
781 "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", 746 "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n",
782 acpi_ut_get_type_name (type))); 747 acpi_ut_get_type_name(type)));
783 status = AE_AML_OPERAND_TYPE; 748 status = AE_AML_OPERAND_TYPE;
784 goto cleanup; 749 goto cleanup;
785 } 750 }
@@ -788,7 +753,7 @@ acpi_ex_opcode_1A_0T_1R (
788 * Now that we have the size of the object, create a result 753 * Now that we have the size of the object, create a result
789 * object to hold the value 754 * object to hold the value
790 */ 755 */
791 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 756 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
792 if (!return_desc) { 757 if (!return_desc) {
793 status = AE_NO_MEMORY; 758 status = AE_NO_MEMORY;
794 goto cleanup; 759 goto cleanup;
@@ -797,22 +762,23 @@ acpi_ex_opcode_1A_0T_1R (
797 return_desc->integer.value = value; 762 return_desc->integer.value = value;
798 break; 763 break;
799 764
765 case AML_REF_OF_OP: /* ref_of (source_object) */
800 766
801 case AML_REF_OF_OP: /* ref_of (source_object) */ 767 status =
802 768 acpi_ex_get_object_reference(operand[0], &return_desc,
803 status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state); 769 walk_state);
804 if (ACPI_FAILURE (status)) { 770 if (ACPI_FAILURE(status)) {
805 goto cleanup; 771 goto cleanup;
806 } 772 }
807 break; 773 break;
808 774
809 775 case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */
810 case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */
811 776
812 /* Check for a method local or argument, or standalone String */ 777 /* Check for a method local or argument, or standalone String */
813 778
814 if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) { 779 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
815 switch (ACPI_GET_OBJECT_TYPE (operand[0])) { 780 ACPI_DESC_TYPE_NAMED) {
781 switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
816 case ACPI_TYPE_LOCAL_REFERENCE: 782 case ACPI_TYPE_LOCAL_REFERENCE:
817 /* 783 /*
818 * This is a deref_of (local_x | arg_x) 784 * This is a deref_of (local_x | arg_x)
@@ -825,11 +791,12 @@ acpi_ex_opcode_1A_0T_1R (
825 791
826 /* Set Operand[0] to the value of the local/arg */ 792 /* Set Operand[0] to the value of the local/arg */
827 793
828 status = acpi_ds_method_data_get_value ( 794 status =
829 operand[0]->reference.opcode, 795 acpi_ds_method_data_get_value
830 operand[0]->reference.offset, 796 (operand[0]->reference.opcode,
831 walk_state, &temp_desc); 797 operand[0]->reference.offset,
832 if (ACPI_FAILURE (status)) { 798 walk_state, &temp_desc);
799 if (ACPI_FAILURE(status)) {
833 goto cleanup; 800 goto cleanup;
834 } 801 }
835 802
@@ -837,7 +804,7 @@ acpi_ex_opcode_1A_0T_1R (
837 * Delete our reference to the input object and 804 * Delete our reference to the input object and
838 * point to the object just retrieved 805 * point to the object just retrieved
839 */ 806 */
840 acpi_ut_remove_reference (operand[0]); 807 acpi_ut_remove_reference(operand[0]);
841 operand[0] = temp_desc; 808 operand[0] = temp_desc;
842 break; 809 break;
843 810
@@ -845,8 +812,9 @@ acpi_ex_opcode_1A_0T_1R (
845 812
846 /* Get the object to which the reference refers */ 813 /* Get the object to which the reference refers */
847 814
848 temp_desc = operand[0]->reference.object; 815 temp_desc =
849 acpi_ut_remove_reference (operand[0]); 816 operand[0]->reference.object;
817 acpi_ut_remove_reference(operand[0]);
850 operand[0] = temp_desc; 818 operand[0] = temp_desc;
851 break; 819 break;
852 820
@@ -857,7 +825,6 @@ acpi_ex_opcode_1A_0T_1R (
857 } 825 }
858 break; 826 break;
859 827
860
861 case ACPI_TYPE_STRING: 828 case ACPI_TYPE_STRING:
862 829
863 /* 830 /*
@@ -868,22 +835,28 @@ acpi_ex_opcode_1A_0T_1R (
868 * 2) Dereference the node to an actual object. Could be a 835 * 2) Dereference the node to an actual object. Could be a
869 * Field, so we need to resolve the node to a value. 836 * Field, so we need to resolve the node to a value.
870 */ 837 */
871 status = acpi_ns_get_node_by_path (operand[0]->string.pointer, 838 status =
872 walk_state->scope_info->scope.node, 839 acpi_ns_get_node_by_path(operand[0]->string.
873 ACPI_NS_SEARCH_PARENT, 840 pointer,
874 ACPI_CAST_INDIRECT_PTR ( 841 walk_state->
875 struct acpi_namespace_node, &return_desc)); 842 scope_info->scope.
876 if (ACPI_FAILURE (status)) { 843 node,
844 ACPI_NS_SEARCH_PARENT,
845 ACPI_CAST_INDIRECT_PTR
846 (struct
847 acpi_namespace_node,
848 &return_desc));
849 if (ACPI_FAILURE(status)) {
877 goto cleanup; 850 goto cleanup;
878 } 851 }
879 852
880 status = acpi_ex_resolve_node_to_value ( 853 status =
881 ACPI_CAST_INDIRECT_PTR ( 854 acpi_ex_resolve_node_to_value
882 struct acpi_namespace_node, &return_desc), 855 (ACPI_CAST_INDIRECT_PTR
883 walk_state); 856 (struct acpi_namespace_node, &return_desc),
857 walk_state);
884 goto cleanup; 858 goto cleanup;
885 859
886
887 default: 860 default:
888 861
889 status = AE_AML_OPERAND_TYPE; 862 status = AE_AML_OPERAND_TYPE;
@@ -893,17 +866,20 @@ acpi_ex_opcode_1A_0T_1R (
893 866
894 /* Operand[0] may have changed from the code above */ 867 /* Operand[0] may have changed from the code above */
895 868
896 if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) { 869 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
870 ACPI_DESC_TYPE_NAMED) {
897 /* 871 /*
898 * This is a deref_of (object_reference) 872 * This is a deref_of (object_reference)
899 * Get the actual object from the Node (This is the dereference). 873 * Get the actual object from the Node (This is the dereference).
900 * This case may only happen when a local_x or arg_x is 874 * This case may only happen when a local_x or arg_x is
901 * dereferenced above. 875 * dereferenced above.
902 */ 876 */
903 return_desc = acpi_ns_get_attached_object ( 877 return_desc = acpi_ns_get_attached_object((struct
904 (struct acpi_namespace_node *) operand[0]); 878 acpi_namespace_node
905 } 879 *)
906 else { 880 operand[0]);
881 acpi_ut_add_reference(return_desc);
882 } else {
907 /* 883 /*
908 * This must be a reference object produced by either the 884 * This must be a reference object produced by either the
909 * Index() or ref_of() operator 885 * Index() or ref_of() operator
@@ -918,7 +894,8 @@ acpi_ex_opcode_1A_0T_1R (
918 switch (operand[0]->reference.target_type) { 894 switch (operand[0]->reference.target_type) {
919 case ACPI_TYPE_BUFFER_FIELD: 895 case ACPI_TYPE_BUFFER_FIELD:
920 896
921 temp_desc = operand[0]->reference.object; 897 temp_desc =
898 operand[0]->reference.object;
922 899
923 /* 900 /*
924 * Create a new object that contains one element of the 901 * Create a new object that contains one element of the
@@ -928,7 +905,9 @@ acpi_ex_opcode_1A_0T_1R (
928 * sub-buffer of the main buffer, it is only a pointer to a 905 * sub-buffer of the main buffer, it is only a pointer to a
929 * single element (byte) of the buffer! 906 * single element (byte) of the buffer!
930 */ 907 */
931 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 908 return_desc =
909 acpi_ut_create_internal_object
910 (ACPI_TYPE_INTEGER);
932 if (!return_desc) { 911 if (!return_desc) {
933 status = AE_NO_MEMORY; 912 status = AE_NO_MEMORY;
934 goto cleanup; 913 goto cleanup;
@@ -940,66 +919,63 @@ acpi_ex_opcode_1A_0T_1R (
940 * reference to the buffer itself. 919 * reference to the buffer itself.
941 */ 920 */
942 return_desc->integer.value = 921 return_desc->integer.value =
943 temp_desc->buffer.pointer[operand[0]->reference.offset]; 922 temp_desc->buffer.
923 pointer[operand[0]->reference.
924 offset];
944 break; 925 break;
945 926
946
947 case ACPI_TYPE_PACKAGE: 927 case ACPI_TYPE_PACKAGE:
948 928
949 /* 929 /*
950 * Return the referenced element of the package. We must 930 * Return the referenced element of the package. We must
951 * add another reference to the referenced object, however. 931 * add another reference to the referenced object, however.
952 */ 932 */
953 return_desc = *(operand[0]->reference.where); 933 return_desc =
954 if (!return_desc) { 934 *(operand[0]->reference.where);
955 /* 935 if (return_desc) {
956 * We can't return a NULL dereferenced value. This is 936 acpi_ut_add_reference
957 * an uninitialized package element and is thus a 937 (return_desc);
958 * severe error.
959 */
960 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
961 "NULL package element obj %p\n",
962 operand[0]));
963 status = AE_AML_UNINITIALIZED_ELEMENT;
964 goto cleanup;
965 } 938 }
966 939
967 acpi_ut_add_reference (return_desc);
968 break; 940 break;
969 941
970
971 default: 942 default:
972 943
973 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 944 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
974 "Unknown Index target_type %X in obj %p\n", 945 "Unknown Index target_type %X in obj %p\n",
975 operand[0]->reference.target_type, operand[0])); 946 operand[0]->reference.
947 target_type,
948 operand[0]));
976 status = AE_AML_OPERAND_TYPE; 949 status = AE_AML_OPERAND_TYPE;
977 goto cleanup; 950 goto cleanup;
978 } 951 }
979 break; 952 break;
980 953
981
982 case AML_REF_OF_OP: 954 case AML_REF_OF_OP:
983 955
984 return_desc = operand[0]->reference.object; 956 return_desc = operand[0]->reference.object;
985 957
986 if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == 958 if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
987 ACPI_DESC_TYPE_NAMED) { 959 ACPI_DESC_TYPE_NAMED) {
988 960
989 return_desc = acpi_ns_get_attached_object ( 961 return_desc =
990 (struct acpi_namespace_node *) return_desc); 962 acpi_ns_get_attached_object((struct
963 acpi_namespace_node
964 *)
965 return_desc);
991 } 966 }
992 967
993 /* Add another reference to the object! */ 968 /* Add another reference to the object! */
994 969
995 acpi_ut_add_reference (return_desc); 970 acpi_ut_add_reference(return_desc);
996 break; 971 break;
997 972
998
999 default: 973 default:
1000 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 974 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1001 "Unknown opcode in ref(%p) - %X\n", 975 "Unknown opcode in ref(%p) - %X\n",
1002 operand[0], operand[0]->reference.opcode)); 976 operand[0],
977 operand[0]->reference.
978 opcode));
1003 979
1004 status = AE_TYPE; 980 status = AE_TYPE;
1005 goto cleanup; 981 goto cleanup;
@@ -1007,25 +983,21 @@ acpi_ex_opcode_1A_0T_1R (
1007 } 983 }
1008 break; 984 break;
1009 985
1010
1011 default: 986 default:
1012 987
1013 ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", 988 ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
1014 walk_state->opcode));
1015 status = AE_AML_BAD_OPCODE; 989 status = AE_AML_BAD_OPCODE;
1016 goto cleanup; 990 goto cleanup;
1017 } 991 }
1018 992
1019 993 cleanup:
1020cleanup:
1021 994
1022 /* Delete return object on error */ 995 /* Delete return object on error */
1023 996
1024 if (ACPI_FAILURE (status)) { 997 if (ACPI_FAILURE(status)) {
1025 acpi_ut_remove_reference (return_desc); 998 acpi_ut_remove_reference(return_desc);
1026 } 999 }
1027 1000
1028 walk_state->result_obj = return_desc; 1001 walk_state->result_obj = return_desc;
1029 return_ACPI_STATUS (status); 1002 return_ACPI_STATUS(status);
1030} 1003}
1031