diff options
Diffstat (limited to 'drivers/acpi/resources/rsutils.c')
-rw-r--r-- | drivers/acpi/resources/rsutils.c | 95 |
1 files changed, 53 insertions, 42 deletions
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 0e493f2fec4d..a9cbee8e8b44 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -442,7 +442,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
442 | * | 442 | * |
443 | * FUNCTION: acpi_rs_get_prt_method_data | 443 | * FUNCTION: acpi_rs_get_prt_method_data |
444 | * | 444 | * |
445 | * PARAMETERS: Handle - Handle to the containing object | 445 | * PARAMETERS: Node - Device node |
446 | * ret_buffer - Pointer to a buffer structure for the | 446 | * ret_buffer - Pointer to a buffer structure for the |
447 | * results | 447 | * results |
448 | * | 448 | * |
@@ -457,7 +457,8 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
457 | ******************************************************************************/ | 457 | ******************************************************************************/ |
458 | 458 | ||
459 | acpi_status | 459 | acpi_status |
460 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | 460 | acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, |
461 | struct acpi_buffer * ret_buffer) | ||
461 | { | 462 | { |
462 | union acpi_operand_object *obj_desc; | 463 | union acpi_operand_object *obj_desc; |
463 | acpi_status status; | 464 | acpi_status status; |
@@ -468,7 +469,7 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
468 | 469 | ||
469 | /* Execute the method, no parameters */ | 470 | /* Execute the method, no parameters */ |
470 | 471 | ||
471 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, | 472 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, |
472 | ACPI_BTYPE_PACKAGE, &obj_desc); | 473 | ACPI_BTYPE_PACKAGE, &obj_desc); |
473 | if (ACPI_FAILURE(status)) { | 474 | if (ACPI_FAILURE(status)) { |
474 | return_ACPI_STATUS(status); | 475 | return_ACPI_STATUS(status); |
@@ -490,7 +491,7 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
490 | * | 491 | * |
491 | * FUNCTION: acpi_rs_get_crs_method_data | 492 | * FUNCTION: acpi_rs_get_crs_method_data |
492 | * | 493 | * |
493 | * PARAMETERS: Handle - Handle to the containing object | 494 | * PARAMETERS: Node - Device node |
494 | * ret_buffer - Pointer to a buffer structure for the | 495 | * ret_buffer - Pointer to a buffer structure for the |
495 | * results | 496 | * results |
496 | * | 497 | * |
@@ -505,7 +506,8 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
505 | ******************************************************************************/ | 506 | ******************************************************************************/ |
506 | 507 | ||
507 | acpi_status | 508 | acpi_status |
508 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 509 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
510 | struct acpi_buffer *ret_buffer) | ||
509 | { | 511 | { |
510 | union acpi_operand_object *obj_desc; | 512 | union acpi_operand_object *obj_desc; |
511 | acpi_status status; | 513 | acpi_status status; |
@@ -516,7 +518,7 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
516 | 518 | ||
517 | /* Execute the method, no parameters */ | 519 | /* Execute the method, no parameters */ |
518 | 520 | ||
519 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, | 521 | status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, |
520 | ACPI_BTYPE_BUFFER, &obj_desc); | 522 | ACPI_BTYPE_BUFFER, &obj_desc); |
521 | if (ACPI_FAILURE(status)) { | 523 | if (ACPI_FAILURE(status)) { |
522 | return_ACPI_STATUS(status); | 524 | return_ACPI_STATUS(status); |
@@ -539,7 +541,7 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
539 | * | 541 | * |
540 | * FUNCTION: acpi_rs_get_prs_method_data | 542 | * FUNCTION: acpi_rs_get_prs_method_data |
541 | * | 543 | * |
542 | * PARAMETERS: Handle - Handle to the containing object | 544 | * PARAMETERS: Node - Device node |
543 | * ret_buffer - Pointer to a buffer structure for the | 545 | * ret_buffer - Pointer to a buffer structure for the |
544 | * results | 546 | * results |
545 | * | 547 | * |
@@ -555,7 +557,8 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
555 | 557 | ||
556 | #ifdef ACPI_FUTURE_USAGE | 558 | #ifdef ACPI_FUTURE_USAGE |
557 | acpi_status | 559 | acpi_status |
558 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 560 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
561 | struct acpi_buffer *ret_buffer) | ||
559 | { | 562 | { |
560 | union acpi_operand_object *obj_desc; | 563 | union acpi_operand_object *obj_desc; |
561 | acpi_status status; | 564 | acpi_status status; |
@@ -566,7 +569,7 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
566 | 569 | ||
567 | /* Execute the method, no parameters */ | 570 | /* Execute the method, no parameters */ |
568 | 571 | ||
569 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, | 572 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, |
570 | ACPI_BTYPE_BUFFER, &obj_desc); | 573 | ACPI_BTYPE_BUFFER, &obj_desc); |
571 | if (ACPI_FAILURE(status)) { | 574 | if (ACPI_FAILURE(status)) { |
572 | return_ACPI_STATUS(status); | 575 | return_ACPI_STATUS(status); |
@@ -641,7 +644,7 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
641 | * | 644 | * |
642 | * FUNCTION: acpi_rs_set_srs_method_data | 645 | * FUNCTION: acpi_rs_set_srs_method_data |
643 | * | 646 | * |
644 | * PARAMETERS: Handle - Handle to the containing object | 647 | * PARAMETERS: Node - Device node |
645 | * in_buffer - Pointer to a buffer structure of the | 648 | * in_buffer - Pointer to a buffer structure of the |
646 | * parameter | 649 | * parameter |
647 | * | 650 | * |
@@ -653,23 +656,37 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
653 | * If the function fails an appropriate status will be returned | 656 | * If the function fails an appropriate status will be returned |
654 | * and the contents of the callers buffer is undefined. | 657 | * and the contents of the callers buffer is undefined. |
655 | * | 658 | * |
659 | * Note: Parameters guaranteed valid by caller | ||
660 | * | ||
656 | ******************************************************************************/ | 661 | ******************************************************************************/ |
657 | 662 | ||
658 | acpi_status | 663 | acpi_status |
659 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | 664 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
665 | struct acpi_buffer *in_buffer) | ||
660 | { | 666 | { |
661 | struct acpi_parameter_info info; | 667 | struct acpi_evaluate_info *info; |
662 | union acpi_operand_object *params[2]; | 668 | union acpi_operand_object *args[2]; |
663 | acpi_status status; | 669 | acpi_status status; |
664 | struct acpi_buffer buffer; | 670 | struct acpi_buffer buffer; |
665 | 671 | ||
666 | ACPI_FUNCTION_TRACE(rs_set_srs_method_data); | 672 | ACPI_FUNCTION_TRACE(rs_set_srs_method_data); |
667 | 673 | ||
668 | /* Parameters guaranteed valid by caller */ | 674 | /* Allocate and initialize the evaluation information block */ |
675 | |||
676 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
677 | if (!info) { | ||
678 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
679 | } | ||
680 | |||
681 | info->prefix_node = node; | ||
682 | info->pathname = METHOD_NAME__SRS; | ||
683 | info->parameters = args; | ||
684 | info->parameter_type = ACPI_PARAM_ARGS; | ||
685 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
669 | 686 | ||
670 | /* | 687 | /* |
671 | * The in_buffer parameter will point to a linked list of | 688 | * The in_buffer parameter will point to a linked list of |
672 | * resource parameters. It needs to be formatted into a | 689 | * resource parameters. It needs to be formatted into a |
673 | * byte stream to be sent in as an input parameter to _SRS | 690 | * byte stream to be sent in as an input parameter to _SRS |
674 | * | 691 | * |
675 | * Convert the linked list into a byte stream | 692 | * Convert the linked list into a byte stream |
@@ -677,42 +694,36 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | |||
677 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 694 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
678 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); | 695 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); |
679 | if (ACPI_FAILURE(status)) { | 696 | if (ACPI_FAILURE(status)) { |
680 | return_ACPI_STATUS(status); | 697 | goto cleanup; |
681 | } | 698 | } |
682 | 699 | ||
683 | /* Init the param object */ | 700 | /* Create and initialize the method parameter object */ |
684 | 701 | ||
685 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 702 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
686 | if (!params[0]) { | 703 | if (!args[0]) { |
687 | acpi_os_free(buffer.pointer); | 704 | /* |
688 | return_ACPI_STATUS(AE_NO_MEMORY); | 705 | * Must free the buffer allocated above (otherwise it is freed |
706 | * later) | ||
707 | */ | ||
708 | ACPI_FREE(buffer.pointer); | ||
709 | status = AE_NO_MEMORY; | ||
710 | goto cleanup; | ||
689 | } | 711 | } |
690 | 712 | ||
691 | /* Set up the parameter object */ | 713 | args[0]->buffer.length = (u32) buffer.length; |
692 | 714 | args[0]->buffer.pointer = buffer.pointer; | |
693 | params[0]->buffer.length = (u32) buffer.length; | 715 | args[0]->common.flags = AOPOBJ_DATA_VALID; |
694 | params[0]->buffer.pointer = buffer.pointer; | 716 | args[1] = NULL; |
695 | params[0]->common.flags = AOPOBJ_DATA_VALID; | ||
696 | params[1] = NULL; | ||
697 | 717 | ||
698 | info.node = handle; | 718 | /* Execute the method, no return value is expected */ |
699 | info.parameters = params; | ||
700 | info.parameter_type = ACPI_PARAM_ARGS; | ||
701 | 719 | ||
702 | /* Execute the method, no return value */ | 720 | status = acpi_ns_evaluate(info); |
703 | 721 | ||
704 | status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); | 722 | /* Clean up and return the status from acpi_ns_evaluate */ |
705 | if (ACPI_SUCCESS(status)) { | ||
706 | |||
707 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
708 | |||
709 | if (info.return_object) { | ||
710 | acpi_ut_remove_reference(info.return_object); | ||
711 | } | ||
712 | } | ||
713 | 723 | ||
714 | /* Clean up and return the status from acpi_ns_evaluate_relative */ | 724 | acpi_ut_remove_reference(args[0]); |
715 | 725 | ||
716 | acpi_ut_remove_reference(params[0]); | 726 | cleanup: |
727 | ACPI_FREE(info); | ||
717 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
718 | } | 729 | } |