aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsaddr.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2005-09-16 16:51:15 -0400
committerLen Brown <len.brown@intel.com>2005-09-21 23:51:39 -0400
commitbda663d36b94c723153246a4231bbc0f1cd1836e (patch)
treecc9f75c1d010d1b99d29f13acd600b21eda5eec5 /drivers/acpi/resources/rsaddr.c
parentefb0372bbaf5b829ff8c39db372779928af542a7 (diff)
[ACPI] ACPICA 20050916
Fixed a problem within the Resource Manager where support for the Generic Register descriptor was not fully implemented. This descriptor is now fully recognized, parsed, disassembled, and displayed. Restructured the Resource Manager code to utilize table-driven dispatch and lookup, eliminating many of the large switch() statements. This reduces overall subsystem code size and code complexity. Affects the resource parsing and construction, disassembly, and debug dump output. Cleaned up and restructured the debug dump output for all resource descriptors. Improved readability of the output and reduced code size. Fixed a problem where changes to internal data structures caused the optional ACPI_MUTEX_DEBUG code to fail compilation if specified. Signed-off-by: Robert Moore <Robert.Moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rsaddr.c')
-rw-r--r--drivers/acpi/resources/rsaddr.c99
1 files changed, 45 insertions, 54 deletions
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 23b54baa0cb2..798778261fb9 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -270,7 +270,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
270 } 270 }
271 271
272 *bytes_consumed = temp16 + 3; 272 *bytes_consumed = temp16 + 3;
273 output_struct->id = ACPI_RSTYPE_ADDRESS16; 273 output_struct->type = ACPI_RSTYPE_ADDRESS16;
274 274
275 /* Get the Resource Type (Byte3) */ 275 /* Get the Resource Type (Byte3) */
276 276
@@ -400,7 +400,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
400 * 400 *
401 * FUNCTION: acpi_rs_address16_stream 401 * FUNCTION: acpi_rs_address16_stream
402 * 402 *
403 * PARAMETERS: linked_list - Pointer to the resource linked list 403 * PARAMETERS: Resource - Pointer to the resource linked list
404 * output_buffer - Pointer to the user's return buffer 404 * output_buffer - Pointer to the user's return buffer
405 * bytes_consumed - Pointer to where the number of bytes 405 * bytes_consumed - Pointer to where the number of bytes
406 * used in the output_buffer is returned 406 * used in the output_buffer is returned
@@ -413,7 +413,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
413 ******************************************************************************/ 413 ******************************************************************************/
414 414
415acpi_status 415acpi_status
416acpi_rs_address16_stream(struct acpi_resource *linked_list, 416acpi_rs_address16_stream(struct acpi_resource *resource,
417 u8 ** output_buffer, acpi_size * bytes_consumed) 417 u8 ** output_buffer, acpi_size * bytes_consumed)
418{ 418{
419 u8 *buffer = *output_buffer; 419 u8 *buffer = *output_buffer;
@@ -434,59 +434,56 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list,
434 434
435 /* Set the Resource Type (Memory, Io, bus_number) */ 435 /* Set the Resource Type (Memory, Io, bus_number) */
436 436
437 *buffer = (u8) (linked_list->data.address16.resource_type & 0x03); 437 *buffer = (u8) (resource->data.address16.resource_type & 0x03);
438 buffer += 1; 438 buffer += 1;
439 439
440 /* Set the general flags */ 440 /* Set the general flags */
441 441
442 *buffer = acpi_rs_encode_general_flags(&linked_list->data); 442 *buffer = acpi_rs_encode_general_flags(&resource->data);
443 buffer += 1; 443 buffer += 1;
444 444
445 /* Set the type specific flags */ 445 /* Set the type specific flags */
446 446
447 *buffer = acpi_rs_encode_specific_flags(&linked_list->data); 447 *buffer = acpi_rs_encode_specific_flags(&resource->data);
448 buffer += 1; 448 buffer += 1;
449 449
450 /* Set the address space granularity */ 450 /* Set the address space granularity */
451 451
452 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); 452 ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.granularity);
453 buffer += 2; 453 buffer += 2;
454 454
455 /* Set the address range minimum */ 455 /* Set the address range minimum */
456 456
457 ACPI_MOVE_32_TO_16(buffer, 457 ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.min_address_range);
458 &linked_list->data.address16.min_address_range);
459 buffer += 2; 458 buffer += 2;
460 459
461 /* Set the address range maximum */ 460 /* Set the address range maximum */
462 461
463 ACPI_MOVE_32_TO_16(buffer, 462 ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.max_address_range);
464 &linked_list->data.address16.max_address_range);
465 buffer += 2; 463 buffer += 2;
466 464
467 /* Set the address translation offset */ 465 /* Set the address translation offset */
468 466
469 ACPI_MOVE_32_TO_16(buffer, 467 ACPI_MOVE_32_TO_16(buffer,
470 &linked_list->data.address16. 468 &resource->data.address16.
471 address_translation_offset); 469 address_translation_offset);
472 buffer += 2; 470 buffer += 2;
473 471
474 /* Set the address length */ 472 /* Set the address length */
475 473
476 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length); 474 ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.address_length);
477 buffer += 2; 475 buffer += 2;
478 476
479 /* Resource Source Index and Resource Source are optional */ 477 /* Resource Source Index and Resource Source are optional */
480 478
481 if (linked_list->data.address16.resource_source.string_length) { 479 if (resource->data.address16.resource_source.string_length) {
482 *buffer = 480 *buffer = (u8) resource->data.address16.resource_source.index;
483 (u8) linked_list->data.address16.resource_source.index;
484 buffer += 1; 481 buffer += 1;
485 482
486 /* Copy the resource_source string */ 483 /* Copy the resource_source string */
487 484
488 ACPI_STRCPY((char *)buffer, 485 ACPI_STRCPY((char *)buffer,
489 linked_list->data.address16.resource_source. 486 resource->data.address16.resource_source.
490 string_ptr); 487 string_ptr);
491 488
492 /* 489 /*
@@ -495,7 +492,7 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list,
495 */ 492 */
496 buffer += 493 buffer +=
497 (acpi_size) (ACPI_STRLEN 494 (acpi_size) (ACPI_STRLEN
498 (linked_list->data.address16.resource_source. 495 (resource->data.address16.resource_source.
499 string_ptr) + 1); 496 string_ptr) + 1);
500 } 497 }
501 498
@@ -562,7 +559,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
562 } 559 }
563 560
564 *bytes_consumed = temp16 + 3; 561 *bytes_consumed = temp16 + 3;
565 output_struct->id = ACPI_RSTYPE_ADDRESS32; 562 output_struct->type = ACPI_RSTYPE_ADDRESS32;
566 563
567 /* Get the Resource Type (Byte3) */ 564 /* Get the Resource Type (Byte3) */
568 565
@@ -690,7 +687,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
690 * 687 *
691 * FUNCTION: acpi_rs_address32_stream 688 * FUNCTION: acpi_rs_address32_stream
692 * 689 *
693 * PARAMETERS: linked_list - Pointer to the resource linked list 690 * PARAMETERS: Resource - Pointer to the resource linked list
694 * output_buffer - Pointer to the user's return buffer 691 * output_buffer - Pointer to the user's return buffer
695 * bytes_consumed - Pointer to where the number of bytes 692 * bytes_consumed - Pointer to where the number of bytes
696 * used in the output_buffer is returned 693 * used in the output_buffer is returned
@@ -703,7 +700,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
703 ******************************************************************************/ 700 ******************************************************************************/
704 701
705acpi_status 702acpi_status
706acpi_rs_address32_stream(struct acpi_resource *linked_list, 703acpi_rs_address32_stream(struct acpi_resource *resource,
707 u8 ** output_buffer, acpi_size * bytes_consumed) 704 u8 ** output_buffer, acpi_size * bytes_consumed)
708{ 705{
709 u8 *buffer; 706 u8 *buffer;
@@ -725,59 +722,56 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list,
725 722
726 /* Set the Resource Type (Memory, Io, bus_number) */ 723 /* Set the Resource Type (Memory, Io, bus_number) */
727 724
728 *buffer = (u8) (linked_list->data.address32.resource_type & 0x03); 725 *buffer = (u8) (resource->data.address32.resource_type & 0x03);
729 buffer += 1; 726 buffer += 1;
730 727
731 /* Set the general flags */ 728 /* Set the general flags */
732 729
733 *buffer = acpi_rs_encode_general_flags(&linked_list->data); 730 *buffer = acpi_rs_encode_general_flags(&resource->data);
734 buffer += 1; 731 buffer += 1;
735 732
736 /* Set the type specific flags */ 733 /* Set the type specific flags */
737 734
738 *buffer = acpi_rs_encode_specific_flags(&linked_list->data); 735 *buffer = acpi_rs_encode_specific_flags(&resource->data);
739 buffer += 1; 736 buffer += 1;
740 737
741 /* Set the address space granularity */ 738 /* Set the address space granularity */
742 739
743 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); 740 ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.granularity);
744 buffer += 4; 741 buffer += 4;
745 742
746 /* Set the address range minimum */ 743 /* Set the address range minimum */
747 744
748 ACPI_MOVE_32_TO_32(buffer, 745 ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.min_address_range);
749 &linked_list->data.address32.min_address_range);
750 buffer += 4; 746 buffer += 4;
751 747
752 /* Set the address range maximum */ 748 /* Set the address range maximum */
753 749
754 ACPI_MOVE_32_TO_32(buffer, 750 ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.max_address_range);
755 &linked_list->data.address32.max_address_range);
756 buffer += 4; 751 buffer += 4;
757 752
758 /* Set the address translation offset */ 753 /* Set the address translation offset */
759 754
760 ACPI_MOVE_32_TO_32(buffer, 755 ACPI_MOVE_32_TO_32(buffer,
761 &linked_list->data.address32. 756 &resource->data.address32.
762 address_translation_offset); 757 address_translation_offset);
763 buffer += 4; 758 buffer += 4;
764 759
765 /* Set the address length */ 760 /* Set the address length */
766 761
767 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length); 762 ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.address_length);
768 buffer += 4; 763 buffer += 4;
769 764
770 /* Resource Source Index and Resource Source are optional */ 765 /* Resource Source Index and Resource Source are optional */
771 766
772 if (linked_list->data.address32.resource_source.string_length) { 767 if (resource->data.address32.resource_source.string_length) {
773 *buffer = 768 *buffer = (u8) resource->data.address32.resource_source.index;
774 (u8) linked_list->data.address32.resource_source.index;
775 buffer += 1; 769 buffer += 1;
776 770
777 /* Copy the resource_source string */ 771 /* Copy the resource_source string */
778 772
779 ACPI_STRCPY((char *)buffer, 773 ACPI_STRCPY((char *)buffer,
780 linked_list->data.address32.resource_source. 774 resource->data.address32.resource_source.
781 string_ptr); 775 string_ptr);
782 776
783 /* 777 /*
@@ -786,7 +780,7 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list,
786 */ 780 */
787 buffer += 781 buffer +=
788 (acpi_size) (ACPI_STRLEN 782 (acpi_size) (ACPI_STRLEN
789 (linked_list->data.address32.resource_source. 783 (resource->data.address32.resource_source.
790 string_ptr) + 1); 784 string_ptr) + 1);
791 } 785 }
792 786
@@ -856,7 +850,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
856 } 850 }
857 851
858 *bytes_consumed = temp16 + 3; 852 *bytes_consumed = temp16 + 3;
859 output_struct->id = ACPI_RSTYPE_ADDRESS64; 853 output_struct->type = ACPI_RSTYPE_ADDRESS64;
860 854
861 /* Get the Resource Type (Byte3) */ 855 /* Get the Resource Type (Byte3) */
862 856
@@ -1005,7 +999,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
1005 * 999 *
1006 * FUNCTION: acpi_rs_address64_stream 1000 * FUNCTION: acpi_rs_address64_stream
1007 * 1001 *
1008 * PARAMETERS: linked_list - Pointer to the resource linked list 1002 * PARAMETERS: Resource - Pointer to the resource linked list
1009 * output_buffer - Pointer to the user's return buffer 1003 * output_buffer - Pointer to the user's return buffer
1010 * bytes_consumed - Pointer to where the number of bytes 1004 * bytes_consumed - Pointer to where the number of bytes
1011 * used in the output_buffer is returned 1005 * used in the output_buffer is returned
@@ -1018,7 +1012,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
1018 ******************************************************************************/ 1012 ******************************************************************************/
1019 1013
1020acpi_status 1014acpi_status
1021acpi_rs_address64_stream(struct acpi_resource *linked_list, 1015acpi_rs_address64_stream(struct acpi_resource *resource,
1022 u8 ** output_buffer, acpi_size * bytes_consumed) 1016 u8 ** output_buffer, acpi_size * bytes_consumed)
1023{ 1017{
1024 u8 *buffer; 1018 u8 *buffer;
@@ -1040,59 +1034,56 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list,
1040 1034
1041 /* Set the Resource Type (Memory, Io, bus_number) */ 1035 /* Set the Resource Type (Memory, Io, bus_number) */
1042 1036
1043 *buffer = (u8) (linked_list->data.address64.resource_type & 0x03); 1037 *buffer = (u8) (resource->data.address64.resource_type & 0x03);
1044 buffer += 1; 1038 buffer += 1;
1045 1039
1046 /* Set the general flags */ 1040 /* Set the general flags */
1047 1041
1048 *buffer = acpi_rs_encode_general_flags(&linked_list->data); 1042 *buffer = acpi_rs_encode_general_flags(&resource->data);
1049 buffer += 1; 1043 buffer += 1;
1050 1044
1051 /* Set the type specific flags */ 1045 /* Set the type specific flags */
1052 1046
1053 *buffer = acpi_rs_encode_specific_flags(&linked_list->data); 1047 *buffer = acpi_rs_encode_specific_flags(&resource->data);
1054 buffer += 1; 1048 buffer += 1;
1055 1049
1056 /* Set the address space granularity */ 1050 /* Set the address space granularity */
1057 1051
1058 ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); 1052 ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.granularity);
1059 buffer += 8; 1053 buffer += 8;
1060 1054
1061 /* Set the address range minimum */ 1055 /* Set the address range minimum */
1062 1056
1063 ACPI_MOVE_64_TO_64(buffer, 1057 ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.min_address_range);
1064 &linked_list->data.address64.min_address_range);
1065 buffer += 8; 1058 buffer += 8;
1066 1059
1067 /* Set the address range maximum */ 1060 /* Set the address range maximum */
1068 1061
1069 ACPI_MOVE_64_TO_64(buffer, 1062 ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.max_address_range);
1070 &linked_list->data.address64.max_address_range);
1071 buffer += 8; 1063 buffer += 8;
1072 1064
1073 /* Set the address translation offset */ 1065 /* Set the address translation offset */
1074 1066
1075 ACPI_MOVE_64_TO_64(buffer, 1067 ACPI_MOVE_64_TO_64(buffer,
1076 &linked_list->data.address64. 1068 &resource->data.address64.
1077 address_translation_offset); 1069 address_translation_offset);
1078 buffer += 8; 1070 buffer += 8;
1079 1071
1080 /* Set the address length */ 1072 /* Set the address length */
1081 1073
1082 ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length); 1074 ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.address_length);
1083 buffer += 8; 1075 buffer += 8;
1084 1076
1085 /* Resource Source Index and Resource Source are optional */ 1077 /* Resource Source Index and Resource Source are optional */
1086 1078
1087 if (linked_list->data.address64.resource_source.string_length) { 1079 if (resource->data.address64.resource_source.string_length) {
1088 *buffer = 1080 *buffer = (u8) resource->data.address64.resource_source.index;
1089 (u8) linked_list->data.address64.resource_source.index;
1090 buffer += 1; 1081 buffer += 1;
1091 1082
1092 /* Copy the resource_source string */ 1083 /* Copy the resource_source string */
1093 1084
1094 ACPI_STRCPY((char *)buffer, 1085 ACPI_STRCPY((char *)buffer,
1095 linked_list->data.address64.resource_source. 1086 resource->data.address64.resource_source.
1096 string_ptr); 1087 string_ptr);
1097 1088
1098 /* 1089 /*
@@ -1101,7 +1092,7 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list,
1101 */ 1092 */
1102 buffer += 1093 buffer +=
1103 (acpi_size) (ACPI_STRLEN 1094 (acpi_size) (ACPI_STRLEN
1104 (linked_list->data.address64.resource_source. 1095 (resource->data.address64.resource_source.
1105 string_ptr) + 1); 1096 string_ptr) + 1);
1106 } 1097 }
1107 1098