diff options
author | Bob Moore <robert.moore@intel.com> | 2008-09-26 23:08:41 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-22 23:14:45 -0400 |
commit | 1044f1f65b7df2aae979e397904c4985eeb99ba2 (patch) | |
tree | 8feb6f2db4f36b75d8c7126d51a7b35e57e13194 /drivers/acpi/dispatcher/dsmthdat.c | |
parent | 2425a0967f29b196fad5d4f726c9502679284656 (diff) |
ACPICA: Cleanup for internal Reference Object
Fix some sloppiness in the Reference object. No longer use AML
opcodes to differentiate the types, introduce new reference
Class. Cleanup the debug output code.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher/dsmthdat.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsmthdat.c | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index 13c43eac35db..d03f81bd1bcb 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdispat.h> | 45 | #include <acpi/acdispat.h> |
46 | #include <acpi/amlcode.h> | ||
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
49 | 48 | ||
@@ -52,11 +51,11 @@ ACPI_MODULE_NAME("dsmthdat") | |||
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | static void | 53 | static void |
55 | acpi_ds_method_data_delete_value(u16 opcode, | 54 | acpi_ds_method_data_delete_value(u8 type, |
56 | u32 index, struct acpi_walk_state *walk_state); | 55 | u32 index, struct acpi_walk_state *walk_state); |
57 | 56 | ||
58 | static acpi_status | 57 | static acpi_status |
59 | acpi_ds_method_data_set_value(u16 opcode, | 58 | acpi_ds_method_data_set_value(u8 type, |
60 | u32 index, | 59 | u32 index, |
61 | union acpi_operand_object *object, | 60 | union acpi_operand_object *object, |
62 | struct acpi_walk_state *walk_state); | 61 | struct acpi_walk_state *walk_state); |
@@ -216,7 +215,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
216 | * Store the argument in the method/walk descriptor. | 215 | * Store the argument in the method/walk descriptor. |
217 | * Do not copy the arg in order to implement call by reference | 216 | * Do not copy the arg in order to implement call by reference |
218 | */ | 217 | */ |
219 | status = acpi_ds_method_data_set_value(AML_ARG_OP, index, | 218 | status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index, |
220 | params[index], | 219 | params[index], |
221 | walk_state); | 220 | walk_state); |
222 | if (ACPI_FAILURE(status)) { | 221 | if (ACPI_FAILURE(status)) { |
@@ -234,7 +233,8 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
234 | * | 233 | * |
235 | * FUNCTION: acpi_ds_method_data_get_node | 234 | * FUNCTION: acpi_ds_method_data_get_node |
236 | * | 235 | * |
237 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 236 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
237 | * ACPI_REFCLASS_ARG | ||
238 | * Index - Which Local or Arg whose type to get | 238 | * Index - Which Local or Arg whose type to get |
239 | * walk_state - Current walk state object | 239 | * walk_state - Current walk state object |
240 | * Node - Where the node is returned. | 240 | * Node - Where the node is returned. |
@@ -246,7 +246,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
246 | ******************************************************************************/ | 246 | ******************************************************************************/ |
247 | 247 | ||
248 | acpi_status | 248 | acpi_status |
249 | acpi_ds_method_data_get_node(u16 opcode, | 249 | acpi_ds_method_data_get_node(u8 type, |
250 | u32 index, | 250 | u32 index, |
251 | struct acpi_walk_state *walk_state, | 251 | struct acpi_walk_state *walk_state, |
252 | struct acpi_namespace_node **node) | 252 | struct acpi_namespace_node **node) |
@@ -256,8 +256,8 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
256 | /* | 256 | /* |
257 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
258 | */ | 258 | */ |
259 | switch (opcode) { | 259 | switch (type) { |
260 | case AML_LOCAL_OP: | 260 | case ACPI_REFCLASS_LOCAL: |
261 | 261 | ||
262 | if (index > ACPI_METHOD_MAX_LOCAL) { | 262 | if (index > ACPI_METHOD_MAX_LOCAL) { |
263 | ACPI_ERROR((AE_INFO, | 263 | ACPI_ERROR((AE_INFO, |
@@ -271,7 +271,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
271 | *node = &walk_state->local_variables[index]; | 271 | *node = &walk_state->local_variables[index]; |
272 | break; | 272 | break; |
273 | 273 | ||
274 | case AML_ARG_OP: | 274 | case ACPI_REFCLASS_ARG: |
275 | 275 | ||
276 | if (index > ACPI_METHOD_MAX_ARG) { | 276 | if (index > ACPI_METHOD_MAX_ARG) { |
277 | ACPI_ERROR((AE_INFO, | 277 | ACPI_ERROR((AE_INFO, |
@@ -286,8 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
286 | break; | 286 | break; |
287 | 287 | ||
288 | default: | 288 | default: |
289 | ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode)); | 289 | ACPI_ERROR((AE_INFO, "Type %d is invalid", type)); |
290 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); | 290 | return_ACPI_STATUS(AE_TYPE); |
291 | } | 291 | } |
292 | 292 | ||
293 | return_ACPI_STATUS(AE_OK); | 293 | return_ACPI_STATUS(AE_OK); |
@@ -297,7 +297,8 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
297 | * | 297 | * |
298 | * FUNCTION: acpi_ds_method_data_set_value | 298 | * FUNCTION: acpi_ds_method_data_set_value |
299 | * | 299 | * |
300 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 300 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
301 | * ACPI_REFCLASS_ARG | ||
301 | * Index - Which Local or Arg to get | 302 | * Index - Which Local or Arg to get |
302 | * Object - Object to be inserted into the stack entry | 303 | * Object - Object to be inserted into the stack entry |
303 | * walk_state - Current walk state object | 304 | * walk_state - Current walk state object |
@@ -310,7 +311,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
310 | ******************************************************************************/ | 311 | ******************************************************************************/ |
311 | 312 | ||
312 | static acpi_status | 313 | static acpi_status |
313 | acpi_ds_method_data_set_value(u16 opcode, | 314 | acpi_ds_method_data_set_value(u8 type, |
314 | u32 index, | 315 | u32 index, |
315 | union acpi_operand_object *object, | 316 | union acpi_operand_object *object, |
316 | struct acpi_walk_state *walk_state) | 317 | struct acpi_walk_state *walk_state) |
@@ -321,13 +322,13 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); | 322 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
322 | 323 | ||
323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 324 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
324 | "NewObj %p Opcode %X, Refs=%d [%s]\n", object, | 325 | "NewObj %p Type %2.2X, Refs=%d [%s]\n", object, |
325 | opcode, object->common.reference_count, | 326 | type, object->common.reference_count, |
326 | acpi_ut_get_type_name(object->common.type))); | 327 | acpi_ut_get_type_name(object->common.type))); |
327 | 328 | ||
328 | /* Get the namespace node for the arg/local */ | 329 | /* Get the namespace node for the arg/local */ |
329 | 330 | ||
330 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 331 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
331 | if (ACPI_FAILURE(status)) { | 332 | if (ACPI_FAILURE(status)) { |
332 | return_ACPI_STATUS(status); | 333 | return_ACPI_STATUS(status); |
333 | } | 334 | } |
@@ -350,7 +351,8 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
350 | * | 351 | * |
351 | * FUNCTION: acpi_ds_method_data_get_value | 352 | * FUNCTION: acpi_ds_method_data_get_value |
352 | * | 353 | * |
353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 354 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
355 | * ACPI_REFCLASS_ARG | ||
354 | * Index - Which local_var or argument to get | 356 | * Index - Which local_var or argument to get |
355 | * walk_state - Current walk state object | 357 | * walk_state - Current walk state object |
356 | * dest_desc - Where Arg or Local value is returned | 358 | * dest_desc - Where Arg or Local value is returned |
@@ -363,7 +365,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
363 | ******************************************************************************/ | 365 | ******************************************************************************/ |
364 | 366 | ||
365 | acpi_status | 367 | acpi_status |
366 | acpi_ds_method_data_get_value(u16 opcode, | 368 | acpi_ds_method_data_get_value(u8 type, |
367 | u32 index, | 369 | u32 index, |
368 | struct acpi_walk_state *walk_state, | 370 | struct acpi_walk_state *walk_state, |
369 | union acpi_operand_object **dest_desc) | 371 | union acpi_operand_object **dest_desc) |
@@ -383,7 +385,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
383 | 385 | ||
384 | /* Get the namespace node for the arg/local */ | 386 | /* Get the namespace node for the arg/local */ |
385 | 387 | ||
386 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 388 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
387 | if (ACPI_FAILURE(status)) { | 389 | if (ACPI_FAILURE(status)) { |
388 | return_ACPI_STATUS(status); | 390 | return_ACPI_STATUS(status); |
389 | } | 391 | } |
@@ -419,8 +421,8 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
419 | /* Otherwise, return the error */ | 421 | /* Otherwise, return the error */ |
420 | 422 | ||
421 | else | 423 | else |
422 | switch (opcode) { | 424 | switch (type) { |
423 | case AML_ARG_OP: | 425 | case ACPI_REFCLASS_ARG: |
424 | 426 | ||
425 | ACPI_ERROR((AE_INFO, | 427 | ACPI_ERROR((AE_INFO, |
426 | "Uninitialized Arg[%d] at node %p", | 428 | "Uninitialized Arg[%d] at node %p", |
@@ -428,7 +430,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
428 | 430 | ||
429 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); | 431 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); |
430 | 432 | ||
431 | case AML_LOCAL_OP: | 433 | case ACPI_REFCLASS_LOCAL: |
432 | 434 | ||
433 | ACPI_ERROR((AE_INFO, | 435 | ACPI_ERROR((AE_INFO, |
434 | "Uninitialized Local[%d] at node %p", | 436 | "Uninitialized Local[%d] at node %p", |
@@ -437,9 +439,10 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
437 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); | 439 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); |
438 | 440 | ||
439 | default: | 441 | default: |
442 | |||
440 | ACPI_ERROR((AE_INFO, | 443 | ACPI_ERROR((AE_INFO, |
441 | "Not a Arg/Local opcode: %X", | 444 | "Not a Arg/Local opcode: %X", |
442 | opcode)); | 445 | type)); |
443 | return_ACPI_STATUS(AE_AML_INTERNAL); | 446 | return_ACPI_STATUS(AE_AML_INTERNAL); |
444 | } | 447 | } |
445 | } | 448 | } |
@@ -458,7 +461,8 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
458 | * | 461 | * |
459 | * FUNCTION: acpi_ds_method_data_delete_value | 462 | * FUNCTION: acpi_ds_method_data_delete_value |
460 | * | 463 | * |
461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 464 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
465 | * ACPI_REFCLASS_ARG | ||
462 | * Index - Which local_var or argument to delete | 466 | * Index - Which local_var or argument to delete |
463 | * walk_state - Current walk state object | 467 | * walk_state - Current walk state object |
464 | * | 468 | * |
@@ -470,7 +474,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
470 | ******************************************************************************/ | 474 | ******************************************************************************/ |
471 | 475 | ||
472 | static void | 476 | static void |
473 | acpi_ds_method_data_delete_value(u16 opcode, | 477 | acpi_ds_method_data_delete_value(u8 type, |
474 | u32 index, struct acpi_walk_state *walk_state) | 478 | u32 index, struct acpi_walk_state *walk_state) |
475 | { | 479 | { |
476 | acpi_status status; | 480 | acpi_status status; |
@@ -481,7 +485,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
481 | 485 | ||
482 | /* Get the namespace node for the arg/local */ | 486 | /* Get the namespace node for the arg/local */ |
483 | 487 | ||
484 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 488 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
485 | if (ACPI_FAILURE(status)) { | 489 | if (ACPI_FAILURE(status)) { |
486 | return_VOID; | 490 | return_VOID; |
487 | } | 491 | } |
@@ -514,7 +518,8 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
514 | * | 518 | * |
515 | * FUNCTION: acpi_ds_store_object_to_local | 519 | * FUNCTION: acpi_ds_store_object_to_local |
516 | * | 520 | * |
517 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 521 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
522 | * ACPI_REFCLASS_ARG | ||
518 | * Index - Which Local or Arg to set | 523 | * Index - Which Local or Arg to set |
519 | * obj_desc - Value to be stored | 524 | * obj_desc - Value to be stored |
520 | * walk_state - Current walk state | 525 | * walk_state - Current walk state |
@@ -528,7 +533,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
528 | ******************************************************************************/ | 533 | ******************************************************************************/ |
529 | 534 | ||
530 | acpi_status | 535 | acpi_status |
531 | acpi_ds_store_object_to_local(u16 opcode, | 536 | acpi_ds_store_object_to_local(u8 type, |
532 | u32 index, | 537 | u32 index, |
533 | union acpi_operand_object *obj_desc, | 538 | union acpi_operand_object *obj_desc, |
534 | struct acpi_walk_state *walk_state) | 539 | struct acpi_walk_state *walk_state) |
@@ -539,8 +544,8 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
539 | union acpi_operand_object *new_obj_desc; | 544 | union acpi_operand_object *new_obj_desc; |
540 | 545 | ||
541 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); | 546 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 547 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n", |
543 | opcode, index, obj_desc)); | 548 | type, index, obj_desc)); |
544 | 549 | ||
545 | /* Parameter validation */ | 550 | /* Parameter validation */ |
546 | 551 | ||
@@ -550,7 +555,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
550 | 555 | ||
551 | /* Get the namespace node for the arg/local */ | 556 | /* Get the namespace node for the arg/local */ |
552 | 557 | ||
553 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 558 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
554 | if (ACPI_FAILURE(status)) { | 559 | if (ACPI_FAILURE(status)) { |
555 | return_ACPI_STATUS(status); | 560 | return_ACPI_STATUS(status); |
556 | } | 561 | } |
@@ -602,7 +607,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
602 | * | 607 | * |
603 | * Weird, but true. | 608 | * Weird, but true. |
604 | */ | 609 | */ |
605 | if (opcode == AML_ARG_OP) { | 610 | if (type == ACPI_REFCLASS_ARG) { |
606 | /* | 611 | /* |
607 | * If we have a valid reference object that came from ref_of(), | 612 | * If we have a valid reference object that came from ref_of(), |
608 | * do the indirect store | 613 | * do the indirect store |
@@ -611,8 +616,8 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
611 | ACPI_DESC_TYPE_OPERAND) | 616 | ACPI_DESC_TYPE_OPERAND) |
612 | && (current_obj_desc->common.type == | 617 | && (current_obj_desc->common.type == |
613 | ACPI_TYPE_LOCAL_REFERENCE) | 618 | ACPI_TYPE_LOCAL_REFERENCE) |
614 | && (current_obj_desc->reference.opcode == | 619 | && (current_obj_desc->reference.class == |
615 | AML_REF_OF_OP)) { | 620 | ACPI_REFCLASS_REFOF)) { |
616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 621 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
617 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", | 622 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
618 | new_obj_desc, | 623 | new_obj_desc, |
@@ -640,11 +645,9 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
640 | } | 645 | } |
641 | } | 646 | } |
642 | 647 | ||
643 | /* | 648 | /* Delete the existing object before storing the new one */ |
644 | * Delete the existing object | 649 | |
645 | * before storing the new one | 650 | acpi_ds_method_data_delete_value(type, index, walk_state); |
646 | */ | ||
647 | acpi_ds_method_data_delete_value(opcode, index, walk_state); | ||
648 | } | 651 | } |
649 | 652 | ||
650 | /* | 653 | /* |
@@ -653,7 +656,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
653 | * (increments the object reference count by one) | 656 | * (increments the object reference count by one) |
654 | */ | 657 | */ |
655 | status = | 658 | status = |
656 | acpi_ds_method_data_set_value(opcode, index, new_obj_desc, | 659 | acpi_ds_method_data_set_value(type, index, new_obj_desc, |
657 | walk_state); | 660 | walk_state); |
658 | 661 | ||
659 | /* Remove local reference if we copied the object above */ | 662 | /* Remove local reference if we copied the object above */ |