diff options
Diffstat (limited to 'drivers/acpi/executer/exoparg1.c')
-rw-r--r-- | drivers/acpi/executer/exoparg1.c | 101 |
1 files changed, 68 insertions, 33 deletions
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 23d0823bcd5e..6374d8be88e0 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | union acpi_operand_object *return_desc = NULL; | 90 | union acpi_operand_object *return_desc = NULL; |
91 | 91 | ||
92 | ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", | 92 | ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R, |
93 | acpi_ps_get_opcode_name(walk_state->opcode)); | 93 | acpi_ps_get_opcode_name(walk_state->opcode)); |
94 | 94 | ||
95 | /* Examine the AML opcode */ | 95 | /* Examine the AML opcode */ |
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) | |||
150 | union acpi_operand_object **operand = &walk_state->operands[0]; | 150 | union acpi_operand_object **operand = &walk_state->operands[0]; |
151 | acpi_status status = AE_OK; | 151 | acpi_status status = AE_OK; |
152 | 152 | ||
153 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R, |
154 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
155 | 155 | ||
156 | /* Examine the AML opcode */ | 156 | /* Examine the AML opcode */ |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object **operand = &walk_state->operands[0]; | 217 | union acpi_operand_object **operand = &walk_state->operands[0]; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", | 219 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R, |
220 | acpi_ps_get_opcode_name(walk_state->opcode)); | 220 | acpi_ps_get_opcode_name(walk_state->opcode)); |
221 | 221 | ||
222 | /* Examine the AML opcode */ | 222 | /* Examine the AML opcode */ |
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
264 | acpi_integer power_of_ten; | 264 | acpi_integer power_of_ten; |
265 | acpi_integer digit; | 265 | acpi_integer digit; |
266 | 266 | ||
267 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", | 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, |
268 | acpi_ps_get_opcode_name(walk_state->opcode)); | 268 | acpi_ps_get_opcode_name(walk_state->opcode)); |
269 | 269 | ||
270 | /* Examine the AML opcode */ | 270 | /* Examine the AML opcode */ |
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
322 | 322 | ||
323 | /* Since the bit position is one-based, subtract from 33 (65) */ | 323 | /* Since the bit position is one-based, subtract from 33 (65) */ |
324 | 324 | ||
325 | return_desc->integer.value = temp32 == 0 ? 0 : | 325 | return_desc->integer.value = |
326 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | 326 | temp32 == |
327 | 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | ||
327 | break; | 328 | break; |
328 | 329 | ||
329 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | 330 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ |
@@ -342,6 +343,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
342 | for (i = 0; | 343 | for (i = 0; |
343 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); | 344 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); |
344 | i++) { | 345 | i++) { |
346 | |||
345 | /* Get the least significant 4-bit BCD digit */ | 347 | /* Get the least significant 4-bit BCD digit */ |
346 | 348 | ||
347 | temp32 = ((u32) digit) & 0xF; | 349 | temp32 = ((u32) digit) & 0xF; |
@@ -487,6 +489,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
487 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 489 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
488 | ACPI_EXPLICIT_CONVERT_DECIMAL); | 490 | ACPI_EXPLICIT_CONVERT_DECIMAL); |
489 | if (return_desc == operand[0]) { | 491 | if (return_desc == operand[0]) { |
492 | |||
490 | /* No conversion performed, add ref to handle return value */ | 493 | /* No conversion performed, add ref to handle return value */ |
491 | acpi_ut_add_reference(return_desc); | 494 | acpi_ut_add_reference(return_desc); |
492 | } | 495 | } |
@@ -497,6 +500,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
497 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 500 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
498 | ACPI_EXPLICIT_CONVERT_HEX); | 501 | ACPI_EXPLICIT_CONVERT_HEX); |
499 | if (return_desc == operand[0]) { | 502 | if (return_desc == operand[0]) { |
503 | |||
500 | /* No conversion performed, add ref to handle return value */ | 504 | /* No conversion performed, add ref to handle return value */ |
501 | acpi_ut_add_reference(return_desc); | 505 | acpi_ut_add_reference(return_desc); |
502 | } | 506 | } |
@@ -506,6 +510,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
506 | 510 | ||
507 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); | 511 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); |
508 | if (return_desc == operand[0]) { | 512 | if (return_desc == operand[0]) { |
513 | |||
509 | /* No conversion performed, add ref to handle return value */ | 514 | /* No conversion performed, add ref to handle return value */ |
510 | acpi_ut_add_reference(return_desc); | 515 | acpi_ut_add_reference(return_desc); |
511 | } | 516 | } |
@@ -516,6 +521,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
516 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, | 521 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, |
517 | ACPI_ANY_BASE); | 522 | ACPI_ANY_BASE); |
518 | if (return_desc == operand[0]) { | 523 | if (return_desc == operand[0]) { |
524 | |||
519 | /* No conversion performed, add ref to handle return value */ | 525 | /* No conversion performed, add ref to handle return value */ |
520 | acpi_ut_add_reference(return_desc); | 526 | acpi_ut_add_reference(return_desc); |
521 | } | 527 | } |
@@ -541,6 +547,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
541 | } | 547 | } |
542 | 548 | ||
543 | if (ACPI_SUCCESS(status)) { | 549 | if (ACPI_SUCCESS(status)) { |
550 | |||
544 | /* Store the return value computed above into the target object */ | 551 | /* Store the return value computed above into the target object */ |
545 | 552 | ||
546 | status = acpi_ex_store(return_desc, operand[1], walk_state); | 553 | status = acpi_ex_store(return_desc, operand[1], walk_state); |
@@ -548,16 +555,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
548 | 555 | ||
549 | cleanup: | 556 | cleanup: |
550 | 557 | ||
551 | if (!walk_state->result_obj) { | ||
552 | walk_state->result_obj = return_desc; | ||
553 | } | ||
554 | |||
555 | /* Delete return object on error */ | 558 | /* Delete return object on error */ |
556 | 559 | ||
557 | if (ACPI_FAILURE(status)) { | 560 | if (ACPI_FAILURE(status)) { |
558 | acpi_ut_remove_reference(return_desc); | 561 | acpi_ut_remove_reference(return_desc); |
559 | } | 562 | } |
560 | 563 | ||
564 | /* Save return object on success */ | ||
565 | |||
566 | else if (!walk_state->result_obj) { | ||
567 | walk_state->result_obj = return_desc; | ||
568 | } | ||
569 | |||
561 | return_ACPI_STATUS(status); | 570 | return_ACPI_STATUS(status); |
562 | } | 571 | } |
563 | 572 | ||
@@ -582,7 +591,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
582 | u32 type; | 591 | u32 type; |
583 | acpi_integer value; | 592 | acpi_integer value; |
584 | 593 | ||
585 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", | 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, |
586 | acpi_ps_get_opcode_name(walk_state->opcode)); | 595 | acpi_ps_get_opcode_name(walk_state->opcode)); |
587 | 596 | ||
588 | /* Examine the AML opcode */ | 597 | /* Examine the AML opcode */ |
@@ -625,6 +634,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
625 | temp_desc = operand[0]; | 634 | temp_desc = operand[0]; |
626 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == | 635 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == |
627 | ACPI_DESC_TYPE_OPERAND) { | 636 | ACPI_DESC_TYPE_OPERAND) { |
637 | |||
628 | /* Internal reference object - prevent deletion */ | 638 | /* Internal reference object - prevent deletion */ |
629 | 639 | ||
630 | acpi_ut_add_reference(temp_desc); | 640 | acpi_ut_add_reference(temp_desc); |
@@ -689,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
689 | if (ACPI_FAILURE(status)) { | 699 | if (ACPI_FAILURE(status)) { |
690 | goto cleanup; | 700 | goto cleanup; |
691 | } | 701 | } |
702 | |||
692 | /* Allocate a descriptor to hold the type. */ | 703 | /* Allocate a descriptor to hold the type. */ |
693 | 704 | ||
694 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 705 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -777,8 +788,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
777 | 788 | ||
778 | /* Check for a method local or argument, or standalone String */ | 789 | /* Check for a method local or argument, or standalone String */ |
779 | 790 | ||
780 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | 791 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == |
781 | ACPI_DESC_TYPE_NAMED) { | 792 | ACPI_DESC_TYPE_NAMED) { |
793 | temp_desc = | ||
794 | acpi_ns_get_attached_object((struct | ||
795 | acpi_namespace_node *) | ||
796 | operand[0]); | ||
797 | if (temp_desc | ||
798 | && | ||
799 | ((ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
800 | ACPI_TYPE_STRING) | ||
801 | || (ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
802 | ACPI_TYPE_LOCAL_REFERENCE))) { | ||
803 | operand[0] = temp_desc; | ||
804 | acpi_ut_add_reference(temp_desc); | ||
805 | } else { | ||
806 | status = AE_AML_OPERAND_TYPE; | ||
807 | goto cleanup; | ||
808 | } | ||
809 | } else { | ||
782 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | 810 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { |
783 | case ACPI_TYPE_LOCAL_REFERENCE: | 811 | case ACPI_TYPE_LOCAL_REFERENCE: |
784 | /* | 812 | /* |
@@ -827,26 +855,35 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
827 | break; | 855 | break; |
828 | 856 | ||
829 | case ACPI_TYPE_STRING: | 857 | case ACPI_TYPE_STRING: |
858 | break; | ||
830 | 859 | ||
860 | default: | ||
861 | status = AE_AML_OPERAND_TYPE; | ||
862 | goto cleanup; | ||
863 | } | ||
864 | } | ||
865 | |||
866 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | ||
867 | ACPI_DESC_TYPE_NAMED) { | ||
868 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == | ||
869 | ACPI_TYPE_STRING) { | ||
831 | /* | 870 | /* |
832 | * This is a deref_of (String). The string is a reference | 871 | * This is a deref_of (String). The string is a reference |
833 | * to a named ACPI object. | 872 | * to a named ACPI object. |
834 | * | 873 | * |
835 | * 1) Find the owning Node | 874 | * 1) Find the owning Node |
836 | * 2) Dereference the node to an actual object. Could be a | 875 | * 2) Dereference the node to an actual object. Could be a |
837 | * Field, so we need to resolve the node to a value. | 876 | * Field, so we need to resolve the node to a value. |
838 | */ | 877 | */ |
839 | status = | 878 | status = |
840 | acpi_ns_get_node_by_path(operand[0]->string. | 879 | acpi_ns_get_node(walk_state->scope_info-> |
841 | pointer, | 880 | scope.node, |
842 | walk_state-> | 881 | operand[0]->string.pointer, |
843 | scope_info->scope. | 882 | ACPI_NS_SEARCH_PARENT, |
844 | node, | 883 | ACPI_CAST_INDIRECT_PTR |
845 | ACPI_NS_SEARCH_PARENT, | 884 | (struct |
846 | ACPI_CAST_INDIRECT_PTR | 885 | acpi_namespace_node, |
847 | (struct | 886 | &return_desc)); |
848 | acpi_namespace_node, | ||
849 | &return_desc)); | ||
850 | if (ACPI_FAILURE(status)) { | 887 | if (ACPI_FAILURE(status)) { |
851 | goto cleanup; | 888 | goto cleanup; |
852 | } | 889 | } |
@@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
857 | (struct acpi_namespace_node, &return_desc), | 894 | (struct acpi_namespace_node, &return_desc), |
858 | walk_state); | 895 | walk_state); |
859 | goto cleanup; | 896 | goto cleanup; |
860 | |||
861 | default: | ||
862 | |||
863 | status = AE_AML_OPERAND_TYPE; | ||
864 | goto cleanup; | ||
865 | } | 897 | } |
866 | } | 898 | } |
867 | 899 | ||
@@ -937,13 +969,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
937 | acpi_ut_add_reference | 969 | acpi_ut_add_reference |
938 | (return_desc); | 970 | (return_desc); |
939 | } | 971 | } |
940 | |||
941 | break; | 972 | break; |
942 | 973 | ||
943 | default: | 974 | default: |
944 | 975 | ||
945 | ACPI_ERROR((AE_INFO, | 976 | ACPI_ERROR((AE_INFO, |
946 | "Unknown Index target_type %X in obj %p", | 977 | "Unknown Index TargetType %X in obj %p", |
947 | operand[0]->reference. | 978 | operand[0]->reference. |
948 | target_type, operand[0])); | 979 | target_type, operand[0])); |
949 | status = AE_AML_OPERAND_TYPE; | 980 | status = AE_AML_OPERAND_TYPE; |
@@ -957,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
957 | 988 | ||
958 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == | 989 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == |
959 | ACPI_DESC_TYPE_NAMED) { | 990 | ACPI_DESC_TYPE_NAMED) { |
960 | |||
961 | return_desc = | 991 | return_desc = |
962 | acpi_ns_get_attached_object((struct | 992 | acpi_ns_get_attached_object((struct |
963 | acpi_namespace_node | 993 | acpi_namespace_node |
@@ -972,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
972 | 1002 | ||
973 | default: | 1003 | default: |
974 | ACPI_ERROR((AE_INFO, | 1004 | ACPI_ERROR((AE_INFO, |
975 | "Unknown opcode in ref(%p) - %X", | 1005 | "Unknown opcode in reference(%p) - %X", |
976 | operand[0], | 1006 | operand[0], |
977 | operand[0]->reference.opcode)); | 1007 | operand[0]->reference.opcode)); |
978 | 1008 | ||
@@ -998,6 +1028,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
998 | acpi_ut_remove_reference(return_desc); | 1028 | acpi_ut_remove_reference(return_desc); |
999 | } | 1029 | } |
1000 | 1030 | ||
1001 | walk_state->result_obj = return_desc; | 1031 | /* Save return object on success */ |
1032 | |||
1033 | else { | ||
1034 | walk_state->result_obj = return_desc; | ||
1035 | } | ||
1036 | |||
1002 | return_ACPI_STATUS(status); | 1037 | return_ACPI_STATUS(status); |
1003 | } | 1038 | } |