diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsopcode.c')
| -rw-r--r-- | drivers/acpi/dispatcher/dsopcode.c | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6229c10674e1..5b974a8fe614 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
| @@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, | |||
| 91 | union acpi_parse_object *op; | 91 | union acpi_parse_object *op; |
| 92 | struct acpi_walk_state *walk_state; | 92 | struct acpi_walk_state *walk_state; |
| 93 | 93 | ||
| 94 | ACPI_FUNCTION_TRACE("ds_execute_arguments"); | 94 | ACPI_FUNCTION_TRACE(ds_execute_arguments); |
| 95 | 95 | ||
| 96 | /* | 96 | /* |
| 97 | * Allocate a new parser op to be the root of the parsed tree | 97 | * Allocate a new parser op to be the root of the parsed tree |
| @@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
| 193 | struct acpi_namespace_node *node; | 193 | struct acpi_namespace_node *node; |
| 194 | acpi_status status; | 194 | acpi_status status; |
| 195 | 195 | ||
| 196 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); |
| 197 | 197 | ||
| 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
| 199 | return_ACPI_STATUS(AE_OK); | 199 | return_ACPI_STATUS(AE_OK); |
| @@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
| 206 | 206 | ||
| 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
| 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
| 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", | 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", |
| 210 | acpi_ut_get_node_name(node))); | 210 | acpi_ut_get_node_name(node))); |
| 211 | 211 | ||
| 212 | /* Execute the AML code for the term_arg arguments */ | 212 | /* Execute the AML code for the term_arg arguments */ |
| @@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | |||
| 235 | struct acpi_namespace_node *node; | 235 | struct acpi_namespace_node *node; |
| 236 | acpi_status status; | 236 | acpi_status status; |
| 237 | 237 | ||
| 238 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); | 238 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); |
| 239 | 239 | ||
| 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
| 241 | return_ACPI_STATUS(AE_OK); | 241 | return_ACPI_STATUS(AE_OK); |
| @@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | |||
| 279 | struct acpi_namespace_node *node; | 279 | struct acpi_namespace_node *node; |
| 280 | acpi_status status; | 280 | acpi_status status; |
| 281 | 281 | ||
| 282 | ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); | 282 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); |
| 283 | 283 | ||
| 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
| 285 | return_ACPI_STATUS(AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
| @@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 324 | acpi_status status; | 324 | acpi_status status; |
| 325 | union acpi_operand_object *extra_desc; | 325 | union acpi_operand_object *extra_desc; |
| 326 | 326 | ||
| 327 | ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); | 327 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); |
| 328 | 328 | ||
| 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
| 330 | return_ACPI_STATUS(AE_OK); | 330 | return_ACPI_STATUS(AE_OK); |
| @@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
| 343 | (ACPI_TYPE_REGION, node, NULL)); | 343 | (ACPI_TYPE_REGION, node, NULL)); |
| 344 | 344 | ||
| 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", |
| 346 | "[%4.4s] op_region Arg Init at AML %p\n", | ||
| 347 | acpi_ut_get_node_name(node), | 346 | acpi_ut_get_node_name(node), |
| 348 | extra_desc->extra.aml_start)); | 347 | extra_desc->extra.aml_start)); |
| 349 | 348 | ||
| @@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 352 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 351 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
| 353 | extra_desc->extra.aml_length, | 352 | extra_desc->extra.aml_length, |
| 354 | extra_desc->extra.aml_start); | 353 | extra_desc->extra.aml_start); |
| 354 | if (ACPI_FAILURE(status)) { | ||
| 355 | return_ACPI_STATUS(status); | ||
| 356 | } | ||
| 357 | |||
| 358 | /* Validate the region address/length via the host OS */ | ||
| 359 | |||
| 360 | status = acpi_os_validate_address(obj_desc->region.space_id, | ||
| 361 | obj_desc->region.address, | ||
| 362 | (acpi_size) obj_desc->region.length); | ||
| 363 | if (ACPI_FAILURE(status)) { | ||
| 364 | /* | ||
| 365 | * Invalid address/length. We will emit an error message and mark | ||
| 366 | * the region as invalid, so that it will cause an additional error if | ||
| 367 | * it is ever used. Then return AE_OK. | ||
| 368 | */ | ||
| 369 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 370 | "During address validation of OpRegion [%4.4s]", | ||
| 371 | node->name.ascii)); | ||
| 372 | obj_desc->common.flags |= AOPOBJ_INVALID; | ||
| 373 | status = AE_OK; | ||
| 374 | } | ||
| 375 | |||
| 355 | return_ACPI_STATUS(status); | 376 | return_ACPI_STATUS(status); |
| 356 | } | 377 | } |
| 357 | 378 | ||
| @@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
| 411 | u8 field_flags; | 432 | u8 field_flags; |
| 412 | acpi_status status; | 433 | acpi_status status; |
| 413 | 434 | ||
| 414 | ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); | 435 | ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc); |
| 415 | 436 | ||
| 416 | /* Host object must be a Buffer */ | 437 | /* Host object must be a Buffer */ |
| 417 | 438 | ||
| @@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
| 457 | 478 | ||
| 458 | if (bit_count == 0) { | 479 | if (bit_count == 0) { |
| 459 | ACPI_ERROR((AE_INFO, | 480 | ACPI_ERROR((AE_INFO, |
| 460 | "Attempt to create_field of length zero")); | 481 | "Attempt to CreateField of length zero")); |
| 461 | status = AE_AML_OPERAND_VALUE; | 482 | status = AE_AML_OPERAND_VALUE; |
| 462 | goto cleanup; | 483 | goto cleanup; |
| 463 | } | 484 | } |
| @@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 595 | struct acpi_namespace_node *node; | 616 | struct acpi_namespace_node *node; |
| 596 | union acpi_parse_object *next_op; | 617 | union acpi_parse_object *next_op; |
| 597 | 618 | ||
| 598 | ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); | 619 | ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op); |
| 599 | 620 | ||
| 600 | /* | 621 | /* |
| 601 | * This is where we evaluate the address and length fields of the | 622 | * This is where we evaluate the address and length fields of the |
| @@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 627 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 648 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
| 628 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 649 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
| 629 | walk_state->num_operands, | 650 | walk_state->num_operands, |
| 630 | "after acpi_ex_resolve_operands"); | 651 | "after AcpiExResolveOperands"); |
| 631 | 652 | ||
| 632 | if (ACPI_FAILURE(status)) { | 653 | if (ACPI_FAILURE(status)) { |
| 633 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", | 654 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", |
| @@ -640,6 +661,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 640 | /* Initialize the Buffer Field */ | 661 | /* Initialize the Buffer Field */ |
| 641 | 662 | ||
| 642 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 663 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
| 664 | |||
| 643 | /* NOTE: Slightly different operands for this opcode */ | 665 | /* NOTE: Slightly different operands for this opcode */ |
| 644 | 666 | ||
| 645 | status = | 667 | status = |
| @@ -685,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 685 | struct acpi_namespace_node *node; | 707 | struct acpi_namespace_node *node; |
| 686 | union acpi_parse_object *next_op; | 708 | union acpi_parse_object *next_op; |
| 687 | 709 | ||
| 688 | ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); | 710 | ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op); |
| 689 | 711 | ||
| 690 | /* | 712 | /* |
| 691 | * This is where we evaluate the address and length fields of the | 713 | * This is where we evaluate the address and length fields of the |
| @@ -718,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 718 | 740 | ||
| 719 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 741 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
| 720 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 742 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
| 721 | 1, "after acpi_ex_resolve_operands"); | 743 | 1, "after AcpiExResolveOperands"); |
| 722 | 744 | ||
| 723 | obj_desc = acpi_ns_get_attached_object(node); | 745 | obj_desc = acpi_ns_get_attached_object(node); |
| 724 | if (!obj_desc) { | 746 | if (!obj_desc) { |
| @@ -744,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 744 | operand_desc->integer.value; | 766 | operand_desc->integer.value; |
| 745 | acpi_ut_remove_reference(operand_desc); | 767 | acpi_ut_remove_reference(operand_desc); |
| 746 | 768 | ||
| 747 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 769 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
| 748 | obj_desc, | 770 | obj_desc, |
| 749 | ACPI_FORMAT_UINT64(obj_desc->region.address), | 771 | ACPI_FORMAT_UINT64(obj_desc->region.address), |
| 750 | obj_desc->region.length)); | 772 | obj_desc->region.length)); |
| @@ -780,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
| 780 | union acpi_operand_object *arg_desc; | 802 | union acpi_operand_object *arg_desc; |
| 781 | u32 length; | 803 | u32 length; |
| 782 | 804 | ||
| 783 | ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); | 805 | ACPI_FUNCTION_TRACE(ds_eval_data_object_operands); |
| 784 | 806 | ||
| 785 | /* The first operand (for all of these data objects) is the length */ | 807 | /* The first operand (for all of these data objects) is the length */ |
| 786 | 808 | ||
| @@ -874,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | |||
| 874 | acpi_status status = AE_OK; | 896 | acpi_status status = AE_OK; |
| 875 | union acpi_generic_state *control_state; | 897 | union acpi_generic_state *control_state; |
| 876 | 898 | ||
| 877 | ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); | 899 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); |
| 878 | 900 | ||
| 879 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | 901 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, |
| 880 | op->common.aml_opcode, walk_state)); | 902 | op->common.aml_opcode, walk_state)); |
| @@ -952,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 952 | acpi_status status = AE_OK; | 974 | acpi_status status = AE_OK; |
| 953 | union acpi_generic_state *control_state; | 975 | union acpi_generic_state *control_state; |
| 954 | 976 | ||
| 955 | ACPI_FUNCTION_NAME("ds_exec_end_control_op"); | 977 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); |
| 956 | 978 | ||
| 957 | switch (op->common.aml_opcode) { | 979 | switch (op->common.aml_opcode) { |
| 958 | case AML_IF_OP: | 980 | case AML_IF_OP: |
| @@ -984,6 +1006,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 984 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
| 985 | 1007 | ||
| 986 | if (walk_state->control_state->common.value) { | 1008 | if (walk_state->control_state->common.value) { |
| 1009 | |||
| 987 | /* Predicate was true, go back and evaluate it again! */ | 1010 | /* Predicate was true, go back and evaluate it again! */ |
| 988 | 1011 | ||
| 989 | status = AE_CTRL_PENDING; | 1012 | status = AE_CTRL_PENDING; |
| @@ -1014,6 +1037,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 1014 | * has been bubbled up the tree | 1037 | * has been bubbled up the tree |
| 1015 | */ | 1038 | */ |
| 1016 | if (op->common.value.arg) { | 1039 | if (op->common.value.arg) { |
| 1040 | |||
| 1017 | /* Since we have a real Return(), delete any implicit return */ | 1041 | /* Since we have a real Return(), delete any implicit return */ |
| 1018 | 1042 | ||
| 1019 | acpi_ds_clear_implicit_return(walk_state); | 1043 | acpi_ds_clear_implicit_return(walk_state); |
| @@ -1047,6 +1071,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 1047 | walk_state->return_desc = walk_state->operands[0]; | 1071 | walk_state->return_desc = walk_state->operands[0]; |
| 1048 | } else if ((walk_state->results) && | 1072 | } else if ((walk_state->results) && |
| 1049 | (walk_state->results->results.num_results > 0)) { | 1073 | (walk_state->results->results.num_results > 0)) { |
| 1074 | |||
| 1050 | /* Since we have a real Return(), delete any implicit return */ | 1075 | /* Since we have a real Return(), delete any implicit return */ |
| 1051 | 1076 | ||
| 1052 | acpi_ds_clear_implicit_return(walk_state); | 1077 | acpi_ds_clear_implicit_return(walk_state); |
| @@ -1095,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 1095 | } | 1120 | } |
| 1096 | 1121 | ||
| 1097 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1122 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 1098 | "Completed RETURN_OP State=%p, ret_val=%p\n", | 1123 | "Completed RETURN_OP State=%p, RetVal=%p\n", |
| 1099 | walk_state, walk_state->return_desc)); | 1124 | walk_state, walk_state->return_desc)); |
| 1100 | 1125 | ||
| 1101 | /* End the control method execution right now */ | 1126 | /* End the control method execution right now */ |
