aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exoparg2.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/executer/exoparg2.c
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff)
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exoparg2.c')
-rw-r--r--drivers/acpi/executer/exoparg2.c69
1 files changed, 36 insertions, 33 deletions
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
index 8be4d80ceed5..7429032c2b6c 100644
--- a/drivers/acpi/executer/exoparg2.c
+++ b/drivers/acpi/executer/exoparg2.c
@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R (
118 118
119 value = (u32) operand[1]->integer.value; 119 value = (u32) operand[1]->integer.value;
120 120
121 /* Notifies allowed on this object? */ 121 /* Are notifies allowed on this object? */
122 122
123 if (!acpi_ev_is_notify_object (node)) { 123 if (!acpi_ev_is_notify_object (node)) {
124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R (
203 acpi_ps_get_opcode_name (walk_state->opcode)); 203 acpi_ps_get_opcode_name (walk_state->opcode));
204 204
205 205
206 /* 206 /* Execute the opcode */
207 * Execute the opcode 207
208 */
209 switch (walk_state->opcode) { 208 switch (walk_state->opcode) {
210 case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ 209 case AML_DIVIDE_OP:
210
211 /* Divide (Dividend, Divisor, remainder_result quotient_result) */
211 212
212 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 213 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
213 if (!return_desc1) { 214 if (!return_desc1) {
@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
241 goto cleanup; 242 goto cleanup;
242 } 243 }
243 244
244
245 /* Store the results to the target reference operands */ 245 /* Store the results to the target reference operands */
246 246
247 status = acpi_ex_store (return_desc2, operand[2], walk_state); 247 status = acpi_ex_store (return_desc2, operand[2], walk_state);
@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R (
295{ 295{
296 union acpi_operand_object **operand = &walk_state->operands[0]; 296 union acpi_operand_object **operand = &walk_state->operands[0];
297 union acpi_operand_object *return_desc = NULL; 297 union acpi_operand_object *return_desc = NULL;
298 u32 index; 298 acpi_integer index;
299 acpi_status status = AE_OK; 299 acpi_status status = AE_OK;
300 acpi_size length; 300 acpi_size length;
301 301
@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R (
304 acpi_ps_get_opcode_name (walk_state->opcode)); 304 acpi_ps_get_opcode_name (walk_state->opcode));
305 305
306 306
307 /* 307 /* Execute the opcode */
308 * Execute the opcode 308
309 */
310 if (walk_state->op_info->flags & AML_MATH) { 309 if (walk_state->op_info->flags & AML_MATH) {
311 /* All simple math opcodes (add, etc.) */ 310 /* All simple math opcodes (add, etc.) */
312 311
@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R (
322 goto store_result_to_target; 321 goto store_result_to_target;
323 } 322 }
324 323
325
326 switch (walk_state->opcode) { 324 switch (walk_state->opcode) {
327 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ 325 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
328 326
329 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 327 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
330 if (!return_desc) { 328 if (!return_desc) {
@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R (
341 break; 339 break;
342 340
343 341
344 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ 342 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
345 343
346 status = acpi_ex_do_concatenate (operand[0], operand[1], 344 status = acpi_ex_do_concatenate (operand[0], operand[1],
347 &return_desc, walk_state); 345 &return_desc, walk_state);
348 break; 346 break;
349 347
350 348
351 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) */
352 350
353 /* 351 /*
354 * Input object is guaranteed to be a buffer at this point (it may have 352 * Input object is guaranteed to be a buffer at this point (it may have
355 * been converted.) Copy the raw buffer data to a new object of type String. 353 * been converted.) Copy the raw buffer data to a new object of
354 * type String.
356 */ 355 */
357 356
358 /* 357 /*
@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R (
383 goto cleanup; 382 goto cleanup;
384 } 383 }
385 384
386 /* Copy the raw buffer data with no transform. NULL terminated already. */ 385 /* Copy the raw buffer data with no transform. NULL terminated already*/
387 386
388 ACPI_MEMCPY (return_desc->string.pointer, 387 ACPI_MEMCPY (return_desc->string.pointer,
389 operand[0]->buffer.pointer, length); 388 operand[0]->buffer.pointer, length);
390 break; 389 break;
391 390
392 391
393 case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ 392 case AML_CONCAT_RES_OP:
393
394 /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
394 395
395 status = acpi_ex_concat_template (operand[0], operand[1], 396 status = acpi_ex_concat_template (operand[0], operand[1],
396 &return_desc, walk_state); 397 &return_desc, walk_state);
@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R (
407 goto cleanup; 408 goto cleanup;
408 } 409 }
409 410
410 index = (u32) operand[1]->integer.value; 411 index = operand[1]->integer.value;
412
413 /* At this point, the Source operand is a Package, Buffer, or String */
411 414
412 /*
413 * At this point, the Source operand is a Package, Buffer, or String
414 */
415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { 415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
416 /* Object to be indexed is a Package */ 416 /* Object to be indexed is a Package */
417 417
418 if (index >= operand[0]->package.count) { 418 if (index >= operand[0]->package.count) {
419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
420 "Index value (%X) beyond package end (%X)\n", 420 "Index value (%X%8.8X) beyond package end (%X)\n",
421 index, operand[0]->package.count)); 421 ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
422 status = AE_AML_PACKAGE_LIMIT; 422 status = AE_AML_PACKAGE_LIMIT;
423 goto cleanup; 423 goto cleanup;
424 } 424 }
425 425
426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE; 426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
427 return_desc->reference.object = operand[0]; 427 return_desc->reference.object = operand[0];
428 return_desc->reference.where = &operand[0]->package.elements [index]; 428 return_desc->reference.where = &operand[0]->package.elements [
429 index];
429 } 430 }
430 else { 431 else {
431 /* Object to be indexed is a Buffer/String */ 432 /* Object to be indexed is a Buffer/String */
432 433
433 if (index >= operand[0]->buffer.length) { 434 if (index >= operand[0]->buffer.length) {
434 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 435 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
435 "Index value (%X) beyond end of buffer (%X)\n", 436 "Index value (%X%8.8X) beyond end of buffer (%X)\n",
436 index, operand[0]->buffer.length)); 437 ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
437 status = AE_AML_BUFFER_LIMIT; 438 status = AE_AML_BUFFER_LIMIT;
438 goto cleanup; 439 goto cleanup;
439 } 440 }
@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R (
451 /* Complete the Index reference object */ 452 /* Complete the Index reference object */
452 453
453 return_desc->reference.opcode = AML_INDEX_OP; 454 return_desc->reference.opcode = AML_INDEX_OP;
454 return_desc->reference.offset = index; 455 return_desc->reference.offset = (u32) index;
455 456
456 /* Store the reference to the Target */ 457 /* Store the reference to the Target */
457 458
@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R (
536 goto cleanup; 537 goto cleanup;
537 } 538 }
538 539
539 /* 540 /* Execute the Opcode */
540 * Execute the Opcode 541
541 */ 542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { 543 /* logical_op (Operand0, Operand1) */
544
543 status = acpi_ex_do_logical_numeric_op (walk_state->opcode, 545 status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
544 operand[0]->integer.value, operand[1]->integer.value, 546 operand[0]->integer.value, operand[1]->integer.value,
545 &logical_result); 547 &logical_result);
546 goto store_logical_result; 548 goto store_logical_result;
547 } 549 }
548 else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { 550 else if (walk_state->op_info->flags & AML_LOGICAL) {
551 /* logical_op (Operand0, Operand1) */
552
549 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], 553 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
550 operand[1], &logical_result); 554 operand[1], &logical_result);
551 goto store_logical_result; 555 goto store_logical_result;
552 } 556 }
553 557
554
555 switch (walk_state->opcode) { 558 switch (walk_state->opcode) {
556 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ 559 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
557 560