aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsutils.c')
-rw-r--r--drivers/acpi/resources/rsutils.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index 25b5aedd6612..c5f7014929b4 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
205 /* Length is stored differently for large and small descriptors */ 205 /* Length is stored differently for large and small descriptors */
206 206
207 if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 207 if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
208
208 /* Large descriptor -- bytes 1-2 contain the 16-bit length */ 209 /* Large descriptor -- bytes 1-2 contain the 16-bit length */
209 210
210 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, 211 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
@@ -328,6 +329,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
328 * we add 1 to the minimum length. 329 * we add 1 to the minimum length.
329 */ 330 */
330 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { 331 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
332
331 /* Get the resource_source_index */ 333 /* Get the resource_source_index */
332 334
333 resource_source->index = aml_resource_source[0]; 335 resource_source->index = aml_resource_source[0];
@@ -351,16 +353,20 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
351 * Zero the entire area of the buffer. 353 * Zero the entire area of the buffer.
352 */ 354 */
353 total_length = 355 total_length =
356 (u32)
354 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN 357 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN
355 ((char *)&aml_resource_source[1]) + 358 (ACPI_CAST_PTR
356 1); 359 (char,
360 &aml_resource_source[1])) + 1);
361
357 ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 362 ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
358 363
359 /* Copy the resource_source string to the destination */ 364 /* Copy the resource_source string to the destination */
360 365
361 resource_source->string_length = 366 resource_source->string_length =
362 acpi_rs_strcpy(resource_source->string_ptr, 367 acpi_rs_strcpy(resource_source->string_ptr,
363 (char *)&aml_resource_source[1]); 368 ACPI_CAST_PTR(char,
369 &aml_resource_source[1]));
364 370
365 return ((acpi_rs_length) total_length); 371 return ((acpi_rs_length) total_length);
366 } 372 }
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
405 /* Non-zero string length indicates presence of a resource_source */ 411 /* Non-zero string length indicates presence of a resource_source */
406 412
407 if (resource_source->string_length) { 413 if (resource_source->string_length) {
414
408 /* Point to the end of the AML descriptor */ 415 /* Point to the end of the AML descriptor */
409 416
410 aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); 417 aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
415 422
416 /* Copy the resource_source string */ 423 /* Copy the resource_source string */
417 424
418 ACPI_STRCPY((char *)&aml_resource_source[1], 425 ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
419 resource_source->string_ptr); 426 resource_source->string_ptr);
420 427
421 /* 428 /*
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml,
435 * 442 *
436 * FUNCTION: acpi_rs_get_prt_method_data 443 * FUNCTION: acpi_rs_get_prt_method_data
437 * 444 *
438 * PARAMETERS: Handle - a handle to the containing object 445 * PARAMETERS: Handle - Handle to the containing object
439 * ret_buffer - a pointer to a buffer structure for the 446 * ret_buffer - Pointer to a buffer structure for the
440 * results 447 * results
441 * 448 *
442 * RETURN: Status 449 * RETURN: Status
443 * 450 *
@@ -483,9 +490,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
483 * 490 *
484 * FUNCTION: acpi_rs_get_crs_method_data 491 * FUNCTION: acpi_rs_get_crs_method_data
485 * 492 *
486 * PARAMETERS: Handle - a handle to the containing object 493 * PARAMETERS: Handle - Handle to the containing object
487 * ret_buffer - a pointer to a buffer structure for the 494 * ret_buffer - Pointer to a buffer structure for the
488 * results 495 * results
489 * 496 *
490 * RETURN: Status 497 * RETURN: Status
491 * 498 *
@@ -532,9 +539,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
532 * 539 *
533 * FUNCTION: acpi_rs_get_prs_method_data 540 * FUNCTION: acpi_rs_get_prs_method_data
534 * 541 *
535 * PARAMETERS: Handle - a handle to the containing object 542 * PARAMETERS: Handle - Handle to the containing object
536 * ret_buffer - a pointer to a buffer structure for the 543 * ret_buffer - Pointer to a buffer structure for the
537 * results 544 * results
538 * 545 *
539 * RETURN: Status 546 * RETURN: Status
540 * 547 *
@@ -583,10 +590,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
583 * 590 *
584 * FUNCTION: acpi_rs_get_method_data 591 * FUNCTION: acpi_rs_get_method_data
585 * 592 *
586 * PARAMETERS: Handle - a handle to the containing object 593 * PARAMETERS: Handle - Handle to the containing object
587 * Path - Path to method, relative to Handle 594 * Path - Path to method, relative to Handle
588 * ret_buffer - a pointer to a buffer structure for the 595 * ret_buffer - Pointer to a buffer structure for the
589 * results 596 * results
590 * 597 *
591 * RETURN: Status 598 * RETURN: Status
592 * 599 *
@@ -634,9 +641,9 @@ acpi_rs_get_method_data(acpi_handle handle,
634 * 641 *
635 * FUNCTION: acpi_rs_set_srs_method_data 642 * FUNCTION: acpi_rs_set_srs_method_data
636 * 643 *
637 * PARAMETERS: Handle - a handle to the containing object 644 * PARAMETERS: Handle - Handle to the containing object
638 * in_buffer - a pointer to a buffer structure of the 645 * in_buffer - Pointer to a buffer structure of the
639 * parameter 646 * parameter
640 * 647 *
641 * RETURN: Status 648 * RETURN: Status
642 * 649 *
@@ -696,6 +703,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
696 703
697 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); 704 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
698 if (ACPI_SUCCESS(status)) { 705 if (ACPI_SUCCESS(status)) {
706
699 /* Delete any return object (especially if implicit_return is enabled) */ 707 /* Delete any return object (especially if implicit_return is enabled) */
700 708
701 if (info.return_object) { 709 if (info.return_object) {