aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsutils.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-05-26 16:36:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-14 02:44:35 -0400
commit4119532c95547821dbe72d6916dfa1b2148475b3 (patch)
tree564eb8f69924fb7dc72e93526faf1547acac7d30 /drivers/acpi/resources/rsutils.c
parentb8d35192c55fb055792ff0641408eaaec7c88988 (diff)
ACPI: ACPICA 20060526
Restructured, flattened, and simplified the internal interfaces for namespace object evaluation - resulting in smaller code, less CPU stack use, and fewer interfaces. (With assistance from Mikhail Kouzmich) Fixed a problem with the CopyObject operator where the first parameter was not typed correctly for the parser, interpreter, compiler, and disassembler. Caused various errors and unexpected behavior. Fixed a problem where a ShiftLeft or ShiftRight of more than 64 bits produced incorrect results with some C compilers. Since the behavior of C compilers when the shift value is larger than the datatype width is apparently not well defined, the interpreter now detects this condition and simply returns zero as expected in all such cases. (BZ 395) Fixed problem reports (Valery Podrezov) integrated: - Update String-to-Integer conversion to match ACPI 3.0A spec http://bugzilla.kernel.org/show_bug.cgi?id=5329 Allow interpreter to handle nested method declarations http://bugzilla.kernel.org/show_bug.cgi?id=5361 Fixed problem reports (Fiodor Suietov) integrated: - acpi_terminate() doesn't free debug memory allocation list objects (BZ 355) - After Core Subsystem shutdown, acpi_subsystem_status() returns AE_OK (BZ 356) - acpi_os_unmap_memory() for RSDP can be invoked inconsistently (BZ 357) - Resource Manager should return AE_TYPE for non-device objects (BZ 358) - Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359) - Use acpi_os_free() instead of ACPI_FREE in acpi_rs_set_srs_method_data (BZ 360) - Incomplete cleanup branch in acpi_ps_parse_aml (BZ 361) - Incomplete cleanup branch in acpi_ds_delete_walk_state (BZ 362) - acpi_get_table_header returns AE_NO_ACPI_TABLES until DSDT is loaded (BZ 365) - Status of the Global Initialization Handler call not used (BZ 366) - Incorrect object parameter to Global Initialization Handler (BZ 367) Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rsutils.c')
-rw-r--r--drivers/acpi/resources/rsutils.c95
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
459acpi_status 459acpi_status
460acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) 460acpi_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
507acpi_status 508acpi_status
508acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) 509acpi_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
557acpi_status 559acpi_status
558acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) 560acpi_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
658acpi_status 663acpi_status
659acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) 664acpi_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}