diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 08:44:28 +0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 08:45:14 +0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/resources | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) | |
download | linux-4be44fcd3bf648b782f4460fd06dfae6c42ded4b.tar.xz |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources')
-rw-r--r-- | drivers/acpi/resources/rsaddr.c | 503 | ||||
-rw-r--r-- | drivers/acpi/resources/rscalc.c | 314 | ||||
-rw-r--r-- | drivers/acpi/resources/rscreate.c | 297 | ||||
-rw-r--r-- | drivers/acpi/resources/rsdump.c | 847 | ||||
-rw-r--r-- | drivers/acpi/resources/rsio.c | 172 | ||||
-rw-r--r-- | drivers/acpi/resources/rsirq.c | 236 | ||||
-rw-r--r-- | drivers/acpi/resources/rslist.c | 279 | ||||
-rw-r--r-- | drivers/acpi/resources/rsmemory.c | 218 | ||||
-rw-r--r-- | drivers/acpi/resources/rsmisc.c | 230 | ||||
-rw-r--r-- | drivers/acpi/resources/rsutils.c | 159 | ||||
-rw-r--r-- | drivers/acpi/resources/rsxface.c | 182 |
11 files changed, 1604 insertions, 1833 deletions
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 55d264771c48..4cf46e1ee01b 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsaddr") - +ACPI_MODULE_NAME("rsaddr") /******************************************************************************* * @@ -69,36 +67,31 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_address16_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_address16_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u32 index; - u16 temp16; - u8 temp8; - u8 *temp_ptr; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_address16); - - - ACPI_FUNCTION_TRACE ("rs_address16_resource"); + u32 index; + u16 temp16; + u8 temp8; + u8 *temp_ptr; + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16); + ACPI_FUNCTION_TRACE("rs_address16_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 13) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -112,7 +105,7 @@ acpi_rs_address16_resource ( /* Values 0-2 and 0xC0-0xFF are valid */ if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } output_struct->data.address16.resource_type = temp8; @@ -144,19 +137,18 @@ acpi_rs_address16_resource ( temp8 = *buffer; if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { - output_struct->data.address16.attribute.memory.read_write_attribute = - (u16) (temp8 & 0x01); + output_struct->data.address16.attribute.memory. + read_write_attribute = (u16) (temp8 & 0x01); output_struct->data.address16.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } - else { - if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) { - output_struct->data.address16.attribute.io.range_attribute = - (u16) (temp8 & 0x03); - output_struct->data.address16.attribute.io.translation_attribute = - (u16) ((temp8 >> 4) & 0x03); - } - else { + (u16) ((temp8 >> 1) & 0x03); + } else { + if (ACPI_IO_RANGE == + output_struct->data.address16.resource_type) { + output_struct->data.address16.attribute.io. + range_attribute = (u16) (temp8 & 0x03); + output_struct->data.address16.attribute.io. + translation_attribute = (u16) ((temp8 >> 4) & 0x03); + } else { /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ /* Nothing needs to be filled in */ } @@ -165,28 +157,31 @@ acpi_rs_address16_resource ( /* Get Granularity (Bytes 6-7) */ buffer += 1; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer); /* Get min_address_range (Bytes 8-9) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, + buffer); /* Get max_address_range (Bytes 10-11) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, + buffer); /* Get address_translation_offset (Bytes 12-13) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, - buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16. + address_translation_offset, buffer); /* Get address_length (Bytes 14-15) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, + buffer); /* Resource Source Index (if present) */ @@ -206,7 +201,8 @@ acpi_rs_address16_resource ( /* Dereference the Index */ temp8 = *buffer; - output_struct->data.address16.resource_source.index = (u32) temp8; + output_struct->data.address16.resource_source.index = + (u32) temp8; /* Point to the String */ @@ -215,10 +211,10 @@ acpi_rs_address16_resource ( /* Point the String pointer to the end of this structure */ output_struct->data.address16.resource_source.string_ptr = - (char *)((u8 * )output_struct + struct_size); + (char *)((u8 *) output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.address16.resource_source.string_ptr; + output_struct->data.address16.resource_source.string_ptr; /* Copy the string into the buffer */ @@ -236,7 +232,8 @@ acpi_rs_address16_resource ( *temp_ptr = 0x00; - output_struct->data.address16.resource_source.string_length = index + 1; + output_struct->data.address16.resource_source.string_length = + index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -244,9 +241,8 @@ acpi_rs_address16_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); - } - else { + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); + } else { output_struct->data.address16.resource_source.index = 0x00; output_struct->data.address16.resource_source.string_length = 0; output_struct->data.address16.resource_source.string_ptr = NULL; @@ -259,10 +255,9 @@ acpi_rs_address16_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address16_stream @@ -280,20 +275,16 @@ acpi_rs_address16_resource ( ******************************************************************************/ acpi_status -acpi_rs_address16_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_address16_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u8 *length_field; - u8 temp8; - char *temp_pointer = NULL; - acpi_size actual_bytes; - - - ACPI_FUNCTION_TRACE ("rs_address16_stream"); + u8 *buffer = *output_buffer; + u8 *length_field; + u8 temp8; + char *temp_pointer = NULL; + acpi_size actual_bytes; + ACPI_FUNCTION_TRACE("rs_address16_stream"); /* The descriptor field is static */ @@ -328,20 +319,19 @@ acpi_rs_address16_stream ( if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { temp8 = (u8) - (linked_list->data.address16.attribute.memory.read_write_attribute & - 0x01); + (linked_list->data.address16.attribute.memory. + read_write_attribute & 0x01); temp8 |= - (linked_list->data.address16.attribute.memory.cache_attribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { + (linked_list->data.address16.attribute.memory. + cache_attribute & 0x03) << 1; + } else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { temp8 = (u8) - (linked_list->data.address16.attribute.io.range_attribute & - 0x03); + (linked_list->data.address16.attribute.io.range_attribute & + 0x03); temp8 |= - (linked_list->data.address16.attribute.io.translation_attribute & - 0x03) << 4; + (linked_list->data.address16.attribute.io. + translation_attribute & 0x03) << 4; } *buffer = temp8; @@ -349,28 +339,31 @@ acpi_rs_address16_stream ( /* Set the address space granularity */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); buffer += 2; /* Set the address range minimum */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16.min_address_range); buffer += 2; /* Set the address range maximum */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16.max_address_range); buffer += 2; /* Set the address translation offset */ - ACPI_MOVE_32_TO_16 (buffer, - &linked_list->data.address16.address_translation_offset); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16. + address_translation_offset); buffer += 2; /* Set the address length */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length); buffer += 2; /* Resource Source Index and Resource Source are optional */ @@ -381,24 +374,27 @@ acpi_rs_address16_stream ( *buffer = temp8; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.address16.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.address16.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size)(ACPI_STRLEN ( - linked_list->data.address16.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.address16.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); + actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer); *bytes_consumed = actual_bytes; /* @@ -406,11 +402,10 @@ acpi_rs_address16_stream ( * minus the header size (3 bytes) */ actual_bytes -= 3; - ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes); - return_ACPI_STATUS (AE_OK); + ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address32_resource @@ -433,36 +428,32 @@ acpi_rs_address16_stream ( ******************************************************************************/ acpi_status -acpi_rs_address32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_address32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer; - struct acpi_resource *output_struct= (void *) *output_buffer; - u16 temp16; - u8 temp8; - u8 *temp_ptr; - acpi_size struct_size; - u32 index; - - - ACPI_FUNCTION_TRACE ("rs_address32_resource"); + u8 *buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16; + u8 temp8; + u8 *temp_ptr; + acpi_size struct_size; + u32 index; + ACPI_FUNCTION_TRACE("rs_address32_resource"); buffer = byte_stream_buffer; - struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); + struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 23) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -476,7 +467,7 @@ acpi_rs_address32_resource ( /* Values 0-2 and 0xC0-0xFF are valid */ if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } output_struct->data.address32.resource_type = temp8; @@ -508,20 +499,19 @@ acpi_rs_address32_resource ( temp8 = *buffer; if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { - output_struct->data.address32.attribute.memory.read_write_attribute = - (u16) (temp8 & 0x01); + output_struct->data.address32.attribute.memory. + read_write_attribute = (u16) (temp8 & 0x01); output_struct->data.address32.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } - else { - if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) { - output_struct->data.address32.attribute.io.range_attribute = - (u16) (temp8 & 0x03); - output_struct->data.address32.attribute.io.translation_attribute = - (u16) ((temp8 >> 4) & 0x03); - } - else { + (u16) ((temp8 >> 1) & 0x03); + } else { + if (ACPI_IO_RANGE == + output_struct->data.address32.resource_type) { + output_struct->data.address32.attribute.io. + range_attribute = (u16) (temp8 & 0x03); + output_struct->data.address32.attribute.io. + translation_attribute = (u16) ((temp8 >> 4) & 0x03); + } else { /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ /* Nothing needs to be filled in */ } @@ -530,28 +520,31 @@ acpi_rs_address32_resource ( /* Get Granularity (Bytes 6-9) */ buffer += 1; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer); /* Get min_address_range (Bytes 10-13) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range, + buffer); /* Get max_address_range (Bytes 14-17) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range, + buffer); /* Get address_translation_offset (Bytes 18-21) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, - buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32. + address_translation_offset, buffer); /* Get address_length (Bytes 22-25) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length, + buffer); /* Resource Source Index (if present) */ @@ -570,7 +563,7 @@ acpi_rs_address32_resource ( temp8 = *buffer; output_struct->data.address32.resource_source.index = - (u32) temp8; + (u32) temp8; /* Point to the String */ @@ -579,10 +572,10 @@ acpi_rs_address32_resource ( /* Point the String pointer to the end of this structure */ output_struct->data.address32.resource_source.string_ptr = - (char *)((u8 *)output_struct + struct_size); + (char *)((u8 *) output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.address32.resource_source.string_ptr; + output_struct->data.address32.resource_source.string_ptr; /* Copy the string into the buffer */ @@ -598,7 +591,8 @@ acpi_rs_address32_resource ( /* Add the terminating null */ *temp_ptr = 0x00; - output_struct->data.address32.resource_source.string_length = index + 1; + output_struct->data.address32.resource_source.string_length = + index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -606,9 +600,8 @@ acpi_rs_address32_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); - } - else { + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); + } else { output_struct->data.address32.resource_source.index = 0x00; output_struct->data.address32.resource_source.string_length = 0; output_struct->data.address32.resource_source.string_ptr = NULL; @@ -621,10 +614,9 @@ acpi_rs_address32_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address32_stream @@ -642,19 +634,15 @@ acpi_rs_address32_resource ( ******************************************************************************/ acpi_status -acpi_rs_address32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_address32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer; - u16 *length_field; - u8 temp8; - char *temp_pointer; - - - ACPI_FUNCTION_TRACE ("rs_address32_stream"); + u8 *buffer; + u16 *length_field; + u8 temp8; + char *temp_pointer; + ACPI_FUNCTION_TRACE("rs_address32_stream"); buffer = *output_buffer; @@ -665,7 +653,7 @@ acpi_rs_address32_stream ( /* Set a pointer to the Length field - to be filled in later */ - length_field = ACPI_CAST_PTR (u16, buffer); + length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Resource Type (Memory, Io, bus_number) */ @@ -691,20 +679,19 @@ acpi_rs_address32_stream ( if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { temp8 = (u8) - (linked_list->data.address32.attribute.memory.read_write_attribute & - 0x01); + (linked_list->data.address32.attribute.memory. + read_write_attribute & 0x01); temp8 |= - (linked_list->data.address32.attribute.memory.cache_attribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { + (linked_list->data.address32.attribute.memory. + cache_attribute & 0x03) << 1; + } else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { temp8 = (u8) - (linked_list->data.address32.attribute.io.range_attribute & - 0x03); + (linked_list->data.address32.attribute.io.range_attribute & + 0x03); temp8 |= - (linked_list->data.address32.attribute.io.translation_attribute & - 0x03) << 4; + (linked_list->data.address32.attribute.io. + translation_attribute & 0x03) << 4; } *buffer = temp8; @@ -712,28 +699,31 @@ acpi_rs_address32_stream ( /* Set the address space granularity */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); buffer += 4; /* Set the address range minimum */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32.min_address_range); buffer += 4; /* Set the address range maximum */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32.max_address_range); buffer += 4; /* Set the address translation offset */ - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.address32.address_translation_offset); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32. + address_translation_offset); buffer += 4; /* Set the address length */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length); buffer += 4; /* Resource Source Index and Resource Source are optional */ @@ -744,34 +734,36 @@ acpi_rs_address32_stream ( *buffer = temp8; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.address32.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.address32.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size)(ACPI_STRLEN ( - linked_list->data.address32.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.address32.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address64_resource @@ -794,38 +786,34 @@ acpi_rs_address32_stream ( ******************************************************************************/ acpi_status -acpi_rs_address64_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_address64_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16; - u8 temp8; - u8 resource_type; - u8 *temp_ptr; - acpi_size struct_size; - u32 index; - - - ACPI_FUNCTION_TRACE ("rs_address64_resource"); + u8 *buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16; + u8 temp8; + u8 resource_type; + u8 *temp_ptr; + acpi_size struct_size; + u32 index; + ACPI_FUNCTION_TRACE("rs_address64_resource"); buffer = byte_stream_buffer; - struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); + struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); resource_type = *buffer; /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 43) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -839,7 +827,7 @@ acpi_rs_address64_resource ( /* Values 0-2 and 0xC0-0xFF are valid */ if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } output_struct->data.address64.resource_type = temp8; @@ -871,20 +859,19 @@ acpi_rs_address64_resource ( temp8 = *buffer; if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { - output_struct->data.address64.attribute.memory.read_write_attribute = - (u16) (temp8 & 0x01); + output_struct->data.address64.attribute.memory. + read_write_attribute = (u16) (temp8 & 0x01); output_struct->data.address64.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } - else { - if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) { - output_struct->data.address64.attribute.io.range_attribute = - (u16) (temp8 & 0x03); - output_struct->data.address64.attribute.io.translation_attribute = - (u16) ((temp8 >> 4) & 0x03); - } - else { + (u16) ((temp8 >> 1) & 0x03); + } else { + if (ACPI_IO_RANGE == + output_struct->data.address64.resource_type) { + output_struct->data.address64.attribute.io. + range_attribute = (u16) (temp8 & 0x03); + output_struct->data.address64.attribute.io. + translation_attribute = (u16) ((temp8 >> 4) & 0x03); + } else { /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ /* Nothing needs to be filled in */ } @@ -899,28 +886,31 @@ acpi_rs_address64_resource ( /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ buffer += 1; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer); /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range, + buffer); /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range, + buffer); /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, - buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64. + address_translation_offset, buffer); /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, + buffer); output_struct->data.address64.resource_source.index = 0x00; output_struct->data.address64.resource_source.string_length = 0; @@ -930,11 +920,9 @@ acpi_rs_address64_resource ( /* Get type_specific_attribute (Bytes 48-55) */ buffer += 8; - ACPI_MOVE_64_TO_64 ( - &output_struct->data.address64.type_specific_attributes, - buffer); - } - else { + ACPI_MOVE_64_TO_64(&output_struct->data.address64. + type_specific_attributes, buffer); + } else { output_struct->data.address64.type_specific_attributes = 0; /* Resource Source Index (if present) */ @@ -956,7 +944,7 @@ acpi_rs_address64_resource ( temp8 = *buffer; output_struct->data.address64.resource_source.index = - (u32) temp8; + (u32) temp8; /* Point to the String */ @@ -964,11 +952,13 @@ acpi_rs_address64_resource ( /* Point the String pointer to the end of this structure */ - output_struct->data.address64.resource_source.string_ptr = - (char *)((u8 *)output_struct + struct_size); + output_struct->data.address64.resource_source. + string_ptr = + (char *)((u8 *) output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.address64.resource_source.string_ptr; + output_struct->data.address64.resource_source. + string_ptr; /* Copy the string into the buffer */ @@ -985,8 +975,8 @@ acpi_rs_address64_resource ( * Add the terminating null */ *temp_ptr = 0x00; - output_struct->data.address64.resource_source.string_length = - index + 1; + output_struct->data.address64.resource_source. + string_length = index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -994,7 +984,7 @@ acpi_rs_address64_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); } } @@ -1005,10 +995,9 @@ acpi_rs_address64_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address64_stream @@ -1026,19 +1015,15 @@ acpi_rs_address64_resource ( ******************************************************************************/ acpi_status -acpi_rs_address64_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_address64_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer; - u16 *length_field; - u8 temp8; - char *temp_pointer; - - - ACPI_FUNCTION_TRACE ("rs_address64_stream"); + u8 *buffer; + u16 *length_field; + u8 temp8; + char *temp_pointer; + ACPI_FUNCTION_TRACE("rs_address64_stream"); buffer = *output_buffer; @@ -1049,7 +1034,7 @@ acpi_rs_address64_stream ( /* Set a pointer to the Length field - to be filled in later */ - length_field = ACPI_CAST_PTR (u16, buffer); + length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Resource Type (Memory, Io, bus_number) */ @@ -1075,20 +1060,19 @@ acpi_rs_address64_stream ( if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { temp8 = (u8) - (linked_list->data.address64.attribute.memory.read_write_attribute & - 0x01); + (linked_list->data.address64.attribute.memory. + read_write_attribute & 0x01); temp8 |= - (linked_list->data.address64.attribute.memory.cache_attribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { + (linked_list->data.address64.attribute.memory. + cache_attribute & 0x03) << 1; + } else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { temp8 = (u8) - (linked_list->data.address64.attribute.io.range_attribute & - 0x03); + (linked_list->data.address64.attribute.io.range_attribute & + 0x03); temp8 |= - (linked_list->data.address64.attribute.io.range_attribute & - 0x03) << 4; + (linked_list->data.address64.attribute.io.range_attribute & + 0x03) << 4; } *buffer = temp8; @@ -1096,28 +1080,31 @@ acpi_rs_address64_stream ( /* Set the address space granularity */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); + ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); buffer += 8; /* Set the address range minimum */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64.min_address_range); buffer += 8; /* Set the address range maximum */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64.max_address_range); buffer += 8; /* Set the address translation offset */ - ACPI_MOVE_64_TO_64 (buffer, - &linked_list->data.address64.address_translation_offset); + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64. + address_translation_offset); buffer += 8; /* Set the address length */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); + ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length); buffer += 8; /* Resource Source Index and Resource Source are optional */ @@ -1128,30 +1115,32 @@ acpi_rs_address64_stream ( *buffer = temp8; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.address64.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.address64.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size)(ACPI_STRLEN ( - linked_list->data.address64.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.address64.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 98176f2fcb5d..378f58390fc1 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -41,15 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #include <acpi/amlcode.h> #include <acpi/acnamesp.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rscalc") - +ACPI_MODULE_NAME("rscalc") /******************************************************************************* * @@ -66,19 +64,15 @@ * the resource data. * ******************************************************************************/ - acpi_status -acpi_rs_get_byte_stream_length ( - struct acpi_resource *linked_list, - acpi_size *size_needed) +acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list, + acpi_size * size_needed) { - acpi_size byte_stream_size_needed = 0; - acpi_size segment_size; - u8 done = FALSE; - - - ACPI_FUNCTION_TRACE ("rs_get_byte_stream_length"); + acpi_size byte_stream_size_needed = 0; + acpi_size segment_size; + u8 done = FALSE; + ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); while (!done) { /* Init the variable that will hold the size to add to the total. */ @@ -145,11 +139,11 @@ acpi_rs_get_byte_stream_length ( */ if (linked_list->data.vendor_specific.length > 7) { segment_size = 3; - } - else { + } else { segment_size = 1; } - segment_size += linked_list->data.vendor_specific.length; + segment_size += + linked_list->data.vendor_specific.length; break; case ACPI_RSTYPE_END_TAG: @@ -194,9 +188,11 @@ acpi_rs_get_byte_stream_length ( */ segment_size = 16; - if (linked_list->data.address16.resource_source.string_ptr) { + if (linked_list->data.address16.resource_source. + string_ptr) { segment_size += - linked_list->data.address16.resource_source.string_length; + linked_list->data.address16.resource_source. + string_length; segment_size++; } break; @@ -211,9 +207,11 @@ acpi_rs_get_byte_stream_length ( */ segment_size = 26; - if (linked_list->data.address32.resource_source.string_ptr) { + if (linked_list->data.address32.resource_source. + string_ptr) { segment_size += - linked_list->data.address32.resource_source.string_length; + linked_list->data.address32.resource_source. + string_length; segment_size++; } break; @@ -227,9 +225,11 @@ acpi_rs_get_byte_stream_length ( */ segment_size = 46; - if (linked_list->data.address64.resource_source.string_ptr) { + if (linked_list->data.address64.resource_source. + string_ptr) { segment_size += - linked_list->data.address64.resource_source.string_length; + linked_list->data.address64.resource_source. + string_length; segment_size++; } break; @@ -244,11 +244,14 @@ acpi_rs_get_byte_stream_length ( * Resource Source + 1 for the null. */ segment_size = 9 + (((acpi_size) - linked_list->data.extended_irq.number_of_interrupts - 1) * 4); + linked_list->data.extended_irq. + number_of_interrupts - 1) * 4); - if (linked_list->data.extended_irq.resource_source.string_ptr) { + if (linked_list->data.extended_irq.resource_source. + string_ptr) { segment_size += - linked_list->data.extended_irq.resource_source.string_length; + linked_list->data.extended_irq. + resource_source.string_length; segment_size++; } break; @@ -257,9 +260,9 @@ acpi_rs_get_byte_stream_length ( /* If we get here, everything is out of sync, exit with error */ - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } /* switch (linked_list->Id) */ + } /* switch (linked_list->Id) */ /* Update the total */ @@ -267,17 +270,16 @@ acpi_rs_get_byte_stream_length ( /* Point to the next object */ - linked_list = ACPI_PTR_ADD (struct acpi_resource, - linked_list, linked_list->length); + linked_list = ACPI_PTR_ADD(struct acpi_resource, + linked_list, linked_list->length); } /* This is the data the caller needs */ *size_needed = byte_stream_size_needed; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_list_length @@ -297,32 +299,28 @@ acpi_rs_get_byte_stream_length ( ******************************************************************************/ acpi_status -acpi_rs_get_list_length ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - acpi_size *size_needed) +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, acpi_size * size_needed) { - u32 buffer_size = 0; - u32 bytes_parsed = 0; - u8 number_of_interrupts = 0; - u8 number_of_channels = 0; - u8 resource_type; - u32 structure_size; - u32 bytes_consumed; - u8 *buffer; - u8 temp8; - u16 temp16; - u8 index; - u8 additional_bytes; - - - ACPI_FUNCTION_TRACE ("rs_get_list_length"); - + u32 buffer_size = 0; + u32 bytes_parsed = 0; + u8 number_of_interrupts = 0; + u8 number_of_channels = 0; + u8 resource_type; + u32 structure_size; + u32 bytes_consumed; + u8 *buffer; + u8 temp8; + u16 temp16; + u8 index; + u8 additional_bytes; + + ACPI_FUNCTION_TRACE("rs_get_list_length"); while (bytes_parsed < byte_stream_buffer_length) { /* The next byte in the stream is the resource type */ - resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); switch (resource_type) { case ACPI_RDESC_TYPE_MEMORY_24: @@ -331,10 +329,10 @@ acpi_rs_get_list_length ( */ bytes_consumed = 12; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); break; - case ACPI_RDESC_TYPE_LARGE_VENDOR: /* * Vendor Defined Resource @@ -342,38 +340,39 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; /* Ensure a 32-bit boundary for the structure */ - temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); + temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + - (temp16 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + (temp16 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_MEMORY_32: /* * 32-Bit Memory Range Resource */ bytes_consumed = 20; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); break; - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: /* * 32-Bit Fixed Memory Resource */ bytes_consumed = 12; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_fixed_mem32); break; - case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: /* * 64-Bit Address Resource @@ -381,13 +380,14 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_address64); break; - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: /* * 64-Bit Address Resource @@ -395,7 +395,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -409,20 +409,19 @@ acpi_rs_get_list_length ( */ if (43 < temp16) { temp8 = (u8) (temp16 - 44); - } - else { + } else { temp8 = 0; } /* Ensure a 64-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: /* * 32-Bit Address Resource @@ -430,7 +429,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -444,20 +443,19 @@ acpi_rs_get_list_length ( */ if (23 < temp16) { temp8 = (u8) (temp16 - 24); - } - else { + } else { temp8 = 0; } /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: /* * 16-Bit Address Resource @@ -465,7 +463,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -479,20 +477,19 @@ acpi_rs_get_list_length ( */ if (13 < temp16) { temp8 = (u8) (temp16 - 14); - } - else { + } else { temp8 = 0; } /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: /* * Extended IRQ @@ -500,7 +497,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -527,21 +524,20 @@ acpi_rs_get_list_length ( */ if (9 + additional_bytes < temp16) { temp8 = (u8) (temp16 - (9 + additional_bytes)); - } - else { + } else { temp8 = 0; } /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + - (additional_bytes * sizeof (u8)) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) + + (additional_bytes * sizeof(u8)) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_IRQ_FORMAT: /* * IRQ Resource. @@ -550,10 +546,9 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; temp8 = *buffer; - if(temp8 & 0x01) { + if (temp8 & 0x01) { bytes_consumed = 4; - } - else { + } else { bytes_consumed = 3; } @@ -563,7 +558,7 @@ acpi_rs_get_list_length ( /* Look at the number of bits set */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); for (index = 0; index < 16; index++) { if (temp16 & 0x1) { @@ -573,11 +568,11 @@ acpi_rs_get_list_length ( temp16 >>= 1; } - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io) + - (number_of_interrupts * sizeof (u32)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) + + (number_of_interrupts * sizeof(u32)); break; - case ACPI_RDESC_TYPE_DMA_FORMAT: /* * DMA Resource @@ -593,19 +588,19 @@ acpi_rs_get_list_length ( temp8 = *buffer; - for(index = 0; index < 8; index++) { - if(temp8 & 0x1) { + for (index = 0; index < 8; index++) { + if (temp8 & 0x1) { ++number_of_channels; } temp8 >>= 1; } - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma) + - (number_of_channels * sizeof (u32)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) + + (number_of_channels * sizeof(u32)); break; - case ACPI_RDESC_TYPE_START_DEPENDENT: /* * Start Dependent Functions Resource @@ -614,17 +609,17 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; temp8 = *buffer; - if(temp8 & 0x01) { + if (temp8 & 0x01) { bytes_consumed = 2; - } - else { + } else { bytes_consumed = 1; } - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_start_dpf); break; - case ACPI_RDESC_TYPE_END_DEPENDENT: /* * End Dependent Functions Resource @@ -633,25 +628,24 @@ acpi_rs_get_list_length ( structure_size = ACPI_RESOURCE_LENGTH; break; - case ACPI_RDESC_TYPE_IO_PORT: /* * IO Port Resource */ bytes_consumed = 8; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); break; - case ACPI_RDESC_TYPE_FIXED_IO_PORT: /* * Fixed IO Port Resource */ bytes_consumed = 4; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: /* * Vendor Specific Resource @@ -664,12 +658,12 @@ acpi_rs_get_list_length ( /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + - (temp8 * sizeof (u8)); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_END_TAG: /* * End Tag @@ -679,18 +673,17 @@ acpi_rs_get_list_length ( byte_stream_buffer_length = bytes_parsed; break; - default: /* * If we get here, everything is out of sync, * exit with an error */ - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } /* Update the return value and counter */ - buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); + buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size); bytes_parsed += bytes_consumed; /* Set the byte stream to point to the next resource */ @@ -701,10 +694,9 @@ acpi_rs_get_list_length ( /* This is the data the caller needs */ *size_needed = buffer_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_pci_routing_table_length @@ -723,22 +715,19 @@ acpi_rs_get_list_length ( ******************************************************************************/ acpi_status -acpi_rs_get_pci_routing_table_length ( - union acpi_operand_object *package_object, - acpi_size *buffer_size_needed) +acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, + acpi_size * buffer_size_needed) { - u32 number_of_elements; - acpi_size temp_size_needed = 0; - union acpi_operand_object **top_object_list; - u32 index; - union acpi_operand_object *package_element; - union acpi_operand_object **sub_object_list; - u8 name_found; - u32 table_index; - - - ACPI_FUNCTION_TRACE ("rs_get_pci_routing_table_length"); + u32 number_of_elements; + acpi_size temp_size_needed = 0; + union acpi_operand_object **top_object_list; + u32 index; + union acpi_operand_object *package_element; + union acpi_operand_object **sub_object_list; + u8 name_found; + u32 table_index; + ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); number_of_elements = package_object->package.count; @@ -769,53 +758,51 @@ acpi_rs_get_pci_routing_table_length ( name_found = FALSE; - for (table_index = 0; table_index < 4 && !name_found; table_index++) { + for (table_index = 0; table_index < 4 && !name_found; + table_index++) { if ((ACPI_TYPE_STRING == - ACPI_GET_OBJECT_TYPE (*sub_object_list)) || - - ((ACPI_TYPE_LOCAL_REFERENCE == - ACPI_GET_OBJECT_TYPE (*sub_object_list)) && - - ((*sub_object_list)->reference.opcode == - AML_INT_NAMEPATH_OP))) { + ACPI_GET_OBJECT_TYPE(*sub_object_list)) + || + ((ACPI_TYPE_LOCAL_REFERENCE == + ACPI_GET_OBJECT_TYPE(*sub_object_list)) + && ((*sub_object_list)->reference.opcode == + AML_INT_NAMEPATH_OP))) { name_found = TRUE; - } - else { + } else { /* Look at the next element */ sub_object_list++; } } - temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); + temp_size_needed += (sizeof(struct acpi_pci_routing_table) - 4); /* Was a String type found? */ if (name_found) { - if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { + if (ACPI_GET_OBJECT_TYPE(*sub_object_list) == + ACPI_TYPE_STRING) { /* * The length String.Length field does not include the * terminating NULL, add 1 */ temp_size_needed += ((acpi_size) - (*sub_object_list)->string.length + 1); + (*sub_object_list)->string. + length + 1); + } else { + temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); } - else { - temp_size_needed += acpi_ns_get_pathname_length ( - (*sub_object_list)->reference.node); - } - } - else { + } else { /* * If no name was found, then this is a NULL, which is * translated as a u32 zero. */ - temp_size_needed += sizeof (u32); + temp_size_needed += sizeof(u32); } /* Round up the size since each element must be aligned */ - temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); + temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); /* Point to the next union acpi_operand_object */ @@ -826,6 +813,7 @@ acpi_rs_get_pci_routing_table_length ( * Adding an extra element to the end of the list, essentially a * NULL terminator */ - *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); - return_ACPI_STATUS (AE_OK); + *buffer_size_needed = + temp_size_needed + sizeof(struct acpi_pci_routing_table); + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 8e0eae0d50bb..0911526b7ad8 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -41,15 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #include <acpi/amlcode.h> #include <acpi/acnamesp.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rscreate") - +ACPI_MODULE_NAME("rscreate") /******************************************************************************* * @@ -68,24 +66,20 @@ * of device resources. * ******************************************************************************/ - acpi_status -acpi_rs_create_resource_list ( - union acpi_operand_object *byte_stream_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, + struct acpi_buffer *output_buffer) { - acpi_status status; - u8 *byte_stream_start; - acpi_size list_size_needed = 0; - u32 byte_stream_buffer_length; + acpi_status status; + u8 *byte_stream_start; + acpi_size list_size_needed = 0; + u32 byte_stream_buffer_length; + ACPI_FUNCTION_TRACE("rs_create_resource_list"); - ACPI_FUNCTION_TRACE ("rs_create_resource_list"); - - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", - byte_stream_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", + byte_stream_buffer)); /* Params already validated, so we don't re-validate here */ @@ -96,36 +90,39 @@ acpi_rs_create_resource_list ( * Pass the byte_stream_buffer into a module that can calculate * the buffer size needed for the linked list */ - status = acpi_rs_get_list_length (byte_stream_start, byte_stream_buffer_length, - &list_size_needed); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", - status, (u32) list_size_needed)); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_rs_get_list_length(byte_stream_start, + byte_stream_buffer_length, + &list_size_needed); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", + status, (u32) list_size_needed)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (output_buffer, list_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_initialize_buffer(output_buffer, list_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Do the conversion */ - status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length, - output_buffer->pointer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_rs_byte_stream_to_list(byte_stream_start, + byte_stream_buffer_length, + output_buffer->pointer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", - output_buffer->pointer, (u32) output_buffer->length)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", + output_buffer->pointer, (u32) output_buffer->length)); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_create_pci_routing_table @@ -148,44 +145,41 @@ acpi_rs_create_resource_list ( ******************************************************************************/ acpi_status -acpi_rs_create_pci_routing_table ( - union acpi_operand_object *package_object, - struct acpi_buffer *output_buffer) +acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, + struct acpi_buffer *output_buffer) { - u8 *buffer; - union acpi_operand_object **top_object_list; - union acpi_operand_object **sub_object_list; - union acpi_operand_object *obj_desc; - acpi_size buffer_size_needed = 0; - u32 number_of_elements; - u32 index; - struct acpi_pci_routing_table *user_prt; - struct acpi_namespace_node *node; - acpi_status status; - struct acpi_buffer path_buffer; - - - ACPI_FUNCTION_TRACE ("rs_create_pci_routing_table"); - + u8 *buffer; + union acpi_operand_object **top_object_list; + union acpi_operand_object **sub_object_list; + union acpi_operand_object *obj_desc; + acpi_size buffer_size_needed = 0; + u32 number_of_elements; + u32 index; + struct acpi_pci_routing_table *user_prt; + struct acpi_namespace_node *node; + acpi_status status; + struct acpi_buffer path_buffer; + + ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); /* Params already validated, so we don't re-validate here */ /* Get the required buffer length */ - status = acpi_rs_get_pci_routing_table_length (package_object, - &buffer_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_get_pci_routing_table_length(package_object, + &buffer_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "buffer_size_needed = %X\n", - (u32) buffer_size_needed)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", + (u32) buffer_size_needed)); /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (output_buffer, buffer_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_initialize_buffer(output_buffer, buffer_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -193,10 +187,10 @@ acpi_rs_create_pci_routing_table ( * should be a package that in turn contains an * acpi_integer Address, a u8 Pin, a Name and a u8 source_index. */ - top_object_list = package_object->package.elements; + top_object_list = package_object->package.elements; number_of_elements = package_object->package.count; - buffer = output_buffer->pointer; - user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + buffer = output_buffer->pointer; + user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); for (index = 0; index < number_of_elements; index++) { /* @@ -206,31 +200,34 @@ acpi_rs_create_pci_routing_table ( * be zero because we cleared the return buffer earlier */ buffer += user_prt->length; - user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); /* * Fill in the Length field with the information we have at this point. * The minus four is to subtract the size of the u8 Source[4] member * because it is added below. */ - user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); + user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); /* Each element of the top-level package must also be a package */ - if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X]) Need sub-package, found %s\n", - index, acpi_ut_get_object_type_name (*top_object_list))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X]) Need sub-package, found %s\n", + index, + acpi_ut_get_object_type_name + (*top_object_list))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Each sub-package must be of length 4 */ if ((*top_object_list)->package.count != 4) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X]) Need package of length 4, found length %d\n", - index, (*top_object_list)->package.count)); - return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X]) Need package of length 4, found length %d\n", + index, + (*top_object_list)->package.count)); + return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); } /* @@ -243,40 +240,43 @@ acpi_rs_create_pci_routing_table ( /* 1) First subobject: Dereference the PRT.Address */ obj_desc = sub_object_list[0]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->address = obj_desc->integer.value; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Address) Need Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Address) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* 2) Second subobject: Dereference the PRT.Pin */ obj_desc = sub_object_list[1]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->pin = (u32) obj_desc->integer.value; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Pin) Need Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Pin) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* 3) Third subobject: Dereference the PRT.source_name */ obj_desc = sub_object_list[2]; - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_LOCAL_REFERENCE: if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Source) Need name, found reference op %X\n", - index, obj_desc->reference.opcode)); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Source) Need name, found reference op %X\n", + index, + obj_desc->reference.opcode)); + return_ACPI_STATUS(AE_BAD_DATA); } node = obj_desc->reference.node; @@ -284,21 +284,23 @@ acpi_rs_create_pci_routing_table ( /* Use *remaining* length of the buffer as max for pathname */ path_buffer.length = output_buffer->length - - (u32) ((u8 *) user_prt->source - - (u8 *) output_buffer->pointer); + (u32) ((u8 *) user_prt->source - + (u8 *) output_buffer->pointer); path_buffer.pointer = user_prt->source; - status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); + status = + acpi_ns_handle_to_pathname((acpi_handle) node, + &path_buffer); /* +1 to include null terminator */ - user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; + user_prt->length += + (u32) ACPI_STRLEN(user_prt->source) + 1; break; - case ACPI_TYPE_STRING: - ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); + ACPI_STRCPY(user_prt->source, obj_desc->string.pointer); /* * Add to the Length field the length of the string @@ -307,7 +309,6 @@ acpi_rs_create_pci_routing_table ( user_prt->length += obj_desc->string.length + 1; break; - case ACPI_TYPE_INTEGER: /* * If this is a number, then the Source Name is NULL, since the @@ -315,33 +316,36 @@ acpi_rs_create_pci_routing_table ( * * Add to the Length field the length of the u32 NULL */ - user_prt->length += sizeof (u32); + user_prt->length += sizeof(u32); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* Now align the current length */ - user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); + user_prt->length = + (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); /* 4) Fourth subobject: Dereference the PRT.source_index */ obj_desc = sub_object_list[3]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->source_index = (u32) obj_desc->integer.value; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].source_index) Need Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].source_index) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* Point to the next union acpi_operand_object in the top level package */ @@ -349,12 +353,11 @@ acpi_rs_create_pci_routing_table ( top_object_list++; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", - output_buffer->pointer, (u32) output_buffer->length)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", + output_buffer->pointer, (u32) output_buffer->length)); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_create_byte_stream @@ -374,19 +377,16 @@ acpi_rs_create_pci_routing_table ( ******************************************************************************/ acpi_status -acpi_rs_create_byte_stream ( - struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer) { - acpi_status status; - acpi_size byte_stream_size_needed = 0; - - - ACPI_FUNCTION_TRACE ("rs_create_byte_stream"); + acpi_status status; + acpi_size byte_stream_size_needed = 0; + ACPI_FUNCTION_TRACE("rs_create_byte_stream"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "linked_list_buffer = %p\n", - linked_list_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", + linked_list_buffer)); /* * Params already validated, so we don't re-validate here @@ -394,32 +394,35 @@ acpi_rs_create_byte_stream ( * Pass the linked_list_buffer into a module that calculates * the buffer size needed for the byte stream. */ - status = acpi_rs_get_byte_stream_length (linked_list_buffer, - &byte_stream_size_needed); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", - (u32) byte_stream_size_needed, acpi_format_exception (status))); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_get_byte_stream_length(linked_list_buffer, + &byte_stream_size_needed); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", + (u32) byte_stream_size_needed, + acpi_format_exception(status))); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (output_buffer, byte_stream_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Do the conversion */ - status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed, - output_buffer->pointer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_rs_list_to_byte_stream(linked_list_buffer, + byte_stream_size_needed, + output_buffer->pointer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", - output_buffer->pointer, (u32) output_buffer->length)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", + output_buffer->pointer, (u32) output_buffer->length)); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 2c3bb8c35741..75bd34d1783f 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -41,70 +41,39 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsdump") - +ACPI_MODULE_NAME("rsdump") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - /* Local prototypes */ +static void acpi_rs_dump_irq(union acpi_resource_data *data); -static void -acpi_rs_dump_irq ( - union acpi_resource_data *data); - -static void -acpi_rs_dump_address16 ( - union acpi_resource_data *data); +static void acpi_rs_dump_address16(union acpi_resource_data *data); -static void -acpi_rs_dump_address32 ( - union acpi_resource_data *data); +static void acpi_rs_dump_address32(union acpi_resource_data *data); -static void -acpi_rs_dump_address64 ( - union acpi_resource_data *data); +static void acpi_rs_dump_address64(union acpi_resource_data *data); -static void -acpi_rs_dump_dma ( - union acpi_resource_data *data); +static void acpi_rs_dump_dma(union acpi_resource_data *data); -static void -acpi_rs_dump_io ( - union acpi_resource_data *data); +static void acpi_rs_dump_io(union acpi_resource_data *data); -static void -acpi_rs_dump_extended_irq ( - union acpi_resource_data *data); +static void acpi_rs_dump_extended_irq(union acpi_resource_data *data); -static void -acpi_rs_dump_fixed_io ( - union acpi_resource_data *data); +static void acpi_rs_dump_fixed_io(union acpi_resource_data *data); -static void -acpi_rs_dump_fixed_memory32 ( - union acpi_resource_data *data); +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data); -static void -acpi_rs_dump_memory24 ( - union acpi_resource_data *data); +static void acpi_rs_dump_memory24(union acpi_resource_data *data); -static void -acpi_rs_dump_memory32 ( - union acpi_resource_data *data); +static void acpi_rs_dump_memory32(union acpi_resource_data *data); -static void -acpi_rs_dump_start_depend_fns ( - union acpi_resource_data *data); - -static void -acpi_rs_dump_vendor_specific ( - union acpi_resource_data *data); +static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data); +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data); /******************************************************************************* * @@ -118,39 +87,37 @@ acpi_rs_dump_vendor_specific ( * ******************************************************************************/ -static void -acpi_rs_dump_irq ( - union acpi_resource_data *data) +static void acpi_rs_dump_irq(union acpi_resource_data *data) { - struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *) data; - u8 index = 0; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data; + u8 index = 0; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("IRQ Resource\n"); + acpi_os_printf("IRQ Resource\n"); - acpi_os_printf (" %s Triggered\n", - ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); + acpi_os_printf(" %s Triggered\n", + ACPI_LEVEL_SENSITIVE == + irq_data->edge_level ? "Level" : "Edge"); - acpi_os_printf (" Active %s\n", - ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); + acpi_os_printf(" Active %s\n", + ACPI_ACTIVE_LOW == + irq_data->active_high_low ? "Low" : "High"); - acpi_os_printf (" %s\n", - ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); + acpi_os_printf(" %s\n", + ACPI_SHARED == + irq_data->shared_exclusive ? "Shared" : "Exclusive"); - acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); + acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts); for (index = 0; index < irq_data->number_of_interrupts; index++) { - acpi_os_printf ("%X ", irq_data->interrupts[index]); + acpi_os_printf("%X ", irq_data->interrupts[index]); } - acpi_os_printf (")\n"); + acpi_os_printf(")\n"); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_dma @@ -163,75 +130,69 @@ acpi_rs_dump_irq ( * ******************************************************************************/ -static void -acpi_rs_dump_dma ( - union acpi_resource_data *data) +static void acpi_rs_dump_dma(union acpi_resource_data *data) { - struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *) data; - u8 index = 0; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data; + u8 index = 0; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("DMA Resource\n"); + acpi_os_printf("DMA Resource\n"); switch (dma_data->type) { case ACPI_COMPATIBILITY: - acpi_os_printf (" Compatibility mode\n"); + acpi_os_printf(" Compatibility mode\n"); break; case ACPI_TYPE_A: - acpi_os_printf (" Type A\n"); + acpi_os_printf(" Type A\n"); break; case ACPI_TYPE_B: - acpi_os_printf (" Type B\n"); + acpi_os_printf(" Type B\n"); break; case ACPI_TYPE_F: - acpi_os_printf (" Type F\n"); + acpi_os_printf(" Type F\n"); break; default: - acpi_os_printf (" Invalid DMA type\n"); + acpi_os_printf(" Invalid DMA type\n"); break; } - acpi_os_printf (" %sBus Master\n", - ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); - + acpi_os_printf(" %sBus Master\n", + ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); switch (dma_data->transfer) { case ACPI_TRANSFER_8: - acpi_os_printf (" 8-bit only transfer\n"); + acpi_os_printf(" 8-bit only transfer\n"); break; case ACPI_TRANSFER_8_16: - acpi_os_printf (" 8 and 16-bit transfer\n"); + acpi_os_printf(" 8 and 16-bit transfer\n"); break; case ACPI_TRANSFER_16: - acpi_os_printf (" 16 bit only transfer\n"); + acpi_os_printf(" 16 bit only transfer\n"); break; default: - acpi_os_printf (" Invalid transfer preference\n"); + acpi_os_printf(" Invalid transfer preference\n"); break; } - acpi_os_printf (" Number of Channels: %X ( ", - dma_data->number_of_channels); + acpi_os_printf(" Number of Channels: %X ( ", + dma_data->number_of_channels); for (index = 0; index < dma_data->number_of_channels; index++) { - acpi_os_printf ("%X ", dma_data->channels[index]); + acpi_os_printf("%X ", dma_data->channels[index]); } - acpi_os_printf (")\n"); + acpi_os_printf(")\n"); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_start_depend_fns @@ -244,58 +205,54 @@ acpi_rs_dump_dma ( * ******************************************************************************/ -static void -acpi_rs_dump_start_depend_fns ( - union acpi_resource_data *data) +static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data) { - struct acpi_resource_start_dpf *sdf_data = (struct acpi_resource_start_dpf *) data; - + struct acpi_resource_start_dpf *sdf_data = + (struct acpi_resource_start_dpf *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - - acpi_os_printf ("Start Dependent Functions Resource\n"); + acpi_os_printf("Start Dependent Functions Resource\n"); switch (sdf_data->compatibility_priority) { case ACPI_GOOD_CONFIGURATION: - acpi_os_printf (" Good configuration\n"); + acpi_os_printf(" Good configuration\n"); break; case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf (" Acceptable configuration\n"); + acpi_os_printf(" Acceptable configuration\n"); break; case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf (" Sub-optimal configuration\n"); + acpi_os_printf(" Sub-optimal configuration\n"); break; default: - acpi_os_printf (" Invalid compatibility priority\n"); + acpi_os_printf(" Invalid compatibility priority\n"); break; } - switch(sdf_data->performance_robustness) { + switch (sdf_data->performance_robustness) { case ACPI_GOOD_CONFIGURATION: - acpi_os_printf (" Good configuration\n"); + acpi_os_printf(" Good configuration\n"); break; case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf (" Acceptable configuration\n"); + acpi_os_printf(" Acceptable configuration\n"); break; case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf (" Sub-optimal configuration\n"); + acpi_os_printf(" Sub-optimal configuration\n"); break; default: - acpi_os_printf (" Invalid performance robustness preference\n"); + acpi_os_printf(" Invalid performance robustness preference\n"); break; } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_io @@ -308,33 +265,30 @@ acpi_rs_dump_start_depend_fns ( * ******************************************************************************/ -static void -acpi_rs_dump_io ( - union acpi_resource_data *data) +static void acpi_rs_dump_io(union acpi_resource_data *data) { - struct acpi_resource_io *io_data = (struct acpi_resource_io *) data; - + struct acpi_resource_io *io_data = (struct acpi_resource_io *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("Io Resource\n"); - acpi_os_printf ("Io Resource\n"); + acpi_os_printf(" %d bit decode\n", + ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); - acpi_os_printf (" %d bit decode\n", - ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); + acpi_os_printf(" Range minimum base: %08X\n", + io_data->min_base_address); - acpi_os_printf (" Range minimum base: %08X\n", io_data->min_base_address); + acpi_os_printf(" Range maximum base: %08X\n", + io_data->max_base_address); - acpi_os_printf (" Range maximum base: %08X\n", io_data->max_base_address); + acpi_os_printf(" Alignment: %08X\n", io_data->alignment); - acpi_os_printf (" Alignment: %08X\n", io_data->alignment); - - acpi_os_printf (" Range Length: %08X\n", io_data->range_length); + acpi_os_printf(" Range Length: %08X\n", io_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_fixed_io @@ -347,25 +301,22 @@ acpi_rs_dump_io ( * ******************************************************************************/ -static void -acpi_rs_dump_fixed_io ( - union acpi_resource_data *data) +static void acpi_rs_dump_fixed_io(union acpi_resource_data *data) { - struct acpi_resource_fixed_io *fixed_io_data = (struct acpi_resource_fixed_io *) data; - + struct acpi_resource_fixed_io *fixed_io_data = + (struct acpi_resource_fixed_io *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("Fixed Io Resource\n"); + acpi_os_printf(" Range base address: %08X", + fixed_io_data->base_address); - acpi_os_printf ("Fixed Io Resource\n"); - acpi_os_printf (" Range base address: %08X", fixed_io_data->base_address); - - acpi_os_printf (" Range length: %08X", fixed_io_data->range_length); + acpi_os_printf(" Range length: %08X", fixed_io_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_vendor_specific @@ -378,30 +329,26 @@ acpi_rs_dump_fixed_io ( * ******************************************************************************/ -static void -acpi_rs_dump_vendor_specific ( - union acpi_resource_data *data) +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data) { - struct acpi_resource_vendor *vendor_data = (struct acpi_resource_vendor *) data; - u16 index = 0; - + struct acpi_resource_vendor *vendor_data = + (struct acpi_resource_vendor *)data; + u16 index = 0; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("Vendor Specific Resource\n"); - acpi_os_printf ("Vendor Specific Resource\n"); - - acpi_os_printf (" Length: %08X\n", vendor_data->length); + acpi_os_printf(" Length: %08X\n", vendor_data->length); for (index = 0; index < vendor_data->length; index++) { - acpi_os_printf (" Byte %X: %08X\n", - index, vendor_data->reserved[index]); + acpi_os_printf(" Byte %X: %08X\n", + index, vendor_data->reserved[index]); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_memory24 @@ -414,37 +361,33 @@ acpi_rs_dump_vendor_specific ( * ******************************************************************************/ -static void -acpi_rs_dump_memory24 ( - union acpi_resource_data *data) +static void acpi_rs_dump_memory24(union acpi_resource_data *data) { - struct acpi_resource_mem24 *memory24_data = (struct acpi_resource_mem24 *) data; - + struct acpi_resource_mem24 *memory24_data = + (struct acpi_resource_mem24 *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("24-Bit Memory Range Resource\n"); - acpi_os_printf ("24-Bit Memory Range Resource\n"); + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + memory24_data->read_write_attribute ? + "/Write" : " only"); - acpi_os_printf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - memory24_data->read_write_attribute ? - "/Write" : " only"); + acpi_os_printf(" Range minimum base: %08X\n", + memory24_data->min_base_address); - acpi_os_printf (" Range minimum base: %08X\n", - memory24_data->min_base_address); + acpi_os_printf(" Range maximum base: %08X\n", + memory24_data->max_base_address); - acpi_os_printf (" Range maximum base: %08X\n", - memory24_data->max_base_address); + acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment); - acpi_os_printf (" Alignment: %08X\n", memory24_data->alignment); - - acpi_os_printf (" Range length: %08X\n", memory24_data->range_length); + acpi_os_printf(" Range length: %08X\n", memory24_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_memory32 @@ -457,37 +400,33 @@ acpi_rs_dump_memory24 ( * ******************************************************************************/ -static void -acpi_rs_dump_memory32 ( - union acpi_resource_data *data) +static void acpi_rs_dump_memory32(union acpi_resource_data *data) { - struct acpi_resource_mem32 *memory32_data = (struct acpi_resource_mem32 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_mem32 *memory32_data = + (struct acpi_resource_mem32 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("32-Bit Memory Range Resource\n"); + acpi_os_printf("32-Bit Memory Range Resource\n"); - acpi_os_printf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - memory32_data->read_write_attribute ? - "/Write" : " only"); + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + memory32_data->read_write_attribute ? + "/Write" : " only"); - acpi_os_printf (" Range minimum base: %08X\n", - memory32_data->min_base_address); + acpi_os_printf(" Range minimum base: %08X\n", + memory32_data->min_base_address); - acpi_os_printf (" Range maximum base: %08X\n", - memory32_data->max_base_address); + acpi_os_printf(" Range maximum base: %08X\n", + memory32_data->max_base_address); - acpi_os_printf (" Alignment: %08X\n", memory32_data->alignment); + acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment); - acpi_os_printf (" Range length: %08X\n", memory32_data->range_length); + acpi_os_printf(" Range length: %08X\n", memory32_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_fixed_memory32 @@ -500,33 +439,29 @@ acpi_rs_dump_memory32 ( * ******************************************************************************/ -static void -acpi_rs_dump_fixed_memory32 ( - union acpi_resource_data *data) +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data) { - struct acpi_resource_fixed_mem32 *fixed_memory32_data = - (struct acpi_resource_fixed_mem32 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_fixed_mem32 *fixed_memory32_data = + (struct acpi_resource_fixed_mem32 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); + acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); - acpi_os_printf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - fixed_memory32_data->read_write_attribute ? "/Write" : " Only"); + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + fixed_memory32_data-> + read_write_attribute ? "/Write" : " Only"); - acpi_os_printf (" Range base address: %08X\n", - fixed_memory32_data->range_base_address); + acpi_os_printf(" Range base address: %08X\n", + fixed_memory32_data->range_base_address); - acpi_os_printf (" Range length: %08X\n", - fixed_memory32_data->range_length); + acpi_os_printf(" Range length: %08X\n", + fixed_memory32_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_address16 @@ -539,134 +474,136 @@ acpi_rs_dump_fixed_memory32 ( * ******************************************************************************/ -static void -acpi_rs_dump_address16 ( - union acpi_resource_data *data) +static void acpi_rs_dump_address16(union acpi_resource_data *data) { - struct acpi_resource_address16 *address16_data = (struct acpi_resource_address16 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_address16 *address16_data = + (struct acpi_resource_address16 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("16-Bit Address Space Resource\n"); - acpi_os_printf (" Resource Type: "); + acpi_os_printf("16-Bit Address Space Resource\n"); + acpi_os_printf(" Resource Type: "); switch (address16_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_os_printf ("Memory Range\n"); + acpi_os_printf("Memory Range\n"); switch (address16_data->attribute.memory.cache_attribute) { case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf (" Type Specific: Noncacheable memory\n"); + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - acpi_os_printf (" Type Specific: Cacheable memory\n"); + acpi_os_printf(" Type Specific: Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf (" Type Specific: Write-combining memory\n"); + acpi_os_printf + (" Type Specific: Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf (" Type Specific: Prefetchable memory\n"); + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); break; default: - acpi_os_printf (" Type Specific: Invalid cache attribute\n"); + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); break; } - acpi_os_printf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - address16_data->attribute.memory.read_write_attribute ? - "/Write" : " Only"); + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address16_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_os_printf ("I/O Range\n"); + acpi_os_printf("I/O Range\n"); switch (address16_data->attribute.io.range_attribute) { case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: ISA Io Addresses\n"); + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); break; case ACPI_ENTIRE_RANGE: - acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); break; default: - acpi_os_printf (" Type Specific: Invalid range attribute\n"); + acpi_os_printf + (" Type Specific: Invalid range attribute\n"); break; } - acpi_os_printf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - address16_data->attribute.io.translation_attribute ? - "Sparse" : "Dense"); + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address16_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_os_printf ("Bus Number Range\n"); + acpi_os_printf("Bus Number Range\n"); break; default: - acpi_os_printf ("0x%2.2X\n", address16_data->resource_type); + acpi_os_printf("0x%2.2X\n", address16_data->resource_type); break; } - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == address16_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address16_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s decode\n", - ACPI_SUB_DECODE == address16_data->decode ? - "Subtractive" : "Positive"); + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address16_data->decode ? + "Subtractive" : "Positive"); - acpi_os_printf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? - "" : "not"); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? + "" : "not"); - acpi_os_printf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? - "" : "not"); + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? + "" : "not"); - acpi_os_printf (" Granularity: %08X\n", - address16_data->granularity); + acpi_os_printf(" Granularity: %08X\n", address16_data->granularity); - acpi_os_printf (" Address range min: %08X\n", - address16_data->min_address_range); + acpi_os_printf(" Address range min: %08X\n", + address16_data->min_address_range); - acpi_os_printf (" Address range max: %08X\n", - address16_data->max_address_range); + acpi_os_printf(" Address range max: %08X\n", + address16_data->max_address_range); - acpi_os_printf (" Address translation offset: %08X\n", - address16_data->address_translation_offset); + acpi_os_printf(" Address translation offset: %08X\n", + address16_data->address_translation_offset); - acpi_os_printf (" Address Length: %08X\n", - address16_data->address_length); + acpi_os_printf(" Address Length: %08X\n", + address16_data->address_length); if (0xFF != address16_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X\n", - address16_data->resource_source.index); + acpi_os_printf(" Resource Source Index: %X\n", + address16_data->resource_source.index); - acpi_os_printf (" Resource Source: %s\n", - address16_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s\n", + address16_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_address32 @@ -679,134 +616,136 @@ acpi_rs_dump_address16 ( * ******************************************************************************/ -static void -acpi_rs_dump_address32 ( - union acpi_resource_data *data) +static void acpi_rs_dump_address32(union acpi_resource_data *data) { - struct acpi_resource_address32 *address32_data = (struct acpi_resource_address32 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_address32 *address32_data = + (struct acpi_resource_address32 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("32-Bit Address Space Resource\n"); + acpi_os_printf("32-Bit Address Space Resource\n"); switch (address32_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_os_printf (" Resource Type: Memory Range\n"); + acpi_os_printf(" Resource Type: Memory Range\n"); switch (address32_data->attribute.memory.cache_attribute) { case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf (" Type Specific: Noncacheable memory\n"); + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - acpi_os_printf (" Type Specific: Cacheable memory\n"); + acpi_os_printf(" Type Specific: Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf (" Type Specific: Write-combining memory\n"); + acpi_os_printf + (" Type Specific: Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf (" Type Specific: Prefetchable memory\n"); + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); break; default: - acpi_os_printf (" Type Specific: Invalid cache attribute\n"); + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); break; } - acpi_os_printf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - address32_data->attribute.memory.read_write_attribute ? - "/Write" : " Only"); + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address32_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_os_printf (" Resource Type: Io Range\n"); + acpi_os_printf(" Resource Type: Io Range\n"); switch (address32_data->attribute.io.range_attribute) { case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: ISA Io Addresses\n"); + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); break; case ACPI_ENTIRE_RANGE: - acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); break; default: - acpi_os_printf (" Type Specific: Invalid Range attribute"); + acpi_os_printf + (" Type Specific: Invalid Range attribute"); break; } - acpi_os_printf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - address32_data->attribute.io.translation_attribute ? - "Sparse" : "Dense"); + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address32_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_os_printf (" Resource Type: Bus Number Range\n"); + acpi_os_printf(" Resource Type: Bus Number Range\n"); break; default: - acpi_os_printf (" Resource Type: 0x%2.2X\n", - address32_data->resource_type); + acpi_os_printf(" Resource Type: 0x%2.2X\n", + address32_data->resource_type); break; } - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == address32_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address32_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s decode\n", - ACPI_SUB_DECODE == address32_data->decode ? - "Subtractive" : "Positive"); + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address32_data->decode ? + "Subtractive" : "Positive"); - acpi_os_printf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? - "" : "not "); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? + "" : "not "); - acpi_os_printf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? - "" : "not "); + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? + "" : "not "); - acpi_os_printf (" Granularity: %08X\n", - address32_data->granularity); + acpi_os_printf(" Granularity: %08X\n", address32_data->granularity); - acpi_os_printf (" Address range min: %08X\n", - address32_data->min_address_range); + acpi_os_printf(" Address range min: %08X\n", + address32_data->min_address_range); - acpi_os_printf (" Address range max: %08X\n", - address32_data->max_address_range); + acpi_os_printf(" Address range max: %08X\n", + address32_data->max_address_range); - acpi_os_printf (" Address translation offset: %08X\n", - address32_data->address_translation_offset); + acpi_os_printf(" Address translation offset: %08X\n", + address32_data->address_translation_offset); - acpi_os_printf (" Address Length: %08X\n", - address32_data->address_length); + acpi_os_printf(" Address Length: %08X\n", + address32_data->address_length); - if(0xFF != address32_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X\n", - address32_data->resource_source.index); + if (0xFF != address32_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X\n", + address32_data->resource_source.index); - acpi_os_printf (" Resource Source: %s\n", - address32_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s\n", + address32_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_address64 @@ -819,137 +758,142 @@ acpi_rs_dump_address32 ( * ******************************************************************************/ -static void -acpi_rs_dump_address64 ( - union acpi_resource_data *data) +static void acpi_rs_dump_address64(union acpi_resource_data *data) { - struct acpi_resource_address64 *address64_data = (struct acpi_resource_address64 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_address64 *address64_data = + (struct acpi_resource_address64 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("64-Bit Address Space Resource\n"); + acpi_os_printf("64-Bit Address Space Resource\n"); switch (address64_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_os_printf (" Resource Type: Memory Range\n"); + acpi_os_printf(" Resource Type: Memory Range\n"); switch (address64_data->attribute.memory.cache_attribute) { case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf (" Type Specific: Noncacheable memory\n"); + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - acpi_os_printf (" Type Specific: Cacheable memory\n"); + acpi_os_printf(" Type Specific: Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf (" Type Specific: Write-combining memory\n"); + acpi_os_printf + (" Type Specific: Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf (" Type Specific: Prefetchable memory\n"); + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); break; default: - acpi_os_printf (" Type Specific: Invalid cache attribute\n"); + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); break; } - acpi_os_printf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - address64_data->attribute.memory.read_write_attribute ? - "/Write" : " Only"); + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address64_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_os_printf (" Resource Type: Io Range\n"); + acpi_os_printf(" Resource Type: Io Range\n"); switch (address64_data->attribute.io.range_attribute) { case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: ISA Io Addresses\n"); + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); break; case ACPI_ENTIRE_RANGE: - acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); break; default: - acpi_os_printf (" Type Specific: Invalid Range attribute"); + acpi_os_printf + (" Type Specific: Invalid Range attribute"); break; } - acpi_os_printf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - address64_data->attribute.io.translation_attribute ? - "Sparse" : "Dense"); + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address64_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_os_printf (" Resource Type: Bus Number Range\n"); + acpi_os_printf(" Resource Type: Bus Number Range\n"); break; default: - acpi_os_printf (" Resource Type: 0x%2.2X\n", - address64_data->resource_type); + acpi_os_printf(" Resource Type: 0x%2.2X\n", + address64_data->resource_type); break; } - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == address64_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address64_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s decode\n", - ACPI_SUB_DECODE == address64_data->decode ? - "Subtractive" : "Positive"); + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address64_data->decode ? + "Subtractive" : "Positive"); - acpi_os_printf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? - "" : "not "); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? + "" : "not "); - acpi_os_printf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? - "" : "not "); + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? + "" : "not "); - acpi_os_printf (" Granularity: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->granularity)); + acpi_os_printf(" Granularity: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->granularity)); - acpi_os_printf (" Address range min: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->min_address_range)); + acpi_os_printf(" Address range min: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->min_address_range)); - acpi_os_printf (" Address range max: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->max_address_range)); + acpi_os_printf(" Address range max: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->max_address_range)); - acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); + acpi_os_printf(" Address translation offset: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data-> + address_translation_offset)); - acpi_os_printf (" Address Length: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->address_length)); + acpi_os_printf(" Address Length: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->address_length)); - acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); + acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data-> + type_specific_attributes)); if (0xFF != address64_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X\n", - address64_data->resource_source.index); + acpi_os_printf(" Resource Source Index: %X\n", + address64_data->resource_source.index); - acpi_os_printf (" Resource Source: %s\n", - address64_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s\n", + address64_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_extended_irq @@ -962,55 +906,52 @@ acpi_rs_dump_address64 ( * ******************************************************************************/ -static void -acpi_rs_dump_extended_irq ( - union acpi_resource_data *data) +static void acpi_rs_dump_extended_irq(union acpi_resource_data *data) { - struct acpi_resource_ext_irq *ext_irq_data = (struct acpi_resource_ext_irq *) data; - u8 index = 0; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_ext_irq *ext_irq_data = + (struct acpi_resource_ext_irq *)data; + u8 index = 0; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("Extended IRQ Resource\n"); + acpi_os_printf("Extended IRQ Resource\n"); - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == ext_irq_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == ext_irq_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s\n", - ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? - "Level" : "Edge"); + acpi_os_printf(" %s\n", + ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? + "Level" : "Edge"); - acpi_os_printf (" Active %s\n", - ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? - "low" : "high"); + acpi_os_printf(" Active %s\n", + ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? + "low" : "high"); - acpi_os_printf (" %s\n", - ACPI_SHARED == ext_irq_data->shared_exclusive ? - "Shared" : "Exclusive"); + acpi_os_printf(" %s\n", + ACPI_SHARED == ext_irq_data->shared_exclusive ? + "Shared" : "Exclusive"); - acpi_os_printf (" Interrupts : %X ( ", ext_irq_data->number_of_interrupts); + acpi_os_printf(" Interrupts : %X ( ", + ext_irq_data->number_of_interrupts); for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { - acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); + acpi_os_printf("%X ", ext_irq_data->interrupts[index]); } - acpi_os_printf (")\n"); + acpi_os_printf(")\n"); - if(0xFF != ext_irq_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X", - ext_irq_data->resource_source.index); + if (0xFF != ext_irq_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X", + ext_irq_data->resource_source.index); - acpi_os_printf (" Resource Source: %s", - ext_irq_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s", + ext_irq_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_resource_list @@ -1023,92 +964,91 @@ acpi_rs_dump_extended_irq ( * ******************************************************************************/ -void -acpi_rs_dump_resource_list ( - struct acpi_resource *resource) +void acpi_rs_dump_resource_list(struct acpi_resource *resource) { - u8 count = 0; - u8 done = FALSE; - - - ACPI_FUNCTION_ENTRY (); + u8 count = 0; + u8 done = FALSE; + ACPI_FUNCTION_ENTRY(); if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { while (!done) { - acpi_os_printf ("Resource structure %X.\n", count++); + acpi_os_printf("Resource structure %X.\n", count++); switch (resource->id) { case ACPI_RSTYPE_IRQ: - acpi_rs_dump_irq (&resource->data); + acpi_rs_dump_irq(&resource->data); break; case ACPI_RSTYPE_DMA: - acpi_rs_dump_dma (&resource->data); + acpi_rs_dump_dma(&resource->data); break; case ACPI_RSTYPE_START_DPF: - acpi_rs_dump_start_depend_fns (&resource->data); + acpi_rs_dump_start_depend_fns(&resource->data); break; case ACPI_RSTYPE_END_DPF: - acpi_os_printf ("end_dependent_functions Resource\n"); - /* acpi_rs_dump_end_dependent_functions (Resource->Data);*/ + acpi_os_printf + ("end_dependent_functions Resource\n"); + /* acpi_rs_dump_end_dependent_functions (Resource->Data); */ break; case ACPI_RSTYPE_IO: - acpi_rs_dump_io (&resource->data); + acpi_rs_dump_io(&resource->data); break; case ACPI_RSTYPE_FIXED_IO: - acpi_rs_dump_fixed_io (&resource->data); + acpi_rs_dump_fixed_io(&resource->data); break; case ACPI_RSTYPE_VENDOR: - acpi_rs_dump_vendor_specific (&resource->data); + acpi_rs_dump_vendor_specific(&resource->data); break; case ACPI_RSTYPE_END_TAG: - /*rs_dump_end_tag (Resource->Data);*/ - acpi_os_printf ("end_tag Resource\n"); + /*rs_dump_end_tag (Resource->Data); */ + acpi_os_printf("end_tag Resource\n"); done = TRUE; break; case ACPI_RSTYPE_MEM24: - acpi_rs_dump_memory24 (&resource->data); + acpi_rs_dump_memory24(&resource->data); break; case ACPI_RSTYPE_MEM32: - acpi_rs_dump_memory32 (&resource->data); + acpi_rs_dump_memory32(&resource->data); break; case ACPI_RSTYPE_FIXED_MEM32: - acpi_rs_dump_fixed_memory32 (&resource->data); + acpi_rs_dump_fixed_memory32(&resource->data); break; case ACPI_RSTYPE_ADDRESS16: - acpi_rs_dump_address16 (&resource->data); + acpi_rs_dump_address16(&resource->data); break; case ACPI_RSTYPE_ADDRESS32: - acpi_rs_dump_address32 (&resource->data); + acpi_rs_dump_address32(&resource->data); break; case ACPI_RSTYPE_ADDRESS64: - acpi_rs_dump_address64 (&resource->data); + acpi_rs_dump_address64(&resource->data); break; case ACPI_RSTYPE_EXT_IRQ: - acpi_rs_dump_extended_irq (&resource->data); + acpi_rs_dump_extended_irq(&resource->data); break; default: - acpi_os_printf ("Invalid resource type\n"); + acpi_os_printf("Invalid resource type\n"); break; } - resource = ACPI_PTR_ADD (struct acpi_resource, resource, resource->length); + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); } } @@ -1127,36 +1067,38 @@ acpi_rs_dump_resource_list ( * ******************************************************************************/ -void -acpi_rs_dump_irq_list ( - u8 *route_table) +void acpi_rs_dump_irq_list(u8 * route_table) { - u8 *buffer = route_table; - u8 count = 0; - u8 done = FALSE; - struct acpi_pci_routing_table *prt_element; - - - ACPI_FUNCTION_ENTRY (); + u8 *buffer = route_table; + u8 count = 0; + u8 done = FALSE; + struct acpi_pci_routing_table *prt_element; + ACPI_FUNCTION_ENTRY(); if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { - prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); while (!done) { - acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); + acpi_os_printf("PCI IRQ Routing Table structure %X.\n", + count++); - acpi_os_printf (" Address: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (prt_element->address)); + acpi_os_printf(" Address: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(prt_element-> + address)); - acpi_os_printf (" Pin: %X\n", prt_element->pin); + acpi_os_printf(" Pin: %X\n", prt_element->pin); - acpi_os_printf (" Source: %s\n", prt_element->source); + acpi_os_printf(" Source: %s\n", prt_element->source); - acpi_os_printf (" source_index: %X\n", prt_element->source_index); + acpi_os_printf(" source_index: %X\n", + prt_element->source_index); buffer += prt_element->length; - prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, + buffer); if (0 == prt_element->length) { done = TRUE; } @@ -1167,4 +1109,3 @@ acpi_rs_dump_irq_list ( } #endif - diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 23a4d149fac8..d53bbe89e851 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsio") - +ACPI_MODULE_NAME("rsio") /******************************************************************************* * @@ -69,24 +67,18 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_io); - - - ACPI_FUNCTION_TRACE ("rs_io_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); + ACPI_FUNCTION_TRACE("rs_io_resource"); /* The number of bytes consumed are Constant */ @@ -104,14 +96,14 @@ acpi_rs_io_resource ( /* Check min_base Address */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.io.min_base_address = temp16; /* Check max_base Address */ buffer += 2; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.io.max_base_address = temp16; @@ -136,10 +128,9 @@ acpi_rs_io_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_io_resource @@ -162,22 +153,18 @@ acpi_rs_io_resource ( ******************************************************************************/ acpi_status -acpi_rs_fixed_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_fixed_io); - - - ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); + ACPI_FUNCTION_TRACE("rs_fixed_io_resource"); /* The number of bytes consumed are Constant */ @@ -188,7 +175,7 @@ acpi_rs_fixed_io_resource ( /* Check Range Base Address */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.fixed_io.base_address = temp16; @@ -206,10 +193,9 @@ acpi_rs_fixed_io_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_io_stream @@ -227,18 +213,14 @@ acpi_rs_fixed_io_resource ( ******************************************************************************/ acpi_status -acpi_rs_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_io_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_io_stream"); /* The descriptor field is static */ @@ -256,14 +238,14 @@ acpi_rs_io_stream ( temp16 = (u16) linked_list->data.io.min_base_address; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Range maximum base address */ temp16 = (u16) linked_list->data.io.max_base_address; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the base alignment */ @@ -282,11 +264,10 @@ acpi_rs_io_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_io_stream @@ -304,18 +285,14 @@ acpi_rs_io_stream ( ******************************************************************************/ acpi_status -acpi_rs_fixed_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); /* The descriptor field is static */ @@ -327,7 +304,7 @@ acpi_rs_fixed_io_stream ( temp16 = (u16) linked_list->data.fixed_io.base_address; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the range length */ @@ -339,11 +316,10 @@ acpi_rs_fixed_io_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_dma_resource @@ -366,23 +342,18 @@ acpi_rs_fixed_io_stream ( ******************************************************************************/ acpi_status -acpi_rs_dma_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_dma_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u8 temp8 = 0; - u8 index; - u8 i; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_dma); - - - ACPI_FUNCTION_TRACE ("rs_dma_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u8 temp8 = 0; + u8 index; + u8 i; + acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); + ACPI_FUNCTION_TRACE("rs_dma_resource"); /* The number of bytes consumed are Constant */ @@ -422,9 +393,9 @@ acpi_rs_dma_resource ( output_struct->data.dma.transfer = temp8 & 0x03; if (0x03 == output_struct->data.dma.transfer) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid DMA.Transfer preference (3)\n")); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid DMA.Transfer preference (3)\n")); + return_ACPI_STATUS(AE_BAD_DATA); } /* Get bus master preference (Bit[2]) */ @@ -442,10 +413,9 @@ acpi_rs_dma_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_dma_stream @@ -463,19 +433,15 @@ acpi_rs_dma_resource ( ******************************************************************************/ acpi_status -acpi_rs_dma_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_dma_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - - ACPI_FUNCTION_TRACE ("rs_dma_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + ACPI_FUNCTION_TRACE("rs_dma_stream"); /* The descriptor field is static */ @@ -486,8 +452,7 @@ acpi_rs_dma_stream ( /* Loop through all of the Channels and set the mask bits */ for (index = 0; - index < linked_list->data.dma.number_of_channels; - index++) { + index < linked_list->data.dma.number_of_channels; index++) { temp16 = (u16) linked_list->data.dma.channels[index]; temp8 |= 0x1 << temp16; } @@ -506,7 +471,6 @@ acpi_rs_dma_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 8a2b630be45b..7179b6243f5b 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsirq") - +ACPI_MODULE_NAME("rsirq") /******************************************************************************* * @@ -69,26 +67,20 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 i; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_irq); - - - ACPI_FUNCTION_TRACE ("rs_irq_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + u8 i; + acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); + ACPI_FUNCTION_TRACE("rs_irq_resource"); /* * The number of bytes consumed are contained in the descriptor @@ -101,7 +93,7 @@ acpi_rs_irq_resource ( /* Point to the 16-bits of Bytes 1 and 2 */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.irq.number_of_interrupts = 0; @@ -132,14 +124,18 @@ acpi_rs_irq_resource ( /* Check for HE, LL interrupts */ switch (temp8 & 0x09) { - case 0x01: /* HE */ - output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; - output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH; + case 0x01: /* HE */ + output_struct->data.irq.edge_level = + ACPI_EDGE_SENSITIVE; + output_struct->data.irq.active_high_low = + ACPI_ACTIVE_HIGH; break; - case 0x08: /* LL */ - output_struct->data.irq.edge_level = ACPI_LEVEL_SENSITIVE; - output_struct->data.irq.active_high_low = ACPI_ACTIVE_LOW; + case 0x08: /* LL */ + output_struct->data.irq.edge_level = + ACPI_LEVEL_SENSITIVE; + output_struct->data.irq.active_high_low = + ACPI_ACTIVE_LOW; break; default: @@ -148,17 +144,16 @@ acpi_rs_irq_resource ( * are allowed (ACPI spec, section "IRQ Format") * so 0x00 and 0x09 are illegal. */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid interrupt polarity/trigger in resource list, %X\n", - temp8)); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid interrupt polarity/trigger in resource list, %X\n", + temp8)); + return_ACPI_STATUS(AE_BAD_DATA); } /* Check for sharable */ output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; - } - else { + } else { /* * Assume Edge Sensitive, Active High, Non-Sharable * per ACPI Specification @@ -175,10 +170,9 @@ acpi_rs_irq_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_irq_stream @@ -196,32 +190,27 @@ acpi_rs_irq_resource ( ******************************************************************************/ acpi_status -acpi_rs_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 IRqinfo_byte_needed; - - - ACPI_FUNCTION_TRACE ("rs_irq_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + u8 IRqinfo_byte_needed; + ACPI_FUNCTION_TRACE("rs_irq_stream"); /* * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && - ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { + ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && + ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { *buffer = 0x22; IRqinfo_byte_needed = FALSE; - } - else { + } else { *buffer = 0x23; IRqinfo_byte_needed = TRUE; } @@ -231,14 +220,13 @@ acpi_rs_irq_stream ( /* Loop through all of the interrupts and set the mask bits */ - for(index = 0; - index < linked_list->data.irq.number_of_interrupts; - index++) { + for (index = 0; + index < linked_list->data.irq.number_of_interrupts; index++) { temp8 = (u8) linked_list->data.irq.interrupts[index]; temp16 |= 0x1 << temp8; } - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the IRQ Info byte if needed. */ @@ -246,13 +234,12 @@ acpi_rs_irq_stream ( if (IRqinfo_byte_needed) { temp8 = 0; temp8 = (u8) ((linked_list->data.irq.shared_exclusive & - 0x01) << 4); + 0x01) << 4); if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { + ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { temp8 |= 0x08; - } - else { + } else { temp8 |= 0x01; } @@ -262,11 +249,10 @@ acpi_rs_irq_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_extended_irq_resource @@ -289,34 +275,30 @@ acpi_rs_irq_stream ( ******************************************************************************/ acpi_status -acpi_rs_extended_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 *temp_ptr; - u8 index; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_ext_irq); - - - ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 *temp_ptr; + u8 index; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq); + ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 6) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -338,7 +320,7 @@ acpi_rs_extended_irq_resource ( * - Edge/Level are defined opposite in the table vs the headers */ output_struct->data.extended_irq.edge_level = - (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; + (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; /* Check Interrupt Polarity */ @@ -356,7 +338,7 @@ acpi_rs_extended_irq_resource ( /* Must have at least one IRQ */ if (temp8 < 1) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } output_struct->data.extended_irq.number_of_interrupts = temp8; @@ -374,8 +356,8 @@ acpi_rs_extended_irq_resource ( /* Cycle through every IRQ in the table */ for (index = 0; index < temp8; index++) { - ACPI_MOVE_32_TO_32 ( - &output_struct->data.extended_irq.interrupts[index], buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq. + interrupts[index], buffer); /* Point to the next IRQ */ @@ -393,12 +375,13 @@ acpi_rs_extended_irq_resource ( * we add 1 to the length. */ if (*bytes_consumed > - ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + - (5 + 1)) { + ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * + 4) + (5 + 1)) { /* Dereference the Index */ temp8 = *buffer; - output_struct->data.extended_irq.resource_source.index = (u32) temp8; + output_struct->data.extended_irq.resource_source.index = + (u32) temp8; /* Point to the String */ @@ -407,10 +390,10 @@ acpi_rs_extended_irq_resource ( /* Point the String pointer to the end of this structure. */ output_struct->data.extended_irq.resource_source.string_ptr = - (char *)((char *) output_struct + struct_size); + (char *)((char *)output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.extended_irq.resource_source.string_ptr; + output_struct->data.extended_irq.resource_source.string_ptr; /* Copy the string into the buffer */ @@ -426,7 +409,8 @@ acpi_rs_extended_irq_resource ( /* Add the terminating null */ *temp_ptr = 0x00; - output_struct->data.extended_irq.resource_source.string_length = index + 1; + output_struct->data.extended_irq.resource_source.string_length = + index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -434,12 +418,13 @@ acpi_rs_extended_irq_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); - } - else { + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); + } else { output_struct->data.extended_irq.resource_source.index = 0x00; - output_struct->data.extended_irq.resource_source.string_length = 0; - output_struct->data.extended_irq.resource_source.string_ptr = NULL; + output_struct->data.extended_irq.resource_source.string_length = + 0; + output_struct->data.extended_irq.resource_source.string_ptr = + NULL; } /* Set the Length parameter */ @@ -449,10 +434,9 @@ acpi_rs_extended_irq_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_extended_irq_stream @@ -470,20 +454,16 @@ acpi_rs_extended_irq_resource ( ******************************************************************************/ acpi_status -acpi_rs_extended_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 *length_field; - u8 temp8 = 0; - u8 index; - char *temp_pointer = NULL; - - - ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); + u8 *buffer = *output_buffer; + u16 *length_field; + u8 temp8 = 0; + u8 index; + char *temp_pointer = NULL; + ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); /* The descriptor field is static */ @@ -492,13 +472,14 @@ acpi_rs_extended_irq_stream ( /* Set a pointer to the Length field - to be filled in later */ - length_field = ACPI_CAST_PTR (u16, buffer); + length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Interrupt vector flags */ - temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); - temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); + temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); + temp8 |= + ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); /* * Set the Interrupt Mode @@ -527,43 +508,48 @@ acpi_rs_extended_irq_stream ( *buffer = temp8; buffer += 1; - for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts; - index++) { - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.extended_irq.interrupts[index]); + for (index = 0; + index < linked_list->data.extended_irq.number_of_interrupts; + index++) { + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.extended_irq. + interrupts[index]); buffer += 4; } /* Resource Source Index and Resource Source are optional */ if (0 != linked_list->data.extended_irq.resource_source.string_length) { - *buffer = (u8) linked_list->data.extended_irq.resource_source.index; + *buffer = + (u8) linked_list->data.extended_irq.resource_source.index; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.extended_irq.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.extended_irq.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size) (ACPI_STRLEN ( - linked_list->data.extended_irq.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.extended_irq. + resource_source.string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index db7bcb4e60e3..103eb31c284e 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rslist") - +ACPI_MODULE_NAME("rslist") /******************************************************************************* * @@ -61,14 +59,10 @@ * a resource descriptor. * ******************************************************************************/ - -u8 -acpi_rs_get_resource_type ( - u8 resource_start_byte) +u8 acpi_rs_get_resource_type(u8 resource_start_byte) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ @@ -79,14 +73,12 @@ acpi_rs_get_resource_type ( return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); - case ACPI_RDESC_TYPE_LARGE: /* Large Resource Type -- All bits are valid */ return (resource_start_byte); - default: /* Invalid type */ break; @@ -95,7 +87,6 @@ acpi_rs_get_resource_type ( return (0xFF); } - /******************************************************************************* * * FUNCTION: acpi_rs_byte_stream_to_list @@ -113,176 +104,189 @@ acpi_rs_get_resource_type ( ******************************************************************************/ acpi_status -acpi_rs_byte_stream_to_list ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u8 *output_buffer) +acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, u8 * output_buffer) { - acpi_status status; - acpi_size bytes_parsed = 0; - u8 resource_type = 0; - acpi_size bytes_consumed = 0; - u8 *buffer = output_buffer; - acpi_size structure_size = 0; - u8 end_tag_processed = FALSE; - struct acpi_resource *resource; - - ACPI_FUNCTION_TRACE ("rs_byte_stream_to_list"); - - - while (bytes_parsed < byte_stream_buffer_length && - !end_tag_processed) { + acpi_status status; + acpi_size bytes_parsed = 0; + u8 resource_type = 0; + acpi_size bytes_consumed = 0; + u8 *buffer = output_buffer; + acpi_size structure_size = 0; + u8 end_tag_processed = FALSE; + struct acpi_resource *resource; + + ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); + + while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) { /* The next byte in the stream is the resource type */ - resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); switch (resource_type) { case ACPI_RDESC_TYPE_MEMORY_24: /* * 24-Bit Memory Resource */ - status = acpi_rs_memory24_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_memory24_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_LARGE_VENDOR: /* * Vendor Defined Resource */ - status = acpi_rs_vendor_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_vendor_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_MEMORY_32: /* * 32-Bit Memory Range Resource */ - status = acpi_rs_memory32_range_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_memory32_range_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: /* * 32-Bit Fixed Memory Resource */ - status = acpi_rs_fixed_memory32_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_fixed_memory32_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: /* * 64-Bit Address Resource */ - status = acpi_rs_address64_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_address64_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: /* * 32-Bit Address Resource */ - status = acpi_rs_address32_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_address32_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: /* * 16-Bit Address Resource */ - status = acpi_rs_address16_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_address16_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: /* * Extended IRQ */ - status = acpi_rs_extended_irq_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_extended_irq_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_IRQ_FORMAT: /* * IRQ Resource */ - status = acpi_rs_irq_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_irq_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_DMA_FORMAT: /* * DMA Resource */ - status = acpi_rs_dma_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_dma_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_START_DEPENDENT: /* * Start Dependent Functions Resource */ - status = acpi_rs_start_depend_fns_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_start_depend_fns_resource + (byte_stream_buffer, &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_END_DEPENDENT: /* * End Dependent Functions Resource */ - status = acpi_rs_end_depend_fns_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_end_depend_fns_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_IO_PORT: /* * IO Port Resource */ - status = acpi_rs_io_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_io_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_FIXED_IO_PORT: /* * Fixed IO Port Resource */ - status = acpi_rs_fixed_io_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_fixed_io_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: /* * Vendor Specific Resource */ - status = acpi_rs_vendor_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_vendor_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_END_TAG: /* * End Tag */ end_tag_processed = TRUE; - status = acpi_rs_end_tag_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_end_tag_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - default: /* * Invalid/Unknown resource type @@ -291,8 +295,8 @@ acpi_rs_byte_stream_to_list ( break; } - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Update the return value and counter */ @@ -305,21 +309,21 @@ acpi_rs_byte_stream_to_list ( /* Set the Buffer to the next structure */ - resource = ACPI_CAST_PTR (struct acpi_resource, buffer); - resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); - buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); + resource = ACPI_CAST_PTR(struct acpi_resource, buffer); + resource->length = + (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length); + buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); } /* Check the reason for exiting the while loop */ if (!end_tag_processed) { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_list_to_byte_stream @@ -342,19 +346,16 @@ acpi_rs_byte_stream_to_list ( ******************************************************************************/ acpi_status -acpi_rs_list_to_byte_stream ( - struct acpi_resource *linked_list, - acpi_size byte_stream_size_needed, - u8 *output_buffer) +acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, + acpi_size byte_stream_size_needed, + u8 * output_buffer) { - acpi_status status; - u8 *buffer = output_buffer; - acpi_size bytes_consumed = 0; - u8 done = FALSE; - - - ACPI_FUNCTION_TRACE ("rs_list_to_byte_stream"); + acpi_status status; + u8 *buffer = output_buffer; + acpi_size bytes_consumed = 0; + u8 done = FALSE; + ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); while (!done) { switch (linked_list->id) { @@ -362,58 +363,72 @@ acpi_rs_list_to_byte_stream ( /* * IRQ Resource */ - status = acpi_rs_irq_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_irq_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_DMA: /* * DMA Resource */ - status = acpi_rs_dma_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_dma_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_START_DPF: /* * Start Dependent Functions Resource */ - status = acpi_rs_start_depend_fns_stream (linked_list, - &buffer, &bytes_consumed); + status = acpi_rs_start_depend_fns_stream(linked_list, + &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_END_DPF: /* * End Dependent Functions Resource */ - status = acpi_rs_end_depend_fns_stream (linked_list, - &buffer, &bytes_consumed); + status = acpi_rs_end_depend_fns_stream(linked_list, + &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_IO: /* * IO Port Resource */ - status = acpi_rs_io_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_io_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_FIXED_IO: /* * Fixed IO Port Resource */ - status = acpi_rs_fixed_io_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_fixed_io_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_VENDOR: /* * Vendor Defined Resource */ - status = acpi_rs_vendor_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_vendor_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_END_TAG: /* * End Tag */ - status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_end_tag_stream(linked_list, &buffer, + &bytes_consumed); /* An End Tag indicates the end of the Resource Template */ @@ -424,55 +439,60 @@ acpi_rs_list_to_byte_stream ( /* * 24-Bit Memory Resource */ - status = acpi_rs_memory24_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_memory24_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_MEM32: /* * 32-Bit Memory Range Resource */ - status = acpi_rs_memory32_range_stream (linked_list, &buffer, - &bytes_consumed); + status = + acpi_rs_memory32_range_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_FIXED_MEM32: /* * 32-Bit Fixed Memory Resource */ - status = acpi_rs_fixed_memory32_stream (linked_list, &buffer, - &bytes_consumed); + status = + acpi_rs_fixed_memory32_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_ADDRESS16: /* * 16-Bit Address Descriptor Resource */ - status = acpi_rs_address16_stream (linked_list, &buffer, - &bytes_consumed); + status = acpi_rs_address16_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_ADDRESS32: /* * 32-Bit Address Descriptor Resource */ - status = acpi_rs_address32_stream (linked_list, &buffer, - &bytes_consumed); + status = acpi_rs_address32_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_ADDRESS64: /* * 64-Bit Address Descriptor Resource */ - status = acpi_rs_address64_stream (linked_list, &buffer, - &bytes_consumed); + status = acpi_rs_address64_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_EXT_IRQ: /* * Extended IRQ Resource */ - status = acpi_rs_extended_irq_stream (linked_list, &buffer, - &bytes_consumed); + status = + acpi_rs_extended_irq_stream(linked_list, &buffer, + &bytes_consumed); break; default: @@ -480,15 +500,15 @@ acpi_rs_list_to_byte_stream ( * If we get here, everything is out of sync, * so exit with an error */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid descriptor type (%X) in resource list\n", - linked_list->id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid descriptor type (%X) in resource list\n", + linked_list->id)); status = AE_BAD_DATA; break; } - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Set the Buffer to point to the open byte */ @@ -497,10 +517,9 @@ acpi_rs_list_to_byte_stream ( /* Point to the next object */ - linked_list = ACPI_PTR_ADD (struct acpi_resource, - linked_list, linked_list->length); + linked_list = ACPI_PTR_ADD(struct acpi_resource, + linked_list, linked_list->length); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 91d0207f01ac..daba1a1ed46d 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsmemory") - +ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * @@ -69,30 +67,25 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_memory24_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_memory24_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_mem24); - - - ACPI_FUNCTION_TRACE ("rs_memory24_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); + ACPI_FUNCTION_TRACE("rs_memory24_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; output_struct->id = ACPI_RSTYPE_MEM24; @@ -105,25 +98,25 @@ acpi_rs_memory24_resource ( /* Get min_base_address (Bytes 4-5) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; output_struct->data.memory24.min_base_address = temp16; /* Get max_base_address (Bytes 6-7) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; output_struct->data.memory24.max_base_address = temp16; /* Get Alignment (Bytes 8-9) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; output_struct->data.memory24.alignment = temp16; /* Get range_length (Bytes 10-11) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.memory24.range_length = temp16; /* Set the Length parameter */ @@ -133,10 +126,9 @@ acpi_rs_memory24_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_memory24_stream @@ -154,18 +146,14 @@ acpi_rs_memory24_resource ( ******************************************************************************/ acpi_status -acpi_rs_memory24_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_memory24_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_memory24_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_memory24_stream"); /* The descriptor field is static */ @@ -175,7 +163,7 @@ acpi_rs_memory24_stream ( /* The length field is static */ temp16 = 0x09; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Information Byte */ @@ -186,31 +174,32 @@ acpi_rs_memory24_stream ( /* Set the Range minimum base address */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.memory24.min_base_address); buffer += 2; /* Set the Range maximum base address */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.memory24.max_base_address); buffer += 2; /* Set the base alignment */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment); buffer += 2; /* Set the range length */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length); buffer += 2; /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_memory32_range_resource @@ -233,28 +222,24 @@ acpi_rs_memory24_stream ( ******************************************************************************/ acpi_status -acpi_rs_memory32_range_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_mem32); - - - ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); + ACPI_FUNCTION_TRACE("rs_memory32_range_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; @@ -279,22 +264,24 @@ acpi_rs_memory32_range_resource ( /* Get min_base_address (Bytes 4-7) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address, + buffer); buffer += 4; /* Get max_base_address (Bytes 8-11) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address, + buffer); buffer += 4; /* Get Alignment (Bytes 12-15) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer); buffer += 4; /* Get range_length (Bytes 16-19) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer); /* Set the Length parameter */ @@ -303,10 +290,9 @@ acpi_rs_memory32_range_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_memory32_resource @@ -329,27 +315,23 @@ acpi_rs_memory32_range_resource ( ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_fixed_mem32); - - - ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32); + ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; @@ -364,13 +346,14 @@ acpi_rs_fixed_memory32_resource ( /* Get range_base_address (Bytes 4-7) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, - buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32. + range_base_address, buffer); buffer += 4; /* Get range_length (Bytes 8-11) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length, + buffer); /* Set the Length parameter */ @@ -379,10 +362,9 @@ acpi_rs_fixed_memory32_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_memory32_range_stream @@ -400,18 +382,14 @@ acpi_rs_fixed_memory32_resource ( ******************************************************************************/ acpi_status -acpi_rs_memory32_range_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); /* The descriptor field is static */ @@ -422,7 +400,7 @@ acpi_rs_memory32_range_stream ( temp16 = 0x11; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Information Byte */ @@ -433,31 +411,32 @@ acpi_rs_memory32_range_stream ( /* Set the Range minimum base address */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.memory32.min_base_address); buffer += 4; /* Set the Range maximum base address */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.memory32.max_base_address); buffer += 4; /* Set the base alignment */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment); buffer += 4; /* Set the range length */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length); buffer += 4; /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_memory32_stream @@ -475,18 +454,14 @@ acpi_rs_memory32_range_stream ( ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); /* The descriptor field is static */ @@ -497,30 +472,31 @@ acpi_rs_fixed_memory32_stream ( temp16 = 0x09; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Information Byte */ - temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); + temp8 = + (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); *buffer = temp8; buffer += 1; /* Set the Range base address */ - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.fixed_memory32.range_base_address); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.fixed_memory32. + range_base_address); buffer += 4; /* Set the range length */ - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.fixed_memory32.range_length); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.fixed_memory32.range_length); buffer += 4; /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index a1f1741f0d83..7a8a34e757f5 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsmisc") - +ACPI_MODULE_NAME("rsmisc") /******************************************************************************* * @@ -69,20 +67,15 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_end_tag_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_end_tag_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - struct acpi_resource *output_struct = (void *) *output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - - ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = ACPI_RESOURCE_LENGTH; + ACPI_FUNCTION_TRACE("rs_end_tag_resource"); /* The number of bytes consumed is static */ @@ -99,10 +92,9 @@ acpi_rs_end_tag_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_end_tag_stream @@ -120,17 +112,13 @@ acpi_rs_end_tag_resource ( ******************************************************************************/ acpi_status -acpi_rs_end_tag_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_end_tag_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); + u8 *buffer = *output_buffer; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_end_tag_stream"); /* The descriptor field is static */ @@ -148,11 +136,10 @@ acpi_rs_end_tag_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_vendor_resource @@ -175,23 +162,19 @@ acpi_rs_end_tag_stream ( ******************************************************************************/ acpi_status -acpi_rs_vendor_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_vendor_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_vendor); - - - ACPI_FUNCTION_TRACE ("rs_vendor_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor); + ACPI_FUNCTION_TRACE("rs_vendor_resource"); /* Dereference the Descriptor to find if this is a large or small item. */ @@ -204,7 +187,7 @@ acpi_rs_vendor_resource ( /* Dereference */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Calculate bytes consumed */ @@ -213,11 +196,10 @@ acpi_rs_vendor_resource ( /* Point to the first vendor byte */ buffer += 2; - } - else { + } else { /* Small Item, dereference the size */ - temp16 = (u8)(*buffer & 0x07); + temp16 = (u8) (*buffer & 0x07); /* Calculate bytes consumed */ @@ -241,7 +223,7 @@ acpi_rs_vendor_resource ( * calculate the length of the vendor string and expand the * struct_size to the next 32-bit boundary. */ - struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); + struct_size += ACPI_ROUND_UP_to_32_bITS(temp16); /* Set the Length parameter */ @@ -250,10 +232,9 @@ acpi_rs_vendor_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_vendor_stream @@ -271,23 +252,19 @@ acpi_rs_vendor_resource ( ******************************************************************************/ acpi_status -acpi_rs_vendor_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_vendor_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - - ACPI_FUNCTION_TRACE ("rs_vendor_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + ACPI_FUNCTION_TRACE("rs_vendor_stream"); /* Dereference the length to find if this is a large or small item. */ - if(linked_list->data.vendor_specific.length > 7) { + if (linked_list->data.vendor_specific.length > 7) { /* Large Item, Set the descriptor field and length bytes */ *buffer = 0x84; @@ -295,10 +272,9 @@ acpi_rs_vendor_stream ( temp16 = (u16) linked_list->data.vendor_specific.length; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; - } - else { + } else { /* Small Item, Set the descriptor field */ temp8 = 0x70; @@ -310,7 +286,8 @@ acpi_rs_vendor_stream ( /* Loop through all of the Vendor Specific fields */ - for (index = 0; index < linked_list->data.vendor_specific.length; index++) { + for (index = 0; index < linked_list->data.vendor_specific.length; + index++) { temp8 = linked_list->data.vendor_specific.reserved[index]; *buffer = temp8; @@ -319,11 +296,10 @@ acpi_rs_vendor_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_start_depend_fns_resource @@ -346,21 +322,18 @@ acpi_rs_vendor_stream ( ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_start_dpf); - - - ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf); + ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource"); /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ @@ -378,26 +351,27 @@ acpi_rs_start_depend_fns_resource ( /* Check Compatibility priority */ - output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; + output_struct->data.start_dpf.compatibility_priority = + temp8 & 0x03; if (3 == output_struct->data.start_dpf.compatibility_priority) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); } /* Check Performance/Robustness preference */ - output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; + output_struct->data.start_dpf.performance_robustness = + (temp8 >> 2) & 0x03; if (3 == output_struct->data.start_dpf.performance_robustness) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); } - } - else { + } else { output_struct->data.start_dpf.compatibility_priority = - ACPI_ACCEPTABLE_CONFIGURATION; + ACPI_ACCEPTABLE_CONFIGURATION; output_struct->data.start_dpf.performance_robustness = - ACPI_ACCEPTABLE_CONFIGURATION; + ACPI_ACCEPTABLE_CONFIGURATION; } /* Set the Length parameter */ @@ -407,10 +381,9 @@ acpi_rs_start_depend_fns_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_end_depend_fns_resource @@ -433,18 +406,14 @@ acpi_rs_start_depend_fns_resource ( ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - struct acpi_resource *output_struct = (void *) *output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - - ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = ACPI_RESOURCE_LENGTH; + ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource"); /* The number of bytes consumed is static */ @@ -461,10 +430,9 @@ acpi_rs_end_depend_fns_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_start_depend_fns_stream @@ -483,39 +451,35 @@ acpi_rs_end_depend_fns_resource ( ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_start_depend_fns_stream"); + u8 *buffer = *output_buffer; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); /* * The descriptor field is set based upon whether a byte is needed * to contain Priority data. */ if (ACPI_ACCEPTABLE_CONFIGURATION == - linked_list->data.start_dpf.compatibility_priority && - ACPI_ACCEPTABLE_CONFIGURATION == - linked_list->data.start_dpf.performance_robustness) { + linked_list->data.start_dpf.compatibility_priority && + ACPI_ACCEPTABLE_CONFIGURATION == + linked_list->data.start_dpf.performance_robustness) { *buffer = 0x30; - } - else { + } else { *buffer = 0x31; buffer += 1; /* Set the Priority Byte Definition */ temp8 = 0; - temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & - 0x03) << 2); - temp8 |= (linked_list->data.start_dpf.compatibility_priority & - 0x03); + temp8 = + (u8) ((linked_list->data.start_dpf. + performance_robustness & 0x03) << 2); + temp8 |= + (linked_list->data.start_dpf.compatibility_priority & 0x03); *buffer = temp8; } @@ -523,11 +487,10 @@ acpi_rs_start_depend_fns_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_end_depend_fns_stream @@ -545,16 +508,12 @@ acpi_rs_start_depend_fns_stream ( ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - - - ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); + u8 *buffer = *output_buffer; + ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); /* The descriptor field is static */ @@ -563,7 +522,6 @@ acpi_rs_end_depend_fns_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 700cf7d65d76..4446778eaf79 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -41,15 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acnamesp.h> #include <acpi/acresrc.h> - #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsutils") - +ACPI_MODULE_NAME("rsutils") /******************************************************************************* * @@ -68,42 +65,36 @@ * and the contents of the callers buffer is undefined. * ******************************************************************************/ - acpi_status -acpi_rs_get_prt_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer) +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_prt_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_prt_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT, - ACPI_BTYPE_PACKAGE, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, + ACPI_BTYPE_PACKAGE, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * Create a resource linked list from the byte stream buffer that comes * back from the _CRS method execution. */ - status = acpi_rs_create_pci_routing_table (obj_desc, ret_buffer); + status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer); /* On exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_crs_method_data @@ -123,25 +114,21 @@ acpi_rs_get_prt_method_data ( ******************************************************************************/ acpi_status -acpi_rs_get_crs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer) +acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_crs_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_crs_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS, - ACPI_BTYPE_BUFFER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, + ACPI_BTYPE_BUFFER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -149,15 +136,14 @@ acpi_rs_get_crs_method_data ( * byte stream buffer that comes back from the _CRS method * execution. */ - status = acpi_rs_create_resource_list (obj_desc, ret_buffer); + status = acpi_rs_create_resource_list(obj_desc, ret_buffer); /* on exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_prs_method_data @@ -178,25 +164,21 @@ acpi_rs_get_crs_method_data ( #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_rs_get_prs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer) +acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_prs_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_prs_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS, - ACPI_BTYPE_BUFFER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, + ACPI_BTYPE_BUFFER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -204,15 +186,14 @@ acpi_rs_get_prs_method_data ( * byte stream buffer that comes back from the _CRS method * execution. */ - status = acpi_rs_create_resource_list (obj_desc, ret_buffer); + status = acpi_rs_create_resource_list(obj_desc, ret_buffer); /* on exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -234,25 +215,22 @@ acpi_rs_get_prs_method_data ( ******************************************************************************/ acpi_status -acpi_rs_get_method_data ( - acpi_handle handle, - char *path, - struct acpi_buffer *ret_buffer) +acpi_rs_get_method_data(acpi_handle handle, + char *path, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -260,12 +238,12 @@ acpi_rs_get_method_data ( * byte stream buffer that comes back from the method * execution. */ - status = acpi_rs_create_resource_list (obj_desc, ret_buffer); + status = acpi_rs_create_resource_list(obj_desc, ret_buffer); /* On exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } /******************************************************************************* @@ -287,18 +265,14 @@ acpi_rs_get_method_data ( ******************************************************************************/ acpi_status -acpi_rs_set_srs_method_data ( - acpi_handle handle, - struct acpi_buffer *in_buffer) +acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) { - struct acpi_parameter_info info; - union acpi_operand_object *params[2]; - acpi_status status; - struct acpi_buffer buffer; - - - ACPI_FUNCTION_TRACE ("rs_set_srs_method_data"); + struct acpi_parameter_info info; + union acpi_operand_object *params[2]; + acpi_status status; + struct acpi_buffer buffer; + ACPI_FUNCTION_TRACE("rs_set_srs_method_data"); /* Parameters guaranteed valid by caller */ @@ -310,24 +284,24 @@ acpi_rs_set_srs_method_data ( * Convert the linked list into a byte stream */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_create_byte_stream (in_buffer->pointer, &buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Init the param object */ - params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); + params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); if (!params[0]) { - acpi_os_free (buffer.pointer); - return_ACPI_STATUS (AE_NO_MEMORY); + acpi_os_free(buffer.pointer); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Set up the parameter object */ - params[0]->buffer.length = (u32) buffer.length; + params[0]->buffer.length = (u32) buffer.length; params[0]->buffer.pointer = buffer.pointer; - params[0]->common.flags = AOPOBJ_DATA_VALID; + params[0]->common.flags = AOPOBJ_DATA_VALID; params[1] = NULL; info.node = handle; @@ -336,18 +310,17 @@ acpi_rs_set_srs_method_data ( /* Execute the method, no return value */ - status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info); - if (ACPI_SUCCESS (status)) { + status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); + if (ACPI_SUCCESS(status)) { /* Delete any return object (especially if implicit_return is enabled) */ if (info.return_object) { - acpi_ut_remove_reference (info.return_object); + acpi_ut_remove_reference(info.return_object); } } /* Clean up and return the status from acpi_ns_evaluate_relative */ - acpi_ut_remove_reference (params[0]); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(params[0]); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 83c944b8b097..ee5a5c509199 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -47,10 +47,9 @@ #include <acpi/acresrc.h> #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsxface") +ACPI_MODULE_NAME("rsxface") /* Local macros for 16,32-bit to 64-bit conversion */ - #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) #define ACPI_COPY_ADDRESS(out, in) \ ACPI_COPY_FIELD(out, in, resource_type); \ @@ -65,8 +64,6 @@ ACPI_COPY_FIELD(out, in, address_translation_offset); \ ACPI_COPY_FIELD(out, in, address_length); \ ACPI_COPY_FIELD(out, in, resource_source); - - /******************************************************************************* * * FUNCTION: acpi_get_irq_routing_table @@ -89,17 +86,13 @@ * the object indicated by the passed device_handle. * ******************************************************************************/ - acpi_status -acpi_get_irq_routing_table ( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_irq_routing_table(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_irq_routing_table "); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); /* * Must have a valid handle and buffer, So we have to have a handle @@ -108,19 +101,18 @@ acpi_get_irq_routing_table ( * we'll be returning the needed buffer size, so keep going. */ if (!device_handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_get_current_resources @@ -146,15 +138,12 @@ acpi_get_irq_routing_table ( ******************************************************************************/ acpi_status -acpi_get_current_resources ( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_current_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_current_resources"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_current_resources"); /* * Must have a valid handle and buffer, So we have to have a handle @@ -163,19 +152,19 @@ acpi_get_current_resources ( * we'll be returning the needed buffer size, so keep going. */ if (!device_handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_current_resources); +EXPORT_SYMBOL(acpi_get_current_resources); /******************************************************************************* * @@ -200,15 +189,12 @@ EXPORT_SYMBOL(acpi_get_current_resources); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_possible_resources ( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_possible_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_possible_resources"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); /* * Must have a valid handle and buffer, So we have to have a handle @@ -217,20 +203,20 @@ acpi_get_possible_resources ( * we'll be returning the needed buffer size, so keep going. */ if (!device_handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_possible_resources); -#endif /* ACPI_FUTURE_USAGE */ +EXPORT_SYMBOL(acpi_get_possible_resources); +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -252,37 +238,33 @@ EXPORT_SYMBOL(acpi_get_possible_resources); ******************************************************************************/ acpi_status -acpi_walk_resources ( - acpi_handle device_handle, - char *path, - ACPI_WALK_RESOURCE_CALLBACK user_function, - void *context) +acpi_walk_resources(acpi_handle device_handle, + char *path, + ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) { - acpi_status status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_resource *resource; - struct acpi_resource *buffer_end; - - - ACPI_FUNCTION_TRACE ("acpi_walk_resources"); + acpi_status status; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_resource *resource; + struct acpi_resource *buffer_end; + ACPI_FUNCTION_TRACE("acpi_walk_resources"); if (!device_handle || - (ACPI_STRNCMP (path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) && - ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && + ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_rs_get_method_data (device_handle, path, &buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_get_method_data(device_handle, path, &buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Setup pointers */ - resource = (struct acpi_resource *) buffer.pointer; - buffer_end = ACPI_CAST_PTR (struct acpi_resource, - ((u8 *) buffer.pointer + buffer.length)); + resource = (struct acpi_resource *)buffer.pointer; + buffer_end = ACPI_CAST_PTR(struct acpi_resource, + ((u8 *) buffer.pointer + buffer.length)); /* Walk the resource list */ @@ -291,7 +273,7 @@ acpi_walk_resources ( break; } - status = user_function (resource, context); + status = user_function(resource, context); switch (status) { case AE_OK: @@ -318,7 +300,7 @@ acpi_walk_resources ( /* Get the next resource descriptor */ - resource = ACPI_NEXT_RESOURCE (resource); + resource = ACPI_NEXT_RESOURCE(resource); /* Check for end-of-buffer */ @@ -327,13 +309,13 @@ acpi_walk_resources ( } } -cleanup: + cleanup: - acpi_os_free (buffer.pointer); - return_ACPI_STATUS (status); + acpi_os_free(buffer.pointer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_walk_resources); +EXPORT_SYMBOL(acpi_walk_resources); /******************************************************************************* * @@ -354,30 +336,25 @@ EXPORT_SYMBOL(acpi_walk_resources); ******************************************************************************/ acpi_status -acpi_set_current_resources ( - acpi_handle device_handle, - struct acpi_buffer *in_buffer) +acpi_set_current_resources(acpi_handle device_handle, + struct acpi_buffer *in_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_set_current_resources"); /* Must have a valid handle and buffer */ - if ((!device_handle) || - (!in_buffer) || - (!in_buffer->pointer) || - (!in_buffer->length)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((!device_handle) || + (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_rs_set_srs_method_data (device_handle, in_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_set_srs_method_data(device_handle, in_buffer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_current_resources); +EXPORT_SYMBOL(acpi_set_current_resources); /****************************************************************************** * @@ -398,41 +375,38 @@ EXPORT_SYMBOL(acpi_set_current_resources); ******************************************************************************/ acpi_status -acpi_resource_to_address64 ( - struct acpi_resource *resource, - struct acpi_resource_address64 *out) +acpi_resource_to_address64(struct acpi_resource *resource, + struct acpi_resource_address64 *out) { - struct acpi_resource_address16 *address16; - struct acpi_resource_address32 *address32; - + struct acpi_resource_address16 *address16; + struct acpi_resource_address32 *address32; switch (resource->id) { case ACPI_RSTYPE_ADDRESS16: - address16 = (struct acpi_resource_address16 *) &resource->data; - ACPI_COPY_ADDRESS (out, address16); + address16 = (struct acpi_resource_address16 *)&resource->data; + ACPI_COPY_ADDRESS(out, address16); break; - case ACPI_RSTYPE_ADDRESS32: - address32 = (struct acpi_resource_address32 *) &resource->data; - ACPI_COPY_ADDRESS (out, address32); + address32 = (struct acpi_resource_address32 *)&resource->data; + ACPI_COPY_ADDRESS(out, address32); break; - case ACPI_RSTYPE_ADDRESS64: /* Simple copy for 64 bit source */ - ACPI_MEMCPY (out, &resource->data, sizeof (struct acpi_resource_address64)); + ACPI_MEMCPY(out, &resource->data, + sizeof(struct acpi_resource_address64)); break; - default: return (AE_BAD_PARAMETER); } return (AE_OK); } + EXPORT_SYMBOL(acpi_resource_to_address64); |