aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources
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
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')
-rw-r--r--drivers/acpi/resources/rsaddr.c99
-rw-r--r--drivers/acpi/resources/rscalc.c985
-rw-r--r--drivers/acpi/resources/rsdump.c1284
-rw-r--r--drivers/acpi/resources/rsio.c56
-rw-r--r--drivers/acpi/resources/rsirq.c57
-rw-r--r--drivers/acpi/resources/rslist.c533
-rw-r--r--drivers/acpi/resources/rsmemory.c68
-rw-r--r--drivers/acpi/resources/rsmisc.c234
-rw-r--r--drivers/acpi/resources/rsxface.c8
9 files changed, 1594 insertions, 1730 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
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 378f58390fc1..cd051c97bf5b 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -44,651 +44,620 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
46#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
47#include <acpi/amlresrc.h>
47#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
48 49
49#define _COMPONENT ACPI_RESOURCES 50#define _COMPONENT ACPI_RESOURCES
50ACPI_MODULE_NAME("rscalc") 51ACPI_MODULE_NAME("rscalc")
51 52
53/*
54 * Base sizes for external resource descriptors, indexed by internal type.
55 * Includes size of the descriptor header (1 byte for small descriptors,
56 * 3 bytes for large descriptors)
57 */
58static u8 acpi_gbl_stream_sizes[] = {
59 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */
60 3, /* ACPI_RSTYPE_DMA */
61 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */
62 1, /* ACPI_RSTYPE_END_DPF */
63 8, /* ACPI_RSTYPE_IO */
64 4, /* ACPI_RSTYPE_FIXED_IO */
65 1, /* ACPI_RSTYPE_VENDOR */
66 2, /* ACPI_RSTYPE_END_TAG */
67 12, /* ACPI_RSTYPE_MEM24 */
68 20, /* ACPI_RSTYPE_MEM32 */
69 12, /* ACPI_RSTYPE_FIXED_MEM32 */
70 16, /* ACPI_RSTYPE_ADDRESS16 */
71 26, /* ACPI_RSTYPE_ADDRESS32 */
72 46, /* ACPI_RSTYPE_ADDRESS64 */
73 9, /* ACPI_RSTYPE_EXT_IRQ */
74 15 /* ACPI_RSTYPE_GENERIC_REG */
75};
76
77/*
78 * Base sizes of resource descriptors, both the actual AML stream length and
79 * size of the internal struct representation.
80 */
81typedef struct acpi_resource_sizes {
82 u8 minimum_stream_size;
83 u8 minimum_struct_size;
84
85} ACPI_RESOURCE_SIZES;
86
87static ACPI_RESOURCE_SIZES acpi_gbl_sm_resource_sizes[] = {
88 0, 0, /* 0x00, Reserved */
89 0, 0, /* 0x01, Reserved */
90 0, 0, /* 0x02, Reserved */
91 0, 0, /* 0x03, Reserved */
92 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq), /* ACPI_RDESC_TYPE_IRQ_FORMAT */
93 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma), /* ACPI_RDESC_TYPE_DMA_FORMAT */
94 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf), /* ACPI_RDESC_TYPE_START_DEPENDENT */
95 1, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_DEPENDENT */
96 8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io), /* ACPI_RDESC_TYPE_IO_PORT */
97 4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io), /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
98 0, 0, /* 0x0A, Reserved */
99 0, 0, /* 0x0B, Reserved */
100 0, 0, /* 0x0C, Reserved */
101 0, 0, /* 0x0D, Reserved */
102 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_SMALL_VENDOR */
103 2, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_TAG */
104};
105
106static ACPI_RESOURCE_SIZES acpi_gbl_lg_resource_sizes[] = {
107 0, 0, /* 0x00, Reserved */
108 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24), /* ACPI_RDESC_TYPE_MEMORY_24 */
109 15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg), /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
110 0, 0, /* 0x03, Reserved */
111 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_LARGE_VENDOR */
112 20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32), /* ACPI_RDESC_TYPE_MEMORY_32 */
113 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32), /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
114 26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32), /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
115 16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16), /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
116 9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq), /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
117 46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
118 56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
119};
120
121/* Local prototypes */
122
123static u8 acpi_rs_count_set_bits(u16 bit_field);
124
125static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type);
126
127static u16 acpi_rs_get_resource_length(u8 * resource);
128
129static acpi_size
130acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
131
132static u32
133acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length);
134
52/******************************************************************************* 135/*******************************************************************************
53 * 136 *
54 * FUNCTION: acpi_rs_get_byte_stream_length 137 * FUNCTION: acpi_rs_count_set_bits
55 * 138 *
56 * PARAMETERS: linked_list - Pointer to the resource linked list 139 * PARAMETERS: bit_field - Field in which to count bits
57 * size_needed - u32 pointer of the size buffer needed
58 * to properly return the parsed data
59 * 140 *
60 * RETURN: Status 141 * RETURN: Number of bits set within the field
61 * 142 *
62 * DESCRIPTION: Takes the resource byte stream and parses it once, calculating 143 * DESCRIPTION: Count the number of bits set in a resource field. Used for
63 * the size buffer needed to hold the linked list that conveys 144 * (Short descriptor) interrupt and DMA lists.
64 * the resource data.
65 * 145 *
66 ******************************************************************************/ 146 ******************************************************************************/
67acpi_status
68acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list,
69 acpi_size * size_needed)
70{
71 acpi_size byte_stream_size_needed = 0;
72 acpi_size segment_size;
73 u8 done = FALSE;
74
75 ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
76 147
77 while (!done) { 148static u8 acpi_rs_count_set_bits(u16 bit_field)
78 /* Init the variable that will hold the size to add to the total. */ 149{
150 u8 bits_set;
79 151
80 segment_size = 0; 152 ACPI_FUNCTION_ENTRY();
81 153
82 switch (linked_list->id) { 154 for (bits_set = 0; bit_field; bits_set++) {
83 case ACPI_RSTYPE_IRQ: 155 /* Zero the least significant bit that is set */
84 /*
85 * IRQ Resource
86 * For an IRQ Resource, Byte 3, although optional, will always be
87 * created - it holds IRQ information.
88 */
89 segment_size = 4;
90 break;
91 156
92 case ACPI_RSTYPE_DMA: 157 bit_field &= (bit_field - 1);
93 /* 158 }
94 * DMA Resource
95 * For this resource the size is static
96 */
97 segment_size = 3;
98 break;
99
100 case ACPI_RSTYPE_START_DPF:
101 /*
102 * Start Dependent Functions Resource
103 * For a start_dependent_functions Resource, Byte 1, although
104 * optional, will always be created.
105 */
106 segment_size = 2;
107 break;
108 159
109 case ACPI_RSTYPE_END_DPF: 160 return (bits_set);
110 /* 161}
111 * End Dependent Functions Resource
112 * For this resource the size is static
113 */
114 segment_size = 1;
115 break;
116 162
117 case ACPI_RSTYPE_IO: 163/*******************************************************************************
118 /* 164 *
119 * IO Port Resource 165 * FUNCTION: acpi_rs_get_resource_sizes
120 * For this resource the size is static 166 *
121 */ 167 * PARAMETERS: resource_type - Byte 0 of a resource descriptor
122 segment_size = 8; 168 *
123 break; 169 * RETURN: Pointer to the resource conversion handler
170 *
171 * DESCRIPTION: Extract the Resource Type/Name from the first byte of
172 * a resource descriptor.
173 *
174 ******************************************************************************/
124 175
125 case ACPI_RSTYPE_FIXED_IO: 176static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type)
126 /* 177{
127 * Fixed IO Port Resource 178 ACPI_RESOURCE_SIZES *size_info;
128 * For this resource the size is static
129 */
130 segment_size = 4;
131 break;
132 179
133 case ACPI_RSTYPE_VENDOR: 180 ACPI_FUNCTION_ENTRY();
134 /*
135 * Vendor Defined Resource
136 * For a Vendor Specific resource, if the Length is between 1 and 7
137 * it will be created as a Small Resource data type, otherwise it
138 * is a Large Resource data type.
139 */
140 if (linked_list->data.vendor_specific.length > 7) {
141 segment_size = 3;
142 } else {
143 segment_size = 1;
144 }
145 segment_size +=
146 linked_list->data.vendor_specific.length;
147 break;
148 181
149 case ACPI_RSTYPE_END_TAG: 182 /* Determine if this is a small or large resource */
150 /*
151 * End Tag
152 * For this resource the size is static
153 */
154 segment_size = 2;
155 done = TRUE;
156 break;
157 183
158 case ACPI_RSTYPE_MEM24: 184 if (resource_type & ACPI_RDESC_TYPE_LARGE) {
159 /* 185 /* Large Resource Type -- bits 6:0 contain the name */
160 * 24-Bit Memory Resource
161 * For this resource the size is static
162 */
163 segment_size = 12;
164 break;
165 186
166 case ACPI_RSTYPE_MEM32: 187 if (resource_type > ACPI_RDESC_LARGE_MAX) {
167 /* 188 return (NULL);
168 * 32-Bit Memory Range Resource 189 }
169 * For this resource the size is static
170 */
171 segment_size = 20;
172 break;
173 190
174 case ACPI_RSTYPE_FIXED_MEM32: 191 size_info = &acpi_gbl_lg_resource_sizes[(resource_type &
175 /* 192 ACPI_RDESC_LARGE_MASK)];
176 * 32-Bit Fixed Memory Resource 193 } else {
177 * For this resource the size is static 194 /* Small Resource Type -- bits 6:3 contain the name */
178 */
179 segment_size = 12;
180 break;
181 195
182 case ACPI_RSTYPE_ADDRESS16: 196 size_info = &acpi_gbl_sm_resource_sizes[((resource_type &
183 /* 197 ACPI_RDESC_SMALL_MASK)
184 * 16-Bit Address Resource 198 >> 3)];
185 * The base size of this byte stream is 16. If a Resource Source 199 }
186 * string is not NULL, add 1 for the Index + the length of the null
187 * terminated string Resource Source + 1 for the null.
188 */
189 segment_size = 16;
190
191 if (linked_list->data.address16.resource_source.
192 string_ptr) {
193 segment_size +=
194 linked_list->data.address16.resource_source.
195 string_length;
196 segment_size++;
197 }
198 break;
199 200
200 case ACPI_RSTYPE_ADDRESS32: 201 /* Zero entry indicates an invalid resource type */
201 /*
202 * 32-Bit Address Resource
203 * The base size of this byte stream is 26. If a Resource
204 * Source string is not NULL, add 1 for the Index + the
205 * length of the null terminated string Resource Source +
206 * 1 for the null.
207 */
208 segment_size = 26;
209
210 if (linked_list->data.address32.resource_source.
211 string_ptr) {
212 segment_size +=
213 linked_list->data.address32.resource_source.
214 string_length;
215 segment_size++;
216 }
217 break;
218 202
219 case ACPI_RSTYPE_ADDRESS64: 203 if (!size_info->minimum_stream_size) {
220 /* 204 return (NULL);
221 * 64-Bit Address Resource 205 }
222 * The base size of this byte stream is 46. If a resource_source
223 * string is not NULL, add 1 for the Index + the length of the null
224 * terminated string Resource Source + 1 for the null.
225 */
226 segment_size = 46;
227
228 if (linked_list->data.address64.resource_source.
229 string_ptr) {
230 segment_size +=
231 linked_list->data.address64.resource_source.
232 string_length;
233 segment_size++;
234 }
235 break;
236 206
237 case ACPI_RSTYPE_EXT_IRQ: 207 return (size_info);
238 /* 208}
239 * Extended IRQ Resource
240 * The base size of this byte stream is 9. This is for an Interrupt
241 * table length of 1. For each additional interrupt, add 4.
242 * If a Resource Source string is not NULL, add 1 for the
243 * Index + the length of the null terminated string
244 * Resource Source + 1 for the null.
245 */
246 segment_size = 9 + (((acpi_size)
247 linked_list->data.extended_irq.
248 number_of_interrupts - 1) * 4);
249
250 if (linked_list->data.extended_irq.resource_source.
251 string_ptr) {
252 segment_size +=
253 linked_list->data.extended_irq.
254 resource_source.string_length;
255 segment_size++;
256 }
257 break;
258 209
259 default: 210/*******************************************************************************
211 *
212 * FUNCTION: acpi_rs_get_resource_length
213 *
214 * PARAMETERS: Resource - Pointer to the resource descriptor
215 *
216 * RETURN: Byte length of the (AML byte stream) descriptor. By definition,
217 * this does not include the size of the descriptor header and the
218 * length field itself.
219 *
220 * DESCRIPTION: Extract the length of a resource descriptor.
221 *
222 ******************************************************************************/
260 223
261 /* If we get here, everything is out of sync, exit with error */ 224static u16 acpi_rs_get_resource_length(u8 * resource)
225{
226 u16 resource_length;
262 227
263 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 228 ACPI_FUNCTION_ENTRY();
264 229
265 } /* switch (linked_list->Id) */ 230 /* Determine if this is a small or large resource */
266 231
267 /* Update the total */ 232 if (*resource & ACPI_RDESC_TYPE_LARGE) {
233 /* Large Resource type -- length is in bytes 1-2 */
268 234
269 byte_stream_size_needed += segment_size; 235 ACPI_MOVE_16_TO_16(&resource_length, (resource + 1));
270 236
271 /* Point to the next object */ 237 } else {
238 /* Small Resource Type -- bits 2:0 of byte 0 contain the length */
272 239
273 linked_list = ACPI_PTR_ADD(struct acpi_resource, 240 resource_length =
274 linked_list, linked_list->length); 241 (u16) (*resource & ACPI_RDESC_SMALL_LENGTH_MASK);
275 } 242 }
276 243
277 /* This is the data the caller needs */ 244 return (resource_length);
278
279 *size_needed = byte_stream_size_needed;
280 return_ACPI_STATUS(AE_OK);
281} 245}
282 246
283/******************************************************************************* 247/*******************************************************************************
284 * 248 *
285 * FUNCTION: acpi_rs_get_list_length 249 * FUNCTION: acpi_rs_struct_option_length
286 * 250 *
287 * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream 251 * PARAMETERS: resource_source - Pointer to optional descriptor field
288 * byte_stream_buffer_length - Size of byte_stream_buffer
289 * size_needed - u32 pointer of the size buffer
290 * needed to properly return the
291 * parsed data
292 * 252 *
293 * RETURN: Status 253 * RETURN: Status
294 * 254 *
295 * DESCRIPTION: Takes the resource byte stream and parses it once, calculating 255 * DESCRIPTION: Common code to handle optional resource_source_index and
296 * the size buffer needed to hold the linked list that conveys 256 * resource_source fields in some Large descriptors. Used during
297 * the resource data. 257 * list-to-stream conversion
298 * 258 *
299 ******************************************************************************/ 259 ******************************************************************************/
300 260
301acpi_status 261static acpi_size
302acpi_rs_get_list_length(u8 * byte_stream_buffer, 262acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
303 u32 byte_stream_buffer_length, acpi_size * size_needed)
304{ 263{
305 u32 buffer_size = 0; 264 ACPI_FUNCTION_ENTRY();
306 u32 bytes_parsed = 0;
307 u8 number_of_interrupts = 0;
308 u8 number_of_channels = 0;
309 u8 resource_type;
310 u32 structure_size;
311 u32 bytes_consumed;
312 u8 *buffer;
313 u8 temp8;
314 u16 temp16;
315 u8 index;
316 u8 additional_bytes;
317
318 ACPI_FUNCTION_TRACE("rs_get_list_length");
319
320 while (bytes_parsed < byte_stream_buffer_length) {
321 /* The next byte in the stream is the resource type */
322
323 resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
324 265
325 switch (resource_type) { 266 /*
326 case ACPI_RDESC_TYPE_MEMORY_24: 267 * If the resource_source string is valid, return the size of the string
327 /* 268 * (string_length includes the NULL terminator) plus the size of the
328 * 24-Bit Memory Resource 269 * resource_source_index (1).
329 */ 270 */
330 bytes_consumed = 12; 271 if (resource_source->string_ptr) {
331 272 return ((acpi_size) resource_source->string_length + 1);
332 structure_size = 273 }
333 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
334 break;
335 274
336 case ACPI_RDESC_TYPE_LARGE_VENDOR: 275 return (0);
337 /* 276}
338 * Vendor Defined Resource
339 */
340 buffer = byte_stream_buffer;
341 ++buffer;
342 277
343 ACPI_MOVE_16_TO_16(&temp16, buffer); 278/*******************************************************************************
344 bytes_consumed = temp16 + 3; 279 *
280 * FUNCTION: acpi_rs_stream_option_length
281 *
282 * PARAMETERS: resource_length - Length from the resource header
283 * minimum_total_length - Minimum length of this resource, before
284 * any optional fields. Includes header size
285 *
286 * RETURN: Length of optional string (0 if no string present)
287 *
288 * DESCRIPTION: Common code to handle optional resource_source_index and
289 * resource_source fields in some Large descriptors. Used during
290 * stream-to-list conversion
291 *
292 ******************************************************************************/
345 293
346 /* Ensure a 32-bit boundary for the structure */ 294static u32
295acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
296{
297 u32 string_length = 0;
298 u32 minimum_resource_length;
347 299
348 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16); 300 ACPI_FUNCTION_ENTRY();
349 301
350 structure_size = 302 /*
351 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + 303 * The resource_source_index and resource_source are optional elements of some
352 (temp16 * sizeof(u8)); 304 * Large-type resource descriptors.
353 break; 305 */
354 306
355 case ACPI_RDESC_TYPE_MEMORY_32: 307 /* Compute minimum size of the data part of the resource descriptor */
356 /*
357 * 32-Bit Memory Range Resource
358 */
359 bytes_consumed = 20;
360 308
361 structure_size = 309 minimum_resource_length =
362 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); 310 minimum_total_length - sizeof(struct asl_large_header);
363 break;
364 311
365 case ACPI_RDESC_TYPE_FIXED_MEMORY_32: 312 /*
366 /* 313 * If the length of the actual resource descriptor is greater than the ACPI
367 * 32-Bit Fixed Memory Resource 314 * spec-defined minimum length, it means that a resource_source_index exists
368 */ 315 * and is followed by a (required) null terminated string. The string length
369 bytes_consumed = 12; 316 * (including the null terminator) is the resource length minus the minimum
317 * length, minus one byte for the resource_source_index itself.
318 */
319 if (resource_length > minimum_resource_length) {
320 /* Compute the length of the optional string */
370 321
371 structure_size = 322 string_length = resource_length - minimum_resource_length - 1;
372 ACPI_SIZEOF_RESOURCE(struct 323 }
373 acpi_resource_fixed_mem32);
374 break;
375 324
376 case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: 325 /* Round up length to 32 bits for internal structure alignment */
377 /*
378 * 64-Bit Address Resource
379 */
380 buffer = byte_stream_buffer;
381 326
382 ++buffer; 327 return (ACPI_ROUND_UP_to_32_bITS(string_length));
383 ACPI_MOVE_16_TO_16(&temp16, buffer); 328}
384 329
385 bytes_consumed = temp16 + 3; 330/*******************************************************************************
386 structure_size = 331 *
387 ACPI_SIZEOF_RESOURCE(struct 332 * FUNCTION: acpi_rs_get_byte_stream_length
388 acpi_resource_address64); 333 *
389 break; 334 * PARAMETERS: Resource - Pointer to the resource linked list
335 * size_needed - Where the required size is returned
336 *
337 * RETURN: Status
338 *
339 * DESCRIPTION: Takes a linked list of internal resource descriptors and
340 * calculates the size buffer needed to hold the corresponding
341 * external resource byte stream.
342 *
343 ******************************************************************************/
390 344
391 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: 345acpi_status
392 /* 346acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
393 * 64-Bit Address Resource 347 acpi_size * size_needed)
394 */ 348{
395 buffer = byte_stream_buffer; 349 acpi_size byte_stream_size_needed = 0;
350 acpi_size segment_size;
396 351
397 ++buffer; 352 ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
398 ACPI_MOVE_16_TO_16(&temp16, buffer);
399 353
400 bytes_consumed = temp16 + 3; 354 /* Traverse entire list of internal resource descriptors */
401 355
402 /* 356 while (resource) {
403 * Resource Source Index and Resource Source are optional elements. 357 /* Validate the descriptor type */
404 * Check the length of the Bytestream. If it is greater than 43,
405 * that means that an Index exists and is followed by a null
406 * terminated string. Therefore, set the temp variable to the
407 * length minus the minimum byte stream length plus the byte for
408 * the Index to determine the size of the NULL terminated string.
409 */
410 if (43 < temp16) {
411 temp8 = (u8) (temp16 - 44);
412 } else {
413 temp8 = 0;
414 }
415 358
416 /* Ensure a 64-bit boundary for the structure */ 359 if (resource->type > ACPI_RSTYPE_MAX) {
360 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
361 }
417 362
418 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8); 363 /* Get the base size of the (external stream) resource descriptor */
419 364
420 structure_size = 365 segment_size = acpi_gbl_stream_sizes[resource->type];
421 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)
422 + (temp8 * sizeof(u8));
423 break;
424 366
425 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: 367 /*
368 * Augment the base size for descriptors with optional and/or
369 * variable-length fields
370 */
371 switch (resource->type) {
372 case ACPI_RSTYPE_VENDOR:
426 /* 373 /*
427 * 32-Bit Address Resource 374 * Vendor Defined Resource:
375 * For a Vendor Specific resource, if the Length is between 1 and 7
376 * it will be created as a Small Resource data type, otherwise it
377 * is a Large Resource data type.
428 */ 378 */
429 buffer = byte_stream_buffer; 379 if (resource->data.vendor_specific.length > 7) {
430 380 /* Base size of a Large resource descriptor */
431 ++buffer;
432 ACPI_MOVE_16_TO_16(&temp16, buffer);
433 381
434 bytes_consumed = temp16 + 3; 382 segment_size = 3;
435
436 /*
437 * Resource Source Index and Resource Source are optional elements.
438 * Check the length of the Bytestream. If it is greater than 23,
439 * that means that an Index exists and is followed by a null
440 * terminated string. Therefore, set the temp variable to the
441 * length minus the minimum byte stream length plus the byte for
442 * the Index to determine the size of the NULL terminated string.
443 */
444 if (23 < temp16) {
445 temp8 = (u8) (temp16 - 24);
446 } else {
447 temp8 = 0;
448 } 383 }
449 384
450 /* Ensure a 32-bit boundary for the structure */ 385 /* Add the size of the vendor-specific data */
451 386
452 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); 387 segment_size += resource->data.vendor_specific.length;
453
454 structure_size =
455 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)
456 + (temp8 * sizeof(u8));
457 break; 388 break;
458 389
459 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: 390 case ACPI_RSTYPE_END_TAG:
460 /* 391 /*
461 * 16-Bit Address Resource 392 * End Tag:
393 * We are done -- return the accumulated total size.
462 */ 394 */
463 buffer = byte_stream_buffer; 395 *size_needed = byte_stream_size_needed + segment_size;
464 396
465 ++buffer; 397 /* Normal exit */
466 ACPI_MOVE_16_TO_16(&temp16, buffer);
467 398
468 bytes_consumed = temp16 + 3; 399 return_ACPI_STATUS(AE_OK);
469 400
401 case ACPI_RSTYPE_ADDRESS16:
470 /* 402 /*
471 * Resource Source Index and Resource Source are optional elements. 403 * 16-Bit Address Resource:
472 * Check the length of the Bytestream. If it is greater than 13, 404 * Add the size of the optional resource_source info
473 * that means that an Index exists and is followed by a null
474 * terminated string. Therefore, set the temp variable to the
475 * length minus the minimum byte stream length plus the byte for
476 * the Index to determine the size of the NULL terminated string.
477 */ 405 */
478 if (13 < temp16) { 406 segment_size +=
479 temp8 = (u8) (temp16 - 14); 407 acpi_rs_struct_option_length(&resource->data.
480 } else { 408 address16.
481 temp8 = 0; 409 resource_source);
482 }
483
484 /* Ensure a 32-bit boundary for the structure */
485
486 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
487
488 structure_size =
489 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)
490 + (temp8 * sizeof(u8));
491 break; 410 break;
492 411
493 case ACPI_RDESC_TYPE_EXTENDED_XRUPT: 412 case ACPI_RSTYPE_ADDRESS32:
494 /*
495 * Extended IRQ
496 */
497 buffer = byte_stream_buffer;
498
499 ++buffer;
500 ACPI_MOVE_16_TO_16(&temp16, buffer);
501
502 bytes_consumed = temp16 + 3;
503
504 /* 413 /*
505 * Point past the length field and the Interrupt vector flags to 414 * 32-Bit Address Resource:
506 * save off the Interrupt table length to the Temp8 variable. 415 * Add the size of the optional resource_source info
507 */ 416 */
508 buffer += 3; 417 segment_size +=
509 temp8 = *buffer; 418 acpi_rs_struct_option_length(&resource->data.
419 address32.
420 resource_source);
421 break;
510 422
423 case ACPI_RSTYPE_ADDRESS64:
511 /* 424 /*
512 * To compensate for multiple interrupt numbers, add 4 bytes for 425 * 64-Bit Address Resource:
513 * each additional interrupts greater than 1 426 * Add the size of the optional resource_source info
514 */ 427 */
515 additional_bytes = (u8) ((temp8 - 1) * 4); 428 segment_size +=
429 acpi_rs_struct_option_length(&resource->data.
430 address64.
431 resource_source);
432 break;
516 433
434 case ACPI_RSTYPE_EXT_IRQ:
517 /* 435 /*
518 * Resource Source Index and Resource Source are optional elements. 436 * Extended IRQ Resource:
519 * Check the length of the Bytestream. If it is greater than 9, 437 * Add the size of each additional optional interrupt beyond the
520 * that means that an Index exists and is followed by a null 438 * required 1 (4 bytes for each u32 interrupt number)
521 * terminated string. Therefore, set the temp variable to the
522 * length minus the minimum byte stream length plus the byte for
523 * the Index to determine the size of the NULL terminated string.
524 */ 439 */
525 if (9 + additional_bytes < temp16) { 440 segment_size += (((acpi_size)
526 temp8 = (u8) (temp16 - (9 + additional_bytes)); 441 resource->data.extended_irq.
527 } else { 442 number_of_interrupts - 1) * 4);
528 temp8 = 0;
529 }
530 443
531 /* Ensure a 32-bit boundary for the structure */ 444 /* Add the size of the optional resource_source info */
532 445
533 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); 446 segment_size +=
447 acpi_rs_struct_option_length(&resource->data.
448 extended_irq.
449 resource_source);
450 break;
534 451
535 structure_size = 452 default:
536 ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) +
537 (additional_bytes * sizeof(u8)) +
538 (temp8 * sizeof(u8));
539 break; 453 break;
454 }
540 455
541 case ACPI_RDESC_TYPE_IRQ_FORMAT: 456 /* Update the total */
542 /*
543 * IRQ Resource.
544 * Determine if it there are two or three trailing bytes
545 */
546 buffer = byte_stream_buffer;
547 temp8 = *buffer;
548 457
549 if (temp8 & 0x01) { 458 byte_stream_size_needed += segment_size;
550 bytes_consumed = 4;
551 } else {
552 bytes_consumed = 3;
553 }
554 459
555 /* Point past the descriptor */ 460 /* Point to the next object */
556 461
557 ++buffer; 462 resource = ACPI_PTR_ADD(struct acpi_resource,
463 resource, resource->length);
464 }
558 465
559 /* Look at the number of bits set */ 466 /* Did not find an END_TAG descriptor */
560 467
561 ACPI_MOVE_16_TO_16(&temp16, buffer); 468 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
469}
562 470
563 for (index = 0; index < 16; index++) { 471/*******************************************************************************
564 if (temp16 & 0x1) { 472 *
565 ++number_of_interrupts; 473 * FUNCTION: acpi_rs_get_list_length
566 } 474 *
475 * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream
476 * byte_stream_buffer_length - Size of byte_stream_buffer
477 * size_needed - Where the size needed is returned
478 *
479 * RETURN: Status
480 *
481 * DESCRIPTION: Takes an external resource byte stream and calculates the size
482 * buffer needed to hold the corresponding internal resource
483 * descriptor linked list.
484 *
485 ******************************************************************************/
567 486
568 temp16 >>= 1; 487acpi_status
569 } 488acpi_rs_get_list_length(u8 * byte_stream_buffer,
489 u32 byte_stream_buffer_length, acpi_size * size_needed)
490{
491 u8 *buffer;
492 ACPI_RESOURCE_SIZES *resource_info;
493 u32 buffer_size = 0;
494 u32 bytes_parsed = 0;
495 u8 resource_type;
496 u16 temp16;
497 u16 resource_length;
498 u16 header_length;
499 u32 extra_struct_bytes;
570 500
571 structure_size = 501 ACPI_FUNCTION_TRACE("rs_get_list_length");
572 ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) +
573 (number_of_interrupts * sizeof(u32));
574 break;
575 502
576 case ACPI_RDESC_TYPE_DMA_FORMAT: 503 while (bytes_parsed < byte_stream_buffer_length) {
577 /* 504 /* The next byte in the stream is the resource descriptor type */
578 * DMA Resource
579 */
580 buffer = byte_stream_buffer;
581 bytes_consumed = 3;
582 505
583 /* Point past the descriptor */ 506 resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
584 507
585 ++buffer; 508 /* Get the base stream size and structure sizes for the descriptor */
586 509
587 /* Look at the number of bits set */ 510 resource_info = acpi_rs_get_resource_sizes(resource_type);
511 if (!resource_info) {
512 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
513 }
588 514
589 temp8 = *buffer; 515 /* Get the Length field from the input resource descriptor */
590 516
591 for (index = 0; index < 8; index++) { 517 resource_length =
592 if (temp8 & 0x1) { 518 acpi_rs_get_resource_length(byte_stream_buffer);
593 ++number_of_channels;
594 }
595 519
596 temp8 >>= 1; 520 /* Augment the size for descriptors with optional fields */
597 }
598 521
599 structure_size = 522 extra_struct_bytes = 0;
600 ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) +
601 (number_of_channels * sizeof(u32));
602 break;
603 523
604 case ACPI_RDESC_TYPE_START_DEPENDENT: 524 if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) {
605 /* 525 /*
606 * Start Dependent Functions Resource 526 * Small resource descriptors
607 * Determine if it there are two or three trailing bytes
608 */ 527 */
609 buffer = byte_stream_buffer; 528 header_length = 1;
610 temp8 = *buffer; 529 buffer = byte_stream_buffer + header_length;
611 530
612 if (temp8 & 0x01) { 531 switch (resource_type) {
613 bytes_consumed = 2; 532 case ACPI_RDESC_TYPE_IRQ_FORMAT:
614 } else { 533 /*
615 bytes_consumed = 1; 534 * IRQ Resource:
616 } 535 * Get the number of bits set in the IRQ word
536 */
537 ACPI_MOVE_16_TO_16(&temp16, buffer);
617 538
618 structure_size = 539 extra_struct_bytes =
619 ACPI_SIZEOF_RESOURCE(struct 540 (acpi_rs_count_set_bits(temp16) *
620 acpi_resource_start_dpf); 541 sizeof(u32));
621 break; 542 break;
622 543
623 case ACPI_RDESC_TYPE_END_DEPENDENT: 544 case ACPI_RDESC_TYPE_DMA_FORMAT:
624 /* 545 /*
625 * End Dependent Functions Resource 546 * DMA Resource:
626 */ 547 * Get the number of bits set in the DMA channels byte
627 bytes_consumed = 1; 548 */
628 structure_size = ACPI_RESOURCE_LENGTH; 549 extra_struct_bytes =
629 break; 550 (acpi_rs_count_set_bits((u16) * buffer) *
551 sizeof(u32));
552 break;
630 553
631 case ACPI_RDESC_TYPE_IO_PORT: 554 case ACPI_RDESC_TYPE_SMALL_VENDOR:
632 /* 555 /*
633 * IO Port Resource 556 * Vendor Specific Resource:
634 */ 557 * Ensure a 32-bit boundary for the structure
635 bytes_consumed = 8; 558 */
636 structure_size = 559 extra_struct_bytes =
637 ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); 560 ACPI_ROUND_UP_to_32_bITS(resource_length);
638 break; 561 break;
639 562
640 case ACPI_RDESC_TYPE_FIXED_IO_PORT: 563 case ACPI_RDESC_TYPE_END_TAG:
641 /* 564 /*
642 * Fixed IO Port Resource 565 * End Tag:
643 */ 566 * Terminate the loop now
644 bytes_consumed = 4; 567 */
645 structure_size = 568 byte_stream_buffer_length = bytes_parsed;
646 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); 569 break;
647 break;
648 570
649 case ACPI_RDESC_TYPE_SMALL_VENDOR: 571 default:
572 break;
573 }
574 } else {
650 /* 575 /*
651 * Vendor Specific Resource 576 * Large resource descriptors
652 */ 577 */
653 buffer = byte_stream_buffer; 578 header_length = sizeof(struct asl_large_header);
579 buffer = byte_stream_buffer + header_length;
654 580
655 temp8 = *buffer; 581 switch (resource_type) {
656 temp8 = (u8) (temp8 & 0x7); 582 case ACPI_RDESC_TYPE_LARGE_VENDOR:
657 bytes_consumed = temp8 + 1; 583 /*
584 * Vendor Defined Resource:
585 * Add vendor data and ensure a 32-bit boundary for the structure
586 */
587 extra_struct_bytes =
588 ACPI_ROUND_UP_to_32_bITS(resource_length);
589 break;
658 590
659 /* Ensure a 32-bit boundary for the structure */ 591 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
592 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
593 /*
594 * 32-Bit or 16-bit Address Resource:
595 * Add the size of any optional data (resource_source)
596 */
597 extra_struct_bytes =
598 acpi_rs_stream_option_length
599 (resource_length,
600 resource_info->minimum_stream_size);
601 break;
660 602
661 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); 603 case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
662 structure_size = 604 /*
663 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + 605 * Extended IRQ:
664 (temp8 * sizeof(u8)); 606 * Point past the interrupt_vector_flags to get the
665 break; 607 * interrupt_table_length.
608 */
609 buffer++;
666 610
667 case ACPI_RDESC_TYPE_END_TAG: 611 /*
668 /* 612 * Add 4 bytes for each additional interrupt. Note: at least one
669 * End Tag 613 * interrupt is required and is included in the minimum
670 */ 614 * descriptor size
671 bytes_consumed = 2; 615 */
672 structure_size = ACPI_RESOURCE_LENGTH; 616 extra_struct_bytes =
673 byte_stream_buffer_length = bytes_parsed; 617 ((*buffer - 1) * sizeof(u32));
674 break;
675 618
676 default: 619 /* Add the size of any optional data (resource_source) */
677 /*
678 * If we get here, everything is out of sync,
679 * exit with an error
680 */
681 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
682 }
683 620
684 /* Update the return value and counter */ 621 extra_struct_bytes +=
622 acpi_rs_stream_option_length(resource_length
623 -
624 extra_struct_bytes,
625 resource_info->
626 minimum_stream_size);
627 break;
685 628
686 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size); 629 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
687 bytes_parsed += bytes_consumed; 630 /*
631 * 64-Bit Address Resource:
632 * Add the size of any optional data (resource_source)
633 * Ensure a 64-bit boundary for the structure
634 */
635 extra_struct_bytes =
636 ACPI_ROUND_UP_to_64_bITS
637 (acpi_rs_stream_option_length
638 (resource_length,
639 resource_info->minimum_stream_size));
640 break;
641
642 default:
643 break;
644 }
645 }
646
647 /* Update the required buffer size for the internal descriptor structs */
688 648
689 /* Set the byte stream to point to the next resource */ 649 temp16 =
650 (u16) (resource_info->minimum_struct_size +
651 extra_struct_bytes);
652 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16);
690 653
691 byte_stream_buffer += bytes_consumed; 654 /*
655 * Update byte count and point to the next resource within the stream
656 * using the size of the header plus the length contained in the header
657 */
658 temp16 = (u16) (header_length + resource_length);
659 bytes_parsed += temp16;
660 byte_stream_buffer += temp16;
692 } 661 }
693 662
694 /* This is the data the caller needs */ 663 /* This is the data the caller needs */
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index 75bd34d1783f..9d93ee5f0060 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -49,1021 +49,967 @@ ACPI_MODULE_NAME("rsdump")
49 49
50#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 50#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
51/* Local prototypes */ 51/* Local prototypes */
52static void acpi_rs_dump_irq(union acpi_resource_data *data); 52static void acpi_rs_dump_irq(union acpi_resource_data *resource);
53 53
54static void acpi_rs_dump_address16(union acpi_resource_data *data); 54static void acpi_rs_dump_address16(union acpi_resource_data *resource);
55 55
56static void acpi_rs_dump_address32(union acpi_resource_data *data); 56static void acpi_rs_dump_address32(union acpi_resource_data *resource);
57 57
58static void acpi_rs_dump_address64(union acpi_resource_data *data); 58static void acpi_rs_dump_address64(union acpi_resource_data *resource);
59 59
60static void acpi_rs_dump_dma(union acpi_resource_data *data); 60static void acpi_rs_dump_dma(union acpi_resource_data *resource);
61 61
62static void acpi_rs_dump_io(union acpi_resource_data *data); 62static void acpi_rs_dump_io(union acpi_resource_data *resource);
63 63
64static void acpi_rs_dump_extended_irq(union acpi_resource_data *data); 64static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource);
65 65
66static void acpi_rs_dump_fixed_io(union acpi_resource_data *data); 66static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
67 67
68static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data); 68static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
69 69
70static void acpi_rs_dump_memory24(union acpi_resource_data *data); 70static void acpi_rs_dump_memory24(union acpi_resource_data *resource);
71 71
72static void acpi_rs_dump_memory32(union acpi_resource_data *data); 72static void acpi_rs_dump_memory32(union acpi_resource_data *resource);
73 73
74static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data); 74static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource);
75 75
76static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data); 76static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource);
77
78static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
79
80static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource);
81
82static void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
83
84static void acpi_rs_out_string(char *title, char *value);
85
86static void acpi_rs_out_integer8(char *title, u8 value);
87
88static void acpi_rs_out_integer16(char *title, u16 value);
89
90static void acpi_rs_out_integer32(char *title, u32 value);
91
92static void acpi_rs_out_integer64(char *title, u64 value);
93
94static void acpi_rs_out_title(char *title);
95
96static void acpi_rs_dump_byte_list(u32 length, u8 * data);
97
98static void acpi_rs_dump_dword_list(u32 length, u32 * data);
99
100static void acpi_rs_dump_short_byte_list(u32 length, u32 * data);
101
102static void
103acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
104
105static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
106
107/* Dispatch table for resource dump functions */
108
109typedef
110void (*ACPI_DUMP_RESOURCE) (union acpi_resource_data * data);
111
112static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = {
113 acpi_rs_dump_irq, /* ACPI_RSTYPE_IRQ */
114 acpi_rs_dump_dma, /* ACPI_RSTYPE_DMA */
115 acpi_rs_dump_start_depend_fns, /* ACPI_RSTYPE_START_DPF */
116 acpi_rs_dump_end_depend_fns, /* ACPI_RSTYPE_END_DPF */
117 acpi_rs_dump_io, /* ACPI_RSTYPE_IO */
118 acpi_rs_dump_fixed_io, /* ACPI_RSTYPE_FIXED_IO */
119 acpi_rs_dump_vendor_specific, /* ACPI_RSTYPE_VENDOR */
120 acpi_rs_dump_end_tag, /* ACPI_RSTYPE_END_TAG */
121 acpi_rs_dump_memory24, /* ACPI_RSTYPE_MEM24 */
122 acpi_rs_dump_memory32, /* ACPI_RSTYPE_MEM32 */
123 acpi_rs_dump_fixed_memory32, /* ACPI_RSTYPE_FIXED_MEM32 */
124 acpi_rs_dump_address16, /* ACPI_RSTYPE_ADDRESS16 */
125 acpi_rs_dump_address32, /* ACPI_RSTYPE_ADDRESS32 */
126 acpi_rs_dump_address64, /* ACPI_RSTYPE_ADDRESS64 */
127 acpi_rs_dump_extended_irq, /* ACPI_RSTYPE_EXT_IRQ */
128 acpi_rs_dump_generic_reg /* ACPI_RSTYPE_GENERIC_REG */
129};
77 130
78/******************************************************************************* 131/*******************************************************************************
79 * 132 *
80 * FUNCTION: acpi_rs_dump_irq 133 * FUNCTION: acpi_rs_out*
134 *
135 * PARAMETERS: Title - Name of the resource field
136 * Value - Value of the resource field
137 *
138 * RETURN: None
139 *
140 * DESCRIPTION: Miscellaneous helper functions to consistently format the
141 * output of the resource dump routines
142 *
143 ******************************************************************************/
144
145static void acpi_rs_out_string(char *title, char *value)
146{
147 acpi_os_printf("%30s : %s\n", title, value);
148}
149
150static void acpi_rs_out_integer8(char *title, u8 value)
151{
152 acpi_os_printf("%30s : %2.2X\n", title, value);
153}
154
155static void acpi_rs_out_integer16(char *title, u16 value)
156{
157 acpi_os_printf("%30s : %4.4X\n", title, value);
158}
159
160static void acpi_rs_out_integer32(char *title, u32 value)
161{
162 acpi_os_printf("%30s : %8.8X\n", title, value);
163}
164
165static void acpi_rs_out_integer64(char *title, u64 value)
166{
167 acpi_os_printf("%30s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
168}
169
170static void acpi_rs_out_title(char *title)
171{
172 acpi_os_printf("%30s : ", title);
173}
174
175/*******************************************************************************
176 *
177 * FUNCTION: acpi_rs_dump*List
178 *
179 * PARAMETERS: Length - Number of elements in the list
180 * Data - Start of the list
181 *
182 * RETURN: None
183 *
184 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
185 *
186 ******************************************************************************/
187
188static void acpi_rs_dump_byte_list(u32 length, u8 * data)
189{
190 u32 i;
191
192 for (i = 0; i < length; i++) {
193 acpi_os_printf("%28s%2.2X : %2.2X\n", "Byte", i, data[i]);
194 }
195}
196
197static void acpi_rs_dump_dword_list(u32 length, u32 * data)
198{
199 u32 i;
200
201 for (i = 0; i < length; i++) {
202 acpi_os_printf("%28s%2.2X : %8.8X\n", "Dword", i, data[i]);
203 }
204}
205
206static void acpi_rs_dump_short_byte_list(u32 length, u32 * data)
207{
208 u32 i;
209
210 for (i = 0; i < length; i++) {
211 acpi_os_printf("%X ", data[i]);
212 }
213 acpi_os_printf("\n");
214}
215
216/*******************************************************************************
217 *
218 * FUNCTION: acpi_rs_dump_resource_source
81 * 219 *
82 * PARAMETERS: Data - pointer to the resource structure to dump. 220 * PARAMETERS: resource_source - Pointer to a Resource Source struct
83 * 221 *
84 * RETURN: None 222 * RETURN: None
85 * 223 *
86 * DESCRIPTION: Prints out the various members of the Data structure type. 224 * DESCRIPTION: Common routine for dumping the optional resource_source and the
225 * corresponding resource_source_index.
87 * 226 *
88 ******************************************************************************/ 227 ******************************************************************************/
89 228
90static void acpi_rs_dump_irq(union acpi_resource_data *data) 229static void
230acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
91{ 231{
92 struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data;
93 u8 index = 0;
94 232
233 if (resource_source->index == 0xFF) {
234 return;
235 }
236
237 acpi_rs_out_integer8("Resource Source Index",
238 (u8) resource_source->index);
239
240 acpi_rs_out_string("Resource Source",
241 resource_source->string_ptr ?
242 resource_source->string_ptr : "[Not Specified]");
243}
244
245/*******************************************************************************
246 *
247 * FUNCTION: acpi_rs_dump_address_common
248 *
249 * PARAMETERS: Resource - Pointer to an internal resource descriptor
250 *
251 * RETURN: None
252 *
253 * DESCRIPTION: Dump the fields that are common to all Address resource
254 * descriptors
255 *
256 ******************************************************************************/
257
258static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
259{
95 ACPI_FUNCTION_ENTRY(); 260 ACPI_FUNCTION_ENTRY();
96 261
97 acpi_os_printf("IRQ Resource\n"); 262 /* Decode the type-specific flags */
263
264 switch (resource->address.resource_type) {
265 case ACPI_MEMORY_RANGE:
98 266
99 acpi_os_printf(" %s Triggered\n", 267 acpi_rs_out_string("Resource Type", "Memory Range");
100 ACPI_LEVEL_SENSITIVE == 268
101 irq_data->edge_level ? "Level" : "Edge"); 269 acpi_rs_out_title("Type-Specific Flags");
270
271 switch (resource->address.attribute.memory.cache_attribute) {
272 case ACPI_NON_CACHEABLE_MEMORY:
273 acpi_os_printf("Noncacheable memory\n");
274 break;
102 275
103 acpi_os_printf(" Active %s\n", 276 case ACPI_CACHABLE_MEMORY:
104 ACPI_ACTIVE_LOW == 277 acpi_os_printf("Cacheable memory\n");
105 irq_data->active_high_low ? "Low" : "High"); 278 break;
106 279
107 acpi_os_printf(" %s\n", 280 case ACPI_WRITE_COMBINING_MEMORY:
108 ACPI_SHARED == 281 acpi_os_printf("Write-combining memory\n");
109 irq_data->shared_exclusive ? "Shared" : "Exclusive"); 282 break;
110 283
111 acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts); 284 case ACPI_PREFETCHABLE_MEMORY:
285 acpi_os_printf("Prefetchable memory\n");
286 break;
287
288 default:
289 acpi_os_printf("Invalid cache attribute\n");
290 break;
291 }
292
293 acpi_rs_out_string("Read/Write Attribute",
294 ACPI_READ_WRITE_MEMORY ==
295 resource->address.attribute.memory.
296 read_write_attribute ? "Read/Write" :
297 "Read Only");
298 break;
299
300 case ACPI_IO_RANGE:
301
302 acpi_rs_out_string("Resource Type", "I/O Range");
303
304 acpi_rs_out_title("Type-Specific Flags");
305
306 switch (resource->address.attribute.io.range_attribute) {
307 case ACPI_NON_ISA_ONLY_RANGES:
308 acpi_os_printf("Non-ISA I/O Addresses\n");
309 break;
112 310
113 for (index = 0; index < irq_data->number_of_interrupts; index++) { 311 case ACPI_ISA_ONLY_RANGES:
114 acpi_os_printf("%X ", irq_data->interrupts[index]); 312 acpi_os_printf("ISA I/O Addresses\n");
313 break;
314
315 case ACPI_ENTIRE_RANGE:
316 acpi_os_printf("ISA and non-ISA I/O Addresses\n");
317 break;
318
319 default:
320 acpi_os_printf("Invalid range attribute\n");
321 break;
322 }
323
324 acpi_rs_out_string("Translation Attribute",
325 ACPI_SPARSE_TRANSLATION ==
326 resource->address.attribute.io.
327 translation_attribute ? "Sparse Translation"
328 : "Dense Translation");
329 break;
330
331 case ACPI_BUS_NUMBER_RANGE:
332
333 acpi_rs_out_string("Resource Type", "Bus Number Range");
334 break;
335
336 default:
337
338 acpi_rs_out_integer8("Resource Type",
339 (u8) resource->address.resource_type);
340 break;
115 } 341 }
116 342
117 acpi_os_printf(")\n"); 343 /* Decode the general flags */
118 return; 344
345 acpi_rs_out_string("Resource",
346 ACPI_CONSUMER ==
347 resource->address.
348 producer_consumer ? "Consumer" : "Producer");
349
350 acpi_rs_out_string("Decode",
351 ACPI_SUB_DECODE == resource->address.decode ?
352 "Subtractive" : "Positive");
353
354 acpi_rs_out_string("Min Address",
355 ACPI_ADDRESS_FIXED ==
356 resource->address.
357 min_address_fixed ? "Fixed" : "Not Fixed");
358
359 acpi_rs_out_string("Max Address",
360 ACPI_ADDRESS_FIXED ==
361 resource->address.
362 max_address_fixed ? "Fixed" : "Not Fixed");
119} 363}
120 364
121/******************************************************************************* 365/*******************************************************************************
122 * 366 *
123 * FUNCTION: acpi_rs_dump_dma 367 * FUNCTION: acpi_rs_dump_resource_list
124 * 368 *
125 * PARAMETERS: Data - pointer to the resource structure to dump. 369 * PARAMETERS: resource_list - Pointer to a resource descriptor list
126 * 370 *
127 * RETURN: None 371 * RETURN: None
128 * 372 *
129 * DESCRIPTION: Prints out the various members of the Data structure type. 373 * DESCRIPTION: Dispatches the structure to the correct dump routine.
130 * 374 *
131 ******************************************************************************/ 375 ******************************************************************************/
132 376
133static void acpi_rs_dump_dma(union acpi_resource_data *data) 377void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
134{ 378{
135 struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data; 379 u32 count = 0;
136 u8 index = 0;
137 380
138 ACPI_FUNCTION_ENTRY(); 381 ACPI_FUNCTION_ENTRY();
139 382
383 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
384 || !(_COMPONENT & acpi_dbg_layer)) {
385 return;
386 }
387
388 /* Dump all resource descriptors in the list */
389
390 while (resource_list) {
391 acpi_os_printf("\n[%02X] ", count);
392
393 /* Validate Type before dispatch */
394
395 if (resource_list->type > ACPI_RSTYPE_MAX) {
396 acpi_os_printf
397 ("Invalid descriptor type (%X) in resource list\n",
398 resource_list->type);
399 return;
400 }
401
402 /* Dump the resource descriptor */
403
404 acpi_gbl_dump_resource_dispatch[resource_list->
405 type] (&resource_list->data);
406
407 /* Exit on end tag */
408
409 if (resource_list->type == ACPI_RSTYPE_END_TAG) {
410 return;
411 }
412
413 /* Get the next resource structure */
414
415 resource_list =
416 ACPI_PTR_ADD(struct acpi_resource, resource_list,
417 resource_list->length);
418 count++;
419 }
420}
421
422/*******************************************************************************
423 *
424 * FUNCTION: acpi_rs_dump_irq
425 *
426 * PARAMETERS: Resource - Pointer to an internal resource descriptor
427 *
428 * RETURN: None
429 *
430 * DESCRIPTION: Dump the field names and values of the resource descriptor
431 *
432 ******************************************************************************/
433
434static void acpi_rs_dump_irq(union acpi_resource_data *resource)
435{
436 ACPI_FUNCTION_ENTRY();
437
438 acpi_os_printf("IRQ Resource\n");
439
440 acpi_rs_out_string("Triggering",
441 ACPI_LEVEL_SENSITIVE ==
442 resource->irq.edge_level ? "Level" : "Edge");
443
444 acpi_rs_out_string("Active",
445 ACPI_ACTIVE_LOW ==
446 resource->irq.active_high_low ? "Low" : "High");
447
448 acpi_rs_out_string("Sharing",
449 ACPI_SHARED ==
450 resource->irq.
451 shared_exclusive ? "Shared" : "Exclusive");
452
453 acpi_rs_out_integer8("Interrupt Count",
454 (u8) resource->irq.number_of_interrupts);
455
456 acpi_rs_out_title("Interrupt List");
457 acpi_rs_dump_short_byte_list(resource->irq.number_of_interrupts,
458 resource->irq.interrupts);
459}
460
461/*******************************************************************************
462 *
463 * FUNCTION: acpi_rs_dump_dma
464 *
465 * PARAMETERS: Resource - Pointer to an internal resource descriptor
466 *
467 * RETURN: None
468 *
469 * DESCRIPTION: Dump the field names and values of the resource descriptor
470 *
471 ******************************************************************************/
472
473static void acpi_rs_dump_dma(union acpi_resource_data *resource)
474{
475 ACPI_FUNCTION_ENTRY();
476
140 acpi_os_printf("DMA Resource\n"); 477 acpi_os_printf("DMA Resource\n");
141 478
142 switch (dma_data->type) { 479 acpi_rs_out_title("DMA Type");
480 switch (resource->dma.type) {
143 case ACPI_COMPATIBILITY: 481 case ACPI_COMPATIBILITY:
144 acpi_os_printf(" Compatibility mode\n"); 482 acpi_os_printf("Compatibility mode\n");
145 break; 483 break;
146 484
147 case ACPI_TYPE_A: 485 case ACPI_TYPE_A:
148 acpi_os_printf(" Type A\n"); 486 acpi_os_printf("Type A\n");
149 break; 487 break;
150 488
151 case ACPI_TYPE_B: 489 case ACPI_TYPE_B:
152 acpi_os_printf(" Type B\n"); 490 acpi_os_printf("Type B\n");
153 break; 491 break;
154 492
155 case ACPI_TYPE_F: 493 case ACPI_TYPE_F:
156 acpi_os_printf(" Type F\n"); 494 acpi_os_printf("Type F\n");
157 break; 495 break;
158 496
159 default: 497 default:
160 acpi_os_printf(" Invalid DMA type\n"); 498 acpi_os_printf("**** Invalid DMA type\n");
161 break; 499 break;
162 } 500 }
163 501
164 acpi_os_printf(" %sBus Master\n", 502 acpi_rs_out_string("Bus Master",
165 ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); 503 ACPI_BUS_MASTER ==
504 resource->dma.bus_master ? "Yes" : "No");
166 505
167 switch (dma_data->transfer) { 506 acpi_rs_out_title("Transfer Type");
507 switch (resource->dma.transfer) {
168 case ACPI_TRANSFER_8: 508 case ACPI_TRANSFER_8:
169 acpi_os_printf(" 8-bit only transfer\n"); 509 acpi_os_printf("8-bit transfers only\n");
170 break; 510 break;
171 511
172 case ACPI_TRANSFER_8_16: 512 case ACPI_TRANSFER_8_16:
173 acpi_os_printf(" 8 and 16-bit transfer\n"); 513 acpi_os_printf("8-bit and 16-bit transfers\n");
174 break; 514 break;
175 515
176 case ACPI_TRANSFER_16: 516 case ACPI_TRANSFER_16:
177 acpi_os_printf(" 16 bit only transfer\n"); 517 acpi_os_printf("16-bit transfers only\n");
178 break; 518 break;
179 519
180 default: 520 default:
181 acpi_os_printf(" Invalid transfer preference\n"); 521 acpi_os_printf("**** Invalid transfer preference\n");
182 break; 522 break;
183 } 523 }
184 524
185 acpi_os_printf(" Number of Channels: %X ( ", 525 acpi_rs_out_integer8("DMA Channel Count",
186 dma_data->number_of_channels); 526 (u8) resource->dma.number_of_channels);
187
188 for (index = 0; index < dma_data->number_of_channels; index++) {
189 acpi_os_printf("%X ", dma_data->channels[index]);
190 }
191 527
192 acpi_os_printf(")\n"); 528 acpi_rs_out_title("Channel List");
193 return; 529 acpi_rs_dump_short_byte_list(resource->dma.number_of_channels,
530 resource->dma.channels);
194} 531}
195 532
196/******************************************************************************* 533/*******************************************************************************
197 * 534 *
198 * FUNCTION: acpi_rs_dump_start_depend_fns 535 * FUNCTION: acpi_rs_dump_start_depend_fns
199 * 536 *
200 * PARAMETERS: Data - pointer to the resource structure to dump. 537 * PARAMETERS: Resource - Pointer to an internal resource descriptor
201 * 538 *
202 * RETURN: None 539 * RETURN: None
203 * 540 *
204 * DESCRIPTION: Prints out the various members of the Data structure type. 541 * DESCRIPTION: Dump the field names and values of the resource descriptor
205 * 542 *
206 ******************************************************************************/ 543 ******************************************************************************/
207 544
208static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data) 545static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource)
209{ 546{
210 struct acpi_resource_start_dpf *sdf_data =
211 (struct acpi_resource_start_dpf *)data;
212
213 ACPI_FUNCTION_ENTRY(); 547 ACPI_FUNCTION_ENTRY();
214 548
215 acpi_os_printf("Start Dependent Functions Resource\n"); 549 acpi_os_printf("Start Dependent Functions Resource\n");
216 550
217 switch (sdf_data->compatibility_priority) { 551 acpi_rs_out_title("Compatibility Priority");
552 switch (resource->start_dpf.compatibility_priority) {
218 case ACPI_GOOD_CONFIGURATION: 553 case ACPI_GOOD_CONFIGURATION:
219 acpi_os_printf(" Good configuration\n"); 554 acpi_os_printf("Good configuration\n");
220 break; 555 break;
221 556
222 case ACPI_ACCEPTABLE_CONFIGURATION: 557 case ACPI_ACCEPTABLE_CONFIGURATION:
223 acpi_os_printf(" Acceptable configuration\n"); 558 acpi_os_printf("Acceptable configuration\n");
224 break; 559 break;
225 560
226 case ACPI_SUB_OPTIMAL_CONFIGURATION: 561 case ACPI_SUB_OPTIMAL_CONFIGURATION:
227 acpi_os_printf(" Sub-optimal configuration\n"); 562 acpi_os_printf("Sub-optimal configuration\n");
228 break; 563 break;
229 564
230 default: 565 default:
231 acpi_os_printf(" Invalid compatibility priority\n"); 566 acpi_os_printf("**** Invalid compatibility priority\n");
232 break; 567 break;
233 } 568 }
234 569
235 switch (sdf_data->performance_robustness) { 570 acpi_rs_out_title("Performance/Robustness");
571 switch (resource->start_dpf.performance_robustness) {
236 case ACPI_GOOD_CONFIGURATION: 572 case ACPI_GOOD_CONFIGURATION:
237 acpi_os_printf(" Good configuration\n"); 573 acpi_os_printf("Good configuration\n");
238 break; 574 break;
239 575
240 case ACPI_ACCEPTABLE_CONFIGURATION: 576 case ACPI_ACCEPTABLE_CONFIGURATION:
241 acpi_os_printf(" Acceptable configuration\n"); 577 acpi_os_printf("Acceptable configuration\n");
242 break; 578 break;
243 579
244 case ACPI_SUB_OPTIMAL_CONFIGURATION: 580 case ACPI_SUB_OPTIMAL_CONFIGURATION:
245 acpi_os_printf(" Sub-optimal configuration\n"); 581 acpi_os_printf("Sub-optimal configuration\n");
246 break; 582 break;
247 583
248 default: 584 default:
249 acpi_os_printf(" Invalid performance robustness preference\n"); 585 acpi_os_printf
586 ("**** Invalid performance robustness preference\n");
250 break; 587 break;
251 } 588 }
252
253 return;
254} 589}
255 590
256/******************************************************************************* 591/*******************************************************************************
257 * 592 *
258 * FUNCTION: acpi_rs_dump_io 593 * FUNCTION: acpi_rs_dump_io
259 * 594 *
260 * PARAMETERS: Data - pointer to the resource structure to dump. 595 * PARAMETERS: Resource - Pointer to an internal resource descriptor
261 * 596 *
262 * RETURN: None 597 * RETURN: None
263 * 598 *
264 * DESCRIPTION: Prints out the various members of the Data structure type. 599 * DESCRIPTION: Dump the field names and values of the resource descriptor
265 * 600 *
266 ******************************************************************************/ 601 ******************************************************************************/
267 602
268static void acpi_rs_dump_io(union acpi_resource_data *data) 603static void acpi_rs_dump_io(union acpi_resource_data *resource)
269{ 604{
270 struct acpi_resource_io *io_data = (struct acpi_resource_io *)data;
271
272 ACPI_FUNCTION_ENTRY(); 605 ACPI_FUNCTION_ENTRY();
273 606
274 acpi_os_printf("Io Resource\n"); 607 acpi_os_printf("I/O Resource\n");
275 608
276 acpi_os_printf(" %d bit decode\n", 609 acpi_rs_out_string("Decode",
277 ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); 610 ACPI_DECODE_16 ==
611 resource->io.io_decode ? "16-bit" : "10-bit");
278 612
279 acpi_os_printf(" Range minimum base: %08X\n", 613 acpi_rs_out_integer32("Range Minimum Base",
280 io_data->min_base_address); 614 resource->io.min_base_address);
281 615
282 acpi_os_printf(" Range maximum base: %08X\n", 616 acpi_rs_out_integer32("Range Maximum Base",
283 io_data->max_base_address); 617 resource->io.max_base_address);
284 618
285 acpi_os_printf(" Alignment: %08X\n", io_data->alignment); 619 acpi_rs_out_integer32("Alignment", resource->io.alignment);
286 620
287 acpi_os_printf(" Range Length: %08X\n", io_data->range_length); 621 acpi_rs_out_integer32("Range Length", resource->io.range_length);
288
289 return;
290} 622}
291 623
292/******************************************************************************* 624/*******************************************************************************
293 * 625 *
294 * FUNCTION: acpi_rs_dump_fixed_io 626 * FUNCTION: acpi_rs_dump_fixed_io
295 * 627 *
296 * PARAMETERS: Data - pointer to the resource structure to dump. 628 * PARAMETERS: Resource - Pointer to an internal resource descriptor
297 * 629 *
298 * RETURN: None 630 * RETURN: None
299 * 631 *
300 * DESCRIPTION: Prints out the various members of the Data structure type. 632 * DESCRIPTION: Dump the field names and values of the resource descriptor
301 * 633 *
302 ******************************************************************************/ 634 ******************************************************************************/
303 635
304static void acpi_rs_dump_fixed_io(union acpi_resource_data *data) 636static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource)
305{ 637{
306 struct acpi_resource_fixed_io *fixed_io_data =
307 (struct acpi_resource_fixed_io *)data;
308
309 ACPI_FUNCTION_ENTRY(); 638 ACPI_FUNCTION_ENTRY();
310 639
311 acpi_os_printf("Fixed Io Resource\n"); 640 acpi_os_printf("Fixed I/O Resource\n");
312 acpi_os_printf(" Range base address: %08X",
313 fixed_io_data->base_address);
314 641
315 acpi_os_printf(" Range length: %08X", fixed_io_data->range_length); 642 acpi_rs_out_integer32("Range Base Address",
643 resource->fixed_io.base_address);
316 644
317 return; 645 acpi_rs_out_integer32("Range Length", resource->fixed_io.range_length);
318} 646}
319 647
320/******************************************************************************* 648/*******************************************************************************
321 * 649 *
322 * FUNCTION: acpi_rs_dump_vendor_specific 650 * FUNCTION: acpi_rs_dump_vendor_specific
323 * 651 *
324 * PARAMETERS: Data - pointer to the resource structure to dump. 652 * PARAMETERS: Resource - Pointer to an internal resource descriptor
325 * 653 *
326 * RETURN: None 654 * RETURN: None
327 * 655 *
328 * DESCRIPTION: Prints out the various members of the Data structure type. 656 * DESCRIPTION: Dump the field names and values of the resource descriptor
329 * 657 *
330 ******************************************************************************/ 658 ******************************************************************************/
331 659
332static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data) 660static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource)
333{ 661{
334 struct acpi_resource_vendor *vendor_data =
335 (struct acpi_resource_vendor *)data;
336 u16 index = 0;
337
338 ACPI_FUNCTION_ENTRY(); 662 ACPI_FUNCTION_ENTRY();
339 663
340 acpi_os_printf("Vendor Specific Resource\n"); 664 acpi_os_printf("Vendor Specific Resource\n");
341 665
342 acpi_os_printf(" Length: %08X\n", vendor_data->length); 666 acpi_rs_out_integer16("Length", (u16) resource->vendor_specific.length);
343 667
344 for (index = 0; index < vendor_data->length; index++) { 668 acpi_rs_dump_byte_list(resource->vendor_specific.length,
345 acpi_os_printf(" Byte %X: %08X\n", 669 resource->vendor_specific.reserved);
346 index, vendor_data->reserved[index]);
347 }
348
349 return;
350} 670}
351 671
352/******************************************************************************* 672/*******************************************************************************
353 * 673 *
354 * FUNCTION: acpi_rs_dump_memory24 674 * FUNCTION: acpi_rs_dump_memory24
355 * 675 *
356 * PARAMETERS: Data - pointer to the resource structure to dump. 676 * PARAMETERS: Resource - Pointer to an internal resource descriptor
357 * 677 *
358 * RETURN: None 678 * RETURN: None
359 * 679 *
360 * DESCRIPTION: Prints out the various members of the Data structure type. 680 * DESCRIPTION: Dump the field names and values of the resource descriptor
361 * 681 *
362 ******************************************************************************/ 682 ******************************************************************************/
363 683
364static void acpi_rs_dump_memory24(union acpi_resource_data *data) 684static void acpi_rs_dump_memory24(union acpi_resource_data *resource)
365{ 685{
366 struct acpi_resource_mem24 *memory24_data =
367 (struct acpi_resource_mem24 *)data;
368
369 ACPI_FUNCTION_ENTRY(); 686 ACPI_FUNCTION_ENTRY();
370 687
371 acpi_os_printf("24-Bit Memory Range Resource\n"); 688 acpi_os_printf("24-Bit Memory Range Resource\n");
372 689
373 acpi_os_printf(" Read%s\n", 690 acpi_rs_out_string("Attribute",
374 ACPI_READ_WRITE_MEMORY == 691 ACPI_READ_WRITE_MEMORY ==
375 memory24_data->read_write_attribute ? 692 resource->memory24.read_write_attribute ?
376 "/Write" : " only"); 693 "Read/Write" : "Read Only");
377
378 acpi_os_printf(" Range minimum base: %08X\n",
379 memory24_data->min_base_address);
380 694
381 acpi_os_printf(" Range maximum base: %08X\n", 695 acpi_rs_out_integer16("Range Minimum Base",
382 memory24_data->max_base_address); 696 (u16) resource->memory24.min_base_address);
383 697
384 acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment); 698 acpi_rs_out_integer16("Range Maximum Base",
699 (u16) resource->memory24.max_base_address);
385 700
386 acpi_os_printf(" Range length: %08X\n", memory24_data->range_length); 701 acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment);
387 702
388 return; 703 acpi_rs_out_integer16("Range Length",
704 (u16) resource->memory24.range_length);
389} 705}
390 706
391/******************************************************************************* 707/*******************************************************************************
392 * 708 *
393 * FUNCTION: acpi_rs_dump_memory32 709 * FUNCTION: acpi_rs_dump_memory32
394 * 710 *
395 * PARAMETERS: Data - pointer to the resource structure to dump. 711 * PARAMETERS: Resource - Pointer to an internal resource descriptor
396 * 712 *
397 * RETURN: None 713 * RETURN: None
398 * 714 *
399 * DESCRIPTION: Prints out the various members of the Data structure type. 715 * DESCRIPTION: Dump the field names and values of the resource descriptor
400 * 716 *
401 ******************************************************************************/ 717 ******************************************************************************/
402 718
403static void acpi_rs_dump_memory32(union acpi_resource_data *data) 719static void acpi_rs_dump_memory32(union acpi_resource_data *resource)
404{ 720{
405 struct acpi_resource_mem32 *memory32_data =
406 (struct acpi_resource_mem32 *)data;
407
408 ACPI_FUNCTION_ENTRY(); 721 ACPI_FUNCTION_ENTRY();
409 722
410 acpi_os_printf("32-Bit Memory Range Resource\n"); 723 acpi_os_printf("32-Bit Memory Range Resource\n");
411 724
412 acpi_os_printf(" Read%s\n", 725 acpi_rs_out_string("Attribute",
413 ACPI_READ_WRITE_MEMORY == 726 ACPI_READ_WRITE_MEMORY ==
414 memory32_data->read_write_attribute ? 727 resource->memory32.read_write_attribute ?
415 "/Write" : " only"); 728 "Read/Write" : "Read Only");
416
417 acpi_os_printf(" Range minimum base: %08X\n",
418 memory32_data->min_base_address);
419 729
420 acpi_os_printf(" Range maximum base: %08X\n", 730 acpi_rs_out_integer32("Range Minimum Base",
421 memory32_data->max_base_address); 731 resource->memory32.min_base_address);
422 732
423 acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment); 733 acpi_rs_out_integer32("Range Maximum Base",
734 resource->memory32.max_base_address);
424 735
425 acpi_os_printf(" Range length: %08X\n", memory32_data->range_length); 736 acpi_rs_out_integer32("Alignment", resource->memory32.alignment);
426 737
427 return; 738 acpi_rs_out_integer32("Range Length", resource->memory32.range_length);
428} 739}
429 740
430/******************************************************************************* 741/*******************************************************************************
431 * 742 *
432 * FUNCTION: acpi_rs_dump_fixed_memory32 743 * FUNCTION: acpi_rs_dump_fixed_memory32
433 * 744 *
434 * PARAMETERS: Data - pointer to the resource structure to dump. 745 * PARAMETERS: Resource - Pointer to an internal resource descriptor
435 * 746 *
436 * RETURN: 747 * RETURN:
437 * 748 *
438 * DESCRIPTION: Prints out the various members of the Data structure type. 749 * DESCRIPTION: Dump the field names and values of the resource descriptor
439 * 750 *
440 ******************************************************************************/ 751 ******************************************************************************/
441 752
442static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data) 753static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource)
443{ 754{
444 struct acpi_resource_fixed_mem32 *fixed_memory32_data =
445 (struct acpi_resource_fixed_mem32 *)data;
446
447 ACPI_FUNCTION_ENTRY(); 755 ACPI_FUNCTION_ENTRY();
448 756
449 acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); 757 acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n");
450 758
451 acpi_os_printf(" Read%s\n", 759 acpi_rs_out_string("Attribute",
452 ACPI_READ_WRITE_MEMORY == 760 ACPI_READ_WRITE_MEMORY ==
453 fixed_memory32_data-> 761 resource->fixed_memory32.read_write_attribute ?
454 read_write_attribute ? "/Write" : " Only"); 762 "Read/Write" : "Read Only");
455
456 acpi_os_printf(" Range base address: %08X\n",
457 fixed_memory32_data->range_base_address);
458 763
459 acpi_os_printf(" Range length: %08X\n", 764 acpi_rs_out_integer32("Range Base Address",
460 fixed_memory32_data->range_length); 765 resource->fixed_memory32.range_base_address);
461 766
462 return; 767 acpi_rs_out_integer32("Range Length",
768 resource->fixed_memory32.range_length);
463} 769}
464 770
465/******************************************************************************* 771/*******************************************************************************
466 * 772 *
467 * FUNCTION: acpi_rs_dump_address16 773 * FUNCTION: acpi_rs_dump_address16
468 * 774 *
469 * PARAMETERS: Data - pointer to the resource structure to dump. 775 * PARAMETERS: Resource - Pointer to an internal resource descriptor
470 * 776 *
471 * RETURN: None 777 * RETURN: None
472 * 778 *
473 * DESCRIPTION: Prints out the various members of the Data structure type. 779 * DESCRIPTION: Dump the field names and values of the resource descriptor
474 * 780 *
475 ******************************************************************************/ 781 ******************************************************************************/
476 782
477static void acpi_rs_dump_address16(union acpi_resource_data *data) 783static void acpi_rs_dump_address16(union acpi_resource_data *resource)
478{ 784{
479 struct acpi_resource_address16 *address16_data =
480 (struct acpi_resource_address16 *)data;
481
482 ACPI_FUNCTION_ENTRY(); 785 ACPI_FUNCTION_ENTRY();
483 786
484 acpi_os_printf("16-Bit Address Space Resource\n"); 787 acpi_os_printf("16-Bit Address Space Resource\n");
485 acpi_os_printf(" Resource Type: ");
486 788
487 switch (address16_data->resource_type) { 789 acpi_rs_dump_address_common(resource);
488 case ACPI_MEMORY_RANGE:
489 790
490 acpi_os_printf("Memory Range\n"); 791 acpi_rs_out_integer16("Granularity",
792 (u16) resource->address16.granularity);
491 793
492 switch (address16_data->attribute.memory.cache_attribute) { 794 acpi_rs_out_integer16("Address Range Min",
493 case ACPI_NON_CACHEABLE_MEMORY: 795 (u16) resource->address16.min_address_range);
494 acpi_os_printf
495 (" Type Specific: Noncacheable memory\n");
496 break;
497 796
498 case ACPI_CACHABLE_MEMORY: 797 acpi_rs_out_integer16("Address Range Max",
499 acpi_os_printf(" Type Specific: Cacheable memory\n"); 798 (u16) resource->address16.max_address_range);
500 break;
501 799
502 case ACPI_WRITE_COMBINING_MEMORY: 800 acpi_rs_out_integer16("Address Translation Offset",
503 acpi_os_printf 801 (u16) resource->address16.
504 (" Type Specific: Write-combining memory\n"); 802 address_translation_offset);
505 break;
506 803
507 case ACPI_PREFETCHABLE_MEMORY: 804 acpi_rs_out_integer16("Address Length",
508 acpi_os_printf 805 (u16) resource->address16.address_length);
509 (" Type Specific: Prefetchable memory\n");
510 break;
511 806
512 default: 807 acpi_rs_dump_resource_source(&resource->address16.resource_source);
513 acpi_os_printf
514 (" Type Specific: Invalid cache attribute\n");
515 break;
516 }
517
518 acpi_os_printf(" Type Specific: Read%s\n",
519 ACPI_READ_WRITE_MEMORY ==
520 address16_data->attribute.memory.
521 read_write_attribute ? "/Write" : " Only");
522 break;
523
524 case ACPI_IO_RANGE:
525
526 acpi_os_printf("I/O Range\n");
527
528 switch (address16_data->attribute.io.range_attribute) {
529 case ACPI_NON_ISA_ONLY_RANGES:
530 acpi_os_printf
531 (" Type Specific: Non-ISA Io Addresses\n");
532 break;
533
534 case ACPI_ISA_ONLY_RANGES:
535 acpi_os_printf(" Type Specific: ISA Io Addresses\n");
536 break;
537
538 case ACPI_ENTIRE_RANGE:
539 acpi_os_printf
540 (" Type Specific: ISA and non-ISA Io Addresses\n");
541 break;
542
543 default:
544 acpi_os_printf
545 (" Type Specific: Invalid range attribute\n");
546 break;
547 }
548
549 acpi_os_printf(" Type Specific: %s Translation\n",
550 ACPI_SPARSE_TRANSLATION ==
551 address16_data->attribute.io.
552 translation_attribute ? "Sparse" : "Dense");
553 break;
554
555 case ACPI_BUS_NUMBER_RANGE:
556
557 acpi_os_printf("Bus Number Range\n");
558 break;
559
560 default:
561
562 acpi_os_printf("0x%2.2X\n", address16_data->resource_type);
563 break;
564 }
565
566 acpi_os_printf(" Resource %s\n",
567 ACPI_CONSUMER == address16_data->producer_consumer ?
568 "Consumer" : "Producer");
569
570 acpi_os_printf(" %s decode\n",
571 ACPI_SUB_DECODE == address16_data->decode ?
572 "Subtractive" : "Positive");
573
574 acpi_os_printf(" Min address is %s fixed\n",
575 ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
576 "" : "not");
577
578 acpi_os_printf(" Max address is %s fixed\n",
579 ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
580 "" : "not");
581
582 acpi_os_printf(" Granularity: %08X\n", address16_data->granularity);
583
584 acpi_os_printf(" Address range min: %08X\n",
585 address16_data->min_address_range);
586
587 acpi_os_printf(" Address range max: %08X\n",
588 address16_data->max_address_range);
589
590 acpi_os_printf(" Address translation offset: %08X\n",
591 address16_data->address_translation_offset);
592
593 acpi_os_printf(" Address Length: %08X\n",
594 address16_data->address_length);
595
596 if (0xFF != address16_data->resource_source.index) {
597 acpi_os_printf(" Resource Source Index: %X\n",
598 address16_data->resource_source.index);
599
600 acpi_os_printf(" Resource Source: %s\n",
601 address16_data->resource_source.string_ptr);
602 }
603
604 return;
605} 808}
606 809
607/******************************************************************************* 810/*******************************************************************************
608 * 811 *
609 * FUNCTION: acpi_rs_dump_address32 812 * FUNCTION: acpi_rs_dump_address32
610 * 813 *
611 * PARAMETERS: Data - pointer to the resource structure to dump. 814 * PARAMETERS: Resource - Pointer to an internal resource descriptor
612 * 815 *
613 * RETURN: None 816 * RETURN: None
614 * 817 *
615 * DESCRIPTION: Prints out the various members of the Data structure type. 818 * DESCRIPTION: Dump the field names and values of the resource descriptor
616 * 819 *
617 ******************************************************************************/ 820 ******************************************************************************/
618 821
619static void acpi_rs_dump_address32(union acpi_resource_data *data) 822static void acpi_rs_dump_address32(union acpi_resource_data *resource)
620{ 823{
621 struct acpi_resource_address32 *address32_data =
622 (struct acpi_resource_address32 *)data;
623
624 ACPI_FUNCTION_ENTRY(); 824 ACPI_FUNCTION_ENTRY();
625 825
626 acpi_os_printf("32-Bit Address Space Resource\n"); 826 acpi_os_printf("32-Bit Address Space Resource\n");
627 827
628 switch (address32_data->resource_type) { 828 acpi_rs_dump_address_common(resource);
629 case ACPI_MEMORY_RANGE:
630 829
631 acpi_os_printf(" Resource Type: Memory Range\n"); 830 acpi_rs_out_integer32("Granularity", resource->address32.granularity);
632 831
633 switch (address32_data->attribute.memory.cache_attribute) { 832 acpi_rs_out_integer32("Address Range Min",
634 case ACPI_NON_CACHEABLE_MEMORY: 833 resource->address32.min_address_range);
635 acpi_os_printf
636 (" Type Specific: Noncacheable memory\n");
637 break;
638 834
639 case ACPI_CACHABLE_MEMORY: 835 acpi_rs_out_integer32("Address Range Max",
640 acpi_os_printf(" Type Specific: Cacheable memory\n"); 836 resource->address32.max_address_range);
641 break;
642 837
643 case ACPI_WRITE_COMBINING_MEMORY: 838 acpi_rs_out_integer32("Address Translation Offset",
644 acpi_os_printf 839 resource->address32.address_translation_offset);
645 (" Type Specific: Write-combining memory\n");
646 break;
647
648 case ACPI_PREFETCHABLE_MEMORY:
649 acpi_os_printf
650 (" Type Specific: Prefetchable memory\n");
651 break;
652
653 default:
654 acpi_os_printf
655 (" Type Specific: Invalid cache attribute\n");
656 break;
657 }
658
659 acpi_os_printf(" Type Specific: Read%s\n",
660 ACPI_READ_WRITE_MEMORY ==
661 address32_data->attribute.memory.
662 read_write_attribute ? "/Write" : " Only");
663 break;
664
665 case ACPI_IO_RANGE:
666
667 acpi_os_printf(" Resource Type: Io Range\n");
668
669 switch (address32_data->attribute.io.range_attribute) {
670 case ACPI_NON_ISA_ONLY_RANGES:
671 acpi_os_printf
672 (" Type Specific: Non-ISA Io Addresses\n");
673 break;
674
675 case ACPI_ISA_ONLY_RANGES:
676 acpi_os_printf(" Type Specific: ISA Io Addresses\n");
677 break;
678
679 case ACPI_ENTIRE_RANGE:
680 acpi_os_printf
681 (" Type Specific: ISA and non-ISA Io Addresses\n");
682 break;
683
684 default:
685 acpi_os_printf
686 (" Type Specific: Invalid Range attribute");
687 break;
688 }
689
690 acpi_os_printf(" Type Specific: %s Translation\n",
691 ACPI_SPARSE_TRANSLATION ==
692 address32_data->attribute.io.
693 translation_attribute ? "Sparse" : "Dense");
694 break;
695
696 case ACPI_BUS_NUMBER_RANGE:
697
698 acpi_os_printf(" Resource Type: Bus Number Range\n");
699 break;
700 840
701 default: 841 acpi_rs_out_integer32("Address Length",
702 842 resource->address32.address_length);
703 acpi_os_printf(" Resource Type: 0x%2.2X\n",
704 address32_data->resource_type);
705 break;
706 }
707 843
708 acpi_os_printf(" Resource %s\n", 844 acpi_rs_dump_resource_source(&resource->address32.resource_source);
709 ACPI_CONSUMER == address32_data->producer_consumer ?
710 "Consumer" : "Producer");
711
712 acpi_os_printf(" %s decode\n",
713 ACPI_SUB_DECODE == address32_data->decode ?
714 "Subtractive" : "Positive");
715
716 acpi_os_printf(" Min address is %s fixed\n",
717 ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
718 "" : "not ");
719
720 acpi_os_printf(" Max address is %s fixed\n",
721 ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
722 "" : "not ");
723
724 acpi_os_printf(" Granularity: %08X\n", address32_data->granularity);
725
726 acpi_os_printf(" Address range min: %08X\n",
727 address32_data->min_address_range);
728
729 acpi_os_printf(" Address range max: %08X\n",
730 address32_data->max_address_range);
731
732 acpi_os_printf(" Address translation offset: %08X\n",
733 address32_data->address_translation_offset);
734
735 acpi_os_printf(" Address Length: %08X\n",
736 address32_data->address_length);
737
738 if (0xFF != address32_data->resource_source.index) {
739 acpi_os_printf(" Resource Source Index: %X\n",
740 address32_data->resource_source.index);
741
742 acpi_os_printf(" Resource Source: %s\n",
743 address32_data->resource_source.string_ptr);
744 }
745
746 return;
747} 845}
748 846
749/******************************************************************************* 847/*******************************************************************************
750 * 848 *
751 * FUNCTION: acpi_rs_dump_address64 849 * FUNCTION: acpi_rs_dump_address64
752 * 850 *
753 * PARAMETERS: Data - pointer to the resource structure to dump. 851 * PARAMETERS: Resource - Pointer to an internal resource descriptor
754 * 852 *
755 * RETURN: None 853 * RETURN: None
756 * 854 *
757 * DESCRIPTION: Prints out the various members of the Data structure type. 855 * DESCRIPTION: Dump the field names and values of the resource descriptor
758 * 856 *
759 ******************************************************************************/ 857 ******************************************************************************/
760 858
761static void acpi_rs_dump_address64(union acpi_resource_data *data) 859static void acpi_rs_dump_address64(union acpi_resource_data *resource)
762{ 860{
763 struct acpi_resource_address64 *address64_data =
764 (struct acpi_resource_address64 *)data;
765
766 ACPI_FUNCTION_ENTRY(); 861 ACPI_FUNCTION_ENTRY();
767 862
768 acpi_os_printf("64-Bit Address Space Resource\n"); 863 acpi_os_printf("64-Bit Address Space Resource\n");
769 864
770 switch (address64_data->resource_type) { 865 acpi_rs_dump_address_common(resource);
771 case ACPI_MEMORY_RANGE:
772
773 acpi_os_printf(" Resource Type: Memory Range\n");
774
775 switch (address64_data->attribute.memory.cache_attribute) {
776 case ACPI_NON_CACHEABLE_MEMORY:
777 acpi_os_printf
778 (" Type Specific: Noncacheable memory\n");
779 break;
780
781 case ACPI_CACHABLE_MEMORY:
782 acpi_os_printf(" Type Specific: Cacheable memory\n");
783 break;
784
785 case ACPI_WRITE_COMBINING_MEMORY:
786 acpi_os_printf
787 (" Type Specific: Write-combining memory\n");
788 break;
789
790 case ACPI_PREFETCHABLE_MEMORY:
791 acpi_os_printf
792 (" Type Specific: Prefetchable memory\n");
793 break;
794
795 default:
796 acpi_os_printf
797 (" Type Specific: Invalid cache attribute\n");
798 break;
799 }
800
801 acpi_os_printf(" Type Specific: Read%s\n",
802 ACPI_READ_WRITE_MEMORY ==
803 address64_data->attribute.memory.
804 read_write_attribute ? "/Write" : " Only");
805 break;
806
807 case ACPI_IO_RANGE:
808
809 acpi_os_printf(" Resource Type: Io Range\n");
810
811 switch (address64_data->attribute.io.range_attribute) {
812 case ACPI_NON_ISA_ONLY_RANGES:
813 acpi_os_printf
814 (" Type Specific: Non-ISA Io Addresses\n");
815 break;
816
817 case ACPI_ISA_ONLY_RANGES:
818 acpi_os_printf(" Type Specific: ISA Io Addresses\n");
819 break;
820
821 case ACPI_ENTIRE_RANGE:
822 acpi_os_printf
823 (" Type Specific: ISA and non-ISA Io Addresses\n");
824 break;
825
826 default:
827 acpi_os_printf
828 (" Type Specific: Invalid Range attribute");
829 break;
830 }
831
832 acpi_os_printf(" Type Specific: %s Translation\n",
833 ACPI_SPARSE_TRANSLATION ==
834 address64_data->attribute.io.
835 translation_attribute ? "Sparse" : "Dense");
836 break;
837
838 case ACPI_BUS_NUMBER_RANGE:
839
840 acpi_os_printf(" Resource Type: Bus Number Range\n");
841 break;
842
843 default:
844
845 acpi_os_printf(" Resource Type: 0x%2.2X\n",
846 address64_data->resource_type);
847 break;
848 }
849
850 acpi_os_printf(" Resource %s\n",
851 ACPI_CONSUMER == address64_data->producer_consumer ?
852 "Consumer" : "Producer");
853 866
854 acpi_os_printf(" %s decode\n", 867 acpi_rs_out_integer64("Granularity", resource->address64.granularity);
855 ACPI_SUB_DECODE == address64_data->decode ?
856 "Subtractive" : "Positive");
857 868
858 acpi_os_printf(" Min address is %s fixed\n", 869 acpi_rs_out_integer64("Address Range Min",
859 ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? 870 resource->address64.min_address_range);
860 "" : "not ");
861 871
862 acpi_os_printf(" Max address is %s fixed\n", 872 acpi_rs_out_integer64("Address Range Max",
863 ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? 873 resource->address64.max_address_range);
864 "" : "not ");
865 874
866 acpi_os_printf(" Granularity: %8.8X%8.8X\n", 875 acpi_rs_out_integer64("Address Translation Offset",
867 ACPI_FORMAT_UINT64(address64_data->granularity)); 876 resource->address64.address_translation_offset);
868 877
869 acpi_os_printf(" Address range min: %8.8X%8.8X\n", 878 acpi_rs_out_integer64("Address Length",
870 ACPI_FORMAT_UINT64(address64_data->min_address_range)); 879 resource->address64.address_length);
871 880
872 acpi_os_printf(" Address range max: %8.8X%8.8X\n", 881 acpi_rs_out_integer64("Type Specific Attributes",
873 ACPI_FORMAT_UINT64(address64_data->max_address_range)); 882 resource->address64.type_specific_attributes);
874 883
875 acpi_os_printf(" Address translation offset: %8.8X%8.8X\n", 884 acpi_rs_dump_resource_source(&resource->address64.resource_source);
876 ACPI_FORMAT_UINT64(address64_data->
877 address_translation_offset));
878
879 acpi_os_printf(" Address Length: %8.8X%8.8X\n",
880 ACPI_FORMAT_UINT64(address64_data->address_length));
881
882 acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n",
883 ACPI_FORMAT_UINT64(address64_data->
884 type_specific_attributes));
885
886 if (0xFF != address64_data->resource_source.index) {
887 acpi_os_printf(" Resource Source Index: %X\n",
888 address64_data->resource_source.index);
889
890 acpi_os_printf(" Resource Source: %s\n",
891 address64_data->resource_source.string_ptr);
892 }
893
894 return;
895} 885}
896 886
897/******************************************************************************* 887/*******************************************************************************
898 * 888 *
899 * FUNCTION: acpi_rs_dump_extended_irq 889 * FUNCTION: acpi_rs_dump_extended_irq
900 * 890 *
901 * PARAMETERS: Data - pointer to the resource structure to dump. 891 * PARAMETERS: Resource - Pointer to an internal resource descriptor
902 * 892 *
903 * RETURN: None 893 * RETURN: None
904 * 894 *
905 * DESCRIPTION: Prints out the various members of the Data structure type. 895 * DESCRIPTION: Dump the field names and values of the resource descriptor
906 * 896 *
907 ******************************************************************************/ 897 ******************************************************************************/
908 898
909static void acpi_rs_dump_extended_irq(union acpi_resource_data *data) 899static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource)
910{ 900{
911 struct acpi_resource_ext_irq *ext_irq_data =
912 (struct acpi_resource_ext_irq *)data;
913 u8 index = 0;
914
915 ACPI_FUNCTION_ENTRY(); 901 ACPI_FUNCTION_ENTRY();
916 902
917 acpi_os_printf("Extended IRQ Resource\n"); 903 acpi_os_printf("Extended IRQ Resource\n");
918 904
919 acpi_os_printf(" Resource %s\n", 905 acpi_rs_out_string("Resource",
920 ACPI_CONSUMER == ext_irq_data->producer_consumer ? 906 ACPI_CONSUMER ==
921 "Consumer" : "Producer"); 907 resource->extended_irq.
908 producer_consumer ? "Consumer" : "Producer");
922 909
923 acpi_os_printf(" %s\n", 910 acpi_rs_out_string("Triggering",
924 ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? 911 ACPI_LEVEL_SENSITIVE ==
925 "Level" : "Edge"); 912 resource->extended_irq.
913 edge_level ? "Level" : "Edge");
926 914
927 acpi_os_printf(" Active %s\n", 915 acpi_rs_out_string("Active",
928 ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? 916 ACPI_ACTIVE_LOW ==
929 "low" : "high"); 917 resource->extended_irq.
918 active_high_low ? "Low" : "High");
930 919
931 acpi_os_printf(" %s\n", 920 acpi_rs_out_string("Sharing",
932 ACPI_SHARED == ext_irq_data->shared_exclusive ? 921 ACPI_SHARED ==
933 "Shared" : "Exclusive"); 922 resource->extended_irq.
923 shared_exclusive ? "Shared" : "Exclusive");
934 924
935 acpi_os_printf(" Interrupts : %X ( ", 925 acpi_rs_dump_resource_source(&resource->extended_irq.resource_source);
936 ext_irq_data->number_of_interrupts);
937 926
938 for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { 927 acpi_rs_out_integer8("Interrupts",
939 acpi_os_printf("%X ", ext_irq_data->interrupts[index]); 928 (u8) resource->extended_irq.number_of_interrupts);
940 }
941
942 acpi_os_printf(")\n");
943 929
944 if (0xFF != ext_irq_data->resource_source.index) { 930 acpi_rs_dump_dword_list(resource->extended_irq.number_of_interrupts,
945 acpi_os_printf(" Resource Source Index: %X", 931 resource->extended_irq.interrupts);
946 ext_irq_data->resource_source.index);
947
948 acpi_os_printf(" Resource Source: %s",
949 ext_irq_data->resource_source.string_ptr);
950 }
951
952 return;
953} 932}
954 933
955/******************************************************************************* 934/*******************************************************************************
956 * 935 *
957 * FUNCTION: acpi_rs_dump_resource_list 936 * FUNCTION: acpi_rs_dump_generic_reg
958 * 937 *
959 * PARAMETERS: Resource - pointer to the resource structure to dump. 938 * PARAMETERS: Resource - Pointer to an internal resource descriptor
960 * 939 *
961 * RETURN: None 940 * RETURN: None
962 * 941 *
963 * DESCRIPTION: Dispatches the structure to the correct dump routine. 942 * DESCRIPTION: Dump the field names and values of the resource descriptor
964 * 943 *
965 ******************************************************************************/ 944 ******************************************************************************/
966 945
967void acpi_rs_dump_resource_list(struct acpi_resource *resource) 946static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
968{ 947{
969 u8 count = 0;
970 u8 done = FALSE;
971 948
972 ACPI_FUNCTION_ENTRY(); 949 ACPI_FUNCTION_ENTRY();
973 950
974 if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { 951 acpi_os_printf("Generic Register Resource\n");
975 while (!done) {
976 acpi_os_printf("Resource structure %X.\n", count++);
977
978 switch (resource->id) {
979 case ACPI_RSTYPE_IRQ:
980 acpi_rs_dump_irq(&resource->data);
981 break;
982
983 case ACPI_RSTYPE_DMA:
984 acpi_rs_dump_dma(&resource->data);
985 break;
986
987 case ACPI_RSTYPE_START_DPF:
988 acpi_rs_dump_start_depend_fns(&resource->data);
989 break;
990
991 case ACPI_RSTYPE_END_DPF:
992 acpi_os_printf
993 ("end_dependent_functions Resource\n");
994 /* acpi_rs_dump_end_dependent_functions (Resource->Data); */
995 break;
996
997 case ACPI_RSTYPE_IO:
998 acpi_rs_dump_io(&resource->data);
999 break;
1000
1001 case ACPI_RSTYPE_FIXED_IO:
1002 acpi_rs_dump_fixed_io(&resource->data);
1003 break;
1004 952
1005 case ACPI_RSTYPE_VENDOR: 953 acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id);
1006 acpi_rs_dump_vendor_specific(&resource->data);
1007 break;
1008 954
1009 case ACPI_RSTYPE_END_TAG: 955 acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width);
1010 /*rs_dump_end_tag (Resource->Data); */
1011 acpi_os_printf("end_tag Resource\n");
1012 done = TRUE;
1013 break;
1014 956
1015 case ACPI_RSTYPE_MEM24: 957 acpi_rs_out_integer8("Bit Offset",
1016 acpi_rs_dump_memory24(&resource->data); 958 (u8) resource->generic_reg.bit_offset);
1017 break;
1018 959
1019 case ACPI_RSTYPE_MEM32: 960 acpi_rs_out_integer8("Address Size",
1020 acpi_rs_dump_memory32(&resource->data); 961 (u8) resource->generic_reg.address_size);
1021 break;
1022 962
1023 case ACPI_RSTYPE_FIXED_MEM32: 963 acpi_rs_out_integer64("Address", resource->generic_reg.address);
1024 acpi_rs_dump_fixed_memory32(&resource->data); 964}
1025 break;
1026
1027 case ACPI_RSTYPE_ADDRESS16:
1028 acpi_rs_dump_address16(&resource->data);
1029 break;
1030
1031 case ACPI_RSTYPE_ADDRESS32:
1032 acpi_rs_dump_address32(&resource->data);
1033 break;
1034 965
1035 case ACPI_RSTYPE_ADDRESS64: 966/*******************************************************************************
1036 acpi_rs_dump_address64(&resource->data); 967 *
1037 break; 968 * FUNCTION: acpi_rs_dump_end_depend_fns
969 *
970 * PARAMETERS: Resource - Pointer to an internal resource descriptor
971 *
972 * RETURN: None
973 *
974 * DESCRIPTION: Print type, no data.
975 *
976 ******************************************************************************/
1038 977
1039 case ACPI_RSTYPE_EXT_IRQ: 978static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource)
1040 acpi_rs_dump_extended_irq(&resource->data); 979{
1041 break; 980 ACPI_FUNCTION_ENTRY();
1042 981
1043 default: 982 acpi_os_printf("end_dependent_functions Resource\n");
1044 acpi_os_printf("Invalid resource type\n"); 983}
1045 break;
1046 984
1047 } 985/*******************************************************************************
986 *
987 * FUNCTION: acpi_rs_dump_end_tag
988 *
989 * PARAMETERS: Resource - Pointer to an internal resource descriptor
990 *
991 * RETURN: None
992 *
993 * DESCRIPTION: Print type, no data.
994 *
995 ******************************************************************************/
1048 996
1049 resource = 997static void acpi_rs_dump_end_tag(union acpi_resource_data *resource)
1050 ACPI_PTR_ADD(struct acpi_resource, resource, 998{
1051 resource->length); 999 ACPI_FUNCTION_ENTRY();
1052 }
1053 }
1054 1000
1055 return; 1001 acpi_os_printf("end_tag Resource\n");
1056} 1002}
1057 1003
1058/******************************************************************************* 1004/*******************************************************************************
1059 * 1005 *
1060 * FUNCTION: acpi_rs_dump_irq_list 1006 * FUNCTION: acpi_rs_dump_irq_list
1061 * 1007 *
1062 * PARAMETERS: route_table - pointer to the routing table to dump. 1008 * PARAMETERS: route_table - Pointer to the routing table to dump.
1063 * 1009 *
1064 * RETURN: None 1010 * RETURN: None
1065 * 1011 *
1066 * DESCRIPTION: Dispatches the structures to the correct dump routine. 1012 * DESCRIPTION: Print IRQ routing table
1067 * 1013 *
1068 ******************************************************************************/ 1014 ******************************************************************************/
1069 1015
@@ -1071,41 +1017,35 @@ void acpi_rs_dump_irq_list(u8 * route_table)
1071{ 1017{
1072 u8 *buffer = route_table; 1018 u8 *buffer = route_table;
1073 u8 count = 0; 1019 u8 count = 0;
1074 u8 done = FALSE;
1075 struct acpi_pci_routing_table *prt_element; 1020 struct acpi_pci_routing_table *prt_element;
1076 1021
1077 ACPI_FUNCTION_ENTRY(); 1022 ACPI_FUNCTION_ENTRY();
1078 1023
1079 if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { 1024 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
1080 prt_element = 1025 || !(_COMPONENT & acpi_dbg_layer)) {
1081 ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 1026 return;
1027 }
1082 1028
1083 while (!done) { 1029 prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
1084 acpi_os_printf("PCI IRQ Routing Table structure %X.\n",
1085 count++);
1086 1030
1087 acpi_os_printf(" Address: %8.8X%8.8X\n", 1031 /* Dump all table elements, Exit on null length element */
1088 ACPI_FORMAT_UINT64(prt_element->
1089 address));
1090 1032
1091 acpi_os_printf(" Pin: %X\n", prt_element->pin); 1033 while (prt_element->length) {
1034 acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
1035 count);
1092 1036
1093 acpi_os_printf(" Source: %s\n", prt_element->source); 1037 acpi_rs_out_integer64("Address", prt_element->address);
1094 1038
1095 acpi_os_printf(" source_index: %X\n", 1039 acpi_rs_out_integer32("Pin", prt_element->pin);
1096 prt_element->source_index); 1040 acpi_rs_out_string("Source", prt_element->source);
1041 acpi_rs_out_integer32("Source Index",
1042 prt_element->source_index);
1097 1043
1098 buffer += prt_element->length; 1044 buffer += prt_element->length;
1099 prt_element = 1045 prt_element =
1100 ACPI_CAST_PTR(struct acpi_pci_routing_table, 1046 ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
1101 buffer); 1047 count++;
1102 if (0 == prt_element->length) {
1103 done = TRUE;
1104 }
1105 }
1106 } 1048 }
1107
1108 return;
1109} 1049}
1110 1050
1111#endif 1051#endif
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index d53bbe89e851..6574e2ae2e52 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -84,7 +84,7 @@ acpi_rs_io_resource(u8 * byte_stream_buffer,
84 84
85 *bytes_consumed = 8; 85 *bytes_consumed = 8;
86 86
87 output_struct->id = ACPI_RSTYPE_IO; 87 output_struct->type = ACPI_RSTYPE_IO;
88 88
89 /* Check Decode */ 89 /* Check Decode */
90 90
@@ -170,7 +170,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
170 170
171 *bytes_consumed = 4; 171 *bytes_consumed = 4;
172 172
173 output_struct->id = ACPI_RSTYPE_FIXED_IO; 173 output_struct->type = ACPI_RSTYPE_FIXED_IO;
174 174
175 /* Check Range Base Address */ 175 /* Check Range Base Address */
176 176
@@ -200,7 +200,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
200 * 200 *
201 * FUNCTION: acpi_rs_io_stream 201 * FUNCTION: acpi_rs_io_stream
202 * 202 *
203 * PARAMETERS: linked_list - Pointer to the resource linked list 203 * PARAMETERS: Resource - Pointer to the resource linked list
204 * output_buffer - Pointer to the user's return buffer 204 * output_buffer - Pointer to the user's return buffer
205 * bytes_consumed - Pointer to where the number of bytes 205 * bytes_consumed - Pointer to where the number of bytes
206 * used in the output_buffer is returned 206 * used in the output_buffer is returned
@@ -213,7 +213,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
213 ******************************************************************************/ 213 ******************************************************************************/
214 214
215acpi_status 215acpi_status
216acpi_rs_io_stream(struct acpi_resource *linked_list, 216acpi_rs_io_stream(struct acpi_resource *resource,
217 u8 ** output_buffer, acpi_size * bytes_consumed) 217 u8 ** output_buffer, acpi_size * bytes_consumed)
218{ 218{
219 u8 *buffer = *output_buffer; 219 u8 *buffer = *output_buffer;
@@ -222,42 +222,42 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
222 222
223 ACPI_FUNCTION_TRACE("rs_io_stream"); 223 ACPI_FUNCTION_TRACE("rs_io_stream");
224 224
225 /* The descriptor field is static */ 225 /* The Descriptor Type field is static */
226 226
227 *buffer = 0x47; 227 *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07;
228 buffer += 1; 228 buffer += 1;
229 229
230 /* Io Information Byte */ 230 /* Io Information Byte */
231 231
232 temp8 = (u8) (linked_list->data.io.io_decode & 0x01); 232 temp8 = (u8) (resource->data.io.io_decode & 0x01);
233 233
234 *buffer = temp8; 234 *buffer = temp8;
235 buffer += 1; 235 buffer += 1;
236 236
237 /* Set the Range minimum base address */ 237 /* Set the Range minimum base address */
238 238
239 temp16 = (u16) linked_list->data.io.min_base_address; 239 temp16 = (u16) resource->data.io.min_base_address;
240 240
241 ACPI_MOVE_16_TO_16(buffer, &temp16); 241 ACPI_MOVE_16_TO_16(buffer, &temp16);
242 buffer += 2; 242 buffer += 2;
243 243
244 /* Set the Range maximum base address */ 244 /* Set the Range maximum base address */
245 245
246 temp16 = (u16) linked_list->data.io.max_base_address; 246 temp16 = (u16) resource->data.io.max_base_address;
247 247
248 ACPI_MOVE_16_TO_16(buffer, &temp16); 248 ACPI_MOVE_16_TO_16(buffer, &temp16);
249 buffer += 2; 249 buffer += 2;
250 250
251 /* Set the base alignment */ 251 /* Set the base alignment */
252 252
253 temp8 = (u8) linked_list->data.io.alignment; 253 temp8 = (u8) resource->data.io.alignment;
254 254
255 *buffer = temp8; 255 *buffer = temp8;
256 buffer += 1; 256 buffer += 1;
257 257
258 /* Set the range length */ 258 /* Set the range length */
259 259
260 temp8 = (u8) linked_list->data.io.range_length; 260 temp8 = (u8) resource->data.io.range_length;
261 261
262 *buffer = temp8; 262 *buffer = temp8;
263 buffer += 1; 263 buffer += 1;
@@ -272,7 +272,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
272 * 272 *
273 * FUNCTION: acpi_rs_fixed_io_stream 273 * FUNCTION: acpi_rs_fixed_io_stream
274 * 274 *
275 * PARAMETERS: linked_list - Pointer to the resource linked list 275 * PARAMETERS: Resource - Pointer to the resource linked list
276 * output_buffer - Pointer to the user's return buffer 276 * output_buffer - Pointer to the user's return buffer
277 * bytes_consumed - Pointer to where the number of bytes 277 * bytes_consumed - Pointer to where the number of bytes
278 * used in the output_buffer is returned 278 * used in the output_buffer is returned
@@ -285,7 +285,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
285 ******************************************************************************/ 285 ******************************************************************************/
286 286
287acpi_status 287acpi_status
288acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, 288acpi_rs_fixed_io_stream(struct acpi_resource *resource,
289 u8 ** output_buffer, acpi_size * bytes_consumed) 289 u8 ** output_buffer, acpi_size * bytes_consumed)
290{ 290{
291 u8 *buffer = *output_buffer; 291 u8 *buffer = *output_buffer;
@@ -294,22 +294,21 @@ acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
294 294
295 ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); 295 ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
296 296
297 /* The descriptor field is static */ 297 /* The Descriptor Type field is static */
298
299 *buffer = 0x4B;
300 298
299 *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03;
301 buffer += 1; 300 buffer += 1;
302 301
303 /* Set the Range base address */ 302 /* Set the Range base address */
304 303
305 temp16 = (u16) linked_list->data.fixed_io.base_address; 304 temp16 = (u16) resource->data.fixed_io.base_address;
306 305
307 ACPI_MOVE_16_TO_16(buffer, &temp16); 306 ACPI_MOVE_16_TO_16(buffer, &temp16);
308 buffer += 2; 307 buffer += 2;
309 308
310 /* Set the range length */ 309 /* Set the range length */
311 310
312 temp8 = (u8) linked_list->data.fixed_io.range_length; 311 temp8 = (u8) resource->data.fixed_io.range_length;
313 312
314 *buffer = temp8; 313 *buffer = temp8;
315 buffer += 1; 314 buffer += 1;
@@ -358,7 +357,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
358 /* The number of bytes consumed are Constant */ 357 /* The number of bytes consumed are Constant */
359 358
360 *bytes_consumed = 3; 359 *bytes_consumed = 3;
361 output_struct->id = ACPI_RSTYPE_DMA; 360 output_struct->type = ACPI_RSTYPE_DMA;
362 361
363 /* Point to the 8-bits of Byte 1 */ 362 /* Point to the 8-bits of Byte 1 */
364 363
@@ -420,7 +419,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
420 * 419 *
421 * FUNCTION: acpi_rs_dma_stream 420 * FUNCTION: acpi_rs_dma_stream
422 * 421 *
423 * PARAMETERS: linked_list - Pointer to the resource linked list 422 * PARAMETERS: Resource - Pointer to the resource linked list
424 * output_buffer - Pointer to the user's return buffer 423 * output_buffer - Pointer to the user's return buffer
425 * bytes_consumed - Pointer to where the number of bytes 424 * bytes_consumed - Pointer to where the number of bytes
426 * used in the output_buffer is returned 425 * used in the output_buffer is returned
@@ -433,7 +432,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
433 ******************************************************************************/ 432 ******************************************************************************/
434 433
435acpi_status 434acpi_status
436acpi_rs_dma_stream(struct acpi_resource *linked_list, 435acpi_rs_dma_stream(struct acpi_resource *resource,
437 u8 ** output_buffer, acpi_size * bytes_consumed) 436 u8 ** output_buffer, acpi_size * bytes_consumed)
438{ 437{
439 u8 *buffer = *output_buffer; 438 u8 *buffer = *output_buffer;
@@ -443,17 +442,16 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
443 442
444 ACPI_FUNCTION_TRACE("rs_dma_stream"); 443 ACPI_FUNCTION_TRACE("rs_dma_stream");
445 444
446 /* The descriptor field is static */ 445 /* The Descriptor Type field is static */
447 446
448 *buffer = 0x2A; 447 *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02;
449 buffer += 1; 448 buffer += 1;
450 temp8 = 0; 449 temp8 = 0;
451 450
452 /* Loop through all of the Channels and set the mask bits */ 451 /* Loop through all of the Channels and set the mask bits */
453 452
454 for (index = 0; 453 for (index = 0; index < resource->data.dma.number_of_channels; index++) {
455 index < linked_list->data.dma.number_of_channels; index++) { 454 temp16 = (u16) resource->data.dma.channels[index];
456 temp16 = (u16) linked_list->data.dma.channels[index];
457 temp8 |= 0x1 << temp16; 455 temp8 |= 0x1 << temp16;
458 } 456 }
459 457
@@ -462,9 +460,9 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
462 460
463 /* Set the DMA Info */ 461 /* Set the DMA Info */
464 462
465 temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); 463 temp8 = (u8) ((resource->data.dma.type & 0x03) << 5);
466 temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); 464 temp8 |= ((resource->data.dma.bus_master & 0x01) << 2);
467 temp8 |= (linked_list->data.dma.transfer & 0x03); 465 temp8 |= (resource->data.dma.transfer & 0x03);
468 466
469 *buffer = temp8; 467 *buffer = temp8;
470 buffer += 1; 468 buffer += 1;
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index 56043fee96cb..75df962115cc 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -88,7 +88,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
88 */ 88 */
89 temp8 = *buffer; 89 temp8 = *buffer;
90 *bytes_consumed = (temp8 & 0x03) + 1; 90 *bytes_consumed = (temp8 & 0x03) + 1;
91 output_struct->id = ACPI_RSTYPE_IRQ; 91 output_struct->type = ACPI_RSTYPE_IRQ;
92 92
93 /* Point to the 16-bits of Bytes 1 and 2 */ 93 /* Point to the 16-bits of Bytes 1 and 2 */
94 94
@@ -177,7 +177,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
177 * 177 *
178 * FUNCTION: acpi_rs_irq_stream 178 * FUNCTION: acpi_rs_irq_stream
179 * 179 *
180 * PARAMETERS: linked_list - Pointer to the resource linked list 180 * PARAMETERS: Resource - Pointer to the resource linked list
181 * output_buffer - Pointer to the user's return buffer 181 * output_buffer - Pointer to the user's return buffer
182 * bytes_consumed - Pointer to where the number of bytes 182 * bytes_consumed - Pointer to where the number of bytes
183 * used in the output_buffer is returned 183 * used in the output_buffer is returned
@@ -190,7 +190,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
190 ******************************************************************************/ 190 ******************************************************************************/
191 191
192acpi_status 192acpi_status
193acpi_rs_irq_stream(struct acpi_resource *linked_list, 193acpi_rs_irq_stream(struct acpi_resource *resource,
194 u8 ** output_buffer, acpi_size * bytes_consumed) 194 u8 ** output_buffer, acpi_size * bytes_consumed)
195{ 195{
196 u8 *buffer = *output_buffer; 196 u8 *buffer = *output_buffer;
@@ -205,13 +205,13 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
205 * The descriptor field is set based upon whether a third byte is 205 * The descriptor field is set based upon whether a third byte is
206 * needed to contain the IRQ Information. 206 * needed to contain the IRQ Information.
207 */ 207 */
208 if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && 208 if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level &&
209 ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && 209 ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low &&
210 ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { 210 ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) {
211 *buffer = 0x22; 211 *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02;
212 IRqinfo_byte_needed = FALSE; 212 IRqinfo_byte_needed = FALSE;
213 } else { 213 } else {
214 *buffer = 0x23; 214 *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03;
215 IRqinfo_byte_needed = TRUE; 215 IRqinfo_byte_needed = TRUE;
216 } 216 }
217 217
@@ -221,8 +221,8 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
221 /* Loop through all of the interrupts and set the mask bits */ 221 /* Loop through all of the interrupts and set the mask bits */
222 222
223 for (index = 0; 223 for (index = 0;
224 index < linked_list->data.irq.number_of_interrupts; index++) { 224 index < resource->data.irq.number_of_interrupts; index++) {
225 temp8 = (u8) linked_list->data.irq.interrupts[index]; 225 temp8 = (u8) resource->data.irq.interrupts[index];
226 temp16 |= 0x1 << temp8; 226 temp16 |= 0x1 << temp8;
227 } 227 }
228 228
@@ -233,11 +233,11 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
233 233
234 if (IRqinfo_byte_needed) { 234 if (IRqinfo_byte_needed) {
235 temp8 = 0; 235 temp8 = 0;
236 temp8 = (u8) ((linked_list->data.irq.shared_exclusive & 236 temp8 = (u8) ((resource->data.irq.shared_exclusive &
237 0x01) << 4); 237 0x01) << 4);
238 238
239 if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && 239 if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level &&
240 ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { 240 ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) {
241 temp8 |= 0x08; 241 temp8 |= 0x08;
242 } else { 242 } else {
243 temp8 |= 0x01; 243 temp8 |= 0x01;
@@ -302,7 +302,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
302 } 302 }
303 303
304 *bytes_consumed = temp16 + 3; 304 *bytes_consumed = temp16 + 3;
305 output_struct->id = ACPI_RSTYPE_EXT_IRQ; 305 output_struct->type = ACPI_RSTYPE_EXT_IRQ;
306 306
307 /* Point to the Byte3 */ 307 /* Point to the Byte3 */
308 308
@@ -441,7 +441,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
441 * 441 *
442 * FUNCTION: acpi_rs_extended_irq_stream 442 * FUNCTION: acpi_rs_extended_irq_stream
443 * 443 *
444 * PARAMETERS: linked_list - Pointer to the resource linked list 444 * PARAMETERS: Resource - Pointer to the resource linked list
445 * output_buffer - Pointer to the user's return buffer 445 * output_buffer - Pointer to the user's return buffer
446 * bytes_consumed - Pointer to where the number of bytes 446 * bytes_consumed - Pointer to where the number of bytes
447 * used in the output_buffer is returned 447 * used in the output_buffer is returned
@@ -454,7 +454,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
454 ******************************************************************************/ 454 ******************************************************************************/
455 455
456acpi_status 456acpi_status
457acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, 457acpi_rs_extended_irq_stream(struct acpi_resource *resource,
458 u8 ** output_buffer, acpi_size * bytes_consumed) 458 u8 ** output_buffer, acpi_size * bytes_consumed)
459{ 459{
460 u8 *buffer = *output_buffer; 460 u8 *buffer = *output_buffer;
@@ -476,9 +476,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
476 476
477 /* Set the Interrupt vector flags */ 477 /* Set the Interrupt vector flags */
478 478
479 temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); 479 temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01);
480 temp8 |= 480 temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3);
481 ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
482 481
483 /* 482 /*
484 * Set the Interrupt Mode 483 * Set the Interrupt Mode
@@ -489,44 +488,44 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
489 * 488 *
490 * - Edge/Level are defined opposite in the table vs the headers 489 * - Edge/Level are defined opposite in the table vs the headers
491 */ 490 */
492 if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) { 491 if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) {
493 temp8 |= 0x2; 492 temp8 |= 0x2;
494 } 493 }
495 494
496 /* Set the Interrupt Polarity */ 495 /* Set the Interrupt Polarity */
497 496
498 temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); 497 temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2);
499 498
500 *buffer = temp8; 499 *buffer = temp8;
501 buffer += 1; 500 buffer += 1;
502 501
503 /* Set the Interrupt table length */ 502 /* Set the Interrupt table length */
504 503
505 temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; 504 temp8 = (u8) resource->data.extended_irq.number_of_interrupts;
506 505
507 *buffer = temp8; 506 *buffer = temp8;
508 buffer += 1; 507 buffer += 1;
509 508
510 for (index = 0; 509 for (index = 0;
511 index < linked_list->data.extended_irq.number_of_interrupts; 510 index < resource->data.extended_irq.number_of_interrupts;
512 index++) { 511 index++) {
513 ACPI_MOVE_32_TO_32(buffer, 512 ACPI_MOVE_32_TO_32(buffer,
514 &linked_list->data.extended_irq. 513 &resource->data.extended_irq.
515 interrupts[index]); 514 interrupts[index]);
516 buffer += 4; 515 buffer += 4;
517 } 516 }
518 517
519 /* Resource Source Index and Resource Source are optional */ 518 /* Resource Source Index and Resource Source are optional */
520 519
521 if (0 != linked_list->data.extended_irq.resource_source.string_length) { 520 if (0 != resource->data.extended_irq.resource_source.string_length) {
522 *buffer = 521 *buffer =
523 (u8) linked_list->data.extended_irq.resource_source.index; 522 (u8) resource->data.extended_irq.resource_source.index;
524 buffer += 1; 523 buffer += 1;
525 524
526 /* Copy the string */ 525 /* Copy the string */
527 526
528 ACPI_STRCPY((char *)buffer, 527 ACPI_STRCPY((char *)buffer,
529 linked_list->data.extended_irq.resource_source. 528 resource->data.extended_irq.resource_source.
530 string_ptr); 529 string_ptr);
531 530
532 /* 531 /*
@@ -535,8 +534,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
535 */ 534 */
536 buffer += 535 buffer +=
537 (acpi_size) (ACPI_STRLEN 536 (acpi_size) (ACPI_STRLEN
538 (linked_list->data.extended_irq. 537 (resource->data.extended_irq.resource_source.
539 resource_source.string_ptr) + 1); 538 string_ptr) + 1);
540 } 539 }
541 540
542 /* Return the number of bytes consumed in this operation */ 541 /* Return the number of bytes consumed in this operation */
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 103eb31c284e..87e75349dd0a 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -47,44 +47,143 @@
47#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
48ACPI_MODULE_NAME("rslist") 48ACPI_MODULE_NAME("rslist")
49 49
50/* Dispatch table for convert-to-stream functions */
51typedef
52acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource,
53 u8 ** output_buffer,
54 acpi_size * bytes_consumed);
55
56static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = {
57 acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */
58 acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */
59 acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */
60 acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */
61 acpi_rs_io_stream, /* ACPI_RSTYPE_IO */
62 acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */
63 acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */
64 acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */
65 acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */
66 acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */
67 acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */
68 acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */
69 acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */
70 acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */
71 acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */
72 acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */
73};
74
75/* Dispatch tables for convert-to-resource functions */
76
77typedef
78acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer,
79 acpi_size * bytes_consumed,
80 u8 ** output_buffer,
81 acpi_size * structure_size);
82
83static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = {
84 NULL, /* 0x00, Reserved */
85 NULL, /* 0x01, Reserved */
86 NULL, /* 0x02, Reserved */
87 NULL, /* 0x03, Reserved */
88 acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */
89 acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */
90 acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */
91 acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */
92 acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */
93 acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
94 NULL, /* 0x0A, Reserved */
95 NULL, /* 0x0B, Reserved */
96 NULL, /* 0x0C, Reserved */
97 NULL, /* 0x0D, Reserved */
98 acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */
99 acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */
100};
101
102static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = {
103 NULL, /* 0x00, Reserved */
104 acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */
105 acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
106 NULL, /* 0x03, Reserved */
107 acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */
108 acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */
109 acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
110 acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
111 acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
112 acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
113 acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
114 acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
115};
116
117/* Local prototypes */
118
119static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type);
120
50/******************************************************************************* 121/*******************************************************************************
51 * 122 *
52 * FUNCTION: acpi_rs_get_resource_type 123 * FUNCTION: acpi_rs_get_resource_type
53 * 124 *
54 * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor 125 * PARAMETERS: resource_type - Byte 0 of a resource descriptor
55 * 126 *
56 * RETURN: The Resource Type with no extraneous bits 127 * RETURN: The Resource Type with no extraneous bits (except the large/
128 * small bit -- left alone)
57 * 129 *
58 * DESCRIPTION: Extract the Resource Type/Name from the first byte of 130 * DESCRIPTION: Extract the Resource Type/Name from the first byte of
59 * a resource descriptor. 131 * a resource descriptor.
60 * 132 *
61 ******************************************************************************/ 133 ******************************************************************************/
62u8 acpi_rs_get_resource_type(u8 resource_start_byte)
63{
64 134
135u8 acpi_rs_get_resource_type(u8 resource_type)
136{
65 ACPI_FUNCTION_ENTRY(); 137 ACPI_FUNCTION_ENTRY();
66 138
67 /* Determine if this is a small or large resource */ 139 /* Determine if this is a small or large resource */
68 140
69 switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { 141 if (resource_type & ACPI_RDESC_TYPE_LARGE) {
70 case ACPI_RDESC_TYPE_SMALL: 142 /* Large Resource Type -- bits 6:0 contain the name */
143
144 return (resource_type);
145 } else {
146 /* Small Resource Type -- bits 6:3 contain the name */
147
148 return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK));
149 }
150}
151
152/*******************************************************************************
153 *
154 * FUNCTION: acpi_rs_get_resource_handler
155 *
156 * PARAMETERS: resource_type - Byte 0 of a resource descriptor
157 *
158 * RETURN: Pointer to the resource conversion handler
159 *
160 * DESCRIPTION: Extract the Resource Type/Name from the first byte of
161 * a resource descriptor.
162 *
163 ******************************************************************************/
71 164
72 /* Small Resource Type -- Only bits 6:3 are valid */ 165static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
166{
167 ACPI_FUNCTION_ENTRY();
73 168
74 return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); 169 /* Determine if this is a small or large resource */
75 170
76 case ACPI_RDESC_TYPE_LARGE: 171 if (resource_type & ACPI_RDESC_TYPE_LARGE) {
172 /* Large Resource Type -- bits 6:0 contain the name */
77 173
78 /* Large Resource Type -- All bits are valid */ 174 if (resource_type > ACPI_RDESC_LARGE_MAX) {
175 return (NULL);
176 }
79 177
80 return (resource_start_byte); 178 return (acpi_gbl_lg_resource_dispatch[(resource_type &
179 ACPI_RDESC_LARGE_MASK)]);
180 } else {
181 /* Small Resource Type -- bits 6:3 contain the name */
81 182
82 default: 183 return (acpi_gbl_sm_resource_dispatch[((resource_type &
83 /* Invalid type */ 184 ACPI_RDESC_SMALL_MASK)
84 break; 185 >> 3)]);
85 } 186 }
86
87 return (0xFF);
88} 187}
89 188
90/******************************************************************************* 189/*******************************************************************************
@@ -107,228 +206,70 @@ acpi_status
107acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, 206acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
108 u32 byte_stream_buffer_length, u8 * output_buffer) 207 u32 byte_stream_buffer_length, u8 * output_buffer)
109{ 208{
209 u8 *buffer = output_buffer;
110 acpi_status status; 210 acpi_status status;
111 acpi_size bytes_parsed = 0; 211 acpi_size bytes_parsed = 0;
112 u8 resource_type = 0;
113 acpi_size bytes_consumed = 0; 212 acpi_size bytes_consumed = 0;
114 u8 *buffer = output_buffer;
115 acpi_size structure_size = 0; 213 acpi_size structure_size = 0;
116 u8 end_tag_processed = FALSE;
117 struct acpi_resource *resource; 214 struct acpi_resource *resource;
215 ACPI_RESOURCE_HANDLER handler;
118 216
119 ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); 217 ACPI_FUNCTION_TRACE("rs_byte_stream_to_list");
120 218
121 while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) { 219 /* Loop until end-of-buffer or an end_tag is found */
122 /* The next byte in the stream is the resource type */ 220
123 221 while (bytes_parsed < byte_stream_buffer_length) {
124 resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); 222 /* Get the handler associated with this Descriptor Type */
125 223
126 switch (resource_type) { 224 handler = acpi_rs_get_resource_handler(*byte_stream_buffer);
127 case ACPI_RDESC_TYPE_MEMORY_24: 225 if (handler) {
128 /* 226 /* Convert a byte stream resource to local resource struct */
129 * 24-Bit Memory Resource 227
130 */ 228 status = handler(byte_stream_buffer, &bytes_consumed,
131 status = acpi_rs_memory24_resource(byte_stream_buffer, 229 &buffer, &structure_size);
132 &bytes_consumed, 230 } else {
133 &buffer, 231 /* Invalid resource type */
134 &structure_size); 232
135 break;
136
137 case ACPI_RDESC_TYPE_LARGE_VENDOR:
138 /*
139 * Vendor Defined Resource
140 */
141 status = acpi_rs_vendor_resource(byte_stream_buffer,
142 &bytes_consumed,
143 &buffer,
144 &structure_size);
145 break;
146
147 case ACPI_RDESC_TYPE_MEMORY_32:
148 /*
149 * 32-Bit Memory Range Resource
150 */
151 status =
152 acpi_rs_memory32_range_resource(byte_stream_buffer,
153 &bytes_consumed,
154 &buffer,
155 &structure_size);
156 break;
157
158 case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
159 /*
160 * 32-Bit Fixed Memory Resource
161 */
162 status =
163 acpi_rs_fixed_memory32_resource(byte_stream_buffer,
164 &bytes_consumed,
165 &buffer,
166 &structure_size);
167 break;
168
169 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
170 case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
171 /*
172 * 64-Bit Address Resource
173 */
174 status = acpi_rs_address64_resource(byte_stream_buffer,
175 &bytes_consumed,
176 &buffer,
177 &structure_size);
178 break;
179
180 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
181 /*
182 * 32-Bit Address Resource
183 */
184 status = acpi_rs_address32_resource(byte_stream_buffer,
185 &bytes_consumed,
186 &buffer,
187 &structure_size);
188 break;
189
190 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
191 /*
192 * 16-Bit Address Resource
193 */
194 status = acpi_rs_address16_resource(byte_stream_buffer,
195 &bytes_consumed,
196 &buffer,
197 &structure_size);
198 break;
199
200 case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
201 /*
202 * Extended IRQ
203 */
204 status =
205 acpi_rs_extended_irq_resource(byte_stream_buffer,
206 &bytes_consumed,
207 &buffer,
208 &structure_size);
209 break;
210
211 case ACPI_RDESC_TYPE_IRQ_FORMAT:
212 /*
213 * IRQ Resource
214 */
215 status = acpi_rs_irq_resource(byte_stream_buffer,
216 &bytes_consumed, &buffer,
217 &structure_size);
218 break;
219
220 case ACPI_RDESC_TYPE_DMA_FORMAT:
221 /*
222 * DMA Resource
223 */
224 status = acpi_rs_dma_resource(byte_stream_buffer,
225 &bytes_consumed, &buffer,
226 &structure_size);
227 break;
228
229 case ACPI_RDESC_TYPE_START_DEPENDENT:
230 /*
231 * Start Dependent Functions Resource
232 */
233 status =
234 acpi_rs_start_depend_fns_resource
235 (byte_stream_buffer, &bytes_consumed, &buffer,
236 &structure_size);
237 break;
238
239 case ACPI_RDESC_TYPE_END_DEPENDENT:
240 /*
241 * End Dependent Functions Resource
242 */
243 status =
244 acpi_rs_end_depend_fns_resource(byte_stream_buffer,
245 &bytes_consumed,
246 &buffer,
247 &structure_size);
248 break;
249
250 case ACPI_RDESC_TYPE_IO_PORT:
251 /*
252 * IO Port Resource
253 */
254 status = acpi_rs_io_resource(byte_stream_buffer,
255 &bytes_consumed, &buffer,
256 &structure_size);
257 break;
258
259 case ACPI_RDESC_TYPE_FIXED_IO_PORT:
260 /*
261 * Fixed IO Port Resource
262 */
263 status = acpi_rs_fixed_io_resource(byte_stream_buffer,
264 &bytes_consumed,
265 &buffer,
266 &structure_size);
267 break;
268
269 case ACPI_RDESC_TYPE_SMALL_VENDOR:
270 /*
271 * Vendor Specific Resource
272 */
273 status = acpi_rs_vendor_resource(byte_stream_buffer,
274 &bytes_consumed,
275 &buffer,
276 &structure_size);
277 break;
278
279 case ACPI_RDESC_TYPE_END_TAG:
280 /*
281 * End Tag
282 */
283 end_tag_processed = TRUE;
284 status = acpi_rs_end_tag_resource(byte_stream_buffer,
285 &bytes_consumed,
286 &buffer,
287 &structure_size);
288 break;
289
290 default:
291 /*
292 * Invalid/Unknown resource type
293 */
294 status = AE_AML_INVALID_RESOURCE_TYPE; 233 status = AE_AML_INVALID_RESOURCE_TYPE;
295 break;
296 } 234 }
297 235
298 if (ACPI_FAILURE(status)) { 236 if (ACPI_FAILURE(status)) {
299 return_ACPI_STATUS(status); 237 return_ACPI_STATUS(status);
300 } 238 }
301 239
302 /* Update the return value and counter */ 240 /* Set the aligned length of the new resource descriptor */
303 241
304 bytes_parsed += bytes_consumed; 242 resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
243 resource->length =
244 (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
305 245
306 /* Set the byte stream to point to the next resource */ 246 /* Normal exit on completion of an end_tag resource descriptor */
307 247
248 if (acpi_rs_get_resource_type(*byte_stream_buffer) ==
249 ACPI_RDESC_TYPE_END_TAG) {
250 return_ACPI_STATUS(AE_OK);
251 }
252
253 /* Update counter and point to the next input resource */
254
255 bytes_parsed += bytes_consumed;
308 byte_stream_buffer += bytes_consumed; 256 byte_stream_buffer += bytes_consumed;
309 257
310 /* Set the Buffer to the next structure */ 258 /* Point to the next structure in the output buffer */
311 259
312 resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
313 resource->length =
314 (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
315 buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); 260 buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
316 } 261 }
317 262
318 /* Check the reason for exiting the while loop */ 263 /* Completed buffer, but did not find an end_tag resource descriptor */
319 264
320 if (!end_tag_processed) { 265 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
321 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
322 }
323
324 return_ACPI_STATUS(AE_OK);
325} 266}
326 267
327/******************************************************************************* 268/*******************************************************************************
328 * 269 *
329 * FUNCTION: acpi_rs_list_to_byte_stream 270 * FUNCTION: acpi_rs_list_to_byte_stream
330 * 271 *
331 * PARAMETERS: linked_list - Pointer to the resource linked list 272 * PARAMETERS: Resource - Pointer to the resource linked list
332 * byte_steam_size_needed - Calculated size of the byte stream 273 * byte_steam_size_needed - Calculated size of the byte stream
333 * needed from calling 274 * needed from calling
334 * acpi_rs_get_byte_stream_length() 275 * acpi_rs_get_byte_stream_length()
@@ -346,180 +287,52 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
346 ******************************************************************************/ 287 ******************************************************************************/
347 288
348acpi_status 289acpi_status
349acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, 290acpi_rs_list_to_byte_stream(struct acpi_resource *resource,
350 acpi_size byte_stream_size_needed, 291 acpi_size byte_stream_size_needed,
351 u8 * output_buffer) 292 u8 * output_buffer)
352{ 293{
353 acpi_status status;
354 u8 *buffer = output_buffer; 294 u8 *buffer = output_buffer;
355 acpi_size bytes_consumed = 0; 295 acpi_size bytes_consumed = 0;
356 u8 done = FALSE; 296 acpi_status status;
357 297
358 ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); 298 ACPI_FUNCTION_TRACE("rs_list_to_byte_stream");
359 299
360 while (!done) { 300 /* Convert each resource descriptor in the list */
361 switch (linked_list->id) {
362 case ACPI_RSTYPE_IRQ:
363 /*
364 * IRQ Resource
365 */
366 status =
367 acpi_rs_irq_stream(linked_list, &buffer,
368 &bytes_consumed);
369 break;
370
371 case ACPI_RSTYPE_DMA:
372 /*
373 * DMA Resource
374 */
375 status =
376 acpi_rs_dma_stream(linked_list, &buffer,
377 &bytes_consumed);
378 break;
379
380 case ACPI_RSTYPE_START_DPF:
381 /*
382 * Start Dependent Functions Resource
383 */
384 status = acpi_rs_start_depend_fns_stream(linked_list,
385 &buffer,
386 &bytes_consumed);
387 break;
388
389 case ACPI_RSTYPE_END_DPF:
390 /*
391 * End Dependent Functions Resource
392 */
393 status = acpi_rs_end_depend_fns_stream(linked_list,
394 &buffer,
395 &bytes_consumed);
396 break;
397
398 case ACPI_RSTYPE_IO:
399 /*
400 * IO Port Resource
401 */
402 status =
403 acpi_rs_io_stream(linked_list, &buffer,
404 &bytes_consumed);
405 break;
406
407 case ACPI_RSTYPE_FIXED_IO:
408 /*
409 * Fixed IO Port Resource
410 */
411 status =
412 acpi_rs_fixed_io_stream(linked_list, &buffer,
413 &bytes_consumed);
414 break;
415
416 case ACPI_RSTYPE_VENDOR:
417 /*
418 * Vendor Defined Resource
419 */
420 status =
421 acpi_rs_vendor_stream(linked_list, &buffer,
422 &bytes_consumed);
423 break;
424
425 case ACPI_RSTYPE_END_TAG:
426 /*
427 * End Tag
428 */
429 status =
430 acpi_rs_end_tag_stream(linked_list, &buffer,
431 &bytes_consumed);
432 301
433 /* An End Tag indicates the end of the Resource Template */ 302 while (1) {
303 /* Validate Type before dispatch */
434 304
435 done = TRUE; 305 if (resource->type > ACPI_RSTYPE_MAX) {
436 break;
437
438 case ACPI_RSTYPE_MEM24:
439 /*
440 * 24-Bit Memory Resource
441 */
442 status =
443 acpi_rs_memory24_stream(linked_list, &buffer,
444 &bytes_consumed);
445 break;
446
447 case ACPI_RSTYPE_MEM32:
448 /*
449 * 32-Bit Memory Range Resource
450 */
451 status =
452 acpi_rs_memory32_range_stream(linked_list, &buffer,
453 &bytes_consumed);
454 break;
455
456 case ACPI_RSTYPE_FIXED_MEM32:
457 /*
458 * 32-Bit Fixed Memory Resource
459 */
460 status =
461 acpi_rs_fixed_memory32_stream(linked_list, &buffer,
462 &bytes_consumed);
463 break;
464
465 case ACPI_RSTYPE_ADDRESS16:
466 /*
467 * 16-Bit Address Descriptor Resource
468 */
469 status = acpi_rs_address16_stream(linked_list, &buffer,
470 &bytes_consumed);
471 break;
472
473 case ACPI_RSTYPE_ADDRESS32:
474 /*
475 * 32-Bit Address Descriptor Resource
476 */
477 status = acpi_rs_address32_stream(linked_list, &buffer,
478 &bytes_consumed);
479 break;
480
481 case ACPI_RSTYPE_ADDRESS64:
482 /*
483 * 64-Bit Address Descriptor Resource
484 */
485 status = acpi_rs_address64_stream(linked_list, &buffer,
486 &bytes_consumed);
487 break;
488
489 case ACPI_RSTYPE_EXT_IRQ:
490 /*
491 * Extended IRQ Resource
492 */
493 status =
494 acpi_rs_extended_irq_stream(linked_list, &buffer,
495 &bytes_consumed);
496 break;
497
498 default:
499 /*
500 * If we get here, everything is out of sync,
501 * so exit with an error
502 */
503 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 306 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
504 "Invalid descriptor type (%X) in resource list\n", 307 "Invalid descriptor type (%X) in resource list\n",
505 linked_list->id)); 308 resource->type));
506 status = AE_BAD_DATA; 309 return_ACPI_STATUS(AE_BAD_DATA);
507 break;
508 } 310 }
509 311
312 /* Perform the conversion, per resource type */
313
314 status = acpi_gbl_stream_dispatch[resource->type] (resource,
315 &buffer,
316 &bytes_consumed);
510 if (ACPI_FAILURE(status)) { 317 if (ACPI_FAILURE(status)) {
511 return_ACPI_STATUS(status); 318 return_ACPI_STATUS(status);
512 } 319 }
513 320
514 /* Set the Buffer to point to the open byte */ 321 /* Check for end-of-list */
322
323 if (resource->type == ACPI_RSTYPE_END_TAG) {
324 /* An End Tag indicates the end of the Resource Template */
325
326 return_ACPI_STATUS(AE_OK);
327 }
328
329 /* Set the Buffer to point to the next (output) resource descriptor */
515 330
516 buffer += bytes_consumed; 331 buffer += bytes_consumed;
517 332
518 /* Point to the next object */ 333 /* Point to the next input resource object */
519 334
520 linked_list = ACPI_PTR_ADD(struct acpi_resource, 335 resource = ACPI_PTR_ADD(struct acpi_resource,
521 linked_list, linked_list->length); 336 resource, resource->length);
522 } 337 }
523
524 return_ACPI_STATUS(AE_OK);
525} 338}
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index daba1a1ed46d..418f1afb10a3 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -84,11 +84,11 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
84 /* Point past the Descriptor to get the number of bytes consumed */ 84 /* Point past the Descriptor to get the number of bytes consumed */
85 85
86 buffer += 1; 86 buffer += 1;
87
88 ACPI_MOVE_16_TO_16(&temp16, buffer); 87 ACPI_MOVE_16_TO_16(&temp16, buffer);
88
89 buffer += 2; 89 buffer += 2;
90 *bytes_consumed = (acpi_size) temp16 + 3; 90 *bytes_consumed = (acpi_size) temp16 + 3;
91 output_struct->id = ACPI_RSTYPE_MEM24; 91 output_struct->type = ACPI_RSTYPE_MEM24;
92 92
93 /* Check Byte 3 the Read/Write bit */ 93 /* Check Byte 3 the Read/Write bit */
94 94
@@ -133,7 +133,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
133 * 133 *
134 * FUNCTION: acpi_rs_memory24_stream 134 * FUNCTION: acpi_rs_memory24_stream
135 * 135 *
136 * PARAMETERS: linked_list - Pointer to the resource linked list 136 * PARAMETERS: Resource - Pointer to the resource linked list
137 * output_buffer - Pointer to the user's return buffer 137 * output_buffer - Pointer to the user's return buffer
138 * bytes_consumed - Pointer to where the number of bytes 138 * bytes_consumed - Pointer to where the number of bytes
139 * used in the output_buffer is returned 139 * used in the output_buffer is returned
@@ -146,7 +146,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
146 ******************************************************************************/ 146 ******************************************************************************/
147 147
148acpi_status 148acpi_status
149acpi_rs_memory24_stream(struct acpi_resource *linked_list, 149acpi_rs_memory24_stream(struct acpi_resource *resource,
150 u8 ** output_buffer, acpi_size * bytes_consumed) 150 u8 ** output_buffer, acpi_size * bytes_consumed)
151{ 151{
152 u8 *buffer = *output_buffer; 152 u8 *buffer = *output_buffer;
@@ -155,9 +155,9 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
155 155
156 ACPI_FUNCTION_TRACE("rs_memory24_stream"); 156 ACPI_FUNCTION_TRACE("rs_memory24_stream");
157 157
158 /* The descriptor field is static */ 158 /* The Descriptor Type field is static */
159 159
160 *buffer = 0x81; 160 *buffer = ACPI_RDESC_TYPE_MEMORY_24;
161 buffer += 1; 161 buffer += 1;
162 162
163 /* The length field is static */ 163 /* The length field is static */
@@ -168,30 +168,28 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
168 168
169 /* Set the Information Byte */ 169 /* Set the Information Byte */
170 170
171 temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); 171 temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01);
172 *buffer = temp8; 172 *buffer = temp8;
173 buffer += 1; 173 buffer += 1;
174 174
175 /* Set the Range minimum base address */ 175 /* Set the Range minimum base address */
176 176
177 ACPI_MOVE_32_TO_16(buffer, 177 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address);
178 &linked_list->data.memory24.min_base_address);
179 buffer += 2; 178 buffer += 2;
180 179
181 /* Set the Range maximum base address */ 180 /* Set the Range maximum base address */
182 181
183 ACPI_MOVE_32_TO_16(buffer, 182 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address);
184 &linked_list->data.memory24.max_base_address);
185 buffer += 2; 183 buffer += 2;
186 184
187 /* Set the base alignment */ 185 /* Set the base alignment */
188 186
189 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment); 187 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment);
190 buffer += 2; 188 buffer += 2;
191 189
192 /* Set the range length */ 190 /* Set the range length */
193 191
194 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length); 192 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length);
195 buffer += 2; 193 buffer += 2;
196 194
197 /* Return the number of bytes consumed in this operation */ 195 /* Return the number of bytes consumed in this operation */
@@ -238,12 +236,11 @@ acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
238 /* Point past the Descriptor to get the number of bytes consumed */ 236 /* Point past the Descriptor to get the number of bytes consumed */
239 237
240 buffer += 1; 238 buffer += 1;
241
242 ACPI_MOVE_16_TO_16(&temp16, buffer); 239 ACPI_MOVE_16_TO_16(&temp16, buffer);
240
243 buffer += 2; 241 buffer += 2;
244 *bytes_consumed = (acpi_size) temp16 + 3; 242 *bytes_consumed = (acpi_size) temp16 + 3;
245 243 output_struct->type = ACPI_RSTYPE_MEM32;
246 output_struct->id = ACPI_RSTYPE_MEM32;
247 244
248 /* 245 /*
249 * Point to the place in the output buffer where the data portion will 246 * Point to the place in the output buffer where the data portion will
@@ -335,8 +332,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
335 332
336 buffer += 2; 333 buffer += 2;
337 *bytes_consumed = (acpi_size) temp16 + 3; 334 *bytes_consumed = (acpi_size) temp16 + 3;
338 335 output_struct->type = ACPI_RSTYPE_FIXED_MEM32;
339 output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
340 336
341 /* Check Byte 3 the Read/Write bit */ 337 /* Check Byte 3 the Read/Write bit */
342 338
@@ -369,7 +365,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
369 * 365 *
370 * FUNCTION: acpi_rs_memory32_range_stream 366 * FUNCTION: acpi_rs_memory32_range_stream
371 * 367 *
372 * PARAMETERS: linked_list - Pointer to the resource linked list 368 * PARAMETERS: Resource - Pointer to the resource linked list
373 * output_buffer - Pointer to the user's return buffer 369 * output_buffer - Pointer to the user's return buffer
374 * bytes_consumed - Pointer to where the number of bytes 370 * bytes_consumed - Pointer to where the number of bytes
375 * used in the output_buffer is returned 371 * used in the output_buffer is returned
@@ -382,7 +378,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
382 ******************************************************************************/ 378 ******************************************************************************/
383 379
384acpi_status 380acpi_status
385acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, 381acpi_rs_memory32_range_stream(struct acpi_resource *resource,
386 u8 ** output_buffer, acpi_size * bytes_consumed) 382 u8 ** output_buffer, acpi_size * bytes_consumed)
387{ 383{
388 u8 *buffer = *output_buffer; 384 u8 *buffer = *output_buffer;
@@ -391,9 +387,9 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
391 387
392 ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); 388 ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
393 389
394 /* The descriptor field is static */ 390 /* The Descriptor Type field is static */
395 391
396 *buffer = 0x85; 392 *buffer = ACPI_RDESC_TYPE_MEMORY_32;
397 buffer += 1; 393 buffer += 1;
398 394
399 /* The length field is static */ 395 /* The length field is static */
@@ -405,30 +401,28 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
405 401
406 /* Set the Information Byte */ 402 /* Set the Information Byte */
407 403
408 temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); 404 temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01);
409 *buffer = temp8; 405 *buffer = temp8;
410 buffer += 1; 406 buffer += 1;
411 407
412 /* Set the Range minimum base address */ 408 /* Set the Range minimum base address */
413 409
414 ACPI_MOVE_32_TO_32(buffer, 410 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address);
415 &linked_list->data.memory32.min_base_address);
416 buffer += 4; 411 buffer += 4;
417 412
418 /* Set the Range maximum base address */ 413 /* Set the Range maximum base address */
419 414
420 ACPI_MOVE_32_TO_32(buffer, 415 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address);
421 &linked_list->data.memory32.max_base_address);
422 buffer += 4; 416 buffer += 4;
423 417
424 /* Set the base alignment */ 418 /* Set the base alignment */
425 419
426 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment); 420 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment);
427 buffer += 4; 421 buffer += 4;
428 422
429 /* Set the range length */ 423 /* Set the range length */
430 424
431 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length); 425 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length);
432 buffer += 4; 426 buffer += 4;
433 427
434 /* Return the number of bytes consumed in this operation */ 428 /* Return the number of bytes consumed in this operation */
@@ -441,7 +435,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
441 * 435 *
442 * FUNCTION: acpi_rs_fixed_memory32_stream 436 * FUNCTION: acpi_rs_fixed_memory32_stream
443 * 437 *
444 * PARAMETERS: linked_list - Pointer to the resource linked list 438 * PARAMETERS: Resource - Pointer to the resource linked list
445 * output_buffer - Pointer to the user's return buffer 439 * output_buffer - Pointer to the user's return buffer
446 * bytes_consumed - Pointer to where the number of bytes 440 * bytes_consumed - Pointer to where the number of bytes
447 * used in the output_buffer is returned 441 * used in the output_buffer is returned
@@ -454,7 +448,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
454 ******************************************************************************/ 448 ******************************************************************************/
455 449
456acpi_status 450acpi_status
457acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, 451acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
458 u8 ** output_buffer, acpi_size * bytes_consumed) 452 u8 ** output_buffer, acpi_size * bytes_consumed)
459{ 453{
460 u8 *buffer = *output_buffer; 454 u8 *buffer = *output_buffer;
@@ -463,9 +457,9 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
463 457
464 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); 458 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
465 459
466 /* The descriptor field is static */ 460 /* The Descriptor Type field is static */
467 461
468 *buffer = 0x86; 462 *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
469 buffer += 1; 463 buffer += 1;
470 464
471 /* The length field is static */ 465 /* The length field is static */
@@ -478,21 +472,19 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
478 /* Set the Information Byte */ 472 /* Set the Information Byte */
479 473
480 temp8 = 474 temp8 =
481 (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); 475 (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01);
482 *buffer = temp8; 476 *buffer = temp8;
483 buffer += 1; 477 buffer += 1;
484 478
485 /* Set the Range base address */ 479 /* Set the Range base address */
486 480
487 ACPI_MOVE_32_TO_32(buffer, 481 ACPI_MOVE_32_TO_32(buffer,
488 &linked_list->data.fixed_memory32. 482 &resource->data.fixed_memory32.range_base_address);
489 range_base_address);
490 buffer += 4; 483 buffer += 4;
491 484
492 /* Set the range length */ 485 /* Set the range length */
493 486
494 ACPI_MOVE_32_TO_32(buffer, 487 ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length);
495 &linked_list->data.fixed_memory32.range_length);
496 buffer += 4; 488 buffer += 4;
497 489
498 /* Return the number of bytes consumed in this operation */ 490 /* Return the number of bytes consumed in this operation */
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index 7a8a34e757f5..fa7f5a85b61d 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -49,6 +49,169 @@ ACPI_MODULE_NAME("rsmisc")
49 49
50/******************************************************************************* 50/*******************************************************************************
51 * 51 *
52 * FUNCTION: acpi_rs_generic_register_resource
53 *
54 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
55 * stream
56 * bytes_consumed - Pointer to where the number of bytes
57 * consumed the byte_stream_buffer is
58 * returned
59 * output_buffer - Pointer to the return data buffer
60 * structure_size - Pointer to where the number of bytes
61 * in the return data struct is returned
62 *
63 * RETURN: Status
64 *
65 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
66 * structure pointed to by the output_buffer. Return the
67 * number of bytes consumed from the byte stream.
68 *
69 ******************************************************************************/
70acpi_status
71acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
72 acpi_size * bytes_consumed,
73 u8 ** output_buffer,
74 acpi_size * structure_size)
75{
76 u8 *buffer = byte_stream_buffer;
77 struct acpi_resource *output_struct = (void *)*output_buffer;
78 u16 temp16;
79 u8 temp8;
80 acpi_size struct_size =
81 ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg);
82
83 ACPI_FUNCTION_TRACE("rs_generic_register_resource");
84
85 /* Byte 0 is the Descriptor Type */
86
87 buffer += 1;
88
89 /* Get the Descriptor Length field (Bytes 1-2) */
90
91 ACPI_MOVE_16_TO_16(&temp16, buffer);
92 buffer += 2;
93
94 /* Validate the descriptor length */
95
96 if (temp16 != 12) {
97 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
98 }
99
100 /* The number of bytes consumed is fixed (12 + 3) */
101
102 *bytes_consumed = 15;
103
104 /* Fill out the structure */
105
106 output_struct->type = ACPI_RSTYPE_GENERIC_REG;
107
108 /* Get space_id (Byte 3) */
109
110 temp8 = *buffer;
111 output_struct->data.generic_reg.space_id = temp8;
112 buffer += 1;
113
114 /* Get register_bit_width (Byte 4) */
115
116 temp8 = *buffer;
117 output_struct->data.generic_reg.bit_width = temp8;
118 buffer += 1;
119
120 /* Get register_bit_offset (Byte 5) */
121
122 temp8 = *buffer;
123 output_struct->data.generic_reg.bit_offset = temp8;
124 buffer += 1;
125
126 /* Get address_size (Byte 6) */
127
128 temp8 = *buffer;
129 output_struct->data.generic_reg.address_size = temp8;
130 buffer += 1;
131
132 /* Get register_address (Bytes 7-14) */
133
134 ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer);
135
136 /* Set the Length parameter */
137
138 output_struct->length = (u32) struct_size;
139
140 /* Return the final size of the structure */
141
142 *structure_size = struct_size;
143 return_ACPI_STATUS(AE_OK);
144}
145
146/*******************************************************************************
147 *
148 * FUNCTION: acpi_rs_generic_register_stream
149 *
150 * PARAMETERS: Resource - Pointer to the resource linked list
151 * output_buffer - Pointer to the user's return buffer
152 * bytes_consumed - Pointer to where the number of bytes
153 * used in the output_buffer is returned
154 *
155 * RETURN: Status
156 *
157 * DESCRIPTION: Take the linked list resource structure and fills in the
158 * the appropriate bytes in a byte stream
159 *
160 ******************************************************************************/
161
162acpi_status
163acpi_rs_generic_register_stream(struct acpi_resource *resource,
164 u8 ** output_buffer, acpi_size * bytes_consumed)
165{
166 u8 *buffer = *output_buffer;
167 u16 temp16;
168
169 ACPI_FUNCTION_TRACE("rs_generic_register_stream");
170
171 /* Set the Descriptor Type (Byte 0) */
172
173 *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER;
174 buffer += 1;
175
176 /* Set the Descriptor Length (Bytes 1-2) */
177
178 temp16 = 12;
179 ACPI_MOVE_16_TO_16(buffer, &temp16);
180 buffer += 2;
181
182 /* Set space_id (Byte 3) */
183
184 *buffer = (u8) resource->data.generic_reg.space_id;
185 buffer += 1;
186
187 /* Set register_bit_width (Byte 4) */
188
189 *buffer = (u8) resource->data.generic_reg.bit_width;
190 buffer += 1;
191
192 /* Set register_bit_offset (Byte 5) */
193
194 *buffer = (u8) resource->data.generic_reg.bit_offset;
195 buffer += 1;
196
197 /* Set address_size (Byte 6) */
198
199 *buffer = (u8) resource->data.generic_reg.address_size;
200 buffer += 1;
201
202 /* Set register_address (Bytes 7-14) */
203
204 ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address);
205 buffer += 8;
206
207 /* Return the number of bytes consumed in this operation */
208
209 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
210 return_ACPI_STATUS(AE_OK);
211}
212
213/*******************************************************************************
214 *
52 * FUNCTION: acpi_rs_end_tag_resource 215 * FUNCTION: acpi_rs_end_tag_resource
53 * 216 *
54 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte 217 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
@@ -67,6 +230,7 @@ ACPI_MODULE_NAME("rsmisc")
67 * number of bytes consumed from the byte stream. 230 * number of bytes consumed from the byte stream.
68 * 231 *
69 ******************************************************************************/ 232 ******************************************************************************/
233
70acpi_status 234acpi_status
71acpi_rs_end_tag_resource(u8 * byte_stream_buffer, 235acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
72 acpi_size * bytes_consumed, 236 acpi_size * bytes_consumed,
@@ -81,9 +245,9 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
81 245
82 *bytes_consumed = 2; 246 *bytes_consumed = 2;
83 247
84 /* Fill out the structure */ 248 /* Fill out the structure */
85 249
86 output_struct->id = ACPI_RSTYPE_END_TAG; 250 output_struct->type = ACPI_RSTYPE_END_TAG;
87 251
88 /* Set the Length parameter */ 252 /* Set the Length parameter */
89 253
@@ -99,7 +263,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
99 * 263 *
100 * FUNCTION: acpi_rs_end_tag_stream 264 * FUNCTION: acpi_rs_end_tag_stream
101 * 265 *
102 * PARAMETERS: linked_list - Pointer to the resource linked list 266 * PARAMETERS: Resource - Pointer to the resource linked list
103 * output_buffer - Pointer to the user's return buffer 267 * output_buffer - Pointer to the user's return buffer
104 * bytes_consumed - Pointer to where the number of bytes 268 * bytes_consumed - Pointer to where the number of bytes
105 * used in the output_buffer is returned 269 * used in the output_buffer is returned
@@ -112,7 +276,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
112 ******************************************************************************/ 276 ******************************************************************************/
113 277
114acpi_status 278acpi_status
115acpi_rs_end_tag_stream(struct acpi_resource *linked_list, 279acpi_rs_end_tag_stream(struct acpi_resource *resource,
116 u8 ** output_buffer, acpi_size * bytes_consumed) 280 u8 ** output_buffer, acpi_size * bytes_consumed)
117{ 281{
118 u8 *buffer = *output_buffer; 282 u8 *buffer = *output_buffer;
@@ -120,9 +284,9 @@ acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
120 284
121 ACPI_FUNCTION_TRACE("rs_end_tag_stream"); 285 ACPI_FUNCTION_TRACE("rs_end_tag_stream");
122 286
123 /* The descriptor field is static */ 287 /* The Descriptor Type field is static */
124 288
125 *buffer = 0x79; 289 *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01;
126 buffer += 1; 290 buffer += 1;
127 291
128 /* 292 /*
@@ -180,7 +344,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
180 344
181 temp8 = *buffer; 345 temp8 = *buffer;
182 346
183 if (temp8 & 0x80) { 347 if (temp8 & ACPI_RDESC_TYPE_LARGE) {
184 /* Large Item, point to the length field */ 348 /* Large Item, point to the length field */
185 349
186 buffer += 1; 350 buffer += 1;
@@ -210,7 +374,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
210 buffer += 1; 374 buffer += 1;
211 } 375 }
212 376
213 output_struct->id = ACPI_RSTYPE_VENDOR; 377 output_struct->type = ACPI_RSTYPE_VENDOR;
214 output_struct->data.vendor_specific.length = temp16; 378 output_struct->data.vendor_specific.length = temp16;
215 379
216 for (index = 0; index < temp16; index++) { 380 for (index = 0; index < temp16; index++) {
@@ -239,7 +403,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
239 * 403 *
240 * FUNCTION: acpi_rs_vendor_stream 404 * FUNCTION: acpi_rs_vendor_stream
241 * 405 *
242 * PARAMETERS: linked_list - Pointer to the resource linked list 406 * PARAMETERS: Resource - Pointer to the resource linked list
243 * output_buffer - Pointer to the user's return buffer 407 * output_buffer - Pointer to the user's return buffer
244 * bytes_consumed - Pointer to where the number of bytes 408 * bytes_consumed - Pointer to where the number of bytes
245 * used in the output_buffer is returned 409 * used in the output_buffer is returned
@@ -252,7 +416,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
252 ******************************************************************************/ 416 ******************************************************************************/
253 417
254acpi_status 418acpi_status
255acpi_rs_vendor_stream(struct acpi_resource *linked_list, 419acpi_rs_vendor_stream(struct acpi_resource *resource,
256 u8 ** output_buffer, acpi_size * bytes_consumed) 420 u8 ** output_buffer, acpi_size * bytes_consumed)
257{ 421{
258 u8 *buffer = *output_buffer; 422 u8 *buffer = *output_buffer;
@@ -264,21 +428,21 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list,
264 428
265 /* Dereference the length to find if this is a large or small item. */ 429 /* Dereference the length to find if this is a large or small item. */
266 430
267 if (linked_list->data.vendor_specific.length > 7) { 431 if (resource->data.vendor_specific.length > 7) {
268 /* Large Item, Set the descriptor field and length bytes */ 432 /* Large Item, Set the descriptor field and length bytes */
269 433
270 *buffer = 0x84; 434 *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR;
271 buffer += 1; 435 buffer += 1;
272 436
273 temp16 = (u16) linked_list->data.vendor_specific.length; 437 temp16 = (u16) resource->data.vendor_specific.length;
274 438
275 ACPI_MOVE_16_TO_16(buffer, &temp16); 439 ACPI_MOVE_16_TO_16(buffer, &temp16);
276 buffer += 2; 440 buffer += 2;
277 } else { 441 } else {
278 /* Small Item, Set the descriptor field */ 442 /* Small Item, Set the descriptor field */
279 443
280 temp8 = 0x70; 444 temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR;
281 temp8 |= (u8) linked_list->data.vendor_specific.length; 445 temp8 |= (u8) resource->data.vendor_specific.length;
282 446
283 *buffer = temp8; 447 *buffer = temp8;
284 buffer += 1; 448 buffer += 1;
@@ -286,9 +450,8 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list,
286 450
287 /* Loop through all of the Vendor Specific fields */ 451 /* Loop through all of the Vendor Specific fields */
288 452
289 for (index = 0; index < linked_list->data.vendor_specific.length; 453 for (index = 0; index < resource->data.vendor_specific.length; index++) {
290 index++) { 454 temp8 = resource->data.vendor_specific.reserved[index];
291 temp8 = linked_list->data.vendor_specific.reserved[index];
292 455
293 *buffer = temp8; 456 *buffer = temp8;
294 buffer += 1; 457 buffer += 1;
@@ -341,7 +504,7 @@ acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
341 504
342 *bytes_consumed = (temp8 & 0x01) + 1; 505 *bytes_consumed = (temp8 & 0x01) + 1;
343 506
344 output_struct->id = ACPI_RSTYPE_START_DPF; 507 output_struct->type = ACPI_RSTYPE_START_DPF;
345 508
346 /* Point to Byte 1 if it is used */ 509 /* Point to Byte 1 if it is used */
347 510
@@ -421,7 +584,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
421 584
422 /* Fill out the structure */ 585 /* Fill out the structure */
423 586
424 output_struct->id = ACPI_RSTYPE_END_DPF; 587 output_struct->type = ACPI_RSTYPE_END_DPF;
425 588
426 /* Set the Length parameter */ 589 /* Set the Length parameter */
427 590
@@ -437,7 +600,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
437 * 600 *
438 * FUNCTION: acpi_rs_start_depend_fns_stream 601 * FUNCTION: acpi_rs_start_depend_fns_stream
439 * 602 *
440 * PARAMETERS: linked_list - Pointer to the resource linked list 603 * PARAMETERS: Resource - Pointer to the resource linked list
441 * output_buffer - Pointer to the user's return buffer 604 * output_buffer - Pointer to the user's return buffer
442 * bytes_consumed - u32 pointer that is filled with 605 * bytes_consumed - u32 pointer that is filled with
443 * the number of bytes of the 606 * the number of bytes of the
@@ -451,7 +614,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
451 ******************************************************************************/ 614 ******************************************************************************/
452 615
453acpi_status 616acpi_status
454acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, 617acpi_rs_start_depend_fns_stream(struct acpi_resource *resource,
455 u8 ** output_buffer, acpi_size * bytes_consumed) 618 u8 ** output_buffer, acpi_size * bytes_consumed)
456{ 619{
457 u8 *buffer = *output_buffer; 620 u8 *buffer = *output_buffer;
@@ -460,26 +623,25 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
460 ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); 623 ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
461 624
462 /* 625 /*
463 * The descriptor field is set based upon whether a byte is needed 626 * The descriptor type field is set based upon whether a byte is needed
464 * to contain Priority data. 627 * to contain Priority data.
465 */ 628 */
466 if (ACPI_ACCEPTABLE_CONFIGURATION == 629 if (ACPI_ACCEPTABLE_CONFIGURATION ==
467 linked_list->data.start_dpf.compatibility_priority && 630 resource->data.start_dpf.compatibility_priority &&
468 ACPI_ACCEPTABLE_CONFIGURATION == 631 ACPI_ACCEPTABLE_CONFIGURATION ==
469 linked_list->data.start_dpf.performance_robustness) { 632 resource->data.start_dpf.performance_robustness) {
470 *buffer = 0x30; 633 *buffer = ACPI_RDESC_TYPE_START_DEPENDENT;
471 } else { 634 } else {
472 *buffer = 0x31; 635 *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01;
473 buffer += 1; 636 buffer += 1;
474 637
475 /* Set the Priority Byte Definition */ 638 /* Set the Priority Byte Definition */
476 639
477 temp8 = 0; 640 temp8 = 0;
478 temp8 = 641 temp8 = (u8) ((resource->data.start_dpf.performance_robustness &
479 (u8) ((linked_list->data.start_dpf. 642 0x03) << 2);
480 performance_robustness & 0x03) << 2); 643 temp8 |= (resource->data.start_dpf.compatibility_priority &
481 temp8 |= 644 0x03);
482 (linked_list->data.start_dpf.compatibility_priority & 0x03);
483 *buffer = temp8; 645 *buffer = temp8;
484 } 646 }
485 647
@@ -495,7 +657,7 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
495 * 657 *
496 * FUNCTION: acpi_rs_end_depend_fns_stream 658 * FUNCTION: acpi_rs_end_depend_fns_stream
497 * 659 *
498 * PARAMETERS: linked_list - Pointer to the resource linked list 660 * PARAMETERS: Resource - Pointer to the resource linked list
499 * output_buffer - Pointer to the user's return buffer 661 * output_buffer - Pointer to the user's return buffer
500 * bytes_consumed - Pointer to where the number of bytes 662 * bytes_consumed - Pointer to where the number of bytes
501 * used in the output_buffer is returned 663 * used in the output_buffer is returned
@@ -508,16 +670,16 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
508 ******************************************************************************/ 670 ******************************************************************************/
509 671
510acpi_status 672acpi_status
511acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, 673acpi_rs_end_depend_fns_stream(struct acpi_resource *resource,
512 u8 ** output_buffer, acpi_size * bytes_consumed) 674 u8 ** output_buffer, acpi_size * bytes_consumed)
513{ 675{
514 u8 *buffer = *output_buffer; 676 u8 *buffer = *output_buffer;
515 677
516 ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); 678 ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
517 679
518 /* The descriptor field is static */ 680 /* The Descriptor Type field is static */
519 681
520 *buffer = 0x38; 682 *buffer = ACPI_RDESC_TYPE_END_DEPENDENT;
521 buffer += 1; 683 buffer += 1;
522 684
523 /* Return the number of bytes consumed in this operation */ 685 /* Return the number of bytes consumed in this operation */
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index ee5a5c509199..1a87c4c7bd97 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle,
269 /* Walk the resource list */ 269 /* Walk the resource list */
270 270
271 for (;;) { 271 for (;;) {
272 if (!resource || resource->id == ACPI_RSTYPE_END_TAG) { 272 if (!resource || resource->type == ACPI_RSTYPE_END_TAG) {
273 break; 273 break;
274 } 274 }
275 275
@@ -360,8 +360,8 @@ EXPORT_SYMBOL(acpi_set_current_resources);
360 * 360 *
361 * FUNCTION: acpi_resource_to_address64 361 * FUNCTION: acpi_resource_to_address64
362 * 362 *
363 * PARAMETERS: resource - Pointer to a resource 363 * PARAMETERS: Resource - Pointer to a resource
364 * out - Pointer to the users's return 364 * Out - Pointer to the users's return
365 * buffer (a struct 365 * buffer (a struct
366 * struct acpi_resource_address64) 366 * struct acpi_resource_address64)
367 * 367 *
@@ -381,7 +381,7 @@ acpi_resource_to_address64(struct acpi_resource *resource,
381 struct acpi_resource_address16 *address16; 381 struct acpi_resource_address16 *address16;
382 struct acpi_resource_address32 *address32; 382 struct acpi_resource_address32 *address32;
383 383
384 switch (resource->id) { 384 switch (resource->type) {
385 case ACPI_RSTYPE_ADDRESS16: 385 case ACPI_RSTYPE_ADDRESS16:
386 386
387 address16 = (struct acpi_resource_address16 *)&resource->data; 387 address16 = (struct acpi_resource_address16 *)&resource->data;