1 /*******************************************************************************
3 * Module Name: rsaddr - Address resource descriptors (16/32/64)
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2004, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
45 #include <acpi/acpi.h>
46 #include <acpi/acresrc.h>
48 #define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsaddr")
52 /*******************************************************************************
54 * FUNCTION: acpi_rs_address16_resource
56 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
58 * bytes_consumed - Pointer to where the number of bytes
59 * consumed the byte_stream_buffer is
61 * output_buffer - Pointer to the return data buffer
62 * structure_size - Pointer to where the number of bytes
63 * in the return data struct is returned
67 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
68 * structure pointed to by the output_buffer. Return the
69 * number of bytes consumed from the byte stream.
71 ******************************************************************************/
74 acpi_rs_address16_resource (
75 u8 *byte_stream_buffer,
76 acpi_size *bytes_consumed,
78 acpi_size *structure_size)
80 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer;
83 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16);
89 ACPI_FUNCTION_TRACE ("rs_address16_resource");
93 * Point past the Descriptor to get the number of bytes consumed
96 ACPI_MOVE_16_TO_16 (&temp16, buffer);
98 /* Validate minimum descriptor length */
101 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
104 *bytes_consumed = temp16 + 3;
105 output_struct->id = ACPI_RSTYPE_ADDRESS16;
108 * Get the Resource Type (Byte3)
113 /* Values 0-2 are valid */
116 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
119 output_struct->data.address16.resource_type = temp8 & 0x03;
122 * Get the General Flags (Byte4)
127 /* Producer / Consumer */
129 output_struct->data.address16.producer_consumer = temp8 & 0x01;
133 output_struct->data.address16.decode = (temp8 >> 1) & 0x01;
135 /* Min Address Fixed */
137 output_struct->data.address16.min_address_fixed = (temp8 >> 2) & 0x01;
139 /* Max Address Fixed */
141 output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
144 * Get the Type Specific Flags (Byte5)
149 if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) {
150 output_struct->data.address16.attribute.memory.read_write_attribute =
151 (u16) (temp8 & 0x01);
152 output_struct->data.address16.attribute.memory.cache_attribute =
153 (u16) ((temp8 >> 1) & 0x03);
156 if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) {
157 output_struct->data.address16.attribute.io.range_attribute =
158 (u16) (temp8 & 0x03);
159 output_struct->data.address16.attribute.io.translation_attribute =
160 (u16) ((temp8 >> 4) & 0x03);
163 /* BUS_NUMBER_RANGE == Address16.Data->resource_type */
164 /* Nothing needs to be filled in */
169 * Get Granularity (Bytes 6-7)
172 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer);
175 * Get min_address_range (Bytes 8-9)
178 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer);
181 * Get max_address_range (Bytes 10-11)
184 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer);
187 * Get address_translation_offset (Bytes 12-13)
190 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer);
193 * Get address_length (Bytes 14-15)
196 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer);
199 * Resource Source Index (if present)
204 * This will leave us pointing to the Resource Source Index
205 * If it is present, then save it off and calculate the
206 * pointer to where the null terminated string goes:
207 * Each Interrupt takes 32-bits + the 5 bytes of the
208 * stream that are default.
210 * Note: Some resource descriptors will have an additional null, so
211 * we add 1 to the length.
213 if (*bytes_consumed > (16 + 1)) {
214 /* Dereference the Index */
217 output_struct->data.address16.resource_source.index = (u32) temp8;
219 /* Point to the String */
223 /* Point the String pointer to the end of this structure */
225 output_struct->data.address16.resource_source.string_ptr =
226 (char *)((u8 * )output_struct + struct_size);
228 temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr;
230 /* Copy the string into the buffer */
234 while (0x00 != *buffer) {
243 * Add the terminating null
247 output_struct->data.address16.resource_source.string_length = index + 1;
250 * In order for the struct_size to fall on a 32-bit boundary,
251 * calculate the length of the string and expand the
252 * struct_size to the next 32-bit boundary.
254 temp8 = (u8) (index + 1);
255 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
258 output_struct->data.address16.resource_source.index = 0x00;
259 output_struct->data.address16.resource_source.string_length = 0;
260 output_struct->data.address16.resource_source.string_ptr = NULL;
264 * Set the Length parameter
266 output_struct->length = (u32) struct_size;
269 * Return the final size of the structure
271 *structure_size = struct_size;
272 return_ACPI_STATUS (AE_OK);
276 /*******************************************************************************
278 * FUNCTION: acpi_rs_address16_stream
280 * PARAMETERS: linked_list - Pointer to the resource linked list
281 * output_buffer - Pointer to the user's return buffer
282 * bytes_consumed - Pointer to where the number of bytes
283 * used in the output_buffer is returned
287 * DESCRIPTION: Take the linked list resource structure and fills in the
288 * the appropriate bytes in a byte stream
290 ******************************************************************************/
293 acpi_rs_address16_stream (
294 struct acpi_resource *linked_list,
296 acpi_size *bytes_consumed)
298 u8 *buffer = *output_buffer;
301 char *temp_pointer = NULL;
302 acpi_size actual_bytes;
305 ACPI_FUNCTION_TRACE ("rs_address16_stream");
309 * The descriptor field is static
315 * Save a pointer to the Length field - to be filled in later
317 length_field = buffer;
321 * Set the Resource Type (Memory, Io, bus_number)
323 temp8 = (u8) (linked_list->data.address16.resource_type & 0x03);
328 * Set the general flags
330 temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01);
332 temp8 |= (linked_list->data.address16.decode & 0x01) << 1;
333 temp8 |= (linked_list->data.address16.min_address_fixed & 0x01) << 2;
334 temp8 |= (linked_list->data.address16.max_address_fixed & 0x01) << 3;
340 * Set the type specific flags
344 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
346 (linked_list->data.address16.attribute.memory.read_write_attribute &
350 (linked_list->data.address16.attribute.memory.cache_attribute &
353 else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) {
355 (linked_list->data.address16.attribute.io.range_attribute &
358 (linked_list->data.address16.attribute.io.translation_attribute &
366 * Set the address space granularity
368 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity);
372 * Set the address range minimum
374 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range);
378 * Set the address range maximum
380 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range);
384 * Set the address translation offset
386 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset);
390 * Set the address length
392 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length);
396 * Resource Source Index and Resource Source are optional
398 if (0 != linked_list->data.address16.resource_source.string_length) {
399 temp8 = (u8) linked_list->data.address16.resource_source.index;
404 temp_pointer = (char *) buffer;
409 ACPI_STRCPY (temp_pointer,
410 linked_list->data.address16.resource_source.string_ptr);
413 * Buffer needs to be set to the length of the sting + one for the
416 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1);
420 * Return the number of bytes consumed in this operation
422 actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
423 *bytes_consumed = actual_bytes;
426 * Set the length field to the number of bytes consumed
427 * minus the header size (3 bytes)
430 ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes);
431 return_ACPI_STATUS (AE_OK);
435 /*******************************************************************************
437 * FUNCTION: acpi_rs_address32_resource
439 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
441 * bytes_consumed - Pointer to where the number of bytes
442 * consumed the byte_stream_buffer is
444 * output_buffer - Pointer to the return data buffer
445 * structure_size - Pointer to where the number of bytes
446 * in the return data struct is returned
450 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
451 * structure pointed to by the output_buffer. Return the
452 * number of bytes consumed from the byte stream.
454 ******************************************************************************/
457 acpi_rs_address32_resource (
458 u8 *byte_stream_buffer,
459 acpi_size *bytes_consumed,
461 acpi_size *structure_size)
464 struct acpi_resource *output_struct= (void *) *output_buffer;
468 acpi_size struct_size;
472 ACPI_FUNCTION_TRACE ("rs_address32_resource");
475 buffer = byte_stream_buffer;
476 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32);
479 * Point past the Descriptor to get the number of bytes consumed
482 ACPI_MOVE_16_TO_16 (&temp16, buffer);
484 /* Validate minimum descriptor length */
487 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
490 *bytes_consumed = temp16 + 3;
491 output_struct->id = ACPI_RSTYPE_ADDRESS32;
494 * Get the Resource Type (Byte3)
499 /* Values 0-2 are valid */
501 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
504 output_struct->data.address32.resource_type = temp8 & 0x03;
507 * Get the General Flags (Byte4)
513 * Producer / Consumer
515 output_struct->data.address32.producer_consumer = temp8 & 0x01;
520 output_struct->data.address32.decode = (temp8 >> 1) & 0x01;
525 output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01;
530 output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01;
533 * Get the Type Specific Flags (Byte5)
538 if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) {
539 output_struct->data.address32.attribute.memory.read_write_attribute =
540 (u16) (temp8 & 0x01);
542 output_struct->data.address32.attribute.memory.cache_attribute =
543 (u16) ((temp8 >> 1) & 0x03);
546 if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) {
547 output_struct->data.address32.attribute.io.range_attribute =
548 (u16) (temp8 & 0x03);
549 output_struct->data.address32.attribute.io.translation_attribute =
550 (u16) ((temp8 >> 4) & 0x03);
553 /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */
554 /* Nothing needs to be filled in */
559 * Get Granularity (Bytes 6-9)
562 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer);
565 * Get min_address_range (Bytes 10-13)
568 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer);
571 * Get max_address_range (Bytes 14-17)
574 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer);
577 * Get address_translation_offset (Bytes 18-21)
580 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer);
583 * Get address_length (Bytes 22-25)
586 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer);
589 * Resource Source Index (if present)
594 * This will leave us pointing to the Resource Source Index
595 * If it is present, then save it off and calculate the
596 * pointer to where the null terminated string goes:
598 * Note: Some resource descriptors will have an additional null, so
599 * we add 1 to the length.
601 if (*bytes_consumed > (26 + 1)) {
602 /* Dereference the Index */
605 output_struct->data.address32.resource_source.index =
608 /* Point to the String */
612 /* Point the String pointer to the end of this structure */
614 output_struct->data.address32.resource_source.string_ptr =
615 (char *)((u8 *)output_struct + struct_size);
617 temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr;
619 /* Copy the string into the buffer */
622 while (0x00 != *buffer) {
631 * Add the terminating null
634 output_struct->data.address32.resource_source.string_length = index + 1;
637 * In order for the struct_size to fall on a 32-bit boundary,
638 * calculate the length of the string and expand the
639 * struct_size to the next 32-bit boundary.
641 temp8 = (u8) (index + 1);
642 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
645 output_struct->data.address32.resource_source.index = 0x00;
646 output_struct->data.address32.resource_source.string_length = 0;
647 output_struct->data.address32.resource_source.string_ptr = NULL;
651 * Set the Length parameter
653 output_struct->length = (u32) struct_size;
656 * Return the final size of the structure
658 *structure_size = struct_size;
659 return_ACPI_STATUS (AE_OK);
663 /*******************************************************************************
665 * FUNCTION: acpi_rs_address32_stream
667 * PARAMETERS: linked_list - Pointer to the resource linked list
668 * output_buffer - Pointer to the user's return buffer
669 * bytes_consumed - Pointer to where the number of bytes
670 * used in the output_buffer is returned
674 * DESCRIPTION: Take the linked list resource structure and fills in the
675 * the appropriate bytes in a byte stream
677 ******************************************************************************/
680 acpi_rs_address32_stream (
681 struct acpi_resource *linked_list,
683 acpi_size *bytes_consumed)
691 ACPI_FUNCTION_TRACE ("rs_address32_stream");
694 buffer = *output_buffer;
697 * The descriptor field is static
703 * Set a pointer to the Length field - to be filled in later
705 length_field = ACPI_CAST_PTR (u16, buffer);
709 * Set the Resource Type (Memory, Io, bus_number)
711 temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
717 * Set the general flags
719 temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01);
720 temp8 |= (linked_list->data.address32.decode & 0x01) << 1;
721 temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2;
722 temp8 |= (linked_list->data.address32.max_address_fixed & 0x01) << 3;
728 * Set the type specific flags
732 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
734 (linked_list->data.address32.attribute.memory.read_write_attribute &
738 (linked_list->data.address32.attribute.memory.cache_attribute &
741 else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) {
743 (linked_list->data.address32.attribute.io.range_attribute &
746 (linked_list->data.address32.attribute.io.translation_attribute &
754 * Set the address space granularity
756 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity);
760 * Set the address range minimum
762 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range);
766 * Set the address range maximum
768 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range);
772 * Set the address translation offset
774 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset);
778 * Set the address length
780 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length);
784 * Resource Source Index and Resource Source are optional
786 if (0 != linked_list->data.address32.resource_source.string_length) {
787 temp8 = (u8) linked_list->data.address32.resource_source.index;
792 temp_pointer = (char *) buffer;
797 ACPI_STRCPY (temp_pointer,
798 linked_list->data.address32.resource_source.string_ptr);
801 * Buffer needs to be set to the length of the sting + one for the
804 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1);
808 * Return the number of bytes consumed in this operation
810 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
813 * Set the length field to the number of bytes consumed
814 * minus the header size (3 bytes)
816 *length_field = (u16) (*bytes_consumed - 3);
817 return_ACPI_STATUS (AE_OK);
821 /*******************************************************************************
823 * FUNCTION: acpi_rs_address64_resource
825 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
827 * bytes_consumed - Pointer to where the number of bytes
828 * consumed the byte_stream_buffer is
830 * output_buffer - Pointer to the return data buffer
831 * structure_size - Pointer to where the number of bytes
832 * in the return data struct is returned
836 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
837 * structure pointed to by the output_buffer. Return the
838 * number of bytes consumed from the byte stream.
840 ******************************************************************************/
843 acpi_rs_address64_resource (
844 u8 *byte_stream_buffer,
845 acpi_size *bytes_consumed,
847 acpi_size *structure_size)
850 struct acpi_resource *output_struct = (void *) *output_buffer;
854 acpi_size struct_size;
858 ACPI_FUNCTION_TRACE ("rs_address64_resource");
861 buffer = byte_stream_buffer;
862 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
865 * Point past the Descriptor to get the number of bytes consumed
868 ACPI_MOVE_16_TO_16 (&temp16, buffer);
870 /* Validate minimum descriptor length */
873 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
876 *bytes_consumed = temp16 + 3;
877 output_struct->id = ACPI_RSTYPE_ADDRESS64;
880 * Get the Resource Type (Byte3)
885 /* Values 0-2 are valid */
888 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
891 output_struct->data.address64.resource_type = temp8 & 0x03;
894 * Get the General Flags (Byte4)
900 * Producer / Consumer
902 output_struct->data.address64.producer_consumer = temp8 & 0x01;
907 output_struct->data.address64.decode = (temp8 >> 1) & 0x01;
912 output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01;
917 output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01;
920 * Get the Type Specific Flags (Byte5)
925 if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) {
926 output_struct->data.address64.attribute.memory.read_write_attribute =
927 (u16) (temp8 & 0x01);
929 output_struct->data.address64.attribute.memory.cache_attribute =
930 (u16) ((temp8 >> 1) & 0x03);
933 if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) {
934 output_struct->data.address64.attribute.io.range_attribute =
935 (u16) (temp8 & 0x03);
936 output_struct->data.address64.attribute.io.translation_attribute =
937 (u16) ((temp8 >> 4) & 0x03);
940 /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */
941 /* Nothing needs to be filled in */
946 * Get Granularity (Bytes 6-13)
949 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer);
952 * Get min_address_range (Bytes 14-21)
955 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer);
958 * Get max_address_range (Bytes 22-29)
961 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer);
964 * Get address_translation_offset (Bytes 30-37)
967 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer);
970 * Get address_length (Bytes 38-45)
973 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer);
976 * Resource Source Index (if present)
981 * This will leave us pointing to the Resource Source Index
982 * If it is present, then save it off and calculate the
983 * pointer to where the null terminated string goes:
984 * Each Interrupt takes 32-bits + the 5 bytes of the
985 * stream that are default.
987 * Note: Some resource descriptors will have an additional null, so
988 * we add 1 to the length.
990 if (*bytes_consumed > (46 + 1)) {
991 /* Dereference the Index */
994 output_struct->data.address64.resource_source.index =
997 /* Point to the String */
1001 /* Point the String pointer to the end of this structure */
1003 output_struct->data.address64.resource_source.string_ptr =
1004 (char *)((u8 *)output_struct + struct_size);
1006 temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr;
1008 /* Copy the string into the buffer */
1011 while (0x00 != *buffer) {
1012 *temp_ptr = *buffer;
1020 * Add the terminating null
1023 output_struct->data.address64.resource_source.string_length = index + 1;
1026 * In order for the struct_size to fall on a 32-bit boundary,
1027 * calculate the length of the string and expand the
1028 * struct_size to the next 32-bit boundary.
1030 temp8 = (u8) (index + 1);
1031 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
1034 output_struct->data.address64.resource_source.index = 0x00;
1035 output_struct->data.address64.resource_source.string_length = 0;
1036 output_struct->data.address64.resource_source.string_ptr = NULL;
1040 * Set the Length parameter
1042 output_struct->length = (u32) struct_size;
1045 * Return the final size of the structure
1047 *structure_size = struct_size;
1048 return_ACPI_STATUS (AE_OK);
1052 /*******************************************************************************
1054 * FUNCTION: acpi_rs_address64_stream
1056 * PARAMETERS: linked_list - Pointer to the resource linked list
1057 * output_buffer - Pointer to the user's return buffer
1058 * bytes_consumed - Pointer to where the number of bytes
1059 * used in the output_buffer is returned
1063 * DESCRIPTION: Take the linked list resource structure and fills in the
1064 * the appropriate bytes in a byte stream
1066 ******************************************************************************/
1069 acpi_rs_address64_stream (
1070 struct acpi_resource *linked_list,
1072 acpi_size *bytes_consumed)
1080 ACPI_FUNCTION_TRACE ("rs_address64_stream");
1083 buffer = *output_buffer;
1086 * The descriptor field is static
1092 * Set a pointer to the Length field - to be filled in later
1094 length_field = ACPI_CAST_PTR (u16, buffer);
1098 * Set the Resource Type (Memory, Io, bus_number)
1100 temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
1106 * Set the general flags
1108 temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01);
1109 temp8 |= (linked_list->data.address64.decode & 0x01) << 1;
1110 temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2;
1111 temp8 |= (linked_list->data.address64.max_address_fixed & 0x01) << 3;
1117 * Set the type specific flags
1121 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
1123 (linked_list->data.address64.attribute.memory.read_write_attribute &
1127 (linked_list->data.address64.attribute.memory.cache_attribute &
1130 else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) {
1132 (linked_list->data.address64.attribute.io.range_attribute &
1135 (linked_list->data.address64.attribute.io.range_attribute &
1143 * Set the address space granularity
1145 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity);
1149 * Set the address range minimum
1151 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range);
1155 * Set the address range maximum
1157 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range);
1161 * Set the address translation offset
1163 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset);
1167 * Set the address length
1169 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length);
1173 * Resource Source Index and Resource Source are optional
1175 if (0 != linked_list->data.address64.resource_source.string_length) {
1176 temp8 = (u8) linked_list->data.address64.resource_source.index;
1181 temp_pointer = (char *) buffer;
1186 ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr);
1189 * Buffer needs to be set to the length of the sting + one for the
1192 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
1196 * Return the number of bytes consumed in this operation
1198 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
1201 * Set the length field to the number of bytes consumed
1202 * minus the header size (3 bytes)
1204 *length_field = (u16) (*bytes_consumed - 3);
1205 return_ACPI_STATUS (AE_OK);