From bda663d36b94c723153246a4231bbc0f1cd1836e Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 16 Sep 2005 16:51:15 -0400 Subject: [ACPI] ACPICA 20050916 Fixed a problem within the Resource Manager where support for the Generic Register descriptor was not fully implemented. This descriptor is now fully recognized, parsed, disassembled, and displayed. Restructured the Resource Manager code to utilize table-driven dispatch and lookup, eliminating many of the large switch() statements. This reduces overall subsystem code size and code complexity. Affects the resource parsing and construction, disassembly, and debug dump output. Cleaned up and restructured the debug dump output for all resource descriptors. Improved readability of the output and reduced code size. Fixed a problem where changes to internal data structures caused the optional ACPI_MUTEX_DEBUG code to fail compilation if specified. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- drivers/acpi/resources/rsaddr.c | 99 ++- drivers/acpi/resources/rscalc.c | 985 ++++++++++++++-------------- drivers/acpi/resources/rsdump.c | 1284 ++++++++++++++++++------------------- drivers/acpi/resources/rsio.c | 56 +- drivers/acpi/resources/rsirq.c | 57 +- drivers/acpi/resources/rslist.c | 533 +++++---------- drivers/acpi/resources/rsmemory.c | 68 +- drivers/acpi/resources/rsmisc.c | 234 +++++-- drivers/acpi/resources/rsxface.c | 8 +- drivers/acpi/utilities/utmisc.c | 2 +- drivers/acpi/utilities/utmutex.c | 4 +- include/acpi/acconfig.h | 4 +- include/acpi/acdisasm.h | 36 +- include/acpi/aclocal.h | 23 +- include/acpi/acresrc.h | 46 +- include/acpi/actypes.h | 13 +- include/acpi/amlresrc.h | 56 +- include/acpi/platform/acenv.h | 1 + 18 files changed, 1701 insertions(+), 1808 deletions(-) diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 23b54baa0cb..798778261fb 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -270,7 +270,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, } *bytes_consumed = temp16 + 3; - output_struct->id = ACPI_RSTYPE_ADDRESS16; + output_struct->type = ACPI_RSTYPE_ADDRESS16; /* Get the Resource Type (Byte3) */ @@ -400,7 +400,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_address16_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -413,7 +413,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_address16_stream(struct acpi_resource *linked_list, +acpi_rs_address16_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -434,59 +434,56 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, /* Set the Resource Type (Memory, Io, bus_number) */ - *buffer = (u8) (linked_list->data.address16.resource_type & 0x03); + *buffer = (u8) (resource->data.address16.resource_type & 0x03); buffer += 1; /* Set the general flags */ - *buffer = acpi_rs_encode_general_flags(&linked_list->data); + *buffer = acpi_rs_encode_general_flags(&resource->data); buffer += 1; /* Set the type specific flags */ - *buffer = acpi_rs_encode_specific_flags(&linked_list->data); + *buffer = acpi_rs_encode_specific_flags(&resource->data); buffer += 1; /* Set the address space granularity */ - ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); + ACPI_MOVE_32_TO_16(buffer, &resource->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, &resource->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, &resource->data.address16.max_address_range); buffer += 2; /* Set the address translation offset */ ACPI_MOVE_32_TO_16(buffer, - &linked_list->data.address16. + &resource->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, &resource->data.address16.address_length); buffer += 2; /* Resource Source Index and Resource Source are optional */ - if (linked_list->data.address16.resource_source.string_length) { - *buffer = - (u8) linked_list->data.address16.resource_source.index; + if (resource->data.address16.resource_source.string_length) { + *buffer = (u8) resource->data.address16.resource_source.index; buffer += 1; /* Copy the resource_source string */ ACPI_STRCPY((char *)buffer, - linked_list->data.address16.resource_source. + resource->data.address16.resource_source. string_ptr); /* @@ -495,7 +492,7 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, */ buffer += (acpi_size) (ACPI_STRLEN - (linked_list->data.address16.resource_source. + (resource->data.address16.resource_source. string_ptr) + 1); } @@ -562,7 +559,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, } *bytes_consumed = temp16 + 3; - output_struct->id = ACPI_RSTYPE_ADDRESS32; + output_struct->type = ACPI_RSTYPE_ADDRESS32; /* Get the Resource Type (Byte3) */ @@ -690,7 +687,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_address32_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -703,7 +700,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_address32_stream(struct acpi_resource *linked_list, +acpi_rs_address32_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer; @@ -725,59 +722,56 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, /* Set the Resource Type (Memory, Io, bus_number) */ - *buffer = (u8) (linked_list->data.address32.resource_type & 0x03); + *buffer = (u8) (resource->data.address32.resource_type & 0x03); buffer += 1; /* Set the general flags */ - *buffer = acpi_rs_encode_general_flags(&linked_list->data); + *buffer = acpi_rs_encode_general_flags(&resource->data); buffer += 1; /* Set the type specific flags */ - *buffer = acpi_rs_encode_specific_flags(&linked_list->data); + *buffer = acpi_rs_encode_specific_flags(&resource->data); buffer += 1; /* Set the address space granularity */ - ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); + ACPI_MOVE_32_TO_32(buffer, &resource->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, &resource->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, &resource->data.address32.max_address_range); buffer += 4; /* Set the address translation offset */ ACPI_MOVE_32_TO_32(buffer, - &linked_list->data.address32. + &resource->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, &resource->data.address32.address_length); buffer += 4; /* Resource Source Index and Resource Source are optional */ - if (linked_list->data.address32.resource_source.string_length) { - *buffer = - (u8) linked_list->data.address32.resource_source.index; + if (resource->data.address32.resource_source.string_length) { + *buffer = (u8) resource->data.address32.resource_source.index; buffer += 1; /* Copy the resource_source string */ ACPI_STRCPY((char *)buffer, - linked_list->data.address32.resource_source. + resource->data.address32.resource_source. string_ptr); /* @@ -786,7 +780,7 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, */ buffer += (acpi_size) (ACPI_STRLEN - (linked_list->data.address32.resource_source. + (resource->data.address32.resource_source. string_ptr) + 1); } @@ -856,7 +850,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, } *bytes_consumed = temp16 + 3; - output_struct->id = ACPI_RSTYPE_ADDRESS64; + output_struct->type = ACPI_RSTYPE_ADDRESS64; /* Get the Resource Type (Byte3) */ @@ -1005,7 +999,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_address64_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -1018,7 +1012,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_address64_stream(struct acpi_resource *linked_list, +acpi_rs_address64_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer; @@ -1040,59 +1034,56 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list, /* Set the Resource Type (Memory, Io, bus_number) */ - *buffer = (u8) (linked_list->data.address64.resource_type & 0x03); + *buffer = (u8) (resource->data.address64.resource_type & 0x03); buffer += 1; /* Set the general flags */ - *buffer = acpi_rs_encode_general_flags(&linked_list->data); + *buffer = acpi_rs_encode_general_flags(&resource->data); buffer += 1; /* Set the type specific flags */ - *buffer = acpi_rs_encode_specific_flags(&linked_list->data); + *buffer = acpi_rs_encode_specific_flags(&resource->data); buffer += 1; /* Set the address space granularity */ - ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); + ACPI_MOVE_64_TO_64(buffer, &resource->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, &resource->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, &resource->data.address64.max_address_range); buffer += 8; /* Set the address translation offset */ ACPI_MOVE_64_TO_64(buffer, - &linked_list->data.address64. + &resource->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, &resource->data.address64.address_length); buffer += 8; /* Resource Source Index and Resource Source are optional */ - if (linked_list->data.address64.resource_source.string_length) { - *buffer = - (u8) linked_list->data.address64.resource_source.index; + if (resource->data.address64.resource_source.string_length) { + *buffer = (u8) resource->data.address64.resource_source.index; buffer += 1; /* Copy the resource_source string */ ACPI_STRCPY((char *)buffer, - linked_list->data.address64.resource_source. + resource->data.address64.resource_source. string_ptr); /* @@ -1101,7 +1092,7 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list, */ buffer += (acpi_size) (ACPI_STRLEN - (linked_list->data.address64.resource_source. + (resource->data.address64.resource_source. string_ptr) + 1); } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 378f58390fc..cd051c97bf5 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -44,651 +44,620 @@ #include #include #include +#include #include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rscalc") +/* + * Base sizes for external resource descriptors, indexed by internal type. + * Includes size of the descriptor header (1 byte for small descriptors, + * 3 bytes for large descriptors) + */ +static u8 acpi_gbl_stream_sizes[] = { + 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */ + 3, /* ACPI_RSTYPE_DMA */ + 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */ + 1, /* ACPI_RSTYPE_END_DPF */ + 8, /* ACPI_RSTYPE_IO */ + 4, /* ACPI_RSTYPE_FIXED_IO */ + 1, /* ACPI_RSTYPE_VENDOR */ + 2, /* ACPI_RSTYPE_END_TAG */ + 12, /* ACPI_RSTYPE_MEM24 */ + 20, /* ACPI_RSTYPE_MEM32 */ + 12, /* ACPI_RSTYPE_FIXED_MEM32 */ + 16, /* ACPI_RSTYPE_ADDRESS16 */ + 26, /* ACPI_RSTYPE_ADDRESS32 */ + 46, /* ACPI_RSTYPE_ADDRESS64 */ + 9, /* ACPI_RSTYPE_EXT_IRQ */ + 15 /* ACPI_RSTYPE_GENERIC_REG */ +}; + +/* + * Base sizes of resource descriptors, both the actual AML stream length and + * size of the internal struct representation. + */ +typedef struct acpi_resource_sizes { + u8 minimum_stream_size; + u8 minimum_struct_size; + +} ACPI_RESOURCE_SIZES; + +static ACPI_RESOURCE_SIZES acpi_gbl_sm_resource_sizes[] = { + 0, 0, /* 0x00, Reserved */ + 0, 0, /* 0x01, Reserved */ + 0, 0, /* 0x02, Reserved */ + 0, 0, /* 0x03, Reserved */ + 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq), /* ACPI_RDESC_TYPE_IRQ_FORMAT */ + 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma), /* ACPI_RDESC_TYPE_DMA_FORMAT */ + 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf), /* ACPI_RDESC_TYPE_START_DEPENDENT */ + 1, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_DEPENDENT */ + 8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io), /* ACPI_RDESC_TYPE_IO_PORT */ + 4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io), /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ + 0, 0, /* 0x0A, Reserved */ + 0, 0, /* 0x0B, Reserved */ + 0, 0, /* 0x0C, Reserved */ + 0, 0, /* 0x0D, Reserved */ + 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_SMALL_VENDOR */ + 2, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_TAG */ +}; + +static ACPI_RESOURCE_SIZES acpi_gbl_lg_resource_sizes[] = { + 0, 0, /* 0x00, Reserved */ + 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24), /* ACPI_RDESC_TYPE_MEMORY_24 */ + 15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg), /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ + 0, 0, /* 0x03, Reserved */ + 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_LARGE_VENDOR */ + 20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32), /* ACPI_RDESC_TYPE_MEMORY_32 */ + 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32), /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ + 26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32), /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ + 16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16), /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ + 9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq), /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ + 46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ + 56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ +}; + +/* Local prototypes */ + +static u8 acpi_rs_count_set_bits(u16 bit_field); + +static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type); + +static u16 acpi_rs_get_resource_length(u8 * resource); + +static acpi_size +acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); + +static u32 +acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length); + /******************************************************************************* * - * FUNCTION: acpi_rs_get_byte_stream_length + * FUNCTION: acpi_rs_count_set_bits * - * PARAMETERS: linked_list - Pointer to the resource linked list - * size_needed - u32 pointer of the size buffer needed - * to properly return the parsed data + * PARAMETERS: bit_field - Field in which to count bits * - * RETURN: Status + * RETURN: Number of bits set within the field * - * DESCRIPTION: Takes the resource byte stream and parses it once, calculating - * the size buffer needed to hold the linked list that conveys - * the resource data. + * DESCRIPTION: Count the number of bits set in a resource field. Used for + * (Short descriptor) interrupt and DMA lists. * ******************************************************************************/ -acpi_status -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"); - while (!done) { - /* Init the variable that will hold the size to add to the total. */ +static u8 acpi_rs_count_set_bits(u16 bit_field) +{ + u8 bits_set; - segment_size = 0; + ACPI_FUNCTION_ENTRY(); - switch (linked_list->id) { - case ACPI_RSTYPE_IRQ: - /* - * IRQ Resource - * For an IRQ Resource, Byte 3, although optional, will always be - * created - it holds IRQ information. - */ - segment_size = 4; - break; + for (bits_set = 0; bit_field; bits_set++) { + /* Zero the least significant bit that is set */ - case ACPI_RSTYPE_DMA: - /* - * DMA Resource - * For this resource the size is static - */ - segment_size = 3; - break; - - case ACPI_RSTYPE_START_DPF: - /* - * Start Dependent Functions Resource - * For a start_dependent_functions Resource, Byte 1, although - * optional, will always be created. - */ - segment_size = 2; - break; + bit_field &= (bit_field - 1); + } - case ACPI_RSTYPE_END_DPF: - /* - * End Dependent Functions Resource - * For this resource the size is static - */ - segment_size = 1; - break; + return (bits_set); +} - case ACPI_RSTYPE_IO: - /* - * IO Port Resource - * For this resource the size is static - */ - segment_size = 8; - break; +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_sizes + * + * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * + * RETURN: Pointer to the resource conversion handler + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ - case ACPI_RSTYPE_FIXED_IO: - /* - * Fixed IO Port Resource - * For this resource the size is static - */ - segment_size = 4; - break; +static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type) +{ + ACPI_RESOURCE_SIZES *size_info; - case ACPI_RSTYPE_VENDOR: - /* - * Vendor Defined Resource - * For a Vendor Specific resource, if the Length is between 1 and 7 - * it will be created as a Small Resource data type, otherwise it - * is a Large Resource data type. - */ - if (linked_list->data.vendor_specific.length > 7) { - segment_size = 3; - } else { - segment_size = 1; - } - segment_size += - linked_list->data.vendor_specific.length; - break; + ACPI_FUNCTION_ENTRY(); - case ACPI_RSTYPE_END_TAG: - /* - * End Tag - * For this resource the size is static - */ - segment_size = 2; - done = TRUE; - break; + /* Determine if this is a small or large resource */ - case ACPI_RSTYPE_MEM24: - /* - * 24-Bit Memory Resource - * For this resource the size is static - */ - segment_size = 12; - break; + if (resource_type & ACPI_RDESC_TYPE_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ - case ACPI_RSTYPE_MEM32: - /* - * 32-Bit Memory Range Resource - * For this resource the size is static - */ - segment_size = 20; - break; + if (resource_type > ACPI_RDESC_LARGE_MAX) { + return (NULL); + } - case ACPI_RSTYPE_FIXED_MEM32: - /* - * 32-Bit Fixed Memory Resource - * For this resource the size is static - */ - segment_size = 12; - break; + size_info = &acpi_gbl_lg_resource_sizes[(resource_type & + ACPI_RDESC_LARGE_MASK)]; + } else { + /* Small Resource Type -- bits 6:3 contain the name */ - case ACPI_RSTYPE_ADDRESS16: - /* - * 16-Bit Address Resource - * The base size of this byte stream is 16. If a Resource Source - * string is not NULL, add 1 for the Index + the length of the null - * terminated string Resource Source + 1 for the null. - */ - segment_size = 16; - - if (linked_list->data.address16.resource_source. - string_ptr) { - segment_size += - linked_list->data.address16.resource_source. - string_length; - segment_size++; - } - break; + size_info = &acpi_gbl_sm_resource_sizes[((resource_type & + ACPI_RDESC_SMALL_MASK) + >> 3)]; + } - case ACPI_RSTYPE_ADDRESS32: - /* - * 32-Bit Address Resource - * The base size of this byte stream is 26. If a Resource - * Source string is not NULL, add 1 for the Index + the - * length of the null terminated string Resource Source + - * 1 for the null. - */ - segment_size = 26; - - if (linked_list->data.address32.resource_source. - string_ptr) { - segment_size += - linked_list->data.address32.resource_source. - string_length; - segment_size++; - } - break; + /* Zero entry indicates an invalid resource type */ - case ACPI_RSTYPE_ADDRESS64: - /* - * 64-Bit Address Resource - * The base size of this byte stream is 46. If a resource_source - * string is not NULL, add 1 for the Index + the length of the null - * terminated string Resource Source + 1 for the null. - */ - segment_size = 46; - - if (linked_list->data.address64.resource_source. - string_ptr) { - segment_size += - linked_list->data.address64.resource_source. - string_length; - segment_size++; - } - break; + if (!size_info->minimum_stream_size) { + return (NULL); + } - case ACPI_RSTYPE_EXT_IRQ: - /* - * Extended IRQ Resource - * The base size of this byte stream is 9. This is for an Interrupt - * table length of 1. For each additional interrupt, add 4. - * If a Resource Source string is not NULL, add 1 for the - * Index + the length of the null terminated string - * Resource Source + 1 for the null. - */ - segment_size = 9 + (((acpi_size) - linked_list->data.extended_irq. - number_of_interrupts - 1) * 4); - - if (linked_list->data.extended_irq.resource_source. - string_ptr) { - segment_size += - linked_list->data.extended_irq. - resource_source.string_length; - segment_size++; - } - break; + return (size_info); +} - default: +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_length + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * + * RETURN: Byte length of the (AML byte stream) descriptor. By definition, + * this does not include the size of the descriptor header and the + * length field itself. + * + * DESCRIPTION: Extract the length of a resource descriptor. + * + ******************************************************************************/ - /* If we get here, everything is out of sync, exit with error */ +static u16 acpi_rs_get_resource_length(u8 * resource) +{ + u16 resource_length; - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + ACPI_FUNCTION_ENTRY(); - } /* switch (linked_list->Id) */ + /* Determine if this is a small or large resource */ - /* Update the total */ + if (*resource & ACPI_RDESC_TYPE_LARGE) { + /* Large Resource type -- length is in bytes 1-2 */ - byte_stream_size_needed += segment_size; + ACPI_MOVE_16_TO_16(&resource_length, (resource + 1)); - /* Point to the next object */ + } else { + /* Small Resource Type -- bits 2:0 of byte 0 contain the length */ - linked_list = ACPI_PTR_ADD(struct acpi_resource, - linked_list, linked_list->length); + resource_length = + (u16) (*resource & ACPI_RDESC_SMALL_LENGTH_MASK); } - /* This is the data the caller needs */ - - *size_needed = byte_stream_size_needed; - return_ACPI_STATUS(AE_OK); + return (resource_length); } /******************************************************************************* * - * FUNCTION: acpi_rs_get_list_length + * FUNCTION: acpi_rs_struct_option_length * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * byte_stream_buffer_length - Size of byte_stream_buffer - * size_needed - u32 pointer of the size buffer - * needed to properly return the - * parsed data + * PARAMETERS: resource_source - Pointer to optional descriptor field * * RETURN: Status * - * DESCRIPTION: Takes the resource byte stream and parses it once, calculating - * the size buffer needed to hold the linked list that conveys - * the resource data. + * DESCRIPTION: Common code to handle optional resource_source_index and + * resource_source fields in some Large descriptors. Used during + * list-to-stream conversion * ******************************************************************************/ -acpi_status -acpi_rs_get_list_length(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, acpi_size * size_needed) +static acpi_size +acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) { - 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); + ACPI_FUNCTION_ENTRY(); - switch (resource_type) { - case ACPI_RDESC_TYPE_MEMORY_24: - /* - * 24-Bit Memory Resource - */ - bytes_consumed = 12; - - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); - break; + /* + * If the resource_source string is valid, return the size of the string + * (string_length includes the NULL terminator) plus the size of the + * resource_source_index (1). + */ + if (resource_source->string_ptr) { + return ((acpi_size) resource_source->string_length + 1); + } - case ACPI_RDESC_TYPE_LARGE_VENDOR: - /* - * Vendor Defined Resource - */ - buffer = byte_stream_buffer; - ++buffer; + return (0); +} - ACPI_MOVE_16_TO_16(&temp16, buffer); - bytes_consumed = temp16 + 3; +/******************************************************************************* + * + * FUNCTION: acpi_rs_stream_option_length + * + * PARAMETERS: resource_length - Length from the resource header + * minimum_total_length - Minimum length of this resource, before + * any optional fields. Includes header size + * + * RETURN: Length of optional string (0 if no string present) + * + * DESCRIPTION: Common code to handle optional resource_source_index and + * resource_source fields in some Large descriptors. Used during + * stream-to-list conversion + * + ******************************************************************************/ - /* Ensure a 32-bit boundary for the structure */ +static u32 +acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) +{ + u32 string_length = 0; + u32 minimum_resource_length; - temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16); + ACPI_FUNCTION_ENTRY(); - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + - (temp16 * sizeof(u8)); - break; + /* + * The resource_source_index and resource_source are optional elements of some + * Large-type resource descriptors. + */ - case ACPI_RDESC_TYPE_MEMORY_32: - /* - * 32-Bit Memory Range Resource - */ - bytes_consumed = 20; + /* Compute minimum size of the data part of the resource descriptor */ - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); - break; + minimum_resource_length = + minimum_total_length - sizeof(struct asl_large_header); - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: - /* - * 32-Bit Fixed Memory Resource - */ - bytes_consumed = 12; + /* + * If the length of the actual resource descriptor is greater than the ACPI + * spec-defined minimum length, it means that a resource_source_index exists + * and is followed by a (required) null terminated string. The string length + * (including the null terminator) is the resource length minus the minimum + * length, minus one byte for the resource_source_index itself. + */ + if (resource_length > minimum_resource_length) { + /* Compute the length of the optional string */ - structure_size = - ACPI_SIZEOF_RESOURCE(struct - acpi_resource_fixed_mem32); - break; + string_length = resource_length - minimum_resource_length - 1; + } - case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: - /* - * 64-Bit Address Resource - */ - buffer = byte_stream_buffer; + /* Round up length to 32 bits for internal structure alignment */ - ++buffer; - ACPI_MOVE_16_TO_16(&temp16, buffer); + return (ACPI_ROUND_UP_to_32_bITS(string_length)); +} - bytes_consumed = temp16 + 3; - structure_size = - ACPI_SIZEOF_RESOURCE(struct - acpi_resource_address64); - break; +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_byte_stream_length + * + * PARAMETERS: Resource - Pointer to the resource linked list + * size_needed - Where the required size is returned + * + * RETURN: Status + * + * DESCRIPTION: Takes a linked list of internal resource descriptors and + * calculates the size buffer needed to hold the corresponding + * external resource byte stream. + * + ******************************************************************************/ - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: - /* - * 64-Bit Address Resource - */ - buffer = byte_stream_buffer; +acpi_status +acpi_rs_get_byte_stream_length(struct acpi_resource * resource, + acpi_size * size_needed) +{ + acpi_size byte_stream_size_needed = 0; + acpi_size segment_size; - ++buffer; - ACPI_MOVE_16_TO_16(&temp16, buffer); + ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); - bytes_consumed = temp16 + 3; + /* Traverse entire list of internal resource descriptors */ - /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 43, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. - */ - if (43 < temp16) { - temp8 = (u8) (temp16 - 44); - } else { - temp8 = 0; - } + while (resource) { + /* Validate the descriptor type */ - /* Ensure a 64-bit boundary for the structure */ + if (resource->type > ACPI_RSTYPE_MAX) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } - temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8); + /* Get the base size of the (external stream) resource descriptor */ - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) - + (temp8 * sizeof(u8)); - break; + segment_size = acpi_gbl_stream_sizes[resource->type]; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: + /* + * Augment the base size for descriptors with optional and/or + * variable-length fields + */ + switch (resource->type) { + case ACPI_RSTYPE_VENDOR: /* - * 32-Bit Address Resource + * Vendor Defined Resource: + * For a Vendor Specific resource, if the Length is between 1 and 7 + * it will be created as a Small Resource data type, otherwise it + * is a Large Resource data type. */ - buffer = byte_stream_buffer; - - ++buffer; - ACPI_MOVE_16_TO_16(&temp16, buffer); + if (resource->data.vendor_specific.length > 7) { + /* Base size of a Large resource descriptor */ - bytes_consumed = temp16 + 3; - - /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 23, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. - */ - if (23 < temp16) { - temp8 = (u8) (temp16 - 24); - } else { - temp8 = 0; + segment_size = 3; } - /* Ensure a 32-bit boundary for the structure */ + /* Add the size of the vendor-specific data */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) - + (temp8 * sizeof(u8)); + segment_size += resource->data.vendor_specific.length; break; - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: + case ACPI_RSTYPE_END_TAG: /* - * 16-Bit Address Resource + * End Tag: + * We are done -- return the accumulated total size. */ - buffer = byte_stream_buffer; + *size_needed = byte_stream_size_needed + segment_size; - ++buffer; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Normal exit */ - bytes_consumed = temp16 + 3; + return_ACPI_STATUS(AE_OK); + case ACPI_RSTYPE_ADDRESS16: /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 13, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. + * 16-Bit Address Resource: + * Add the size of the optional resource_source info */ - if (13 < temp16) { - temp8 = (u8) (temp16 - 14); - } else { - temp8 = 0; - } - - /* 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_address16) - + (temp8 * sizeof(u8)); + segment_size += + acpi_rs_struct_option_length(&resource->data. + address16. + resource_source); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: - /* - * Extended IRQ - */ - buffer = byte_stream_buffer; - - ++buffer; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - bytes_consumed = temp16 + 3; - + case ACPI_RSTYPE_ADDRESS32: /* - * Point past the length field and the Interrupt vector flags to - * save off the Interrupt table length to the Temp8 variable. + * 32-Bit Address Resource: + * Add the size of the optional resource_source info */ - buffer += 3; - temp8 = *buffer; + segment_size += + acpi_rs_struct_option_length(&resource->data. + address32. + resource_source); + break; + case ACPI_RSTYPE_ADDRESS64: /* - * To compensate for multiple interrupt numbers, add 4 bytes for - * each additional interrupts greater than 1 + * 64-Bit Address Resource: + * Add the size of the optional resource_source info */ - additional_bytes = (u8) ((temp8 - 1) * 4); + segment_size += + acpi_rs_struct_option_length(&resource->data. + address64. + resource_source); + break; + case ACPI_RSTYPE_EXT_IRQ: /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 9, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. + * Extended IRQ Resource: + * Add the size of each additional optional interrupt beyond the + * required 1 (4 bytes for each u32 interrupt number) */ - if (9 + additional_bytes < temp16) { - temp8 = (u8) (temp16 - (9 + additional_bytes)); - } else { - temp8 = 0; - } + segment_size += (((acpi_size) + resource->data.extended_irq. + number_of_interrupts - 1) * 4); - /* Ensure a 32-bit boundary for the structure */ + /* Add the size of the optional resource_source info */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); + segment_size += + acpi_rs_struct_option_length(&resource->data. + extended_irq. + resource_source); + break; - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) + - (additional_bytes * sizeof(u8)) + - (temp8 * sizeof(u8)); + default: break; + } - case ACPI_RDESC_TYPE_IRQ_FORMAT: - /* - * IRQ Resource. - * Determine if it there are two or three trailing bytes - */ - buffer = byte_stream_buffer; - temp8 = *buffer; + /* Update the total */ - if (temp8 & 0x01) { - bytes_consumed = 4; - } else { - bytes_consumed = 3; - } + byte_stream_size_needed += segment_size; - /* Point past the descriptor */ + /* Point to the next object */ - ++buffer; + resource = ACPI_PTR_ADD(struct acpi_resource, + resource, resource->length); + } - /* Look at the number of bits set */ + /* Did not find an END_TAG descriptor */ - ACPI_MOVE_16_TO_16(&temp16, buffer); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); +} - for (index = 0; index < 16; index++) { - if (temp16 & 0x1) { - ++number_of_interrupts; - } +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_list_length + * + * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream + * byte_stream_buffer_length - Size of byte_stream_buffer + * size_needed - Where the size needed is returned + * + * RETURN: Status + * + * DESCRIPTION: Takes an external resource byte stream and calculates the size + * buffer needed to hold the corresponding internal resource + * descriptor linked list. + * + ******************************************************************************/ - temp16 >>= 1; - } +acpi_status +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, acpi_size * size_needed) +{ + u8 *buffer; + ACPI_RESOURCE_SIZES *resource_info; + u32 buffer_size = 0; + u32 bytes_parsed = 0; + u8 resource_type; + u16 temp16; + u16 resource_length; + u16 header_length; + u32 extra_struct_bytes; - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) + - (number_of_interrupts * sizeof(u32)); - break; + ACPI_FUNCTION_TRACE("rs_get_list_length"); - case ACPI_RDESC_TYPE_DMA_FORMAT: - /* - * DMA Resource - */ - buffer = byte_stream_buffer; - bytes_consumed = 3; + while (bytes_parsed < byte_stream_buffer_length) { + /* The next byte in the stream is the resource descriptor type */ - /* Point past the descriptor */ + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); - ++buffer; + /* Get the base stream size and structure sizes for the descriptor */ - /* Look at the number of bits set */ + resource_info = acpi_rs_get_resource_sizes(resource_type); + if (!resource_info) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } - temp8 = *buffer; + /* Get the Length field from the input resource descriptor */ - for (index = 0; index < 8; index++) { - if (temp8 & 0x1) { - ++number_of_channels; - } + resource_length = + acpi_rs_get_resource_length(byte_stream_buffer); - temp8 >>= 1; - } + /* Augment the size for descriptors with optional fields */ - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) + - (number_of_channels * sizeof(u32)); - break; + extra_struct_bytes = 0; - case ACPI_RDESC_TYPE_START_DEPENDENT: + if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) { /* - * Start Dependent Functions Resource - * Determine if it there are two or three trailing bytes + * Small resource descriptors */ - buffer = byte_stream_buffer; - temp8 = *buffer; + header_length = 1; + buffer = byte_stream_buffer + header_length; - if (temp8 & 0x01) { - bytes_consumed = 2; - } else { - bytes_consumed = 1; - } + switch (resource_type) { + case ACPI_RDESC_TYPE_IRQ_FORMAT: + /* + * IRQ Resource: + * Get the number of bits set in the IRQ word + */ + ACPI_MOVE_16_TO_16(&temp16, buffer); - structure_size = - ACPI_SIZEOF_RESOURCE(struct - acpi_resource_start_dpf); - break; + extra_struct_bytes = + (acpi_rs_count_set_bits(temp16) * + sizeof(u32)); + break; - case ACPI_RDESC_TYPE_END_DEPENDENT: - /* - * End Dependent Functions Resource - */ - bytes_consumed = 1; - structure_size = ACPI_RESOURCE_LENGTH; - break; + case ACPI_RDESC_TYPE_DMA_FORMAT: + /* + * DMA Resource: + * Get the number of bits set in the DMA channels byte + */ + extra_struct_bytes = + (acpi_rs_count_set_bits((u16) * buffer) * + sizeof(u32)); + break; - case ACPI_RDESC_TYPE_IO_PORT: - /* - * IO Port Resource - */ - bytes_consumed = 8; - structure_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); - break; + case ACPI_RDESC_TYPE_SMALL_VENDOR: + /* + * Vendor Specific Resource: + * Ensure a 32-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_32_bITS(resource_length); + 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); - break; + case ACPI_RDESC_TYPE_END_TAG: + /* + * End Tag: + * Terminate the loop now + */ + byte_stream_buffer_length = bytes_parsed; + break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: + default: + break; + } + } else { /* - * Vendor Specific Resource + * Large resource descriptors */ - buffer = byte_stream_buffer; + header_length = sizeof(struct asl_large_header); + buffer = byte_stream_buffer + header_length; - temp8 = *buffer; - temp8 = (u8) (temp8 & 0x7); - bytes_consumed = temp8 + 1; + switch (resource_type) { + case ACPI_RDESC_TYPE_LARGE_VENDOR: + /* + * Vendor Defined Resource: + * Add vendor data and ensure a 32-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_32_bITS(resource_length); + break; - /* Ensure a 32-bit boundary for the structure */ + case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: + case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: + /* + * 32-Bit or 16-bit Address Resource: + * Add the size of any optional data (resource_source) + */ + extra_struct_bytes = + acpi_rs_stream_option_length + (resource_length, + resource_info->minimum_stream_size); + break; - 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_EXTENDED_XRUPT: + /* + * Extended IRQ: + * Point past the interrupt_vector_flags to get the + * interrupt_table_length. + */ + buffer++; - case ACPI_RDESC_TYPE_END_TAG: - /* - * End Tag - */ - bytes_consumed = 2; - structure_size = ACPI_RESOURCE_LENGTH; - byte_stream_buffer_length = bytes_parsed; - break; + /* + * Add 4 bytes for each additional interrupt. Note: at least one + * interrupt is required and is included in the minimum + * descriptor size + */ + extra_struct_bytes = + ((*buffer - 1) * sizeof(u32)); - default: - /* - * If we get here, everything is out of sync, - * exit with an error - */ - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + /* Add the size of any optional data (resource_source) */ - /* Update the return value and counter */ + extra_struct_bytes += + acpi_rs_stream_option_length(resource_length + - + extra_struct_bytes, + resource_info-> + minimum_stream_size); + break; - buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size); - bytes_parsed += bytes_consumed; + case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: + /* + * 64-Bit Address Resource: + * Add the size of any optional data (resource_source) + * Ensure a 64-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_64_bITS + (acpi_rs_stream_option_length + (resource_length, + resource_info->minimum_stream_size)); + break; + + default: + break; + } + } + + /* Update the required buffer size for the internal descriptor structs */ - /* Set the byte stream to point to the next resource */ + temp16 = + (u16) (resource_info->minimum_struct_size + + extra_struct_bytes); + buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); - byte_stream_buffer += bytes_consumed; + /* + * Update byte count and point to the next resource within the stream + * using the size of the header plus the length contained in the header + */ + temp16 = (u16) (header_length + resource_length); + bytes_parsed += temp16; + byte_stream_buffer += temp16; } /* This is the data the caller needs */ diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 75bd34d1783..9d93ee5f006 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -49,1021 +49,967 @@ 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 *resource); -static void acpi_rs_dump_address16(union acpi_resource_data *data); +static void acpi_rs_dump_address16(union acpi_resource_data *resource); -static void acpi_rs_dump_address32(union acpi_resource_data *data); +static void acpi_rs_dump_address32(union acpi_resource_data *resource); -static void acpi_rs_dump_address64(union acpi_resource_data *data); +static void acpi_rs_dump_address64(union acpi_resource_data *resource); -static void acpi_rs_dump_dma(union acpi_resource_data *data); +static void acpi_rs_dump_dma(union acpi_resource_data *resource); -static void acpi_rs_dump_io(union acpi_resource_data *data); +static void acpi_rs_dump_io(union acpi_resource_data *resource); -static void acpi_rs_dump_extended_irq(union acpi_resource_data *data); +static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource); -static void acpi_rs_dump_fixed_io(union acpi_resource_data *data); +static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); -static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data); +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); -static void acpi_rs_dump_memory24(union acpi_resource_data *data); +static void acpi_rs_dump_memory24(union acpi_resource_data *resource); -static void acpi_rs_dump_memory32(union acpi_resource_data *data); +static void acpi_rs_dump_memory32(union acpi_resource_data *resource); -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 *resource); -static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data); +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource); + +static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); + +static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource); + +static void acpi_rs_dump_end_tag(union acpi_resource_data *resource); + +static void acpi_rs_out_string(char *title, char *value); + +static void acpi_rs_out_integer8(char *title, u8 value); + +static void acpi_rs_out_integer16(char *title, u16 value); + +static void acpi_rs_out_integer32(char *title, u32 value); + +static void acpi_rs_out_integer64(char *title, u64 value); + +static void acpi_rs_out_title(char *title); + +static void acpi_rs_dump_byte_list(u32 length, u8 * data); + +static void acpi_rs_dump_dword_list(u32 length, u32 * data); + +static void acpi_rs_dump_short_byte_list(u32 length, u32 * data); + +static void +acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); + +static void acpi_rs_dump_address_common(union acpi_resource_data *resource); + +/* Dispatch table for resource dump functions */ + +typedef +void (*ACPI_DUMP_RESOURCE) (union acpi_resource_data * data); + +static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = { + acpi_rs_dump_irq, /* ACPI_RSTYPE_IRQ */ + acpi_rs_dump_dma, /* ACPI_RSTYPE_DMA */ + acpi_rs_dump_start_depend_fns, /* ACPI_RSTYPE_START_DPF */ + acpi_rs_dump_end_depend_fns, /* ACPI_RSTYPE_END_DPF */ + acpi_rs_dump_io, /* ACPI_RSTYPE_IO */ + acpi_rs_dump_fixed_io, /* ACPI_RSTYPE_FIXED_IO */ + acpi_rs_dump_vendor_specific, /* ACPI_RSTYPE_VENDOR */ + acpi_rs_dump_end_tag, /* ACPI_RSTYPE_END_TAG */ + acpi_rs_dump_memory24, /* ACPI_RSTYPE_MEM24 */ + acpi_rs_dump_memory32, /* ACPI_RSTYPE_MEM32 */ + acpi_rs_dump_fixed_memory32, /* ACPI_RSTYPE_FIXED_MEM32 */ + acpi_rs_dump_address16, /* ACPI_RSTYPE_ADDRESS16 */ + acpi_rs_dump_address32, /* ACPI_RSTYPE_ADDRESS32 */ + acpi_rs_dump_address64, /* ACPI_RSTYPE_ADDRESS64 */ + acpi_rs_dump_extended_irq, /* ACPI_RSTYPE_EXT_IRQ */ + acpi_rs_dump_generic_reg /* ACPI_RSTYPE_GENERIC_REG */ +}; /******************************************************************************* * - * FUNCTION: acpi_rs_dump_irq + * FUNCTION: acpi_rs_out* + * + * PARAMETERS: Title - Name of the resource field + * Value - Value of the resource field + * + * RETURN: None + * + * DESCRIPTION: Miscellaneous helper functions to consistently format the + * output of the resource dump routines + * + ******************************************************************************/ + +static void acpi_rs_out_string(char *title, char *value) +{ + acpi_os_printf("%30s : %s\n", title, value); +} + +static void acpi_rs_out_integer8(char *title, u8 value) +{ + acpi_os_printf("%30s : %2.2X\n", title, value); +} + +static void acpi_rs_out_integer16(char *title, u16 value) +{ + acpi_os_printf("%30s : %4.4X\n", title, value); +} + +static void acpi_rs_out_integer32(char *title, u32 value) +{ + acpi_os_printf("%30s : %8.8X\n", title, value); +} + +static void acpi_rs_out_integer64(char *title, u64 value) +{ + acpi_os_printf("%30s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); +} + +static void acpi_rs_out_title(char *title) +{ + acpi_os_printf("%30s : ", title); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump*List + * + * PARAMETERS: Length - Number of elements in the list + * Data - Start of the list + * + * RETURN: None + * + * DESCRIPTION: Miscellaneous functions to dump lists of raw data + * + ******************************************************************************/ + +static void acpi_rs_dump_byte_list(u32 length, u8 * data) +{ + u32 i; + + for (i = 0; i < length; i++) { + acpi_os_printf("%28s%2.2X : %2.2X\n", "Byte", i, data[i]); + } +} + +static void acpi_rs_dump_dword_list(u32 length, u32 * data) +{ + u32 i; + + for (i = 0; i < length; i++) { + acpi_os_printf("%28s%2.2X : %8.8X\n", "Dword", i, data[i]); + } +} + +static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) +{ + u32 i; + + for (i = 0; i < length; i++) { + acpi_os_printf("%X ", data[i]); + } + acpi_os_printf("\n"); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_resource_source * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: resource_source - Pointer to a Resource Source struct * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Common routine for dumping the optional resource_source and the + * corresponding resource_source_index. * ******************************************************************************/ -static void acpi_rs_dump_irq(union acpi_resource_data *data) +static void +acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) { - struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data; - u8 index = 0; + if (resource_source->index == 0xFF) { + return; + } + + acpi_rs_out_integer8("Resource Source Index", + (u8) resource_source->index); + + acpi_rs_out_string("Resource Source", + resource_source->string_ptr ? + resource_source->string_ptr : "[Not Specified]"); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_address_common + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the fields that are common to all Address resource + * descriptors + * + ******************************************************************************/ + +static void acpi_rs_dump_address_common(union acpi_resource_data *resource) +{ ACPI_FUNCTION_ENTRY(); - acpi_os_printf("IRQ Resource\n"); + /* Decode the type-specific flags */ + + switch (resource->address.resource_type) { + case ACPI_MEMORY_RANGE: - acpi_os_printf(" %s Triggered\n", - ACPI_LEVEL_SENSITIVE == - irq_data->edge_level ? "Level" : "Edge"); + acpi_rs_out_string("Resource Type", "Memory Range"); + + acpi_rs_out_title("Type-Specific Flags"); + + switch (resource->address.attribute.memory.cache_attribute) { + case ACPI_NON_CACHEABLE_MEMORY: + acpi_os_printf("Noncacheable memory\n"); + break; - acpi_os_printf(" Active %s\n", - ACPI_ACTIVE_LOW == - irq_data->active_high_low ? "Low" : "High"); + case ACPI_CACHABLE_MEMORY: + acpi_os_printf("Cacheable memory\n"); + break; - acpi_os_printf(" %s\n", - ACPI_SHARED == - irq_data->shared_exclusive ? "Shared" : "Exclusive"); + case ACPI_WRITE_COMBINING_MEMORY: + acpi_os_printf("Write-combining memory\n"); + break; - acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts); + case ACPI_PREFETCHABLE_MEMORY: + acpi_os_printf("Prefetchable memory\n"); + break; + + default: + acpi_os_printf("Invalid cache attribute\n"); + break; + } + + acpi_rs_out_string("Read/Write Attribute", + ACPI_READ_WRITE_MEMORY == + resource->address.attribute.memory. + read_write_attribute ? "Read/Write" : + "Read Only"); + break; + + case ACPI_IO_RANGE: + + acpi_rs_out_string("Resource Type", "I/O Range"); + + acpi_rs_out_title("Type-Specific Flags"); + + switch (resource->address.attribute.io.range_attribute) { + case ACPI_NON_ISA_ONLY_RANGES: + acpi_os_printf("Non-ISA I/O Addresses\n"); + break; - for (index = 0; index < irq_data->number_of_interrupts; index++) { - acpi_os_printf("%X ", irq_data->interrupts[index]); + case ACPI_ISA_ONLY_RANGES: + acpi_os_printf("ISA I/O Addresses\n"); + break; + + case ACPI_ENTIRE_RANGE: + acpi_os_printf("ISA and non-ISA I/O Addresses\n"); + break; + + default: + acpi_os_printf("Invalid range attribute\n"); + break; + } + + acpi_rs_out_string("Translation Attribute", + ACPI_SPARSE_TRANSLATION == + resource->address.attribute.io. + translation_attribute ? "Sparse Translation" + : "Dense Translation"); + break; + + case ACPI_BUS_NUMBER_RANGE: + + acpi_rs_out_string("Resource Type", "Bus Number Range"); + break; + + default: + + acpi_rs_out_integer8("Resource Type", + (u8) resource->address.resource_type); + break; } - acpi_os_printf(")\n"); - return; + /* Decode the general flags */ + + acpi_rs_out_string("Resource", + ACPI_CONSUMER == + resource->address. + producer_consumer ? "Consumer" : "Producer"); + + acpi_rs_out_string("Decode", + ACPI_SUB_DECODE == resource->address.decode ? + "Subtractive" : "Positive"); + + acpi_rs_out_string("Min Address", + ACPI_ADDRESS_FIXED == + resource->address. + min_address_fixed ? "Fixed" : "Not Fixed"); + + acpi_rs_out_string("Max Address", + ACPI_ADDRESS_FIXED == + resource->address. + max_address_fixed ? "Fixed" : "Not Fixed"); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_dma + * FUNCTION: acpi_rs_dump_resource_list * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: resource_list - Pointer to a resource descriptor list * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dispatches the structure to the correct dump routine. * ******************************************************************************/ -static void acpi_rs_dump_dma(union acpi_resource_data *data) +void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) { - struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data; - u8 index = 0; + u32 count = 0; ACPI_FUNCTION_ENTRY(); + if (!(acpi_dbg_level & ACPI_LV_RESOURCES) + || !(_COMPONENT & acpi_dbg_layer)) { + return; + } + + /* Dump all resource descriptors in the list */ + + while (resource_list) { + acpi_os_printf("\n[%02X] ", count); + + /* Validate Type before dispatch */ + + if (resource_list->type > ACPI_RSTYPE_MAX) { + acpi_os_printf + ("Invalid descriptor type (%X) in resource list\n", + resource_list->type); + return; + } + + /* Dump the resource descriptor */ + + acpi_gbl_dump_resource_dispatch[resource_list-> + type] (&resource_list->data); + + /* Exit on end tag */ + + if (resource_list->type == ACPI_RSTYPE_END_TAG) { + return; + } + + /* Get the next resource structure */ + + resource_list = + ACPI_PTR_ADD(struct acpi_resource, resource_list, + resource_list->length); + count++; + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_irq + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +static void acpi_rs_dump_irq(union acpi_resource_data *resource) +{ + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("IRQ Resource\n"); + + acpi_rs_out_string("Triggering", + ACPI_LEVEL_SENSITIVE == + resource->irq.edge_level ? "Level" : "Edge"); + + acpi_rs_out_string("Active", + ACPI_ACTIVE_LOW == + resource->irq.active_high_low ? "Low" : "High"); + + acpi_rs_out_string("Sharing", + ACPI_SHARED == + resource->irq. + shared_exclusive ? "Shared" : "Exclusive"); + + acpi_rs_out_integer8("Interrupt Count", + (u8) resource->irq.number_of_interrupts); + + acpi_rs_out_title("Interrupt List"); + acpi_rs_dump_short_byte_list(resource->irq.number_of_interrupts, + resource->irq.interrupts); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_dma + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +static void acpi_rs_dump_dma(union acpi_resource_data *resource) +{ + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("DMA Resource\n"); - switch (dma_data->type) { + acpi_rs_out_title("DMA Type"); + switch (resource->dma.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_rs_out_string("Bus Master", + ACPI_BUS_MASTER == + resource->dma.bus_master ? "Yes" : "No"); - switch (dma_data->transfer) { + acpi_rs_out_title("Transfer Type"); + switch (resource->dma.transfer) { case ACPI_TRANSFER_8: - acpi_os_printf(" 8-bit only transfer\n"); + acpi_os_printf("8-bit transfers only\n"); break; case ACPI_TRANSFER_8_16: - acpi_os_printf(" 8 and 16-bit transfer\n"); + acpi_os_printf("8-bit and 16-bit transfers\n"); break; case ACPI_TRANSFER_16: - acpi_os_printf(" 16 bit only transfer\n"); + acpi_os_printf("16-bit transfers only\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); - - for (index = 0; index < dma_data->number_of_channels; index++) { - acpi_os_printf("%X ", dma_data->channels[index]); - } + acpi_rs_out_integer8("DMA Channel Count", + (u8) resource->dma.number_of_channels); - acpi_os_printf(")\n"); - return; + acpi_rs_out_title("Channel List"); + acpi_rs_dump_short_byte_list(resource->dma.number_of_channels, + resource->dma.channels); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_start_depend_fns * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -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 *resource) { - struct acpi_resource_start_dpf *sdf_data = - (struct acpi_resource_start_dpf *)data; - ACPI_FUNCTION_ENTRY(); acpi_os_printf("Start Dependent Functions Resource\n"); - switch (sdf_data->compatibility_priority) { + acpi_rs_out_title("Compatibility Priority"); + switch (resource->start_dpf.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) { + acpi_rs_out_title("Performance/Robustness"); + switch (resource->start_dpf.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 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_io(union acpi_resource_data *data) +static void acpi_rs_dump_io(union acpi_resource_data *resource) { - struct acpi_resource_io *io_data = (struct acpi_resource_io *)data; - ACPI_FUNCTION_ENTRY(); - acpi_os_printf("Io Resource\n"); + acpi_os_printf("I/O Resource\n"); - acpi_os_printf(" %d bit decode\n", - ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); + acpi_rs_out_string("Decode", + ACPI_DECODE_16 == + resource->io.io_decode ? "16-bit" : "10-bit"); - acpi_os_printf(" Range minimum base: %08X\n", - io_data->min_base_address); + acpi_rs_out_integer32("Range Minimum Base", + resource->io.min_base_address); - acpi_os_printf(" Range maximum base: %08X\n", - io_data->max_base_address); + acpi_rs_out_integer32("Range Maximum Base", + resource->io.max_base_address); - acpi_os_printf(" Alignment: %08X\n", io_data->alignment); + acpi_rs_out_integer32("Alignment", resource->io.alignment); - acpi_os_printf(" Range Length: %08X\n", io_data->range_length); - - return; + acpi_rs_out_integer32("Range Length", resource->io.range_length); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_fixed_io * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_fixed_io(union acpi_resource_data *data) +static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) { - struct acpi_resource_fixed_io *fixed_io_data = - (struct acpi_resource_fixed_io *)data; - 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 I/O Resource\n"); - acpi_os_printf(" Range length: %08X", fixed_io_data->range_length); + acpi_rs_out_integer32("Range Base Address", + resource->fixed_io.base_address); - return; + acpi_rs_out_integer32("Range Length", resource->fixed_io.range_length); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_vendor_specific * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data) +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource) { - struct acpi_resource_vendor *vendor_data = - (struct acpi_resource_vendor *)data; - u16 index = 0; - ACPI_FUNCTION_ENTRY(); acpi_os_printf("Vendor Specific Resource\n"); - acpi_os_printf(" Length: %08X\n", vendor_data->length); + acpi_rs_out_integer16("Length", (u16) resource->vendor_specific.length); - for (index = 0; index < vendor_data->length; index++) { - acpi_os_printf(" Byte %X: %08X\n", - index, vendor_data->reserved[index]); - } - - return; + acpi_rs_dump_byte_list(resource->vendor_specific.length, + resource->vendor_specific.reserved); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_memory24 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_memory24(union acpi_resource_data *data) +static void acpi_rs_dump_memory24(union acpi_resource_data *resource) { - struct acpi_resource_mem24 *memory24_data = - (struct acpi_resource_mem24 *)data; - ACPI_FUNCTION_ENTRY(); 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(" Range minimum base: %08X\n", - memory24_data->min_base_address); + acpi_rs_out_string("Attribute", + ACPI_READ_WRITE_MEMORY == + resource->memory24.read_write_attribute ? + "Read/Write" : "Read Only"); - acpi_os_printf(" Range maximum base: %08X\n", - memory24_data->max_base_address); + acpi_rs_out_integer16("Range Minimum Base", + (u16) resource->memory24.min_base_address); - acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment); + acpi_rs_out_integer16("Range Maximum Base", + (u16) resource->memory24.max_base_address); - acpi_os_printf(" Range length: %08X\n", memory24_data->range_length); + acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment); - return; + acpi_rs_out_integer16("Range Length", + (u16) resource->memory24.range_length); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_memory32 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_memory32(union acpi_resource_data *data) +static void acpi_rs_dump_memory32(union acpi_resource_data *resource) { - 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(" 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_rs_out_string("Attribute", + ACPI_READ_WRITE_MEMORY == + resource->memory32.read_write_attribute ? + "Read/Write" : "Read Only"); - acpi_os_printf(" Range maximum base: %08X\n", - memory32_data->max_base_address); + acpi_rs_out_integer32("Range Minimum Base", + resource->memory32.min_base_address); - acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment); + acpi_rs_out_integer32("Range Maximum Base", + resource->memory32.max_base_address); - acpi_os_printf(" Range length: %08X\n", memory32_data->range_length); + acpi_rs_out_integer32("Alignment", resource->memory32.alignment); - return; + acpi_rs_out_integer32("Range Length", resource->memory32.range_length); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_fixed_memory32 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data) +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) { - 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(" 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_rs_out_string("Attribute", + ACPI_READ_WRITE_MEMORY == + resource->fixed_memory32.read_write_attribute ? + "Read/Write" : "Read Only"); - acpi_os_printf(" Range length: %08X\n", - fixed_memory32_data->range_length); + acpi_rs_out_integer32("Range Base Address", + resource->fixed_memory32.range_base_address); - return; + acpi_rs_out_integer32("Range Length", + resource->fixed_memory32.range_length); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_address16 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_address16(union acpi_resource_data *data) +static void acpi_rs_dump_address16(union acpi_resource_data *resource) { - 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: "); - switch (address16_data->resource_type) { - case ACPI_MEMORY_RANGE: + acpi_rs_dump_address_common(resource); - acpi_os_printf("Memory Range\n"); + acpi_rs_out_integer16("Granularity", + (u16) resource->address16.granularity); - switch (address16_data->attribute.memory.cache_attribute) { - case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf - (" Type Specific: Noncacheable memory\n"); - break; + acpi_rs_out_integer16("Address Range Min", + (u16) resource->address16.min_address_range); - case ACPI_CACHABLE_MEMORY: - acpi_os_printf(" Type Specific: Cacheable memory\n"); - break; + acpi_rs_out_integer16("Address Range Max", + (u16) resource->address16.max_address_range); - case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf - (" Type Specific: Write-combining memory\n"); - break; + acpi_rs_out_integer16("Address Translation Offset", + (u16) resource->address16. + address_translation_offset); - case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf - (" Type Specific: Prefetchable memory\n"); - break; + acpi_rs_out_integer16("Address Length", + (u16) resource->address16.address_length); - default: - 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"); - break; - - case ACPI_IO_RANGE: - - 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"); - break; - - case ACPI_ISA_ONLY_RANGES: - 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"); - break; - - default: - 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"); - break; - - case ACPI_BUS_NUMBER_RANGE: - - acpi_os_printf("Bus Number Range\n"); - break; - - default: - - 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(" %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(" 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(" 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 translation offset: %08X\n", - address16_data->address_translation_offset); - - 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: %s\n", - address16_data->resource_source.string_ptr); - } - - return; + acpi_rs_dump_resource_source(&resource->address16.resource_source); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_address32 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_address32(union acpi_resource_data *data) +static void acpi_rs_dump_address32(union acpi_resource_data *resource) { - struct acpi_resource_address32 *address32_data = - (struct acpi_resource_address32 *)data; - ACPI_FUNCTION_ENTRY(); acpi_os_printf("32-Bit Address Space Resource\n"); - switch (address32_data->resource_type) { - case ACPI_MEMORY_RANGE: + acpi_rs_dump_address_common(resource); - acpi_os_printf(" Resource Type: Memory Range\n"); + acpi_rs_out_integer32("Granularity", resource->address32.granularity); - switch (address32_data->attribute.memory.cache_attribute) { - case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf - (" Type Specific: Noncacheable memory\n"); - break; + acpi_rs_out_integer32("Address Range Min", + resource->address32.min_address_range); - case ACPI_CACHABLE_MEMORY: - acpi_os_printf(" Type Specific: Cacheable memory\n"); - break; + acpi_rs_out_integer32("Address Range Max", + resource->address32.max_address_range); - case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf - (" Type Specific: Write-combining memory\n"); - break; - - case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf - (" Type Specific: Prefetchable memory\n"); - break; - - default: - 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"); - break; - - case ACPI_IO_RANGE: - - 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"); - break; - - case ACPI_ISA_ONLY_RANGES: - 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"); - break; - - default: - 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"); - break; - - case ACPI_BUS_NUMBER_RANGE: - - acpi_os_printf(" Resource Type: Bus Number Range\n"); - break; + acpi_rs_out_integer32("Address Translation Offset", + resource->address32.address_translation_offset); - default: - - acpi_os_printf(" Resource Type: 0x%2.2X\n", - address32_data->resource_type); - break; - } + acpi_rs_out_integer32("Address Length", + resource->address32.address_length); - 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(" 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(" Granularity: %08X\n", address32_data->granularity); - - 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 translation offset: %08X\n", - address32_data->address_translation_offset); - - 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); - - acpi_os_printf(" Resource Source: %s\n", - address32_data->resource_source.string_ptr); - } - - return; + acpi_rs_dump_resource_source(&resource->address32.resource_source); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_address64 * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_address64(union acpi_resource_data *data) +static void acpi_rs_dump_address64(union acpi_resource_data *resource) { - struct acpi_resource_address64 *address64_data = - (struct acpi_resource_address64 *)data; - ACPI_FUNCTION_ENTRY(); 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"); - - switch (address64_data->attribute.memory.cache_attribute) { - case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf - (" Type Specific: Noncacheable memory\n"); - break; - - case ACPI_CACHABLE_MEMORY: - acpi_os_printf(" Type Specific: Cacheable memory\n"); - break; - - case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf - (" Type Specific: Write-combining memory\n"); - break; - - case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf - (" Type Specific: Prefetchable memory\n"); - break; - - default: - 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"); - break; - - case ACPI_IO_RANGE: - - 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"); - break; - - case ACPI_ISA_ONLY_RANGES: - 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"); - break; - - default: - 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"); - break; - - case ACPI_BUS_NUMBER_RANGE: - - acpi_os_printf(" Resource Type: Bus Number Range\n"); - break; - - default: - - 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_rs_dump_address_common(resource); - acpi_os_printf(" %s decode\n", - ACPI_SUB_DECODE == address64_data->decode ? - "Subtractive" : "Positive"); + acpi_rs_out_integer64("Granularity", resource->address64.granularity); - acpi_os_printf(" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? - "" : "not "); + acpi_rs_out_integer64("Address Range Min", + resource->address64.min_address_range); - acpi_os_printf(" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? - "" : "not "); + acpi_rs_out_integer64("Address Range Max", + resource->address64.max_address_range); - acpi_os_printf(" Granularity: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(address64_data->granularity)); + acpi_rs_out_integer64("Address Translation Offset", + resource->address64.address_translation_offset); - acpi_os_printf(" Address range min: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(address64_data->min_address_range)); + acpi_rs_out_integer64("Address Length", + resource->address64.address_length); - acpi_os_printf(" Address range max: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(address64_data->max_address_range)); + acpi_rs_out_integer64("Type Specific Attributes", + resource->address64.type_specific_attributes); - 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(" 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: %s\n", - address64_data->resource_source.string_ptr); - } - - return; + acpi_rs_dump_resource_source(&resource->address64.resource_source); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_extended_irq * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -static void acpi_rs_dump_extended_irq(union acpi_resource_data *data) +static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) { - 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(" Resource %s\n", - ACPI_CONSUMER == ext_irq_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_rs_out_string("Resource", + ACPI_CONSUMER == + resource->extended_irq. + producer_consumer ? "Consumer" : "Producer"); - acpi_os_printf(" %s\n", - ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? - "Level" : "Edge"); + acpi_rs_out_string("Triggering", + ACPI_LEVEL_SENSITIVE == + resource->extended_irq. + edge_level ? "Level" : "Edge"); - acpi_os_printf(" Active %s\n", - ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? - "low" : "high"); + acpi_rs_out_string("Active", + ACPI_ACTIVE_LOW == + resource->extended_irq. + active_high_low ? "Low" : "High"); - acpi_os_printf(" %s\n", - ACPI_SHARED == ext_irq_data->shared_exclusive ? - "Shared" : "Exclusive"); + acpi_rs_out_string("Sharing", + ACPI_SHARED == + resource->extended_irq. + shared_exclusive ? "Shared" : "Exclusive"); - acpi_os_printf(" Interrupts : %X ( ", - ext_irq_data->number_of_interrupts); + acpi_rs_dump_resource_source(&resource->extended_irq.resource_source); - for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { - acpi_os_printf("%X ", ext_irq_data->interrupts[index]); - } - - acpi_os_printf(")\n"); + acpi_rs_out_integer8("Interrupts", + (u8) resource->extended_irq.number_of_interrupts); - 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); - } - - return; + acpi_rs_dump_dword_list(resource->extended_irq.number_of_interrupts, + resource->extended_irq.interrupts); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_resource_list + * FUNCTION: acpi_rs_dump_generic_reg * - * PARAMETERS: Resource - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Dispatches the structure to the correct dump routine. + * DESCRIPTION: Dump the field names and values of the resource descriptor * ******************************************************************************/ -void acpi_rs_dump_resource_list(struct acpi_resource *resource) +static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) { - 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++); - - switch (resource->id) { - case ACPI_RSTYPE_IRQ: - acpi_rs_dump_irq(&resource->data); - break; - - case ACPI_RSTYPE_DMA: - acpi_rs_dump_dma(&resource->data); - break; - - case ACPI_RSTYPE_START_DPF: - 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); */ - break; - - case ACPI_RSTYPE_IO: - acpi_rs_dump_io(&resource->data); - break; - - case ACPI_RSTYPE_FIXED_IO: - acpi_rs_dump_fixed_io(&resource->data); - break; + acpi_os_printf("Generic Register Resource\n"); - case ACPI_RSTYPE_VENDOR: - acpi_rs_dump_vendor_specific(&resource->data); - break; + acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id); - case ACPI_RSTYPE_END_TAG: - /*rs_dump_end_tag (Resource->Data); */ - acpi_os_printf("end_tag Resource\n"); - done = TRUE; - break; + acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width); - case ACPI_RSTYPE_MEM24: - acpi_rs_dump_memory24(&resource->data); - break; + acpi_rs_out_integer8("Bit Offset", + (u8) resource->generic_reg.bit_offset); - case ACPI_RSTYPE_MEM32: - acpi_rs_dump_memory32(&resource->data); - break; + acpi_rs_out_integer8("Address Size", + (u8) resource->generic_reg.address_size); - case ACPI_RSTYPE_FIXED_MEM32: - acpi_rs_dump_fixed_memory32(&resource->data); - break; - - case ACPI_RSTYPE_ADDRESS16: - acpi_rs_dump_address16(&resource->data); - break; - - case ACPI_RSTYPE_ADDRESS32: - acpi_rs_dump_address32(&resource->data); - break; + acpi_rs_out_integer64("Address", resource->generic_reg.address); +} - case ACPI_RSTYPE_ADDRESS64: - acpi_rs_dump_address64(&resource->data); - break; +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_end_depend_fns + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Print type, no data. + * + ******************************************************************************/ - case ACPI_RSTYPE_EXT_IRQ: - acpi_rs_dump_extended_irq(&resource->data); - break; +static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource) +{ + ACPI_FUNCTION_ENTRY(); - default: - acpi_os_printf("Invalid resource type\n"); - break; + acpi_os_printf("end_dependent_functions Resource\n"); +} - } +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_end_tag + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Print type, no data. + * + ******************************************************************************/ - resource = - ACPI_PTR_ADD(struct acpi_resource, resource, - resource->length); - } - } +static void acpi_rs_dump_end_tag(union acpi_resource_data *resource) +{ + ACPI_FUNCTION_ENTRY(); - return; + acpi_os_printf("end_tag Resource\n"); } /******************************************************************************* * * FUNCTION: acpi_rs_dump_irq_list * - * PARAMETERS: route_table - pointer to the routing table to dump. + * PARAMETERS: route_table - Pointer to the routing table to dump. * * RETURN: None * - * DESCRIPTION: Dispatches the structures to the correct dump routine. + * DESCRIPTION: Print IRQ routing table * ******************************************************************************/ @@ -1071,41 +1017,35 @@ 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(); - if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { - prt_element = - ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); + if (!(acpi_dbg_level & ACPI_LV_RESOURCES) + || !(_COMPONENT & acpi_dbg_layer)) { + return; + } - while (!done) { - acpi_os_printf("PCI IRQ Routing Table structure %X.\n", - count++); + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); - acpi_os_printf(" Address: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(prt_element-> - address)); + /* Dump all table elements, Exit on null length element */ - acpi_os_printf(" Pin: %X\n", prt_element->pin); + while (prt_element->length) { + acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", + count); - acpi_os_printf(" Source: %s\n", prt_element->source); + acpi_rs_out_integer64("Address", prt_element->address); - acpi_os_printf(" source_index: %X\n", - prt_element->source_index); + acpi_rs_out_integer32("Pin", prt_element->pin); + acpi_rs_out_string("Source", prt_element->source); + acpi_rs_out_integer32("Source Index", + prt_element->source_index); - buffer += prt_element->length; - prt_element = - ACPI_CAST_PTR(struct acpi_pci_routing_table, - buffer); - if (0 == prt_element->length) { - done = TRUE; - } - } + buffer += prt_element->length; + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); + count++; } - - return; } #endif diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index d53bbe89e85..6574e2ae2e5 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -84,7 +84,7 @@ acpi_rs_io_resource(u8 * byte_stream_buffer, *bytes_consumed = 8; - output_struct->id = ACPI_RSTYPE_IO; + output_struct->type = ACPI_RSTYPE_IO; /* Check Decode */ @@ -170,7 +170,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, *bytes_consumed = 4; - output_struct->id = ACPI_RSTYPE_FIXED_IO; + output_struct->type = ACPI_RSTYPE_FIXED_IO; /* Check Range Base Address */ @@ -200,7 +200,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_io_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -213,7 +213,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_io_stream(struct acpi_resource *linked_list, +acpi_rs_io_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -222,42 +222,42 @@ acpi_rs_io_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_io_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x47; + *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07; buffer += 1; /* Io Information Byte */ - temp8 = (u8) (linked_list->data.io.io_decode & 0x01); + temp8 = (u8) (resource->data.io.io_decode & 0x01); *buffer = temp8; buffer += 1; /* Set the Range minimum base address */ - temp16 = (u16) linked_list->data.io.min_base_address; + temp16 = (u16) resource->data.io.min_base_address; ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Range maximum base address */ - temp16 = (u16) linked_list->data.io.max_base_address; + temp16 = (u16) resource->data.io.max_base_address; ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the base alignment */ - temp8 = (u8) linked_list->data.io.alignment; + temp8 = (u8) resource->data.io.alignment; *buffer = temp8; buffer += 1; /* Set the range length */ - temp8 = (u8) linked_list->data.io.range_length; + temp8 = (u8) resource->data.io.range_length; *buffer = temp8; buffer += 1; @@ -272,7 +272,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list, * * FUNCTION: acpi_rs_fixed_io_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -285,7 +285,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list, ******************************************************************************/ acpi_status -acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, +acpi_rs_fixed_io_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -294,22 +294,21 @@ acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); - /* The descriptor field is static */ - - *buffer = 0x4B; + /* The Descriptor Type field is static */ + *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03; buffer += 1; /* Set the Range base address */ - temp16 = (u16) linked_list->data.fixed_io.base_address; + temp16 = (u16) resource->data.fixed_io.base_address; ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the range length */ - temp8 = (u8) linked_list->data.fixed_io.range_length; + temp8 = (u8) resource->data.fixed_io.range_length; *buffer = temp8; buffer += 1; @@ -358,7 +357,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer, /* The number of bytes consumed are Constant */ *bytes_consumed = 3; - output_struct->id = ACPI_RSTYPE_DMA; + output_struct->type = ACPI_RSTYPE_DMA; /* Point to the 8-bits of Byte 1 */ @@ -420,7 +419,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_dma_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -433,7 +432,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_dma_stream(struct acpi_resource *linked_list, +acpi_rs_dma_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -443,17 +442,16 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_dma_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x2A; + *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02; buffer += 1; temp8 = 0; /* Loop through all of the Channels and set the mask bits */ - for (index = 0; - index < linked_list->data.dma.number_of_channels; index++) { - temp16 = (u16) linked_list->data.dma.channels[index]; + for (index = 0; index < resource->data.dma.number_of_channels; index++) { + temp16 = (u16) resource->data.dma.channels[index]; temp8 |= 0x1 << temp16; } @@ -462,9 +460,9 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list, /* Set the DMA Info */ - temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); - temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); - temp8 |= (linked_list->data.dma.transfer & 0x03); + temp8 = (u8) ((resource->data.dma.type & 0x03) << 5); + temp8 |= ((resource->data.dma.bus_master & 0x01) << 2); + temp8 |= (resource->data.dma.transfer & 0x03); *buffer = temp8; buffer += 1; diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 56043fee96c..75df962115c 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -88,7 +88,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, */ temp8 = *buffer; *bytes_consumed = (temp8 & 0x03) + 1; - output_struct->id = ACPI_RSTYPE_IRQ; + output_struct->type = ACPI_RSTYPE_IRQ; /* Point to the 16-bits of Bytes 1 and 2 */ @@ -177,7 +177,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_irq_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -190,7 +190,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_irq_stream(struct acpi_resource *linked_list, +acpi_rs_irq_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -205,13 +205,13 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list, * 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) { - *buffer = 0x22; + if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level && + ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low && + ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) { + *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02; IRqinfo_byte_needed = FALSE; } else { - *buffer = 0x23; + *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03; IRqinfo_byte_needed = TRUE; } @@ -221,8 +221,8 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list, /* Loop through all of the interrupts and set the mask bits */ for (index = 0; - index < linked_list->data.irq.number_of_interrupts; index++) { - temp8 = (u8) linked_list->data.irq.interrupts[index]; + index < resource->data.irq.number_of_interrupts; index++) { + temp8 = (u8) resource->data.irq.interrupts[index]; temp16 |= 0x1 << temp8; } @@ -233,11 +233,11 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list, if (IRqinfo_byte_needed) { temp8 = 0; - temp8 = (u8) ((linked_list->data.irq.shared_exclusive & + temp8 = (u8) ((resource->data.irq.shared_exclusive & 0x01) << 4); - if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { + if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level && + ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) { temp8 |= 0x08; } else { temp8 |= 0x01; @@ -302,7 +302,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, } *bytes_consumed = temp16 + 3; - output_struct->id = ACPI_RSTYPE_EXT_IRQ; + output_struct->type = ACPI_RSTYPE_EXT_IRQ; /* Point to the Byte3 */ @@ -441,7 +441,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_extended_irq_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -454,7 +454,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, +acpi_rs_extended_irq_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -476,9 +476,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, /* 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) (resource->data.extended_irq.producer_consumer & 0x01); + temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3); /* * Set the Interrupt Mode @@ -489,44 +488,44 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, * * - Edge/Level are defined opposite in the table vs the headers */ - if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) { + if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) { temp8 |= 0x2; } /* Set the Interrupt Polarity */ - temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); + temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2); *buffer = temp8; buffer += 1; /* Set the Interrupt table length */ - temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; + temp8 = (u8) resource->data.extended_irq.number_of_interrupts; *buffer = temp8; buffer += 1; for (index = 0; - index < linked_list->data.extended_irq.number_of_interrupts; + index < resource->data.extended_irq.number_of_interrupts; index++) { ACPI_MOVE_32_TO_32(buffer, - &linked_list->data.extended_irq. + &resource->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) { + if (0 != resource->data.extended_irq.resource_source.string_length) { *buffer = - (u8) linked_list->data.extended_irq.resource_source.index; + (u8) resource->data.extended_irq.resource_source.index; buffer += 1; /* Copy the string */ ACPI_STRCPY((char *)buffer, - linked_list->data.extended_irq.resource_source. + resource->data.extended_irq.resource_source. string_ptr); /* @@ -535,8 +534,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, */ buffer += (acpi_size) (ACPI_STRLEN - (linked_list->data.extended_irq. - resource_source.string_ptr) + 1); + (resource->data.extended_irq.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 103eb31c284..87e75349dd0 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -47,44 +47,143 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rslist") +/* Dispatch table for convert-to-stream functions */ +typedef +acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource, + u8 ** output_buffer, + acpi_size * bytes_consumed); + +static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = { + acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */ + acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */ + acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */ + acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */ + acpi_rs_io_stream, /* ACPI_RSTYPE_IO */ + acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */ + acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */ + acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */ + acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */ + acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */ + acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */ + acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */ + acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */ + acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */ + acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */ + acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */ +}; + +/* Dispatch tables for convert-to-resource functions */ + +typedef +acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); + +static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = { + NULL, /* 0x00, Reserved */ + NULL, /* 0x01, Reserved */ + NULL, /* 0x02, Reserved */ + NULL, /* 0x03, Reserved */ + acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */ + acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */ + acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */ + acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */ + acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */ + acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ + NULL, /* 0x0A, Reserved */ + NULL, /* 0x0B, Reserved */ + NULL, /* 0x0C, Reserved */ + NULL, /* 0x0D, Reserved */ + acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */ + acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */ +}; + +static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = { + NULL, /* 0x00, Reserved */ + acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */ + acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ + NULL, /* 0x03, Reserved */ + acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */ + acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */ + acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ + acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ + acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ + acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ + acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ + acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ +}; + +/* Local prototypes */ + +static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); + /******************************************************************************* * * FUNCTION: acpi_rs_get_resource_type * - * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor + * PARAMETERS: resource_type - Byte 0 of a resource descriptor * - * RETURN: The Resource Type with no extraneous bits + * RETURN: The Resource Type with no extraneous bits (except the large/ + * small bit -- left alone) * * DESCRIPTION: Extract the Resource Type/Name from the first byte of * a resource descriptor. * ******************************************************************************/ -u8 acpi_rs_get_resource_type(u8 resource_start_byte) -{ +u8 acpi_rs_get_resource_type(u8 resource_type) +{ ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ - switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { - case ACPI_RDESC_TYPE_SMALL: + if (resource_type & ACPI_RDESC_TYPE_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (resource_type); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_handler + * + * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * + * RETURN: Pointer to the resource conversion handler + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ - /* Small Resource Type -- Only bits 6:3 are valid */ +static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) +{ + ACPI_FUNCTION_ENTRY(); - return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); + /* Determine if this is a small or large resource */ - case ACPI_RDESC_TYPE_LARGE: + if (resource_type & ACPI_RDESC_TYPE_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ - /* Large Resource Type -- All bits are valid */ + if (resource_type > ACPI_RDESC_LARGE_MAX) { + return (NULL); + } - return (resource_start_byte); + return (acpi_gbl_lg_resource_dispatch[(resource_type & + ACPI_RDESC_LARGE_MASK)]); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ - default: - /* Invalid type */ - break; + return (acpi_gbl_sm_resource_dispatch[((resource_type & + ACPI_RDESC_SMALL_MASK) + >> 3)]); } - - return (0xFF); } /******************************************************************************* @@ -107,228 +206,70 @@ acpi_status acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, u32 byte_stream_buffer_length, u8 * output_buffer) { + u8 *buffer = 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_RESOURCE_HANDLER handler; 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); - - 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); - break; - - case ACPI_RDESC_TYPE_LARGE_VENDOR: - /* - * Vendor Defined Resource - */ - 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); - 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); - 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); - 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); - 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); - break; - - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: - /* - * Extended IRQ - */ - 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); - break; - - case ACPI_RDESC_TYPE_DMA_FORMAT: - /* - * DMA Resource - */ - 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); - 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); - break; - - case ACPI_RDESC_TYPE_IO_PORT: - /* - * IO Port Resource - */ - 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); - break; - - case ACPI_RDESC_TYPE_SMALL_VENDOR: - /* - * Vendor Specific Resource - */ - 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); - break; - - default: - /* - * Invalid/Unknown resource type - */ + /* Loop until end-of-buffer or an end_tag is found */ + + while (bytes_parsed < byte_stream_buffer_length) { + /* Get the handler associated with this Descriptor Type */ + + handler = acpi_rs_get_resource_handler(*byte_stream_buffer); + if (handler) { + /* Convert a byte stream resource to local resource struct */ + + status = handler(byte_stream_buffer, &bytes_consumed, + &buffer, &structure_size); + } else { + /* Invalid resource type */ + status = AE_AML_INVALID_RESOURCE_TYPE; - break; } if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Update the return value and counter */ + /* Set the aligned length of the new resource descriptor */ - bytes_parsed += bytes_consumed; + resource = ACPI_CAST_PTR(struct acpi_resource, buffer); + resource->length = + (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length); - /* Set the byte stream to point to the next resource */ + /* Normal exit on completion of an end_tag resource descriptor */ + if (acpi_rs_get_resource_type(*byte_stream_buffer) == + ACPI_RDESC_TYPE_END_TAG) { + return_ACPI_STATUS(AE_OK); + } + + /* Update counter and point to the next input resource */ + + bytes_parsed += bytes_consumed; byte_stream_buffer += bytes_consumed; - /* Set the Buffer to the next structure */ + /* Point to the next structure in the output buffer */ - 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 */ + /* Completed buffer, but did not find an end_tag resource descriptor */ - if (!end_tag_processed) { - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); - } - - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } /******************************************************************************* * * FUNCTION: acpi_rs_list_to_byte_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * byte_steam_size_needed - Calculated size of the byte stream * needed from calling * acpi_rs_get_byte_stream_length() @@ -346,180 +287,52 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, +acpi_rs_list_to_byte_stream(struct acpi_resource *resource, 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_status status; ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); - while (!done) { - switch (linked_list->id) { - case ACPI_RSTYPE_IRQ: - /* - * IRQ Resource - */ - 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); - break; - - case ACPI_RSTYPE_START_DPF: - /* - * Start Dependent Functions Resource - */ - 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); - break; - - case ACPI_RSTYPE_IO: - /* - * IO Port Resource - */ - 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); - break; - - case ACPI_RSTYPE_VENDOR: - /* - * Vendor Defined Resource - */ - 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); + /* Convert each resource descriptor in the list */ - /* An End Tag indicates the end of the Resource Template */ + while (1) { + /* Validate Type before dispatch */ - done = TRUE; - break; - - case ACPI_RSTYPE_MEM24: - /* - * 24-Bit Memory Resource - */ - 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); - break; - - case ACPI_RSTYPE_FIXED_MEM32: - /* - * 32-Bit Fixed Memory Resource - */ - 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); - break; - - case ACPI_RSTYPE_ADDRESS32: - /* - * 32-Bit Address Descriptor Resource - */ - 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); - break; - - case ACPI_RSTYPE_EXT_IRQ: - /* - * Extended IRQ Resource - */ - status = - acpi_rs_extended_irq_stream(linked_list, &buffer, - &bytes_consumed); - break; - - default: - /* - * If we get here, everything is out of sync, - * so exit with an error - */ + if (resource->type > ACPI_RSTYPE_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", - linked_list->id)); - status = AE_BAD_DATA; - break; + resource->type)); + return_ACPI_STATUS(AE_BAD_DATA); } + /* Perform the conversion, per resource type */ + + status = acpi_gbl_stream_dispatch[resource->type] (resource, + &buffer, + &bytes_consumed); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Set the Buffer to point to the open byte */ + /* Check for end-of-list */ + + if (resource->type == ACPI_RSTYPE_END_TAG) { + /* An End Tag indicates the end of the Resource Template */ + + return_ACPI_STATUS(AE_OK); + } + + /* Set the Buffer to point to the next (output) resource descriptor */ buffer += bytes_consumed; - /* Point to the next object */ + /* Point to the next input resource object */ - linked_list = ACPI_PTR_ADD(struct acpi_resource, - linked_list, linked_list->length); + resource = ACPI_PTR_ADD(struct acpi_resource, + resource, resource->length); } - - return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index daba1a1ed46..418f1afb10a 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -84,11 +84,11 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer, /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->id = ACPI_RSTYPE_MEM24; + output_struct->type = ACPI_RSTYPE_MEM24; /* Check Byte 3 the Read/Write bit */ @@ -133,7 +133,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_memory24_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -146,7 +146,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_memory24_stream(struct acpi_resource *linked_list, +acpi_rs_memory24_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -155,9 +155,9 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_memory24_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x81; + *buffer = ACPI_RDESC_TYPE_MEMORY_24; buffer += 1; /* The length field is static */ @@ -168,30 +168,28 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list, /* Set the Information Byte */ - temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); + temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01); *buffer = temp8; buffer += 1; /* 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, &resource->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, &resource->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, &resource->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, &resource->data.memory24.range_length); buffer += 2; /* Return the number of bytes consumed in this operation */ @@ -238,12 +236,11 @@ acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; - - output_struct->id = ACPI_RSTYPE_MEM32; + output_struct->type = ACPI_RSTYPE_MEM32; /* * Point to the place in the output buffer where the data portion will @@ -335,8 +332,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; - - output_struct->id = ACPI_RSTYPE_FIXED_MEM32; + output_struct->type = ACPI_RSTYPE_FIXED_MEM32; /* Check Byte 3 the Read/Write bit */ @@ -369,7 +365,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_memory32_range_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -382,7 +378,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, +acpi_rs_memory32_range_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -391,9 +387,9 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x85; + *buffer = ACPI_RDESC_TYPE_MEMORY_32; buffer += 1; /* The length field is static */ @@ -405,30 +401,28 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, /* Set the Information Byte */ - temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); + temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01); *buffer = temp8; buffer += 1; /* 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, &resource->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, &resource->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, &resource->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, &resource->data.memory32.range_length); buffer += 4; /* Return the number of bytes consumed in this operation */ @@ -441,7 +435,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, * * FUNCTION: acpi_rs_fixed_memory32_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -454,7 +448,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, +acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -463,9 +457,9 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x86; + *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32; buffer += 1; /* The length field is static */ @@ -478,21 +472,19 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, /* Set the Information Byte */ temp8 = - (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); + (u8) (resource->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); + &resource->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, &resource->data.fixed_memory32.range_length); buffer += 4; /* Return the number of bytes consumed in this operation */ diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 7a8a34e757f..fa7f5a85b61 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -47,6 +47,169 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsmisc") +/******************************************************************************* + * + * FUNCTION: acpi_rs_generic_register_resource + * + * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte + * stream + * bytes_consumed - Pointer to where the number of bytes + * consumed the byte_stream_buffer is + * returned + * output_buffer - Pointer to the return data buffer + * structure_size - Pointer to where the number of bytes + * in the return data struct is returned + * + * RETURN: Status + * + * DESCRIPTION: Take the resource byte stream and fill out the appropriate + * structure pointed to by the output_buffer. Return the + * number of bytes consumed from the byte stream. + * + ******************************************************************************/ +acpi_status +acpi_rs_generic_register_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; + u8 temp8; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg); + + ACPI_FUNCTION_TRACE("rs_generic_register_resource"); + + /* Byte 0 is the Descriptor Type */ + + buffer += 1; + + /* Get the Descriptor Length field (Bytes 1-2) */ + + ACPI_MOVE_16_TO_16(&temp16, buffer); + buffer += 2; + + /* Validate the descriptor length */ + + if (temp16 != 12) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + } + + /* The number of bytes consumed is fixed (12 + 3) */ + + *bytes_consumed = 15; + + /* Fill out the structure */ + + output_struct->type = ACPI_RSTYPE_GENERIC_REG; + + /* Get space_id (Byte 3) */ + + temp8 = *buffer; + output_struct->data.generic_reg.space_id = temp8; + buffer += 1; + + /* Get register_bit_width (Byte 4) */ + + temp8 = *buffer; + output_struct->data.generic_reg.bit_width = temp8; + buffer += 1; + + /* Get register_bit_offset (Byte 5) */ + + temp8 = *buffer; + output_struct->data.generic_reg.bit_offset = temp8; + buffer += 1; + + /* Get address_size (Byte 6) */ + + temp8 = *buffer; + output_struct->data.generic_reg.address_size = temp8; + buffer += 1; + + /* Get register_address (Bytes 7-14) */ + + ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer); + + /* Set the Length parameter */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_generic_register_stream + * + * PARAMETERS: Resource - Pointer to the resource linked list + * output_buffer - Pointer to the user's return buffer + * bytes_consumed - Pointer to where the number of bytes + * used in the output_buffer is returned + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream + * + ******************************************************************************/ + +acpi_status +acpi_rs_generic_register_stream(struct acpi_resource *resource, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16; + + ACPI_FUNCTION_TRACE("rs_generic_register_stream"); + + /* Set the Descriptor Type (Byte 0) */ + + *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER; + buffer += 1; + + /* Set the Descriptor Length (Bytes 1-2) */ + + temp16 = 12; + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set space_id (Byte 3) */ + + *buffer = (u8) resource->data.generic_reg.space_id; + buffer += 1; + + /* Set register_bit_width (Byte 4) */ + + *buffer = (u8) resource->data.generic_reg.bit_width; + buffer += 1; + + /* Set register_bit_offset (Byte 5) */ + + *buffer = (u8) resource->data.generic_reg.bit_offset; + buffer += 1; + + /* Set address_size (Byte 6) */ + + *buffer = (u8) resource->data.generic_reg.address_size; + buffer += 1; + + /* Set register_address (Bytes 7-14) */ + + ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address); + buffer += 8; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} + /******************************************************************************* * * FUNCTION: acpi_rs_end_tag_resource @@ -67,6 +230,7 @@ ACPI_MODULE_NAME("rsmisc") * number of bytes consumed from the byte stream. * ******************************************************************************/ + acpi_status acpi_rs_end_tag_resource(u8 * byte_stream_buffer, acpi_size * bytes_consumed, @@ -81,9 +245,9 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer, *bytes_consumed = 2; - /* Fill out the structure */ + /* Fill out the structure */ - output_struct->id = ACPI_RSTYPE_END_TAG; + output_struct->type = ACPI_RSTYPE_END_TAG; /* Set the Length parameter */ @@ -99,7 +263,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_end_tag_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -112,7 +276,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_end_tag_stream(struct acpi_resource *linked_list, +acpi_rs_end_tag_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -120,9 +284,9 @@ acpi_rs_end_tag_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_end_tag_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x79; + *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01; buffer += 1; /* @@ -180,7 +344,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer, temp8 = *buffer; - if (temp8 & 0x80) { + if (temp8 & ACPI_RDESC_TYPE_LARGE) { /* Large Item, point to the length field */ buffer += 1; @@ -210,7 +374,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer, buffer += 1; } - output_struct->id = ACPI_RSTYPE_VENDOR; + output_struct->type = ACPI_RSTYPE_VENDOR; output_struct->data.vendor_specific.length = temp16; for (index = 0; index < temp16; index++) { @@ -239,7 +403,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_vendor_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -252,7 +416,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_vendor_stream(struct acpi_resource *linked_list, +acpi_rs_vendor_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -264,21 +428,21 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list, /* Dereference the length to find if this is a large or small item. */ - if (linked_list->data.vendor_specific.length > 7) { + if (resource->data.vendor_specific.length > 7) { /* Large Item, Set the descriptor field and length bytes */ - *buffer = 0x84; + *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR; buffer += 1; - temp16 = (u16) linked_list->data.vendor_specific.length; + temp16 = (u16) resource->data.vendor_specific.length; ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; } else { /* Small Item, Set the descriptor field */ - temp8 = 0x70; - temp8 |= (u8) linked_list->data.vendor_specific.length; + temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR; + temp8 |= (u8) resource->data.vendor_specific.length; *buffer = temp8; buffer += 1; @@ -286,9 +450,8 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list, /* Loop through all of the Vendor Specific fields */ - for (index = 0; index < linked_list->data.vendor_specific.length; - index++) { - temp8 = linked_list->data.vendor_specific.reserved[index]; + for (index = 0; index < resource->data.vendor_specific.length; index++) { + temp8 = resource->data.vendor_specific.reserved[index]; *buffer = temp8; buffer += 1; @@ -341,7 +504,7 @@ acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, *bytes_consumed = (temp8 & 0x01) + 1; - output_struct->id = ACPI_RSTYPE_START_DPF; + output_struct->type = ACPI_RSTYPE_START_DPF; /* Point to Byte 1 if it is used */ @@ -421,7 +584,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, /* Fill out the structure */ - output_struct->id = ACPI_RSTYPE_END_DPF; + output_struct->type = ACPI_RSTYPE_END_DPF; /* Set the Length parameter */ @@ -437,7 +600,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_start_depend_fns_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - u32 pointer that is filled with * the number of bytes of the @@ -451,7 +614,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, +acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -460,26 +623,25 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); /* - * The descriptor field is set based upon whether a byte is needed + * The descriptor type 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 && + resource->data.start_dpf.compatibility_priority && ACPI_ACCEPTABLE_CONFIGURATION == - linked_list->data.start_dpf.performance_robustness) { - *buffer = 0x30; + resource->data.start_dpf.performance_robustness) { + *buffer = ACPI_RDESC_TYPE_START_DEPENDENT; } else { - *buffer = 0x31; + *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01; 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) ((resource->data.start_dpf.performance_robustness & + 0x03) << 2); + temp8 |= (resource->data.start_dpf.compatibility_priority & + 0x03); *buffer = temp8; } @@ -495,7 +657,7 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, * * FUNCTION: acpi_rs_end_depend_fns_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -508,16 +670,16 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, +acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); - /* The descriptor field is static */ + /* The Descriptor Type field is static */ - *buffer = 0x38; + *buffer = ACPI_RDESC_TYPE_END_DEPENDENT; buffer += 1; /* Return the number of bytes consumed in this operation */ diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index ee5a5c50919..1a87c4c7bd9 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle, /* Walk the resource list */ for (;;) { - if (!resource || resource->id == ACPI_RSTYPE_END_TAG) { + if (!resource || resource->type == ACPI_RSTYPE_END_TAG) { break; } @@ -360,8 +360,8 @@ EXPORT_SYMBOL(acpi_set_current_resources); * * FUNCTION: acpi_resource_to_address64 * - * PARAMETERS: resource - Pointer to a resource - * out - Pointer to the users's return + * PARAMETERS: Resource - Pointer to a resource + * Out - Pointer to the users's return * buffer (a struct * struct acpi_resource_address64) * @@ -381,7 +381,7 @@ acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address16 *address16; struct acpi_resource_address32 *address32; - switch (resource->id) { + switch (resource->type) { case ACPI_RSTYPE_ADDRESS16: address16 = (struct acpi_resource_address16 *)&resource->data; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 0c5abc536c7..aa1dcd851f8 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -811,7 +811,7 @@ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) while (buffer < end_buffer) { buffer_byte = *buffer; - if (buffer_byte & ACPI_RDESC_TYPE_MASK) { + if (buffer_byte & ACPI_RDESC_TYPE_LARGE) { /* Large Descriptor - Length is next 2 bytes */ buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 90134c56ece..e158b1b6313 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -214,7 +214,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) * the ACPI subsystem code. */ for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { + if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Mutex [%s] already acquired by this thread [%X]\n", @@ -313,7 +313,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * the ACPI subsystem code. */ for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { + if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { continue; } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 427cff1a3f8..1427c5cf430 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -61,9 +61,9 @@ * */ -/* Version string */ +/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20050902 +#define ACPI_CA_VERSION 0x20050916 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 3d96dcb1bb4..759b4cff4f8 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -187,73 +187,73 @@ void acpi_dm_decode_attribute(u8 attribute); * dmresrcl */ void -acpi_dm_word_descriptor(struct asl_word_address_desc *resource, +acpi_dm_word_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource, +acpi_dm_dword_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource, +acpi_dm_extended_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource, +acpi_dm_qword_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource, +acpi_dm_memory24_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource, +acpi_dm_memory32_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource, - u32 length, u32 level); +acpi_dm_fixed_memory32_descriptor(union asl_resource_desc *resource, + u32 length, u32 level); void -acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource, +acpi_dm_generic_register_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource, +acpi_dm_interrupt_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource, +acpi_dm_vendor_large_descriptor(union asl_resource_desc *resource, u32 length, u32 level); /* * dmresrcs */ void -acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource, +acpi_dm_irq_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource, +acpi_dm_dma_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level); +acpi_dm_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource, +acpi_dm_fixed_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource, +acpi_dm_start_dependent_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource, +acpi_dm_end_dependent_descriptor(union asl_resource_desc *resource, u32 length, u32 level); void -acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource, +acpi_dm_vendor_small_descriptor(union asl_resource_desc *resource, u32 length, u32 level); /* diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 9fba0fddda9..76ac1533c40 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -744,12 +744,13 @@ struct acpi_bit_register_info { #define ACPI_RDESC_TYPE_LARGE 0x80 #define ACPI_RDESC_TYPE_SMALL 0x00 -#define ACPI_RDESC_TYPE_MASK 0x80 -#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ +#define ACPI_RDESC_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ +#define ACPI_RDESC_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ +#define ACPI_RDESC_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ /* * Small resource descriptor types - * Note: The 3 length bits (2:0) must be zero + * Note: Bits 2:0 are used for the descriptor length */ #define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 #define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 @@ -757,6 +758,10 @@ struct acpi_bit_register_info { #define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 #define ACPI_RDESC_TYPE_IO_PORT 0x40 #define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 +#define ACPI_RDESC_TYPE_RESERVED_S1 0x50 +#define ACPI_RDESC_TYPE_RESERVED_S2 0x58 +#define ACPI_RDESC_TYPE_RESERVED_S3 0x60 +#define ACPI_RDESC_TYPE_RESERVED_S4 0x68 #define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 #define ACPI_RDESC_TYPE_END_TAG 0x78 @@ -764,7 +769,8 @@ struct acpi_bit_register_info { * Large resource descriptor types */ #define ACPI_RDESC_TYPE_MEMORY_24 0x81 -#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 +#define ACPI_RDESC_TYPE_GENERIC_REGISTER 0x82 +#define ACPI_RDESC_TYPE_RESERVED_L1 0x83 #define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 #define ACPI_RDESC_TYPE_MEMORY_32 0x85 #define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 @@ -773,6 +779,15 @@ struct acpi_bit_register_info { #define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B +#define ACPI_RDESC_LARGE_MAX 0x8B + +/* + * Minimum lengths for descriptors with optional fields + */ +#define ACPI_RDESC_QWORD_MIN 43 +#define ACPI_RDESC_DWORD_MIN 23 +#define ACPI_RDESC_WORD_MIN 13 +#define ACPI_RDESC_EXT_XRUPT_MIN 6 /***************************************************************************** * diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index 38e798b05d0..ce2cf72fd4c 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -110,7 +110,7 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, u32 byte_stream_buffer_length, u8 * output_buffer); acpi_status -acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, +acpi_rs_list_to_byte_stream(struct acpi_resource *resource, acpi_size byte_stream_size_needed, u8 * output_buffer); @@ -125,11 +125,11 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_io_stream(struct acpi_resource *linked_list, +acpi_rs_io_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, +acpi_rs_fixed_io_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -138,7 +138,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_irq_stream(struct acpi_resource *linked_list, +acpi_rs_irq_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -147,7 +147,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_dma_stream(struct acpi_resource *linked_list, +acpi_rs_dma_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -156,7 +156,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address16_stream(struct acpi_resource *linked_list, +acpi_rs_address16_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -165,7 +165,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address32_stream(struct acpi_resource *linked_list, +acpi_rs_address32_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -174,7 +174,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address64_stream(struct acpi_resource *linked_list, +acpi_rs_address64_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -190,12 +190,12 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, acpi_size * structure_size); acpi_status -acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, +acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, +acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -204,7 +204,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_memory24_stream(struct acpi_resource *linked_list, +acpi_rs_memory24_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -220,11 +220,11 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, acpi_size * structure_size); acpi_status -acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, +acpi_rs_memory32_range_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, +acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -233,7 +233,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, +acpi_rs_extended_irq_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -242,7 +242,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_end_tag_stream(struct acpi_resource *linked_list, +acpi_rs_end_tag_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status @@ -251,9 +251,23 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer, u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_vendor_stream(struct acpi_resource *linked_list, +acpi_rs_vendor_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed); u8 acpi_rs_get_resource_type(u8 resource_start_byte); +/* + * rsmisc + */ +acpi_status +acpi_rs_generic_register_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); + +acpi_status +acpi_rs_generic_register_stream(struct acpi_resource *resource, + u8 ** output_buffer, + acpi_size * bytes_consumed); + #endif /* __ACRESRC_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 6213b27516e..1dfa64fae4e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -1125,6 +1125,14 @@ struct acpi_resource_ext_irq { u32 interrupts[1]; }; +struct acpi_resource_generic_reg { + u32 space_id; + u32 bit_width; + u32 bit_offset; + u32 address_size; + u64 address; +}; + /* ACPI_RESOURCE_TYPEs */ #define ACPI_RSTYPE_IRQ 0 @@ -1142,6 +1150,8 @@ struct acpi_resource_ext_irq { #define ACPI_RSTYPE_ADDRESS32 12 #define ACPI_RSTYPE_ADDRESS64 13 #define ACPI_RSTYPE_EXT_IRQ 14 +#define ACPI_RSTYPE_GENERIC_REG 15 +#define ACPI_RSTYPE_MAX 15 typedef u32 acpi_resource_type; @@ -1161,10 +1171,11 @@ union acpi_resource_data { struct acpi_resource_address32 address32; struct acpi_resource_address64 address64; struct acpi_resource_ext_irq extended_irq; + struct acpi_resource_generic_reg generic_reg; }; struct acpi_resource { - acpi_resource_type id; + acpi_resource_type type; u32 length; union acpi_resource_data data; }; diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 051786e4b21..a3c46ba6358 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -157,10 +157,15 @@ struct asl_end_tag_desc { /* LARGE descriptors */ +#define ASL_LARGE_HEADER_COMMON \ + u8 descriptor_type;\ + u16 length; + +struct asl_large_header { +ASL_LARGE_HEADER_COMMON}; + struct asl_memory_24_desc { - u8 descriptor_type; - u16 length; - u8 information; + ASL_LARGE_HEADER_COMMON u8 information; u16 address_min; u16 address_max; u16 alignment; @@ -168,15 +173,11 @@ struct asl_memory_24_desc { }; struct asl_large_vendor_desc { - u8 descriptor_type; - u16 length; - u8 vendor_defined[1]; + ASL_LARGE_HEADER_COMMON u8 vendor_defined[1]; }; struct asl_memory_32_desc { - u8 descriptor_type; - u16 length; - u8 information; + ASL_LARGE_HEADER_COMMON u8 information; u32 address_min; u32 address_max; u32 alignment; @@ -184,17 +185,13 @@ struct asl_memory_32_desc { }; struct asl_fixed_memory_32_desc { - u8 descriptor_type; - u16 length; - u8 information; + ASL_LARGE_HEADER_COMMON u8 information; u32 base_address; u32 range_length; }; struct asl_extended_address_desc { - u8 descriptor_type; - u16 length; - u8 resource_type; + ASL_LARGE_HEADER_COMMON u8 resource_type; u8 flags; u8 specific_flags; u8 revision_iD; @@ -211,9 +208,7 @@ struct asl_extended_address_desc { #define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ struct asl_qword_address_desc { - u8 descriptor_type; - u16 length; - u8 resource_type; + ASL_LARGE_HEADER_COMMON u8 resource_type; u8 flags; u8 specific_flags; u64 granularity; @@ -225,9 +220,7 @@ struct asl_qword_address_desc { }; struct asl_dword_address_desc { - u8 descriptor_type; - u16 length; - u8 resource_type; + ASL_LARGE_HEADER_COMMON u8 resource_type; u8 flags; u8 specific_flags; u32 granularity; @@ -239,9 +232,7 @@ struct asl_dword_address_desc { }; struct asl_word_address_desc { - u8 descriptor_type; - u16 length; - u8 resource_type; + ASL_LARGE_HEADER_COMMON u8 resource_type; u8 flags; u8 specific_flags; u16 granularity; @@ -253,18 +244,14 @@ struct asl_word_address_desc { }; struct asl_extended_xrupt_desc { - u8 descriptor_type; - u16 length; - u8 flags; + ASL_LARGE_HEADER_COMMON u8 flags; u8 table_length; u32 interrupt_number[1]; /* res_source_index, res_source optional fields follow */ }; -struct asl_general_register_desc { - u8 descriptor_type; - u16 length; - u8 address_space_id; +struct asl_generic_register_desc { + ASL_LARGE_HEADER_COMMON u8 address_space_id; u8 bit_width; u8 bit_offset; u8 access_size; /* ACPI 3.0, was Reserved */ @@ -280,13 +267,14 @@ struct asl_general_register_desc { union asl_resource_desc { struct asl_irq_format_desc irq; struct asl_dma_format_desc dma; - struct asl_start_dependent_desc std; - struct asl_end_dependent_desc end; struct asl_io_port_desc iop; struct asl_fixed_io_port_desc fio; + struct asl_start_dependent_desc std; + struct asl_end_dependent_desc end; struct asl_small_vendor_desc smv; struct asl_end_tag_desc et; + struct asl_large_header lhd; struct asl_memory_24_desc M24; struct asl_large_vendor_desc lgv; struct asl_memory_32_desc M32; @@ -296,7 +284,7 @@ union asl_resource_desc { struct asl_word_address_desc was; struct asl_extended_address_desc eas; struct asl_extended_xrupt_desc exx; - struct asl_general_register_desc grg; + struct asl_generic_register_desc grg; u32 u32_item; u16 u16_item; u8 U8item; diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 16609c1ab2e..08539125696 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -68,6 +68,7 @@ #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER +#define ACPI_MUTEX_DEBUG #endif #ifdef ACPI_ASL_COMPILER -- cgit v1.2.3 From eca008c8134df15262a0362623edb59902628c95 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Thu, 22 Sep 2005 00:25:18 -0400 Subject: [ACPI] handle ACPICA 20050916's acpi_resource.type rename Signed-off-by: Len Brown --- drivers/acpi/ec.c | 2 +- drivers/acpi/glue.c | 6 +++--- drivers/acpi/motherboard.c | 4 ++-- drivers/acpi/pci_link.c | 10 +++++----- drivers/acpi/pci_root.c | 6 +++--- drivers/char/hpet.c | 2 +- drivers/pnp/pnpacpi/rsparser.c | 36 ++++++++++++++++++------------------ 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7e1a445955b..c33bfba5df8 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) union acpi_ec *ec = (union acpi_ec *)context; struct acpi_generic_address *addr; - if (resource->id != ACPI_RSTYPE_IO) { + if (resource->type != ACPI_RSTYPE_IO) { return AE_OK; } diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index e36c5da2b31..00aeb4801d7 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -99,9 +99,9 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) int *busnr = (int *)data; struct acpi_resource_address64 address; - if (resource->id != ACPI_RSTYPE_ADDRESS16 && - resource->id != ACPI_RSTYPE_ADDRESS32 && - resource->id != ACPI_RSTYPE_ADDRESS64) + if (resource->type != ACPI_RSTYPE_ADDRESS16 && + resource->type != ACPI_RSTYPE_ADDRESS32 && + resource->type != ACPI_RSTYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index e928e8c2c6e..85c1fb5c9a5 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c @@ -54,7 +54,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); - if (res->id == ACPI_RSTYPE_IO) { + if (res->type == ACPI_RSTYPE_IO) { struct acpi_resource_io *io_res = &res->data.io; if (io_res->min_base_address != io_res->max_base_address) @@ -70,7 +70,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) request_region(io_res->min_base_address, io_res->range_length, "motherboard"); } - } else if (res->id == ACPI_RSTYPE_FIXED_IO) { + } else if (res->type == ACPI_RSTYPE_FIXED_IO) { struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io; diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 82292b77e5c..d8956c0bf14 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -108,7 +108,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); - switch (resource->id) { + switch (resource->type) { case ACPI_RSTYPE_START_DPF: return_ACPI_STATUS(AE_OK); case ACPI_RSTYPE_IRQ: @@ -201,7 +201,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); - switch (resource->id) { + switch (resource->type) { case ACPI_RSTYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; @@ -326,7 +326,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) switch (link->irq.resource_type) { case ACPI_RSTYPE_IRQ: - resource->res.id = ACPI_RSTYPE_IRQ; + resource->res.type = ACPI_RSTYPE_IRQ; resource->res.length = sizeof(struct acpi_resource); resource->res.data.irq.edge_level = link->irq.edge_level; resource->res.data.irq.active_high_low = @@ -341,7 +341,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) break; case ACPI_RSTYPE_EXT_IRQ: - resource->res.id = ACPI_RSTYPE_EXT_IRQ; + resource->res.type = ACPI_RSTYPE_EXT_IRQ; resource->res.length = sizeof(struct acpi_resource); resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; @@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) goto end; } - resource->end.id = ACPI_RSTYPE_END_TAG; + resource->end.type = ACPI_RSTYPE_END_TAG; /* Attempt to set the resource */ status = acpi_set_current_resources(link->handle, &buffer); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 0fd9988c283..5d6bc815fe7 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -122,9 +122,9 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) int *busnr = (int *)data; struct acpi_resource_address64 address; - if (resource->id != ACPI_RSTYPE_ADDRESS16 && - resource->id != ACPI_RSTYPE_ADDRESS32 && - resource->id != ACPI_RSTYPE_ADDRESS64) + if (resource->type != ACPI_RSTYPE_ADDRESS16 && + resource->type != ACPI_RSTYPE_ADDRESS32 && + resource->type != ACPI_RSTYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index de0379b6d50..a5c3f9c0c90 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -897,7 +897,7 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) if (hpetp->hp_hpet == hdp->hd_address) return -EBUSY; - } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { + } else if (res->type == ACPI_RSTYPE_EXT_IRQ) { struct acpi_resource_ext_irq *irqp; int i; diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 416d30debe6..15ec05f69dd 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -163,7 +163,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; int i; - switch (res->id) { + switch (res->type) { case ACPI_RSTYPE_IRQ: /* * Per spec, only one interrupt per descriptor is allowed in @@ -233,7 +233,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, case ACPI_RSTYPE_VENDOR: break; default: - pnp_warn("PnPACPI: unknown resource type %d", res->id); + pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; } @@ -467,7 +467,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, struct pnp_dev *dev = parse_data->dev; struct pnp_option *option = parse_data->option; - switch (res->id) { + switch (res->type) { case ACPI_RSTYPE_IRQ: pnpacpi_parse_irq_option(option, &res->data.irq); break; @@ -528,7 +528,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, parse_data->option_independent = NULL; break; default: - pnp_warn("PnPACPI: unknown resource type %d", res->id); + pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; } @@ -559,7 +559,7 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, void *data) { int *res_cnt = (int *)data; - switch (res->id) { + switch (res->type) { case ACPI_RSTYPE_IRQ: case ACPI_RSTYPE_EXT_IRQ: case ACPI_RSTYPE_DMA: @@ -584,7 +584,7 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) { struct acpi_resource **resource = (struct acpi_resource **)data; - switch (res->id) { + switch (res->type) { case ACPI_RSTYPE_IRQ: case ACPI_RSTYPE_EXT_IRQ: case ACPI_RSTYPE_DMA: @@ -598,7 +598,7 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, case ACPI_RSTYPE_ADDRESS32: case ACPI_RSTYPE_ADDRESS64: #endif - (*resource)->id = res->id; + (*resource)->type = res->type; (*resource)++; default: return AE_OK; @@ -636,7 +636,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, return -EINVAL; } /* resource will pointer the end resource now */ - resource->id = ACPI_RSTYPE_END_TAG; + resource->type = ACPI_RSTYPE_END_TAG; return 0; } @@ -648,7 +648,7 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, &active_high_low); - resource->id = ACPI_RSTYPE_IRQ; + resource->type = ACPI_RSTYPE_IRQ; resource->length = sizeof(struct acpi_resource); resource->data.irq.edge_level = edge_level; resource->data.irq.active_high_low = active_high_low; @@ -667,7 +667,7 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, &active_high_low); - resource->id = ACPI_RSTYPE_EXT_IRQ; + resource->type = ACPI_RSTYPE_EXT_IRQ; resource->length = sizeof(struct acpi_resource); resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; resource->data.extended_irq.edge_level = edge_level; @@ -683,7 +683,7 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, static void pnpacpi_encode_dma(struct acpi_resource *resource, struct resource *p) { - resource->id = ACPI_RSTYPE_DMA; + resource->type = ACPI_RSTYPE_DMA; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ if (p->flags & IORESOURCE_DMA_COMPATIBLE) @@ -708,7 +708,7 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, static void pnpacpi_encode_io(struct acpi_resource *resource, struct resource *p) { - resource->id = ACPI_RSTYPE_IO; + resource->type = ACPI_RSTYPE_IO; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? @@ -722,7 +722,7 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, struct resource *p) { - resource->id = ACPI_RSTYPE_FIXED_IO; + resource->type = ACPI_RSTYPE_FIXED_IO; resource->length = sizeof(struct acpi_resource); resource->data.fixed_io.base_address = p->start; resource->data.fixed_io.range_length = p->end - p->start + 1; @@ -731,7 +731,7 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, static void pnpacpi_encode_mem24(struct acpi_resource *resource, struct resource *p) { - resource->id = ACPI_RSTYPE_MEM24; + resource->type = ACPI_RSTYPE_MEM24; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ resource->data.memory24.read_write_attribute = @@ -746,7 +746,7 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, static void pnpacpi_encode_mem32(struct acpi_resource *resource, struct resource *p) { - resource->id = ACPI_RSTYPE_MEM32; + resource->type = ACPI_RSTYPE_MEM32; resource->length = sizeof(struct acpi_resource); resource->data.memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? @@ -760,7 +760,7 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, struct resource *p) { - resource->id = ACPI_RSTYPE_FIXED_MEM32; + resource->type = ACPI_RSTYPE_FIXED_MEM32; resource->length = sizeof(struct acpi_resource); resource->data.fixed_memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? @@ -780,7 +780,7 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, pnp_dbg("res cnt %d", res_cnt); while (i < res_cnt) { - switch(resource->id) { + switch(resource->type) { case ACPI_RSTYPE_IRQ: pnp_dbg("Encode irq"); pnpacpi_encode_irq(resource, @@ -831,7 +831,7 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, mem ++; break; default: /* other type */ - pnp_warn("unknown resource type %d", resource->id); + pnp_warn("unknown resource type %d", resource->type); return -EINVAL; } resource ++; -- cgit v1.2.3 From 486368bf33a2844319ad4865039543cd50ac90dd Mon Sep 17 00:00:00 2001 From: Len Brown Date: Thu, 22 Sep 2005 01:57:01 -0400 Subject: [ACPI] clean up ACPICA 20050916's rscalc typedef syntax Signed-off-by: Len Brown --- drivers/acpi/resources/rscalc.c | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index cd051c97bf5..2da7c6a8182 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -78,51 +78,50 @@ static u8 acpi_gbl_stream_sizes[] = { * Base sizes of resource descriptors, both the actual AML stream length and * size of the internal struct representation. */ -typedef struct acpi_resource_sizes { +struct acpi_resource_sizes { u8 minimum_stream_size; u8 minimum_struct_size; +}; -} ACPI_RESOURCE_SIZES; - -static ACPI_RESOURCE_SIZES acpi_gbl_sm_resource_sizes[] = { - 0, 0, /* 0x00, Reserved */ - 0, 0, /* 0x01, Reserved */ - 0, 0, /* 0x02, Reserved */ - 0, 0, /* 0x03, Reserved */ - 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq), /* ACPI_RDESC_TYPE_IRQ_FORMAT */ - 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma), /* ACPI_RDESC_TYPE_DMA_FORMAT */ - 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf), /* ACPI_RDESC_TYPE_START_DEPENDENT */ - 1, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_DEPENDENT */ - 8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io), /* ACPI_RDESC_TYPE_IO_PORT */ - 4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io), /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ - 0, 0, /* 0x0A, Reserved */ - 0, 0, /* 0x0B, Reserved */ - 0, 0, /* 0x0C, Reserved */ - 0, 0, /* 0x0D, Reserved */ - 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_SMALL_VENDOR */ - 2, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_TAG */ +static struct acpi_resource_sizes acpi_gbl_sm_resource_sizes[] = { + {0, 0}, /* 0x00, Reserved */ + {0, 0}, /* 0x01, Reserved */ + {0, 0}, /* 0x02, Reserved */ + {0, 0}, /* 0x03, Reserved */ + {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, /* ACPI_RDESC_TYPE_IRQ_FORMAT */ + {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, /* ACPI_RDESC_TYPE_DMA_FORMAT */ + {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf)}, /* ACPI_RDESC_TYPE_START_DEPENDENT */ + {1, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_DEPENDENT */ + {8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, /* ACPI_RDESC_TYPE_IO_PORT */ + {4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ + {0, 0}, /* 0x0A, Reserved */ + {0, 0}, /* 0x0B, Reserved */ + {0, 0}, /* 0x0C, Reserved */ + {0, 0}, /* 0x0D, Reserved */ + {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_SMALL_VENDOR */ + {2, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_TAG */ }; -static ACPI_RESOURCE_SIZES acpi_gbl_lg_resource_sizes[] = { - 0, 0, /* 0x00, Reserved */ - 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24), /* ACPI_RDESC_TYPE_MEMORY_24 */ - 15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg), /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ - 0, 0, /* 0x03, Reserved */ - 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_LARGE_VENDOR */ - 20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32), /* ACPI_RDESC_TYPE_MEMORY_32 */ - 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32), /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ - 26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32), /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ - 16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16), /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ - 9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq), /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ - 46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ - 56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ +static struct acpi_resource_sizes acpi_gbl_lg_resource_sizes[] = { + {0, 0}, /* 0x00, Reserved */ + {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24)}, /* ACPI_RDESC_TYPE_MEMORY_24 */ + {15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg)}, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ + {0, 0}, /* 0x03, Reserved */ + {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_LARGE_VENDOR */ + {20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32)}, /* ACPI_RDESC_TYPE_MEMORY_32 */ + {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32)}, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ + {26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ + {16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ + {9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq)}, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ + {46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ + {56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ }; /* Local prototypes */ static u8 acpi_rs_count_set_bits(u16 bit_field); -static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type); +static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type); static u16 acpi_rs_get_resource_length(u8 * resource); @@ -173,9 +172,9 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) * ******************************************************************************/ -static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type) +static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type) { - ACPI_RESOURCE_SIZES *size_info; + struct acpi_resource_sizes *size_info; ACPI_FUNCTION_ENTRY(); @@ -489,7 +488,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, u32 byte_stream_buffer_length, acpi_size * size_needed) { u8 *buffer; - ACPI_RESOURCE_SIZES *resource_info; + struct acpi_resource_sizes *resource_info; u32 buffer_size = 0; u32 bytes_parsed = 0; u8 resource_type; @@ -759,7 +758,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, (*sub_object_list)->string. length + 1); } else { - temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); + temp_size_needed += + acpi_ns_get_pathname_length((*sub_object_list)->reference.node); } } else { /* -- cgit v1.2.3 From c780f964902a8c4e7f702ff3e0a2b754e82b3ca3 Mon Sep 17 00:00:00 2001 From: MAEDA Naoaki Date: Wed, 30 Nov 2005 18:00:24 -0500 Subject: [ACPI] ia64 build fix arch/ia64/kernel/acpi-ext.c: In function `acpi_vendor_resource_match': arch/ia64/kernel/acpi-ext.c:38: error: structure has no member named `id' Signed-off-by: MAEDA Naoaki Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- arch/ia64/kernel/acpi-ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c index 13a5b3b49bf..a146016d7ad 100644 --- a/arch/ia64/kernel/acpi-ext.c +++ b/arch/ia64/kernel/acpi-ext.c @@ -35,7 +35,7 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context) struct acpi_vendor_descriptor *descriptor; u32 length; - if (resource->id != ACPI_RSTYPE_VENDOR) + if (resource->type != ACPI_RSTYPE_VENDOR) return AE_OK; vendor = (struct acpi_resource_vendor *)&resource->data; -- cgit v1.2.3 From 378b2556f4e09fa6f87ff0cb5c4395ff28257d02 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 30 Nov 2005 21:03:21 -0500 Subject: [ACPI] 8250_acpi.c buildfix Signed-off-by: Len Brown --- drivers/serial/8250_acpi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c index a802bdce6e5..36681ba7b03 100644 --- a/drivers/serial/8250_acpi.c +++ b/drivers/serial/8250_acpi.c @@ -83,11 +83,11 @@ static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data) status = acpi_resource_to_address64(res, &addr); if (ACPI_SUCCESS(status)) return acpi_serial_mmio(port, &addr); - else if (res->id == ACPI_RSTYPE_IO) + else if (res->type == ACPI_RSTYPE_IO) return acpi_serial_port(port, &res->data.io); - else if (res->id == ACPI_RSTYPE_EXT_IRQ) + else if (res->type == ACPI_RSTYPE_EXT_IRQ) return acpi_serial_ext_irq(port, &res->data.extended_irq); - else if (res->id == ACPI_RSTYPE_IRQ) + else if (res->type == ACPI_RSTYPE_IRQ) return acpi_serial_irq(port, &res->data.irq); return AE_OK; } -- cgit v1.2.3 From 1a38416cea8ac801ae8f261074721f35317613dc Mon Sep 17 00:00:00 2001 From: David Shaohua Li Date: Wed, 23 Nov 2005 12:36:00 -0500 Subject: [ACPI] SMP S3 resume: evaluate _WAK after INIT On SMP resume from S3, we reset (INIT) the non-boot processors to boot them cleanly. But the BIOS needs to execute _WAK after INIT in order to properly initialized these processors upon resume. http://bugzilla.kernel.org/show_bug.cgi?id=5651 Signed-off-by: David Shaohua Li Signed-off-by: Len Brown --- kernel/power/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/power/main.c b/kernel/power/main.c index d253f3ae2fa..9cb235cba4a 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -133,10 +133,10 @@ static int suspend_enter(suspend_state_t state) static void suspend_finish(suspend_state_t state) { device_resume(); - if (pm_ops && pm_ops->finish) - pm_ops->finish(state); thaw_processes(); enable_nonboot_cpus(); + if (pm_ops && pm_ops->finish) + pm_ops->finish(state); pm_restore_console(); } -- cgit v1.2.3 From 05131ecc99ea9da7f45ba3058fe8a2c1d0ceeab8 Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Sun, 23 Oct 2005 16:31:00 -0400 Subject: [ACPI] Avoid BIOS inflicted crashes by evaluating _PDC only once Linux invokes the AML _PDC method (Processor Driver Capabilities) to tell the BIOS what features it can handle. While the ACPI spec says nothing about the OS invoking _PDC multiple times, doing so with changing bits seems to hopelessly confuse the BIOS on multiple platforms up to and including crashing the system. Factor out the _PDC invocation so Linux invokes it only once. http://bugzilla.kernel.org/show_bug.cgi?id=5483 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown --- arch/i386/kernel/acpi/Makefile | 2 +- arch/i386/kernel/acpi/cstate.c | 58 ------------------ arch/i386/kernel/acpi/processor.c | 75 +++++++++++++++++++++++ arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 67 -------------------- arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | 12 ---- arch/ia64/kernel/cpufreq/Makefile | 5 ++ arch/ia64/kernel/cpufreq/acpi-cpufreq.c | 51 --------------- arch/ia64/kernel/cpufreq/acpi-processor.c | 67 ++++++++++++++++++++ arch/x86_64/kernel/acpi/Makefile | 5 ++ arch/x86_64/kernel/acpi/processor.c | 72 ++++++++++++++++++++++ drivers/acpi/processor_core.c | 28 ++++----- drivers/acpi/processor_idle.c | 2 - drivers/acpi/processor_perflib.c | 2 - include/acpi/pdc_intel.h | 4 +- include/acpi/processor.h | 22 ++----- include/asm-i386/acpi.h | 2 +- 16 files changed, 243 insertions(+), 231 deletions(-) create mode 100644 arch/i386/kernel/acpi/processor.c create mode 100644 arch/ia64/kernel/cpufreq/acpi-processor.c create mode 100644 arch/x86_64/kernel/acpi/processor.c diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile index 267ca48e1b6..d51c7313cae 100644 --- a/arch/i386/kernel/acpi/Makefile +++ b/arch/i386/kernel/acpi/Makefile @@ -3,6 +3,6 @@ obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o ifneq ($(CONFIG_ACPI_PROCESSOR),) -obj-y += cstate.o +obj-y += cstate.o processor.o endif diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c index 4c3036ba65d..25db49ef177 100644 --- a/arch/i386/kernel/acpi/cstate.c +++ b/arch/i386/kernel/acpi/cstate.c @@ -14,64 +14,6 @@ #include #include -static void acpi_processor_power_init_intel_pdc(struct acpi_processor_power - *pow) -{ - struct acpi_object_list *obj_list; - union acpi_object *obj; - u32 *buf; - - /* allocate and initialize pdc. It will be used later. */ - obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); - if (!obj_list) { - printk(KERN_ERR "Memory allocation error\n"); - return; - } - - obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); - if (!obj) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj_list); - return; - } - - buf = kmalloc(12, GFP_KERNEL); - if (!buf) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj); - kfree(obj_list); - return; - } - - buf[0] = ACPI_PDC_REVISION_ID; - buf[1] = 1; - buf[2] = ACPI_PDC_C_CAPABILITY_SMP; - - obj->type = ACPI_TYPE_BUFFER; - obj->buffer.length = 12; - obj->buffer.pointer = (u8 *) buf; - obj_list->count = 1; - obj_list->pointer = obj; - pow->pdc = obj_list; - - return; -} - -/* Initialize _PDC data based on the CPU vendor */ -void acpi_processor_power_init_pdc(struct acpi_processor_power *pow, - unsigned int cpu) -{ - struct cpuinfo_x86 *c = cpu_data + cpu; - - pow->pdc = NULL; - if (c->x86_vendor == X86_VENDOR_INTEL) - acpi_processor_power_init_intel_pdc(pow); - - return; -} - -EXPORT_SYMBOL(acpi_processor_power_init_pdc); - /* * Initialize bm_flags based on the CPU cache properties * On SMP it depends on cache configuration diff --git a/arch/i386/kernel/acpi/processor.c b/arch/i386/kernel/acpi/processor.c new file mode 100644 index 00000000000..9f4cc02717e --- /dev/null +++ b/arch/i386/kernel/acpi/processor.c @@ -0,0 +1,75 @@ +/* + * arch/i386/kernel/acpi/processor.c + * + * Copyright (C) 2005 Intel Corporation + * Venkatesh Pallipadi + * - Added _PDC for platforms with Intel CPUs + */ + +#include +#include +#include +#include + +#include +#include + +static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) +{ + struct acpi_object_list *obj_list; + union acpi_object *obj; + u32 *buf; + + /* allocate and initialize pdc. It will be used later. */ + obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); + if (!obj_list) { + printk(KERN_ERR "Memory allocation error\n"); + return; + } + + obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + if (!obj) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj_list); + return; + } + + buf = kmalloc(12, GFP_KERNEL); + if (!buf) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj); + kfree(obj_list); + return; + } + + buf[0] = ACPI_PDC_REVISION_ID; + buf[1] = 1; + buf[2] = ACPI_PDC_C_CAPABILITY_SMP; + + if (cpu_has(c, X86_FEATURE_EST)) + buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; + + obj->type = ACPI_TYPE_BUFFER; + obj->buffer.length = 12; + obj->buffer.pointer = (u8 *) buf; + obj_list->count = 1; + obj_list->pointer = obj; + pr->pdc = obj_list; + + return; +} + +/* Initialize _PDC data based on the CPU vendor */ +void arch_acpi_processor_init_pdc(struct acpi_processor *pr) +{ + unsigned int cpu = pr->id; + struct cpuinfo_x86 *c = cpu_data + cpu; + + pr->pdc = NULL; + if (c->x86_vendor == X86_VENDOR_INTEL) + init_intel_pdc(pr, c); + + return; +} + +EXPORT_SYMBOL(arch_acpi_processor_init_pdc); diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 871366b83b3..31ce890865d 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -297,68 +297,6 @@ acpi_cpufreq_guess_freq ( } -/* - * acpi_processor_cpu_init_pdc_est - let BIOS know about the SMP capabilities - * of this driver - * @perf: processor-specific acpi_io_data struct - * @cpu: CPU being initialized - * - * To avoid issues with legacy OSes, some BIOSes require to be informed of - * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC - * accordingly, for Enhanced Speedstep. Actual call to _PDC is done in - * driver/acpi/processor.c - */ -static void -acpi_processor_cpu_init_pdc_est( - struct acpi_processor_performance *perf, - unsigned int cpu, - struct acpi_object_list *obj_list - ) -{ - union acpi_object *obj; - u32 *buf; - struct cpuinfo_x86 *c = cpu_data + cpu; - dprintk("acpi_processor_cpu_init_pdc_est\n"); - - if (!cpu_has(c, X86_FEATURE_EST)) - return; - - /* Initialize pdc. It will be used later. */ - if (!obj_list) - return; - - if (!(obj_list->count && obj_list->pointer)) - return; - - obj = obj_list->pointer; - if ((obj->buffer.length == 12) && obj->buffer.pointer) { - buf = (u32 *)obj->buffer.pointer; - buf[0] = ACPI_PDC_REVISION_ID; - buf[1] = 1; - buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; - perf->pdc = obj_list; - } - return; -} - - -/* CPU specific PDC initialization */ -static void -acpi_processor_cpu_init_pdc( - struct acpi_processor_performance *perf, - unsigned int cpu, - struct acpi_object_list *obj_list - ) -{ - struct cpuinfo_x86 *c = cpu_data + cpu; - dprintk("acpi_processor_cpu_init_pdc\n"); - perf->pdc = NULL; - if (cpu_has(c, X86_FEATURE_EST)) - acpi_processor_cpu_init_pdc_est(perf, cpu, obj_list); - return; -} - - static int acpi_cpufreq_cpu_init ( struct cpufreq_policy *policy) @@ -373,9 +311,6 @@ acpi_cpufreq_cpu_init ( struct acpi_object_list arg_list = {1, &arg0}; dprintk("acpi_cpufreq_cpu_init\n"); - /* setup arg_list for _PDC settings */ - arg0.buffer.length = 12; - arg0.buffer.pointer = (u8 *) arg0_buf; data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); if (!data) @@ -383,9 +318,7 @@ acpi_cpufreq_cpu_init ( acpi_io_data[cpu] = data; - acpi_processor_cpu_init_pdc(&data->acpi_data, cpu, &arg_list); result = acpi_processor_register_performance(&data->acpi_data, cpu); - data->acpi_data.pdc = NULL; if (result) goto err_free; diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index edb9873e27e..d93023438c4 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c @@ -364,22 +364,10 @@ static struct acpi_processor_performance p; */ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { - union acpi_object arg0 = {ACPI_TYPE_BUFFER}; - u32 arg0_buf[3]; - struct acpi_object_list arg_list = {1, &arg0}; unsigned long cur_freq; int result = 0, i; unsigned int cpu = policy->cpu; - /* _PDC settings */ - arg0.buffer.length = 12; - arg0.buffer.pointer = (u8 *) arg0_buf; - arg0_buf[0] = ACPI_PDC_REVISION_ID; - arg0_buf[1] = 1; - arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR; - - p.pdc = &arg_list; - /* register with ACPI core */ if (acpi_processor_register_performance(&p, cpu)) { dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); diff --git a/arch/ia64/kernel/cpufreq/Makefile b/arch/ia64/kernel/cpufreq/Makefile index f748d34c02f..642648361ed 100644 --- a/arch/ia64/kernel/cpufreq/Makefile +++ b/arch/ia64/kernel/cpufreq/Makefile @@ -1 +1,6 @@ obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o + +ifneq ($(CONFIG_ACPI_PROCESSOR),) +obj-y += acpi-processor.o +endif + diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c index da4d5cf80a4..5a1bf815282 100644 --- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c +++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c @@ -269,48 +269,6 @@ acpi_cpufreq_verify ( } -/* - * processor_init_pdc - let BIOS know about the SMP capabilities - * of this driver - * @perf: processor-specific acpi_io_data struct - * @cpu: CPU being initialized - * - * To avoid issues with legacy OSes, some BIOSes require to be informed of - * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC - * accordingly. Actual call to _PDC is done in driver/acpi/processor.c - */ -static void -processor_init_pdc ( - struct acpi_processor_performance *perf, - unsigned int cpu, - struct acpi_object_list *obj_list - ) -{ - union acpi_object *obj; - u32 *buf; - - dprintk("processor_init_pdc\n"); - - perf->pdc = NULL; - /* Initialize pdc. It will be used later. */ - if (!obj_list) - return; - - if (!(obj_list->count && obj_list->pointer)) - return; - - obj = obj_list->pointer; - if ((obj->buffer.length == 12) && obj->buffer.pointer) { - buf = (u32 *)obj->buffer.pointer; - buf[0] = ACPI_PDC_REVISION_ID; - buf[1] = 1; - buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; - perf->pdc = obj_list; - } - return; -} - - static int acpi_cpufreq_cpu_init ( struct cpufreq_policy *policy) @@ -320,14 +278,7 @@ acpi_cpufreq_cpu_init ( struct cpufreq_acpi_io *data; unsigned int result = 0; - union acpi_object arg0 = {ACPI_TYPE_BUFFER}; - u32 arg0_buf[3]; - struct acpi_object_list arg_list = {1, &arg0}; - dprintk("acpi_cpufreq_cpu_init\n"); - /* setup arg_list for _PDC settings */ - arg0.buffer.length = 12; - arg0.buffer.pointer = (u8 *) arg0_buf; data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); if (!data) @@ -337,9 +288,7 @@ acpi_cpufreq_cpu_init ( acpi_io_data[cpu] = data; - processor_init_pdc(&data->acpi_data, cpu, &arg_list); result = acpi_processor_register_performance(&data->acpi_data, cpu); - data->acpi_data.pdc = NULL; if (result) goto err_free; diff --git a/arch/ia64/kernel/cpufreq/acpi-processor.c b/arch/ia64/kernel/cpufreq/acpi-processor.c new file mode 100644 index 00000000000..e683630c8ce --- /dev/null +++ b/arch/ia64/kernel/cpufreq/acpi-processor.c @@ -0,0 +1,67 @@ +/* + * arch/ia64/kernel/cpufreq/processor.c + * + * Copyright (C) 2005 Intel Corporation + * Venkatesh Pallipadi + * - Added _PDC for platforms with Intel CPUs + */ + +#include +#include +#include +#include + +#include +#include + +static void init_intel_pdc(struct acpi_processor *pr) +{ + struct acpi_object_list *obj_list; + union acpi_object *obj; + u32 *buf; + + /* allocate and initialize pdc. It will be used later. */ + obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); + if (!obj_list) { + printk(KERN_ERR "Memory allocation error\n"); + return; + } + + obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + if (!obj) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj_list); + return; + } + + buf = kmalloc(12, GFP_KERNEL); + if (!buf) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj); + kfree(obj_list); + return; + } + + buf[0] = ACPI_PDC_REVISION_ID; + buf[1] = 1; + buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; + + obj->type = ACPI_TYPE_BUFFER; + obj->buffer.length = 12; + obj->buffer.pointer = (u8 *) buf; + obj_list->count = 1; + obj_list->pointer = obj; + pr->pdc = obj_list; + + return; +} + +/* Initialize _PDC data based on the CPU vendor */ +void arch_acpi_processor_init_pdc(struct acpi_processor *pr) +{ + pr->pdc = NULL; + init_intel_pdc(pr); + return; +} + +EXPORT_SYMBOL(arch_acpi_processor_init_pdc); diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile index 7da9ace890b..4fe97071f29 100644 --- a/arch/x86_64/kernel/acpi/Makefile +++ b/arch/x86_64/kernel/acpi/Makefile @@ -1,3 +1,8 @@ obj-y := boot.o boot-y := ../../../i386/kernel/acpi/boot.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o + +ifneq ($(CONFIG_ACPI_PROCESSOR),) +obj-y += processor.o +endif + diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c new file mode 100644 index 00000000000..3bdc2baa5bb --- /dev/null +++ b/arch/x86_64/kernel/acpi/processor.c @@ -0,0 +1,72 @@ +/* + * arch/x86_64/kernel/acpi/processor.c + * + * Copyright (C) 2005 Intel Corporation + * Venkatesh Pallipadi + * - Added _PDC for platforms with Intel CPUs + */ + +#include +#include +#include +#include + +#include +#include + +static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) +{ + struct acpi_object_list *obj_list; + union acpi_object *obj; + u32 *buf; + + /* allocate and initialize pdc. It will be used later. */ + obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); + if (!obj_list) { + printk(KERN_ERR "Memory allocation error\n"); + return; + } + + obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + if (!obj) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj_list); + return; + } + + buf = kmalloc(12, GFP_KERNEL); + if (!buf) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj); + kfree(obj_list); + return; + } + + buf[0] = ACPI_PDC_REVISION_ID; + buf[1] = 1; + buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; + + obj->type = ACPI_TYPE_BUFFER; + obj->buffer.length = 12; + obj->buffer.pointer = (u8 *) buf; + obj_list->count = 1; + obj_list->pointer = obj; + pr->pdc = obj_list; + + return; +} + +/* Initialize _PDC data based on the CPU vendor */ +void arch_acpi_processor_init_pdc(struct acpi_processor *pr) +{ + unsigned int cpu = pr->id; + struct cpuinfo_x86 *c = cpu_data + cpu; + + pr->pdc = NULL; + if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST)) + init_intel_pdc(pr, c); + + return; +} + +EXPORT_SYMBOL(arch_acpi_processor_init_pdc); diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 42179256264..66bbda78507 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -253,31 +253,21 @@ static int acpi_processor_errata(struct acpi_processor *pr) * _PDC is required for a BIOS-OS handshake for most of the newer * ACPI processor features. */ - -int acpi_processor_set_pdc(struct acpi_processor *pr, - struct acpi_object_list *pdc_in) +static int acpi_processor_set_pdc(struct acpi_processor *pr) { + struct acpi_object_list *pdc_in = pr->pdc; acpi_status status = AE_OK; - u32 arg0_buf[3]; - union acpi_object arg0 = { ACPI_TYPE_BUFFER }; - struct acpi_object_list no_object = { 1, &arg0 }; - struct acpi_object_list *pdc; ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); - arg0.buffer.length = 12; - arg0.buffer.pointer = (u8 *) arg0_buf; - arg0_buf[0] = ACPI_PDC_REVISION_ID; - arg0_buf[1] = 0; - arg0_buf[2] = 0; - - pdc = (pdc_in) ? pdc_in : &no_object; + if (!pdc_in) + return_VALUE(status); - status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); + status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); - if ((ACPI_FAILURE(status)) && (pdc_in)) + if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Error evaluating _PDC, using legacy perf. control...\n")); + "Could not evaluate _PDC, using legacy perf. control...\n")); return_VALUE(status); } @@ -574,6 +564,10 @@ static int acpi_processor_start(struct acpi_device *device) "Error installing device notify handler\n")); } + /* _PDC call should be done before doing anything else (if reqd.). */ + arch_acpi_processor_init_pdc(pr); + acpi_processor_set_pdc(pr); + acpi_processor_power_init(pr, device); if (pr->flags.throttling) { diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 70d8a6ec092..1915c377bfc 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1014,8 +1014,6 @@ int acpi_processor_power_init(struct acpi_processor *pr, } } - acpi_processor_power_init_pdc(&(pr->power), pr->id); - acpi_processor_set_pdc(pr, pr->power.pdc); acpi_processor_get_power_info(pr); /* diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 22c7bb66c20..532370734c6 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -315,8 +315,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) if (!pr || !pr->performance || !pr->handle) return_VALUE(-EINVAL); - acpi_processor_set_pdc(pr, pr->performance->pdc); - status = acpi_get_handle(pr->handle, "_PCT", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h index 91f4a12a99a..3fa81d55cd0 100644 --- a/include/acpi/pdc_intel.h +++ b/include/acpi/pdc_intel.h @@ -15,9 +15,7 @@ #define ACPI_PDC_C_C1_FFH (0x0100) #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ - ACPI_PDC_C_C1_HALT) - -#define ACPI_PDC_EST_CAPABILITY_SMP_MSR (ACPI_PDC_EST_CAPABILITY_SMP | \ + ACPI_PDC_C_C1_HALT | \ ACPI_PDC_P_FFH) #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 7a00d5089de..82a9b7d430e 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -62,9 +62,6 @@ struct acpi_processor_power { u32 bm_activity; int count; struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; - - /* the _PDC objects passed by the driver, if any */ - struct acpi_object_list *pdc; }; /* Performance Management */ @@ -96,8 +93,6 @@ struct acpi_processor_performance { unsigned int state_count; struct acpi_processor_px *states; - /* the _PDC objects passed by the driver, if any */ - struct acpi_object_list *pdc; }; /* Throttling Control */ @@ -151,6 +146,9 @@ struct acpi_processor { struct acpi_processor_performance *performance; struct acpi_processor_throttling throttling; struct acpi_processor_limit limit; + + /* the _PDC objects for this processor, if any */ + struct acpi_object_list *pdc; }; struct acpi_processor_errata { @@ -178,22 +176,12 @@ int acpi_processor_notify_smm(struct module *calling_module); extern struct acpi_processor *processors[NR_CPUS]; extern struct acpi_processor_errata errata; -int acpi_processor_set_pdc(struct acpi_processor *pr, - struct acpi_object_list *pdc_in); +void arch_acpi_processor_init_pdc(struct acpi_processor *pr); -#ifdef ARCH_HAS_POWER_PDC_INIT -void acpi_processor_power_init_pdc(struct acpi_processor_power *pow, - unsigned int cpu); +#ifdef ARCH_HAS_POWER_INIT void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, unsigned int cpu); #else -static inline void acpi_processor_power_init_pdc(struct acpi_processor_power - *pow, unsigned int cpu) -{ - pow->pdc = NULL; - return; -} - static inline void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, unsigned int cpu) diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index df4ed323aa4..55059abf9c9 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h @@ -179,7 +179,7 @@ extern void acpi_reserve_bootmem(void); extern u8 x86_acpiid_to_apicid[]; -#define ARCH_HAS_POWER_PDC_INIT 1 +#define ARCH_HAS_POWER_INIT 1 #endif /*__KERNEL__*/ -- cgit v1.2.3 From cf82478840188f8c8494c1d7a668a8ae170d0e07 Mon Sep 17 00:00:00 2001 From: Janosch Machowinski Date: Sat, 20 Aug 2005 08:02:00 -0400 Subject: [ACPI] handle BIOS with implicit C1 in _CST The ASUS M6Ne specifies C2, implying C1 but not explicitly specifying it. http://bugzilla.kernel.org/show_bug.cgi?id=4485 Signed-off-by: Janosch Machowinski Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown --- drivers/acpi/processor_idle.c | 64 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 83fd1b6c10c..40c9f9ca596 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -532,18 +532,10 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) if (!pr->pblk) return_VALUE(-ENODEV); - memset(pr->power.states, 0, sizeof(pr->power.states)); - /* if info is obtained from pblk/fadt, type equals state */ - pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; - /* the C0 state only exists as a filler in our array, - * and all processors need to support C1 */ - pr->power.states[ACPI_STATE_C0].valid = 1; - pr->power.states[ACPI_STATE_C1].valid = 1; - #ifndef CONFIG_HOTPLUG_CPU /* * Check for P_LVL2_UP flag before entering C2 and above on @@ -573,12 +565,11 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) { ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); + /* Zero initialize all the C-states info. */ memset(pr->power.states, 0, sizeof(pr->power.states)); - /* if info is obtained from pblk/fadt, type equals state */ + /* set the first C-State to C1 */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; - pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; - pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; /* the C0 state only exists as a filler in our array, * and all processors need to support C1 */ @@ -592,6 +583,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) { acpi_status status = 0; acpi_integer count; + int current_count; int i; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *cst; @@ -601,10 +593,12 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) if (nocst) return_VALUE(-ENODEV); - pr->power.count = 0; - for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, - sizeof(struct acpi_processor_cx)); + current_count = 1; + + /* Zero initialize C2 onwards and prepare for fresh CST lookup */ + for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++) + memset(&(pr->power.states[i]), 0, + sizeof(struct acpi_processor_cx)); status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); if (ACPI_FAILURE(status)) { @@ -632,16 +626,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) goto end; } - /* We support up to ACPI_PROCESSOR_MAX_POWER. */ - if (count > ACPI_PROCESSOR_MAX_POWER) { - printk(KERN_WARNING - "Limiting number of power states to max (%d)\n", - ACPI_PROCESSOR_MAX_POWER); - printk(KERN_WARNING - "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); - count = ACPI_PROCESSOR_MAX_POWER; - } - /* Tell driver that at least _CST is supported. */ pr->flags.has_cst = 1; @@ -685,7 +669,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) continue; - if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3)) + if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) continue; obj = (union acpi_object *)&(element->package.elements[2]); @@ -700,15 +684,28 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) cx.power = obj->integer.value; - (pr->power.count)++; - memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); + current_count++; + memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx)); + + /* + * We support total ACPI_PROCESSOR_MAX_POWER - 1 + * (From 1 through ACPI_PROCESSOR_MAX_POWER - 1) + */ + if (current_count >= (ACPI_PROCESSOR_MAX_POWER - 1)) { + printk(KERN_WARNING + "Limiting number of power states to max (%d)\n", + ACPI_PROCESSOR_MAX_POWER); + printk(KERN_WARNING + "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); + break; + } } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", - pr->power.count)); + current_count)); /* Validate number of power states discovered */ - if (pr->power.count < 2) + if (current_count < 2) status = -EFAULT; end: @@ -859,12 +856,13 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) /* NOTE: the idle thread may not be running while calling * this function */ + /* Adding C1 state */ + acpi_processor_get_power_info_default_c1(pr); result = acpi_processor_get_power_info_cst(pr); if (result == -ENODEV) - result = acpi_processor_get_power_info_fadt(pr); + acpi_processor_get_power_info_fadt(pr); - if ((result) || (acpi_processor_power_verify(pr) < 2)) - result = acpi_processor_get_power_info_default_c1(pr); + pr->power.count = acpi_processor_power_verify(pr); /* * Set Default Policy -- cgit v1.2.3 From 06a2a3855e20ed3df380d69b37130ba86bec8001 Mon Sep 17 00:00:00 2001 From: Luming Yu Date: Tue, 27 Sep 2005 00:43:00 -0400 Subject: [ACPI] Disable EC burst mode w/o disabling EC interrupts Need to de-couple the concept of polling/interrupts vs burst/non-burst. http://bugzilla.kernel.org/show_bug.cgi?id=4980 Signed-off-by: Luming Yu Signed-off-by: Len Brown --- drivers/acpi/ec.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7e1a445955b..6edfbe6f187 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -213,19 +213,14 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) smp_mb(); switch (event) { - case ACPI_EC_EVENT_OBF: - if (acpi_ec_read_status(ec) & event) { - ec->burst.expect_event = 0; - return_VALUE(0); - } - break; - case ACPI_EC_EVENT_IBE: if (~acpi_ec_read_status(ec) & event) { ec->burst.expect_event = 0; return_VALUE(0); } break; + default: + break; } result = wait_event_timeout(ec->burst.wait, @@ -255,7 +250,11 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) return_VALUE(-ETIME); } -static int acpi_ec_enter_burst_mode(union acpi_ec *ec) +/* + * Note: samsung nv5000 doesn't work with ec burst mode. + * http://bugzilla.kernel.org/show_bug.cgi?id=4980 + */ +int acpi_ec_enter_burst_mode(union acpi_ec *ec) { u32 tmp = 0; int status = 0; @@ -270,8 +269,6 @@ static int acpi_ec_enter_burst_mode(union acpi_ec *ec) acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); - if (status) - return_VALUE(-EINVAL); acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); if (tmp != 0x90) { /* Burst ACK byte */ return_VALUE(-EINVAL); @@ -285,13 +282,25 @@ static int acpi_ec_enter_burst_mode(union acpi_ec *ec) return_VALUE(-1); } -static int acpi_ec_leave_burst_mode(union acpi_ec *ec) +int acpi_ec_leave_burst_mode(union acpi_ec *ec) { + int status = 0; ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); + status = acpi_ec_read_status(ec); + if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ + status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); + if(status) + goto end; + acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); + acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); + } atomic_set(&ec->burst.leaving_burst, 1); return_VALUE(0); +end: + printk("leave burst_mode:error \n"); + return_VALUE(-1); } static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) @@ -424,7 +433,6 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) WARN_ON(in_interrupt()); down(&ec->burst.sem); - acpi_ec_enter_burst_mode(ec); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { printk("read EC, IB not empty\n"); @@ -448,7 +456,6 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) *data, address)); end: - acpi_ec_leave_burst_mode(ec); up(&ec->burst.sem); if (ec->common.global_lock) @@ -476,8 +483,6 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) WARN_ON(in_interrupt()); down(&ec->burst.sem); - acpi_ec_enter_burst_mode(ec); - status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { printk("write EC, IB not empty\n"); @@ -500,7 +505,6 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", data, address)); - acpi_ec_leave_burst_mode(ec); up(&ec->burst.sem); if (ec->common.global_lock) -- cgit v1.2.3 From 02b28a33aae93a3b53068e0858d62f8bcaef60a3 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Mon, 5 Dec 2005 16:33:04 -0500 Subject: [ACPI] Embedded Controller (EC) driver syntax update "intr" largely replaces "burst" for syntax to follow semantics "poll" largely replaces "polling" for economy of expression append "interrupt mode" or "polling mode" to dmesg line no functional changes Signed-off-by: Len Brown --- drivers/acpi/ec.c | 233 +++++++++++++++++++++++++++--------------------------- 1 file changed, 117 insertions(+), 116 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 6edfbe6f187..bb3963b49a9 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -60,20 +60,20 @@ ACPI_MODULE_NAME("acpi_ec") #define ACPI_EC_BURST_ENABLE 0x82 #define ACPI_EC_BURST_DISABLE 0x83 #define ACPI_EC_COMMAND_QUERY 0x84 -#define EC_POLLING 0xFF -#define EC_BURST 0x00 +#define EC_POLL 0xFF +#define EC_INTR 0x00 static int acpi_ec_remove(struct acpi_device *device, int type); static int acpi_ec_start(struct acpi_device *device); static int acpi_ec_stop(struct acpi_device *device, int type); -static int acpi_ec_burst_add(struct acpi_device *device); -static int acpi_ec_polling_add(struct acpi_device *device); +static int acpi_ec_intr_add(struct acpi_device *device); +static int acpi_ec_poll_add(struct acpi_device *device); static struct acpi_driver acpi_ec_driver = { .name = ACPI_EC_DRIVER_NAME, .class = ACPI_EC_CLASS, .ids = ACPI_EC_HID, .ops = { - .add = acpi_ec_polling_add, + .add = acpi_ec_poll_add, .remove = acpi_ec_remove, .start = acpi_ec_start, .stop = acpi_ec_stop, @@ -105,7 +105,7 @@ union acpi_ec { atomic_t pending_gpe; struct semaphore sem; wait_queue_head_t wait; - } burst; + } intr; struct { u32 mode; @@ -117,37 +117,37 @@ union acpi_ec { struct acpi_generic_address data_addr; unsigned long global_lock; spinlock_t lock; - } polling; + } poll; }; -static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event); -static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); -static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data); -static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data); -static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data); -static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data); -static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data); -static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data); -static void acpi_ec_gpe_polling_query(void *ec_cxt); -static void acpi_ec_gpe_burst_query(void *ec_cxt); -static u32 acpi_ec_gpe_polling_handler(void *data); -static u32 acpi_ec_gpe_burst_handler(void *data); +static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event); +static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event); +static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data); +static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data); +static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data); +static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data); +static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data); +static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data); +static void acpi_ec_gpe_poll_query(void *ec_cxt); +static void acpi_ec_gpe_intr_query(void *ec_cxt); +static u32 acpi_ec_gpe_poll_handler(void *data); +static u32 acpi_ec_gpe_intr_handler(void *data); static acpi_status __init -acpi_fake_ecdt_polling_callback(acpi_handle handle, +acpi_fake_ecdt_poll_callback(acpi_handle handle, u32 Level, void *context, void **retval); static acpi_status __init -acpi_fake_ecdt_burst_callback(acpi_handle handle, +acpi_fake_ecdt_intr_callback(acpi_handle handle, u32 Level, void *context, void **retval); -static int __init acpi_ec_polling_get_real_ecdt(void); -static int __init acpi_ec_burst_get_real_ecdt(void); +static int __init acpi_ec_poll_get_real_ecdt(void); +static int __init acpi_ec_intr_get_real_ecdt(void); /* If we find an EC via the ECDT, we need to keep a ptr to its context */ static union acpi_ec *ec_ecdt; /* External interfaces use first EC only, so remember */ static struct acpi_device *first_ec; -static int acpi_ec_polling_mode = EC_POLLING; +static int acpi_ec_poll_mode = EC_POLL; /* -------------------------------------------------------------------------- Transaction Management @@ -163,13 +163,13 @@ static inline u32 acpi_ec_read_status(union acpi_ec *ec) static int acpi_ec_wait(union acpi_ec *ec, u8 event) { - if (acpi_ec_polling_mode) - return acpi_ec_polling_wait(ec, event); + if (acpi_ec_poll_mode) + return acpi_ec_poll_wait(ec, event); else - return acpi_ec_burst_wait(ec, event); + return acpi_ec_intr_wait(ec, event); } -static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) +static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event) { u32 acpi_ec_status = 0; u32 i = ACPI_EC_UDELAY_COUNT; @@ -203,19 +203,19 @@ static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) return -ETIME; } -static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) +static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) { int result = 0; ACPI_FUNCTION_TRACE("acpi_ec_wait"); - ec->burst.expect_event = event; + ec->intr.expect_event = event; smp_mb(); switch (event) { case ACPI_EC_EVENT_IBE: if (~acpi_ec_read_status(ec) & event) { - ec->burst.expect_event = 0; + ec->intr.expect_event = 0; return_VALUE(0); } break; @@ -223,11 +223,11 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) break; } - result = wait_event_timeout(ec->burst.wait, - !ec->burst.expect_event, + result = wait_event_timeout(ec->intr.wait, + !ec->intr.expect_event, msecs_to_jiffies(ACPI_EC_DELAY)); - ec->burst.expect_event = 0; + ec->intr.expect_event = 0; smp_mb(); /* @@ -250,6 +250,7 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) return_VALUE(-ETIME); } +#ifdef ACPI_FUTURE_USAGE /* * Note: samsung nv5000 doesn't work with ec burst mode. * http://bugzilla.kernel.org/show_bug.cgi?id=4980 @@ -275,7 +276,7 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) } } - atomic_set(&ec->burst.leaving_burst, 0); + atomic_set(&ec->intr.leaving_burst, 0); return_VALUE(0); end: printk("Error in acpi_ec_wait\n"); @@ -296,28 +297,29 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); } - atomic_set(&ec->burst.leaving_burst, 1); + atomic_set(&ec->intr.leaving_burst, 1); return_VALUE(0); end: printk("leave burst_mode:error \n"); return_VALUE(-1); } +#endif /* ACPI_FUTURE_USAGE */ static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) { - if (acpi_ec_polling_mode) - return acpi_ec_polling_read(ec, address, data); + if (acpi_ec_poll_mode) + return acpi_ec_poll_read(ec, address, data); else - return acpi_ec_burst_read(ec, address, data); + return acpi_ec_intr_read(ec, address, data); } static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) { - if (acpi_ec_polling_mode) - return acpi_ec_polling_write(ec, address, data); + if (acpi_ec_poll_mode) + return acpi_ec_poll_write(ec, address, data); else - return acpi_ec_burst_write(ec, address, data); + return acpi_ec_intr_write(ec, address, data); } -static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) +static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) { acpi_status status = AE_OK; int result = 0; @@ -337,7 +339,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) return_VALUE(-ENODEV); } - spin_lock_irqsave(&ec->polling.lock, flags); + spin_lock_irqsave(&ec->poll.lock, flags); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); @@ -356,7 +358,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) *data, address)); end: - spin_unlock_irqrestore(&ec->polling.lock, flags); + spin_unlock_irqrestore(&ec->poll.lock, flags); if (ec->common.global_lock) acpi_release_global_lock(glk); @@ -364,7 +366,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) return_VALUE(result); } -static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) +static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) { int result = 0; acpi_status status = AE_OK; @@ -382,7 +384,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) return_VALUE(-ENODEV); } - spin_lock_irqsave(&ec->polling.lock, flags); + spin_lock_irqsave(&ec->poll.lock, flags); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); @@ -404,7 +406,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) data, address)); end: - spin_unlock_irqrestore(&ec->polling.lock, flags); + spin_unlock_irqrestore(&ec->poll.lock, flags); if (ec->common.global_lock) acpi_release_global_lock(glk); @@ -412,7 +414,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) return_VALUE(result); } -static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) +static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) { int status = 0; u32 glk; @@ -431,7 +433,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) } WARN_ON(in_interrupt()); - down(&ec->burst.sem); + down(&ec->intr.sem); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { @@ -456,7 +458,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) *data, address)); end: - up(&ec->burst.sem); + up(&ec->intr.sem); if (ec->common.global_lock) acpi_release_global_lock(glk); @@ -464,7 +466,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) return_VALUE(status); } -static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) +static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) { int status = 0; u32 glk; @@ -481,7 +483,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) } WARN_ON(in_interrupt()); - down(&ec->burst.sem); + down(&ec->intr.sem); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { @@ -505,7 +507,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", data, address)); - up(&ec->burst.sem); + up(&ec->intr.sem); if (ec->common.global_lock) acpi_release_global_lock(glk); @@ -557,12 +559,12 @@ EXPORT_SYMBOL(ec_write); static int acpi_ec_query(union acpi_ec *ec, u32 * data) { - if (acpi_ec_polling_mode) - return acpi_ec_polling_query(ec, data); + if (acpi_ec_poll_mode) + return acpi_ec_poll_query(ec, data); else - return acpi_ec_burst_query(ec, data); + return acpi_ec_intr_query(ec, data); } -static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) +static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) { int result = 0; acpi_status status = AE_OK; @@ -587,7 +589,7 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) * Note that successful completion of the query causes the ACPI_EC_SCI * bit to be cleared (and thus clearing the interrupt source). */ - spin_lock_irqsave(&ec->polling.lock, flags); + spin_lock_irqsave(&ec->poll.lock, flags); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); @@ -600,14 +602,14 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) result = -ENODATA; end: - spin_unlock_irqrestore(&ec->polling.lock, flags); + spin_unlock_irqrestore(&ec->poll.lock, flags); if (ec->common.global_lock) acpi_release_global_lock(glk); return_VALUE(result); } -static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) +static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) { int status = 0; u32 glk; @@ -624,7 +626,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) return_VALUE(-ENODEV); } - down(&ec->burst.sem); + down(&ec->intr.sem); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { @@ -649,7 +651,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) status = -ENODATA; end: - up(&ec->burst.sem); + up(&ec->intr.sem); if (ec->common.global_lock) acpi_release_global_lock(glk); @@ -668,13 +670,13 @@ union acpi_ec_query_data { static void acpi_ec_gpe_query(void *ec_cxt) { - if (acpi_ec_polling_mode) - acpi_ec_gpe_polling_query(ec_cxt); + if (acpi_ec_poll_mode) + acpi_ec_gpe_poll_query(ec_cxt); else - acpi_ec_gpe_burst_query(ec_cxt); + acpi_ec_gpe_intr_query(ec_cxt); } -static void acpi_ec_gpe_polling_query(void *ec_cxt) +static void acpi_ec_gpe_poll_query(void *ec_cxt) { union acpi_ec *ec = (union acpi_ec *)ec_cxt; u32 value = 0; @@ -689,9 +691,9 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt) if (!ec_cxt) goto end; - spin_lock_irqsave(&ec->polling.lock, flags); + spin_lock_irqsave(&ec->poll.lock, flags); acpi_hw_low_level_read(8, &value, &ec->common.command_addr); - spin_unlock_irqrestore(&ec->polling.lock, flags); + spin_unlock_irqrestore(&ec->poll.lock, flags); /* TBD: Implement asynch events! * NOTE: All we care about are EC-SCI's. Other EC events are @@ -715,7 +717,7 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt) end: acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); } -static void acpi_ec_gpe_burst_query(void *ec_cxt) +static void acpi_ec_gpe_intr_query(void *ec_cxt) { union acpi_ec *ec = (union acpi_ec *)ec_cxt; u32 value; @@ -740,18 +742,18 @@ static void acpi_ec_gpe_burst_query(void *ec_cxt) acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); end: - atomic_dec(&ec->burst.pending_gpe); + atomic_dec(&ec->intr.pending_gpe); return; } static u32 acpi_ec_gpe_handler(void *data) { - if (acpi_ec_polling_mode) - return acpi_ec_gpe_polling_handler(data); + if (acpi_ec_poll_mode) + return acpi_ec_gpe_poll_handler(data); else - return acpi_ec_gpe_burst_handler(data); + return acpi_ec_gpe_intr_handler(data); } -static u32 acpi_ec_gpe_polling_handler(void *data) +static u32 acpi_ec_gpe_poll_handler(void *data) { acpi_status status = AE_OK; union acpi_ec *ec = (union acpi_ec *)data; @@ -769,7 +771,7 @@ static u32 acpi_ec_gpe_polling_handler(void *data) else return ACPI_INTERRUPT_NOT_HANDLED; } -static u32 acpi_ec_gpe_burst_handler(void *data) +static u32 acpi_ec_gpe_intr_handler(void *data) { acpi_status status = AE_OK; u32 value; @@ -781,22 +783,22 @@ static u32 acpi_ec_gpe_burst_handler(void *data) acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); value = acpi_ec_read_status(ec); - switch (ec->burst.expect_event) { + switch (ec->intr.expect_event) { case ACPI_EC_EVENT_OBF: if (!(value & ACPI_EC_FLAG_OBF)) break; case ACPI_EC_EVENT_IBE: if ((value & ACPI_EC_FLAG_IBF)) break; - ec->burst.expect_event = 0; - wake_up(&ec->burst.wait); + ec->intr.expect_event = 0; + wake_up(&ec->intr.wait); return ACPI_INTERRUPT_HANDLED; default: break; } if (value & ACPI_EC_FLAG_SCI) { - atomic_add(1, &ec->burst.pending_gpe); + atomic_add(1, &ec->intr.pending_gpe); status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, acpi_ec_gpe_query, ec); return status == AE_OK ? @@ -984,7 +986,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) Driver Interface -------------------------------------------------------------------------- */ -static int acpi_ec_polling_add(struct acpi_device *device) +static int acpi_ec_poll_add(struct acpi_device *device) { int result = 0; acpi_status status = AE_OK; @@ -1003,7 +1005,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) ec->common.handle = device->handle; ec->common.uid = -1; - spin_lock_init(&ec->polling.lock); + spin_lock_init(&ec->poll.lock); strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); acpi_driver_data(device) = ec; @@ -1042,7 +1044,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) if (result) goto end; - printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", + printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n", acpi_device_name(device), acpi_device_bid(device), (u32) ec->common.gpe_bit); @@ -1055,7 +1057,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) return_VALUE(result); } -static int acpi_ec_burst_add(struct acpi_device *device) +static int acpi_ec_intr_add(struct acpi_device *device) { int result = 0; acpi_status status = AE_OK; @@ -1074,10 +1076,10 @@ static int acpi_ec_burst_add(struct acpi_device *device) ec->common.handle = device->handle; ec->common.uid = -1; - atomic_set(&ec->burst.pending_gpe, 0); - atomic_set(&ec->burst.leaving_burst, 1); - init_MUTEX(&ec->burst.sem); - init_waitqueue_head(&ec->burst.wait); + atomic_set(&ec->intr.pending_gpe, 0); + atomic_set(&ec->intr.leaving_burst, 1); + init_MUTEX(&ec->intr.sem); + init_waitqueue_head(&ec->intr.wait); strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); acpi_driver_data(device) = ec; @@ -1116,8 +1118,7 @@ static int acpi_ec_burst_add(struct acpi_device *device) if (result) goto end; - printk("burst-mode-ec-10-Aug\n"); - printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", + printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n", acpi_device_name(device), acpi_device_bid(device), (u32) ec->common.gpe_bit); @@ -1271,16 +1272,16 @@ acpi_fake_ecdt_callback(acpi_handle handle, u32 Level, void *context, void **retval) { - if (acpi_ec_polling_mode) - return acpi_fake_ecdt_polling_callback(handle, + if (acpi_ec_poll_mode) + return acpi_fake_ecdt_poll_callback(handle, Level, context, retval); else - return acpi_fake_ecdt_burst_callback(handle, + return acpi_fake_ecdt_intr_callback(handle, Level, context, retval); } static acpi_status __init -acpi_fake_ecdt_polling_callback(acpi_handle handle, +acpi_fake_ecdt_poll_callback(acpi_handle handle, u32 Level, void *context, void **retval) { acpi_status status; @@ -1299,7 +1300,7 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle, &ec_ecdt->common.gpe_bit); if (ACPI_FAILURE(status)) return status; - spin_lock_init(&ec_ecdt->polling.lock); + spin_lock_init(&ec_ecdt->poll.lock); ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.handle = handle; @@ -1312,13 +1313,13 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle, } static acpi_status __init -acpi_fake_ecdt_burst_callback(acpi_handle handle, +acpi_fake_ecdt_intr_callback(acpi_handle handle, u32 Level, void *context, void **retval) { acpi_status status; - init_MUTEX(&ec_ecdt->burst.sem); - init_waitqueue_head(&ec_ecdt->burst.wait); + init_MUTEX(&ec_ecdt->intr.sem); + init_waitqueue_head(&ec_ecdt->intr.wait); status = acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_ec_io_ports, ec_ecdt); if (ACPI_FAILURE(status)) @@ -1384,13 +1385,13 @@ static int __init acpi_ec_fake_ecdt(void) static int __init acpi_ec_get_real_ecdt(void) { - if (acpi_ec_polling_mode) - return acpi_ec_polling_get_real_ecdt(); + if (acpi_ec_poll_mode) + return acpi_ec_poll_get_real_ecdt(); else - return acpi_ec_burst_get_real_ecdt(); + return acpi_ec_intr_get_real_ecdt(); } -static int __init acpi_ec_polling_get_real_ecdt(void) +static int __init acpi_ec_poll_get_real_ecdt(void) { acpi_status status; struct acpi_table_ecdt *ecdt_ptr; @@ -1415,7 +1416,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void) ec_ecdt->common.status_addr = ecdt_ptr->ec_control; ec_ecdt->common.data_addr = ecdt_ptr->ec_data; ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; - spin_lock_init(&ec_ecdt->polling.lock); + spin_lock_init(&ec_ecdt->poll.lock); /* use the GL just to be safe */ ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.uid = ecdt_ptr->uid; @@ -1435,7 +1436,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void) return -ENODEV; } -static int __init acpi_ec_burst_get_real_ecdt(void) +static int __init acpi_ec_intr_get_real_ecdt(void) { acpi_status status; struct acpi_table_ecdt *ecdt_ptr; @@ -1456,8 +1457,8 @@ static int __init acpi_ec_burst_get_real_ecdt(void) return -ENOMEM; memset(ec_ecdt, 0, sizeof(union acpi_ec)); - init_MUTEX(&ec_ecdt->burst.sem); - init_waitqueue_head(&ec_ecdt->burst.wait); + init_MUTEX(&ec_ecdt->intr.sem); + init_waitqueue_head(&ec_ecdt->intr.wait); ec_ecdt->common.command_addr = ecdt_ptr->ec_control; ec_ecdt->common.status_addr = ecdt_ptr->ec_control; ec_ecdt->common.data_addr = ecdt_ptr->ec_data; @@ -1575,22 +1576,22 @@ static int __init acpi_fake_ecdt_setup(char *str) } __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); -static int __init acpi_ec_set_polling_mode(char *str) +static int __init acpi_ec_set_intr_mode(char *str) { - int burst; + int intr; - if (!get_option(&str, &burst)) + if (!get_option(&str, &intr)) return 0; - if (burst) { - acpi_ec_polling_mode = EC_BURST; - acpi_ec_driver.ops.add = acpi_ec_burst_add; + if (intr) { + acpi_ec_poll_mode = EC_INTR; + acpi_ec_driver.ops.add = acpi_ec_intr_add; } else { - acpi_ec_polling_mode = EC_POLLING; - acpi_ec_driver.ops.add = acpi_ec_polling_add; + acpi_ec_poll_mode = EC_POLL; + acpi_ec_driver.ops.add = acpi_ec_poll_add; } - printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling"); + printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling"); return 0; } -__setup("ec_burst=", acpi_ec_set_polling_mode); +__setup("ec_burst=", acpi_ec_set_intr_mode); -- cgit v1.2.3 From 53f11d4ff8797bcceaf014e62bd39f16ce84baec Mon Sep 17 00:00:00 2001 From: Len Brown Date: Mon, 5 Dec 2005 16:46:36 -0500 Subject: [ACPI] Enable Embedded Controller (EC) interrupt mode by default "ec_intr=0" reverts to polling "ec_burst=" no longer exists. Signed-off-by: Len Brown Acked-by: Luming Yu --- Documentation/kernel-parameters.txt | 5 +++++ drivers/acpi/ec.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5dffcfefc3c..2ad64efdf18 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -452,6 +452,11 @@ running once the system is up. eata= [HW,SCSI] + ec_intr= [HW,ACPI] ACPI Embedded Controller interrupt mode + Format: + 0: polling mode + non-0: interrupt mode (default) + eda= [HW,PS2] edb= [HW,PS2] diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index bb3963b49a9..d4366ad4edc 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -73,7 +73,7 @@ static struct acpi_driver acpi_ec_driver = { .class = ACPI_EC_CLASS, .ids = ACPI_EC_HID, .ops = { - .add = acpi_ec_poll_add, + .add = acpi_ec_intr_add, .remove = acpi_ec_remove, .start = acpi_ec_start, .stop = acpi_ec_stop, @@ -147,7 +147,7 @@ static union acpi_ec *ec_ecdt; /* External interfaces use first EC only, so remember */ static struct acpi_device *first_ec; -static int acpi_ec_poll_mode = EC_POLL; +static int acpi_ec_poll_mode = EC_INTR; /* -------------------------------------------------------------------------- Transaction Management @@ -1594,4 +1594,4 @@ static int __init acpi_ec_set_intr_mode(char *str) return 0; } -__setup("ec_burst=", acpi_ec_set_intr_mode); +__setup("ec_intr=", acpi_ec_set_intr_mode); -- cgit v1.2.3 From 1e8df53c925024548cca4374f03bed1a7e2b0c45 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Mon, 5 Dec 2005 16:47:46 -0500 Subject: [ACPI] Embedded Controller (EC) driver printk syntax update no functional changes Signed-off-by: Len Brown --- drivers/acpi/ec.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d4366ad4edc..93fcaec6d58 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -279,7 +279,7 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) atomic_set(&ec->intr.leaving_burst, 0); return_VALUE(0); end: - printk("Error in acpi_ec_wait\n"); + printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); return_VALUE(-1); } @@ -300,7 +300,7 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) atomic_set(&ec->intr.leaving_burst, 1); return_VALUE(0); end: - printk("leave burst_mode:error \n"); + printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); return_VALUE(-1); } #endif /* ACPI_FUTURE_USAGE */ @@ -437,20 +437,20 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { - printk("read EC, IB not empty\n"); + printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); goto end; } acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { - printk("read EC, IB not empty\n"); + printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); } acpi_hw_low_level_write(8, address, &ec->common.data_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status) { - printk("read EC, OB not full\n"); + printk(KERN_DEBUG PREFIX "read EC, OB not full\n"); goto end; } acpi_hw_low_level_read(8, data, &ec->common.data_addr); @@ -487,19 +487,19 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { - printk("write EC, IB not empty\n"); + printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); } acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { - printk("write EC, IB not empty\n"); + printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); } acpi_hw_low_level_write(8, address, &ec->common.data_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { - printk("write EC, IB not empty\n"); + printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); } acpi_hw_low_level_write(8, data, &ec->common.data_addr); @@ -630,7 +630,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { - printk("query EC, IB not empty\n"); + printk(KERN_DEBUG PREFIX "query EC, IB not empty\n"); goto end; } /* @@ -642,7 +642,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status) { - printk("query EC, OB not full\n"); + printk(KERN_DEBUG PREFIX "query EC, OB not full\n"); goto end; } -- cgit v1.2.3 From c82e6abfb3182c84d0204b178363086b09881a4a Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Thu, 1 Dec 2005 18:16:00 -0500 Subject: [ACPI] IA64 ZX1 buildfix for _PDC patch http://bugzilla.kernel.org/show_bug.cgi?id=5483 ZX1 config doesn't include cpufreq, so move move acpi-processor.c up out of ia64/cpufreq directory. no functional changes Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown --- arch/ia64/kernel/Makefile | 5 +++ arch/ia64/kernel/acpi-processor.c | 67 +++++++++++++++++++++++++++++++ arch/ia64/kernel/cpufreq/Makefile | 4 -- arch/ia64/kernel/cpufreq/acpi-processor.c | 67 ------------------------------- 4 files changed, 72 insertions(+), 71 deletions(-) create mode 100644 arch/ia64/kernel/acpi-processor.c delete mode 100644 arch/ia64/kernel/cpufreq/acpi-processor.c diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile index 307514f7a28..09a0dbc17fb 100644 --- a/arch/ia64/kernel/Makefile +++ b/arch/ia64/kernel/Makefile @@ -13,6 +13,11 @@ obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o + +ifneq ($(CONFIG_ACPI_PROCESSOR),) +obj-y += acpi-processor.o +endif + obj-$(CONFIG_IA64_PALINFO) += palinfo.o obj-$(CONFIG_IOSAPIC) += iosapic.o obj-$(CONFIG_MODULES) += module.o diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c new file mode 100644 index 00000000000..e683630c8ce --- /dev/null +++ b/arch/ia64/kernel/acpi-processor.c @@ -0,0 +1,67 @@ +/* + * arch/ia64/kernel/cpufreq/processor.c + * + * Copyright (C) 2005 Intel Corporation + * Venkatesh Pallipadi + * - Added _PDC for platforms with Intel CPUs + */ + +#include +#include +#include +#include + +#include +#include + +static void init_intel_pdc(struct acpi_processor *pr) +{ + struct acpi_object_list *obj_list; + union acpi_object *obj; + u32 *buf; + + /* allocate and initialize pdc. It will be used later. */ + obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); + if (!obj_list) { + printk(KERN_ERR "Memory allocation error\n"); + return; + } + + obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + if (!obj) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj_list); + return; + } + + buf = kmalloc(12, GFP_KERNEL); + if (!buf) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj); + kfree(obj_list); + return; + } + + buf[0] = ACPI_PDC_REVISION_ID; + buf[1] = 1; + buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; + + obj->type = ACPI_TYPE_BUFFER; + obj->buffer.length = 12; + obj->buffer.pointer = (u8 *) buf; + obj_list->count = 1; + obj_list->pointer = obj; + pr->pdc = obj_list; + + return; +} + +/* Initialize _PDC data based on the CPU vendor */ +void arch_acpi_processor_init_pdc(struct acpi_processor *pr) +{ + pr->pdc = NULL; + init_intel_pdc(pr); + return; +} + +EXPORT_SYMBOL(arch_acpi_processor_init_pdc); diff --git a/arch/ia64/kernel/cpufreq/Makefile b/arch/ia64/kernel/cpufreq/Makefile index 642648361ed..4838f2a57c7 100644 --- a/arch/ia64/kernel/cpufreq/Makefile +++ b/arch/ia64/kernel/cpufreq/Makefile @@ -1,6 +1,2 @@ obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o -ifneq ($(CONFIG_ACPI_PROCESSOR),) -obj-y += acpi-processor.o -endif - diff --git a/arch/ia64/kernel/cpufreq/acpi-processor.c b/arch/ia64/kernel/cpufreq/acpi-processor.c deleted file mode 100644 index e683630c8ce..00000000000 --- a/arch/ia64/kernel/cpufreq/acpi-processor.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * arch/ia64/kernel/cpufreq/processor.c - * - * Copyright (C) 2005 Intel Corporation - * Venkatesh Pallipadi - * - Added _PDC for platforms with Intel CPUs - */ - -#include -#include -#include -#include - -#include -#include - -static void init_intel_pdc(struct acpi_processor *pr) -{ - struct acpi_object_list *obj_list; - union acpi_object *obj; - u32 *buf; - - /* allocate and initialize pdc. It will be used later. */ - obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); - if (!obj_list) { - printk(KERN_ERR "Memory allocation error\n"); - return; - } - - obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); - if (!obj) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj_list); - return; - } - - buf = kmalloc(12, GFP_KERNEL); - if (!buf) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj); - kfree(obj_list); - return; - } - - buf[0] = ACPI_PDC_REVISION_ID; - buf[1] = 1; - buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; - - obj->type = ACPI_TYPE_BUFFER; - obj->buffer.length = 12; - obj->buffer.pointer = (u8 *) buf; - obj_list->count = 1; - obj_list->pointer = obj; - pr->pdc = obj_list; - - return; -} - -/* Initialize _PDC data based on the CPU vendor */ -void arch_acpi_processor_init_pdc(struct acpi_processor *pr) -{ - pr->pdc = NULL; - init_intel_pdc(pr); - return; -} - -EXPORT_SYMBOL(arch_acpi_processor_init_pdc); -- cgit v1.2.3 From 50eca3eb89d73d9f0aa070b126c7ee6a616016ab Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 30 Sep 2005 19:03:00 -0400 Subject: [ACPI] ACPICA 20050930 Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore Signed-off-by: Len Brown --- arch/ia64/kernel/acpi-ext.c | 22 +- arch/ia64/pci/pci.c | 8 +- arch/x86_64/kernel/io_apic.c | 10 +- arch/x86_64/kernel/mpparse.c | 8 +- drivers/acpi/acpi_memhotplug.c | 4 +- drivers/acpi/dispatcher/dsutils.c | 12 +- drivers/acpi/ec.c | 4 +- drivers/acpi/events/evgpe.c | 10 +- drivers/acpi/events/evsci.c | 4 +- drivers/acpi/executer/exdump.c | 10 +- drivers/acpi/executer/exnames.c | 4 +- drivers/acpi/executer/exprep.c | 4 +- drivers/acpi/executer/exresop.c | 2 +- drivers/acpi/executer/exutils.c | 6 +- drivers/acpi/glue.c | 8 +- drivers/acpi/hardware/hwacpi.c | 8 +- drivers/acpi/motherboard.c | 30 +- drivers/acpi/namespace/nsaccess.c | 2 +- drivers/acpi/namespace/nsnames.c | 2 +- drivers/acpi/namespace/nsutils.c | 12 +- drivers/acpi/parser/psargs.c | 2 +- drivers/acpi/parser/psxface.c | 142 +++++ drivers/acpi/pci_irq.c | 48 +- drivers/acpi/pci_link.c | 92 +-- drivers/acpi/pci_root.c | 8 +- drivers/acpi/resources/Makefile | 2 +- drivers/acpi/resources/rsaddr.c | 1132 ++++++++++++------------------------- drivers/acpi/resources/rscalc.c | 282 +++------ drivers/acpi/resources/rscreate.c | 59 +- drivers/acpi/resources/rsdump.c | 313 +++++----- drivers/acpi/resources/rsinfo.c | 2 +- drivers/acpi/resources/rsio.c | 451 +++++---------- drivers/acpi/resources/rsirq.c | 494 ++++++---------- drivers/acpi/resources/rslist.c | 290 +++++----- drivers/acpi/resources/rsmemory.c | 472 +++++----------- drivers/acpi/resources/rsmisc.c | 711 ++++++++--------------- drivers/acpi/resources/rsutils.c | 437 +++++++++++++- drivers/acpi/resources/rsxface.c | 14 +- drivers/acpi/tables/tbrsdt.c | 2 +- drivers/acpi/tables/tbxfroot.c | 2 +- drivers/acpi/utilities/utalloc.c | 6 +- drivers/acpi/utilities/utglobal.c | 3 + drivers/acpi/utilities/utmisc.c | 6 +- drivers/char/hpet.c | 26 +- drivers/pnp/pnpacpi/rsparser.c | 364 ++++++------ drivers/serial/8250_acpi.c | 22 +- include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 40 +- include/acpi/acglobal.h | 9 + include/acpi/aclocal.h | 79 ++- include/acpi/acmacros.h | 58 +- include/acpi/acpi_drivers.h | 4 +- include/acpi/acpixf.h | 3 + include/acpi/acresrc.h | 313 ++++++---- include/acpi/actypes.h | 152 ++--- include/acpi/amlresrc.h | 242 ++++---- include/asm-x86_64/mpspec.h | 2 +- include/linux/acpi.h | 2 +- 58 files changed, 2949 insertions(+), 3509 deletions(-) diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c index a146016d7ad..4a5574ff007 100644 --- a/arch/ia64/kernel/acpi-ext.c +++ b/arch/ia64/kernel/acpi-ext.c @@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context) struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; struct acpi_resource_vendor *vendor; struct acpi_vendor_descriptor *descriptor; - u32 length; + u32 byte_length; - if (resource->type != ACPI_RSTYPE_VENDOR) + if (resource->type != ACPI_RESOURCE_TYPE_VENDOR) return AE_OK; vendor = (struct acpi_resource_vendor *)&resource->data; - descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; - if (vendor->length <= sizeof(*info->descriptor) || + descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data; + if (vendor->byte_length <= sizeof(*info->descriptor) || descriptor->guid_id != info->descriptor->guid_id || efi_guidcmp(descriptor->guid, info->descriptor->guid)) return AE_OK; - length = vendor->length - sizeof(struct acpi_vendor_descriptor); - info->data = acpi_os_allocate(length); + byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor); + info->data = acpi_os_allocate(byte_length); if (!info->data) return AE_NO_MEMORY; memcpy(info->data, - vendor->reserved + sizeof(struct acpi_vendor_descriptor), - length); - info->length = length; + vendor->byte_data + sizeof(struct acpi_vendor_descriptor), + byte_length); + info->length = byte_length; return AE_CTRL_TERMINATE; } acpi_status acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, - u8 ** data, u32 * length) + u8 ** data, u32 * byte_length) { struct acpi_vendor_info info; @@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, return AE_NOT_FOUND; *data = info.data; - *length = info.length; + *byte_length = info.length; return AE_OK; } diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 20d76fae24e..25f923d050e 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr) goto free_resource; } - min = addr->min_address_range; + min = addr->minimum; max = min + addr->address_length - 1; if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) sparse = 1; - space_nr = new_space(addr->address_translation_offset, sparse); + space_nr = new_space(addr->translation_offset, sparse); if (space_nr == ~0) goto free_name; @@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) if (addr.resource_type == ACPI_MEMORY_RANGE) { flags = IORESOURCE_MEM; root = &iomem_resource; - offset = addr.address_translation_offset; + offset = addr.translation_offset; } else if (addr.resource_type == ACPI_IO_RANGE) { flags = IORESOURCE_IO; root = &ioport_resource; @@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) window = &info->controller->window[info->controller->windows++]; window->resource.name = info->name; window->resource.flags = flags; - window->resource.start = addr.min_address_range + offset; + window->resource.start = addr.minimum + offset; window->resource.end = window->resource.start + addr.address_length - 1; window->resource.child = NULL; window->offset = offset; diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 97154ab058b..619767d3ea2 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c @@ -1956,7 +1956,7 @@ int __init io_apic_get_redir_entries (int ioapic) } -int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) +int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity) { struct IO_APIC_route_entry entry; unsigned long flags; @@ -1978,8 +1978,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a entry.delivery_mode = INT_DELIVERY_MODE; entry.dest_mode = INT_DEST_MODE; entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); - entry.trigger = edge_level; - entry.polarity = active_high_low; + entry.trigger = triggering; + entry.polarity = polarity; entry.mask = 1; /* Disabled (masked) */ irq = gsi_irq_sharing(irq); @@ -1994,9 +1994,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " "IRQ %d Mode:%i Active:%i)\n", ioapic, mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, - edge_level, active_high_low); + triggering, polarity); - ioapic_register_intr(irq, entry.vector, edge_level); + ioapic_register_intr(irq, entry.vector, triggering); if (!ioapic && (irq < 16)) disable_8259A_irq(irq); diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 1105250bf02..ba817e7454b 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c @@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void) #define MAX_GSI_NUM 4096 -int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) +int mp_register_gsi(u32 gsi, int triggering, int polarity) { int ioapic = -1; int ioapic_pin = 0; @@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<read_write_attribute = address64.attribute.memory.read_write_attribute; - mem_device->start_addr = address64.min_address_range; - mem_device->end_addr = address64.max_address_range; + mem_device->start_addr = address64.minimum; + mem_device->end_addr = address64.maximum; } } diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 83ae1c1aa28..2cc53da5c0b 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, if (!op) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); - return_VALUE(TRUE); + return_UINT8(TRUE); } /* @@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, "At Method level, result of [%s] not used\n", acpi_ps_get_opcode_name(op->common. aml_opcode))); - return_VALUE(FALSE); + return_UINT8(FALSE); } /* Get info on the parent. The root_op is AML_SCOPE */ @@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, if (parent_info->class == AML_CLASS_UNKNOWN) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); - return_VALUE(FALSE); + return_UINT8(FALSE); } /* @@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, acpi_ps_get_opcode_name(op->common.parent->common. aml_opcode), op)); - return_VALUE(TRUE); + return_UINT8(TRUE); result_not_used: ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, @@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, acpi_ps_get_opcode_name(op->common.parent->common. aml_opcode), op)); - return_VALUE(FALSE); + return_UINT8(FALSE); } /******************************************************************************* @@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, if (op_info->flags & AML_HAS_RETVAL) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "Argument previously created, already stacked \n")); + "Argument previously created, already stacked\n")); ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object (walk_state-> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index c33bfba5df8..0ecbfa5db1b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) union acpi_ec *ec = (union acpi_ec *)context; struct acpi_generic_address *addr; - if (resource->type != ACPI_RSTYPE_IO) { + if (resource->type != ACPI_RESOURCE_TYPE_IO) { return AE_OK; } @@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; addr->register_bit_width = 8; addr->register_bit_offset = 0; - addr->address = resource->data.io.min_base_address; + addr->address = resource->data.io.minimum; return AE_OK; } diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index b2f232df13d..f51c3b16c60 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -638,7 +638,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } break; @@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } /* @@ -680,12 +680,12 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } break; } - return_VALUE(ACPI_INTERRUPT_HANDLED); + return_UINT32(ACPI_INTERRUPT_HANDLED); } #ifdef ACPI_GPE_NOTIFY_CHECK diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 14183597700..e2c0b48a7e9 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c @@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - return_VALUE(interrupt_handled); + return_UINT32(interrupt_handled); } /******************************************************************************* @@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - return_VALUE(interrupt_handled); + return_UINT32(interrupt_handled); } /****************************************************************************** diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index bc2fa996047..4477a62fed5 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -214,7 +214,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_BUFFER: - acpi_os_printf("Buffer len %X @ %p \n", + acpi_os_printf("Buffer len %X @ %p\n", obj_desc->buffer.length, obj_desc->buffer.pointer); @@ -320,17 +320,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_BUFFER_FIELD: - acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", + acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, obj_desc->buffer_field.start_field_bit_offset); if (!obj_desc->buffer_field.buffer_obj) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n")); } else if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { - acpi_os_printf("*not a Buffer* \n"); + acpi_os_printf("*not a Buffer*\n"); } else { acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, depth + 1); @@ -618,7 +618,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) case ACPI_TYPE_PACKAGE: - acpi_os_printf("[Package] Contains %d Elements: \n", + acpi_os_printf("[Package] Contains %d Elements:\n", obj_desc->package.count); for (i = 0; i < obj_desc->package.count; i++) { diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 239d8473e9a..dff41121a30 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) if (name_string) { ACPI_STRCAT(name_string, char_buf); ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Appended to - %s \n", name_string)); + "Appended to - %s\n", name_string)); } else { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "No Name string - %s \n", char_buf)); + "No Name string - %s\n", char_buf)); } } else if (index == 0) { /* diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 7476c363e40..88ccbf3b29d 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c @@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown field access type %X\n", access)); - return_VALUE(0); + return_UINT32(0); } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { @@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, } *return_byte_alignment = byte_alignment; - return_VALUE(bit_length); + return_UINT32(bit_length); } /******************************************************************************* diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index ff064e79ab9..b04e4a3707a 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode, } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Opcode %X [%s] required_operand_types=%8.8X \n", + "Opcode %X [%s] required_operand_types=%8.8X\n", opcode, op_info->name, arg_types)); /* diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 1ee79d8c8f8..9f4e547d773 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) } } - return_VALUE(locked); + return_UINT8(locked); } /******************************************************************************* @@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ if (value == 0) { - return_VALUE(1); + return_UINT32(1); } current_value = value; @@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) num_digits++; } - return_VALUE(num_digits); + return_UINT32(num_digits); } /******************************************************************************* diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index fcb881db5b0..8daef57b994 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) unsigned long *busnr = (unsigned long *)data; struct acpi_resource_address64 address; - if (resource->type != ACPI_RSTYPE_ADDRESS16 && - resource->type != ACPI_RSTYPE_ADDRESS32 && - resource->type != ACPI_RSTYPE_ADDRESS64) + if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); if ((address.address_length > 0) && (address.resource_type == ACPI_BUS_NUMBER_RANGE)) - *busnr = address.min_address_range; + *busnr = address.minimum; return AE_OK; } diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 1bb3463d704..20a335cc9be 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void) * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - return_VALUE(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_ACPI); } status = acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); if (ACPI_FAILURE(status)) { - return_VALUE(ACPI_SYS_MODE_LEGACY); + return_UINT32(ACPI_SYS_MODE_LEGACY); } if (value) { - return_VALUE(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_ACPI); } else { - return_VALUE(ACPI_SYS_MODE_LEGACY); + return_UINT32(ACPI_SYS_MODE_LEGACY); } } diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 85c1fb5c9a5..468244147ec 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c @@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); - if (res->type == ACPI_RSTYPE_IO) { + if (res->type == ACPI_RESOURCE_TYPE_IO) { struct acpi_resource_io *io_res = &res->data.io; - if (io_res->min_base_address != io_res->max_base_address) + if (io_res->minimum != io_res->maximum) return_VALUE(AE_OK); if (IS_RESERVED_ADDR - (io_res->min_base_address, io_res->range_length)) { + (io_res->minimum, io_res->address_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - io_res->min_base_address, - io_res->min_base_address + - io_res->range_length)); + io_res->minimum, + io_res->minimum + + io_res->address_length)); requested_res = - request_region(io_res->min_base_address, - io_res->range_length, "motherboard"); + request_region(io_res->minimum, + io_res->address_length, "motherboard"); } - } else if (res->type == ACPI_RSTYPE_FIXED_IO) { + } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) { struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io; if (IS_RESERVED_ADDR - (fixed_io_res->base_address, fixed_io_res->range_length)) { + (fixed_io_res->address, fixed_io_res->address_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - fixed_io_res->base_address, - fixed_io_res->base_address + - fixed_io_res->range_length)); + fixed_io_res->address, + fixed_io_res->address + + fixed_io_res->address_length)); requested_res = - request_region(fixed_io_res->base_address, - fixed_io_res->range_length, + request_region(fixed_io_res->address, + fixed_io_res->address_length, "motherboard"); } } else { diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index edfbe34600f..6923059ba3c 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, path++; ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Multi Pathname (%d Segments, Flags=%X) \n", + "Multi Pathname (%d Segments, Flags=%X)\n", num_segments, flags)); break; diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index d5e8dea61c2..5400728eb79 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, acpi_ns_build_external_path(node, required_size, buffer->pointer); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", (char *)buffer->pointer, (u32) required_size)); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index ebec036423c..549075fb9f8 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) if (!node) { ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); - return_VALUE(ACPI_TYPE_ANY); + return_UINT32(ACPI_TYPE_ANY); } - return_VALUE((acpi_object_type) node->type); + return_UINT32((acpi_object_type) node->type); } /******************************************************************************* @@ -276,10 +276,10 @@ u32 acpi_ns_local(acpi_object_type type) /* Type code out of range */ ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); - return_VALUE(ACPI_NS_NORMAL); + return_UINT32(ACPI_NS_NORMAL); } - return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); + return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); } /******************************************************************************* @@ -805,10 +805,10 @@ u32 acpi_ns_opens_scope(acpi_object_type type) ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", type)); - return_VALUE(ACPI_NS_NORMAL); + return_UINT32(ACPI_NS_NORMAL); } - return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); + return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); } /******************************************************************************* diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 5858188f94a..562d0f822ab 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -116,7 +116,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) break; } - return_VALUE(length); + return_UINT32(length); } /******************************************************************************* diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 4dcbd443160..4c426f4c6af 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -50,11 +50,145 @@ ACPI_MODULE_NAME("psxface") /* Local Prototypes */ +static void acpi_ps_start_trace(struct acpi_parameter_info *info); + +static void acpi_ps_stop_trace(struct acpi_parameter_info *info); + static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); static void acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); +/******************************************************************************* + * + * FUNCTION: acpi_debug_trace + * + * PARAMETERS: method_name - Valid ACPI name string + * debug_level - Optional level mask. 0 to use default + * debug_layer - Optional layer mask. 0 to use default + * Flags - bit 1: one shot(1) or persistent(0) + * + * RETURN: Status + * + * DESCRIPTION: External interface to enable debug tracing during control + * method execution + * + ******************************************************************************/ + +acpi_status +acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) +{ + acpi_status status; + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return (status); + } + + /* TBDs: Validate name, allow full path or just nameseg */ + + acpi_gbl_trace_method_name = *(u32 *) name; + acpi_gbl_trace_flags = flags; + + if (debug_level) { + acpi_gbl_trace_dbg_level = debug_level; + } + if (debug_layer) { + acpi_gbl_trace_dbg_layer = debug_layer; + } + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ps_start_trace + * + * PARAMETERS: Info - Method info struct + * + * RETURN: None + * + * DESCRIPTION: Start control method execution trace + * + ******************************************************************************/ + +static void acpi_ps_start_trace(struct acpi_parameter_info *info) +{ + acpi_status status; + + ACPI_FUNCTION_ENTRY(); + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return; + } + + if ((!acpi_gbl_trace_method_name) || + (acpi_gbl_trace_method_name != info->node->name.integer)) { + goto exit; + } + + acpi_gbl_original_dbg_level = acpi_dbg_level; + acpi_gbl_original_dbg_layer = acpi_dbg_layer; + + acpi_dbg_level = 0x00FFFFFF; + acpi_dbg_layer = ACPI_UINT32_MAX; + + if (acpi_gbl_trace_dbg_level) { + acpi_dbg_level = acpi_gbl_trace_dbg_level; + } + if (acpi_gbl_trace_dbg_layer) { + acpi_dbg_layer = acpi_gbl_trace_dbg_layer; + } + + exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ps_stop_trace + * + * PARAMETERS: Info - Method info struct + * + * RETURN: None + * + * DESCRIPTION: Stop control method execution trace + * + ******************************************************************************/ + +static void acpi_ps_stop_trace(struct acpi_parameter_info *info) +{ + acpi_status status; + + ACPI_FUNCTION_ENTRY(); + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return; + } + + if ((!acpi_gbl_trace_method_name) || + (acpi_gbl_trace_method_name != info->node->name.integer)) { + goto exit; + } + + /* Disable further tracing if type is one-shot */ + + if (acpi_gbl_trace_flags & 1) { + acpi_gbl_trace_method_name = 0; + acpi_gbl_trace_dbg_level = 0; + acpi_gbl_trace_dbg_layer = 0; + } + + acpi_dbg_level = acpi_gbl_original_dbg_level; + acpi_dbg_layer = acpi_gbl_original_dbg_layer; + + exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +} + /******************************************************************************* * * FUNCTION: acpi_ps_execute_method @@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) */ acpi_ps_update_parameter_list(info, REF_INCREMENT); + /* Begin tracing if requested */ + + acpi_ps_start_trace(info); + /* * 1) Perform the first pass parse of the method to enter any * named objects that it creates into the namespace @@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) status = acpi_ps_execute_pass(info); cleanup: + /* End optional tracing */ + + acpi_ps_stop_trace(info); + /* Take away the extra reference that we gave the parameters above */ acpi_ps_update_parameter_list(info, REF_DECREMENT); diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 09567c2edcf..726dda1fce1 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); static int acpi_pci_allocate_irq(struct acpi_prt_entry *entry, - int *edge_level, int *active_high_low, char **link) + int *triggering, int *polarity, char **link) { int irq; @@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, if (entry->link.handle) { irq = acpi_pci_link_allocate_irq(entry->link.handle, - entry->link.index, edge_level, - active_high_low, link); + entry->link.index, triggering, + polarity, link); if (irq < 0) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); @@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, } } else { irq = entry->link.index; - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; + *triggering = ACPI_LEVEL_SENSITIVE; + *polarity = ACPI_ACTIVE_LOW; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); @@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, static int acpi_pci_free_irq(struct acpi_prt_entry *entry, - int *edge_level, int *active_high_low, char **link) + int *triggering, int *polarity, char **link) { int irq; @@ -307,8 +307,8 @@ static int acpi_pci_irq_lookup(struct pci_bus *bus, int device, int pin, - int *edge_level, - int *active_high_low, char **link, irq_lookup_func func) + int *triggering, + int *polarity, char **link, irq_lookup_func func) { struct acpi_prt_entry *entry = NULL; int segment = pci_domain_nr(bus); @@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus, return_VALUE(-1); } - ret = func(entry, edge_level, active_high_low, link); + ret = func(entry, triggering, polarity, link); return_VALUE(ret); } @@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus, static int acpi_pci_irq_derive(struct pci_dev *dev, int pin, - int *edge_level, - int *active_high_low, char **link, irq_lookup_func func) + int *triggering, + int *polarity, char **link, irq_lookup_func func) { struct pci_dev *bridge = dev; int irq = -1; @@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, } irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), - pin, edge_level, active_high_low, + pin, triggering, polarity, link, func); } @@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) { int irq = 0; u8 pin = 0; - int edge_level = ACPI_LEVEL_SENSITIVE; - int active_high_low = ACPI_ACTIVE_LOW; + int triggering = ACPI_LEVEL_SENSITIVE; + int polarity = ACPI_ACTIVE_LOW; char *link = NULL; int rc; @@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * values override any BIOS-assigned IRQs set during boot. */ irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, &link, + &triggering, &polarity, &link, acpi_pci_allocate_irq); /* @@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * device's parent bridge. */ if (irq < 0) - irq = acpi_pci_irq_derive(dev, pin, &edge_level, - &active_high_low, &link, + irq = acpi_pci_irq_derive(dev, pin, &triggering, + &polarity, &link, acpi_pci_allocate_irq); /* @@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) } } - rc = acpi_register_gsi(irq, edge_level, active_high_low); + rc = acpi_register_gsi(irq, triggering, polarity); if (rc < 0) { printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " "to register GSI\n", pci_name(dev), ('A' + pin)); @@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) printk("Link [%s] -> ", link); printk("GSI %u (%s, %s) -> IRQ %d\n", irq, - (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", - (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); + (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", + (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); return_VALUE(0); } @@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev) { int gsi = 0; u8 pin = 0; - int edge_level = ACPI_LEVEL_SENSITIVE; - int active_high_low = ACPI_ACTIVE_LOW; + int triggering = ACPI_LEVEL_SENSITIVE; + int polarity = ACPI_ACTIVE_LOW; ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); @@ -512,7 +512,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) * First we check the PCI IRQ routing table (PRT) for an IRQ. */ gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, NULL, + &triggering, &polarity, NULL, acpi_pci_free_irq); /* * If no PRT entry was found, we'll try to derive an IRQ from the @@ -520,7 +520,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) */ if (gsi < 0) gsi = acpi_pci_irq_derive(dev, pin, - &edge_level, &active_high_low, NULL, + &triggering, &polarity, NULL, acpi_pci_free_irq); if (gsi < 0) return_VOID; diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index d8956c0bf14..49217037349 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = { */ struct acpi_pci_link_irq { u8 active; /* Current IRQ */ - u8 edge_level; /* All IRQs */ - u8 active_high_low; /* All IRQs */ + u8 triggering; /* All IRQs */ + u8 polarity; /* All IRQs */ u8 resource_type; u8 possible_count; u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; @@ -109,18 +109,18 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); switch (resource->type) { - case ACPI_RSTYPE_START_DPF: + case ACPI_RESOURCE_TYPE_START_DEPENDENT: return_ACPI_STATUS(AE_OK); - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n")); return_ACPI_STATUS(AE_OK); } for (i = 0; - (i < p->number_of_interrupts + (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, @@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) link->irq.possible[i] = p->interrupts[i]; link->irq.possible_count++; } - link->irq.edge_level = p->edge_level; - link->irq.active_high_low = p->active_high_low; - link->irq.resource_type = ACPI_RSTYPE_IRQ; + link->irq.triggering = p->triggering; + link->irq.polarity = p->polarity; + link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; break; } - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: { - struct acpi_resource_ext_irq *p = + struct acpi_resource_extended_irq *p = &resource->data.extended_irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank EXT IRQ resource\n")); return_ACPI_STATUS(AE_OK); } for (i = 0; - (i < p->number_of_interrupts + (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, @@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) link->irq.possible[i] = p->interrupts[i]; link->irq.possible_count++; } - link->irq.edge_level = p->edge_level; - link->irq.active_high_low = p->active_high_low; - link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; + link->irq.triggering = p->triggering; + link->irq.polarity = p->polarity; + link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; break; } default: @@ -202,10 +202,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); switch (resource->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { /* * IRQ descriptors may have no IRQ# bits set, * particularly those those w/ _STA disabled @@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) *irq = p->interrupts[0]; break; } - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: { - struct acpi_resource_ext_irq *p = + struct acpi_resource_extended_irq *p = &resource->data.extended_irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { /* * extended IRQ descriptors must * return at least 1 IRQ @@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) buffer.pointer = resource; switch (link->irq.resource_type) { - case ACPI_RSTYPE_IRQ: - resource->res.type = ACPI_RSTYPE_IRQ; + case ACPI_RESOURCE_TYPE_IRQ: + resource->res.type = ACPI_RESOURCE_TYPE_IRQ; resource->res.length = sizeof(struct acpi_resource); - resource->res.data.irq.edge_level = link->irq.edge_level; - resource->res.data.irq.active_high_low = - link->irq.active_high_low; - if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource->res.data.irq.shared_exclusive = + resource->res.data.irq.triggering = link->irq.triggering; + resource->res.data.irq.polarity = + link->irq.polarity; + if (link->irq.triggering == ACPI_EDGE_SENSITIVE) + resource->res.data.irq.sharable = ACPI_EXCLUSIVE; else - resource->res.data.irq.shared_exclusive = ACPI_SHARED; - resource->res.data.irq.number_of_interrupts = 1; + resource->res.data.irq.sharable = ACPI_SHARED; + resource->res.data.irq.interrupt_count = 1; resource->res.data.irq.interrupts[0] = irq; break; - case ACPI_RSTYPE_EXT_IRQ: - resource->res.type = ACPI_RSTYPE_EXT_IRQ; + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; resource->res.length = sizeof(struct acpi_resource); resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource->res.data.extended_irq.edge_level = - link->irq.edge_level; - resource->res.data.extended_irq.active_high_low = - link->irq.active_high_low; - if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource->res.data.irq.shared_exclusive = + resource->res.data.extended_irq.triggering = + link->irq.triggering; + resource->res.data.extended_irq.polarity = + link->irq.polarity; + if (link->irq.triggering == ACPI_EDGE_SENSITIVE) + resource->res.data.irq.sharable = ACPI_EXCLUSIVE; else - resource->res.data.irq.shared_exclusive = ACPI_SHARED; - resource->res.data.extended_irq.number_of_interrupts = 1; + resource->res.data.irq.sharable = ACPI_SHARED; + resource->res.data.extended_irq.interrupt_count = 1; resource->res.data.extended_irq.interrupts[0] = irq; /* ignore resource_source, it's optional */ break; @@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) goto end; } - resource->end.type = ACPI_RSTYPE_END_TAG; + resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; /* Attempt to set the resource */ status = acpi_set_current_resources(link->handle, &buffer); @@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) int acpi_pci_link_allocate_irq(acpi_handle handle, int index, - int *edge_level, int *active_high_low, char **name) + int *triggering, int *polarity, char **name) { int result = 0; struct acpi_device *device = NULL; @@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle, link->refcnt++; up(&acpi_link_lock); - if (edge_level) - *edge_level = link->irq.edge_level; - if (active_high_low) - *active_high_low = link->irq.active_high_low; + if (triggering) + *triggering = link->irq.triggering; + if (polarity) + *polarity = link->irq.polarity; if (name) *name = acpi_device_bid(link->device); ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 5d6bc815fe7..4c313eab631 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -122,15 +122,15 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) int *busnr = (int *)data; struct acpi_resource_address64 address; - if (resource->type != ACPI_RSTYPE_ADDRESS16 && - resource->type != ACPI_RSTYPE_ADDRESS32 && - resource->type != ACPI_RSTYPE_ADDRESS64) + if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); if ((address.address_length > 0) && (address.resource_type == ACPI_BUS_NUMBER_RANGE)) - *busnr = address.min_address_range; + *busnr = address.minimum; return AE_OK; } diff --git a/drivers/acpi/resources/Makefile b/drivers/acpi/resources/Makefile index 2130b74170c..8de4f69dfa0 100644 --- a/drivers/acpi/resources/Makefile +++ b/drivers/acpi/resources/Makefile @@ -2,7 +2,7 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := rsaddr.o rscreate.o rsio.o rslist.o rsmisc.o rsxface.o \ +obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ rscalc.o rsirq.o rsmemory.o rsutils.o obj-$(ACPI_FUTURE_USAGE) += rsdump.o diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 798778261fb..6f48ebf3304 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -58,12 +58,20 @@ acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); +static void +acpi_rs_set_address_common(union aml_resource *aml, + struct acpi_resource *resource); + +static u8 +acpi_rs_get_address_common(struct acpi_resource *resource, + union aml_resource *aml); + /******************************************************************************* * * FUNCTION: acpi_rs_decode_general_flags * * PARAMETERS: Resource - Address resource data struct - * Flags - Actual flag byte + * Flags - Raw AML flag byte * * RETURN: Decoded flag bits in resource struct * @@ -107,27 +115,19 @@ acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) { - u8 flags; - ACPI_FUNCTION_ENTRY(); - /* Producer / Consumer - flag bit[0] */ - - flags = (u8) (resource->address.producer_consumer & 0x01); - - /* Decode (_DEC) - flag bit[1] */ - - flags |= (u8) ((resource->address.decode & 0x01) << 1); - - /* Min Address Fixed (_MIF) - flag bit[2] */ - - flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2); - - /* Max Address Fixed (_MAF) - flag bit[3] */ - - flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3); - - return (flags); + return ((u8) + + /* Producer / Consumer - flag bit[0] */ + ((resource->address.producer_consumer & 0x01) | + /* Decode (_DEC) - flag bit[1] */ + ((resource->address.decode & 0x01) << 1) | + /* Min Address Fixed (_MIF) - flag bit[2] */ + ((resource->address.min_address_fixed & 0x01) << 2) | + /* Max Address Fixed (_MAF) - flag bit[3] */ + ((resource->address.max_address_fixed & 0x01) << 3)) + ); } /******************************************************************************* @@ -135,7 +135,7 @@ static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) * FUNCTION: acpi_rs_decode_specific_flags * * PARAMETERS: Resource - Address resource data struct - * Flags - Actual flag byte + * Flags - Raw AML flag byte * * RETURN: Decoded flag bits in attribute struct * @@ -189,921 +189,541 @@ acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) { - u8 flags = 0; - ACPI_FUNCTION_ENTRY(); if (resource->address.resource_type == ACPI_MEMORY_RANGE) { - /* Write Status (_RW) - flag bit[0] */ - - flags = (u8) - (resource->address.attribute.memory. - read_write_attribute & 0x01); - - /* Memory Attributes (_MEM) - flag bits[2:1] */ - - flags |= (u8) - ((resource->address.attribute.memory. - cache_attribute & 0x03) << 1); + return ((u8) + + /* Write Status (_RW) - flag bit[0] */ + ((resource->address.attribute.memory. + read_write_attribute & 0x01) | + /* Memory Attributes (_MEM) - flag bits[2:1] */ + ((resource->address.attribute.memory. + cache_attribute & 0x03) << 1))); } else if (resource->address.resource_type == ACPI_IO_RANGE) { - /* Ranges (_RNG) - flag bits[1:0] */ - - flags = (u8) - (resource->address.attribute.io.range_attribute & 0x03); - - /* Translations (_TTP and _TRS) - flag bits[5:4] */ - - flags |= (u8) - ((resource->address.attribute.io. - translation_attribute & 0x03) << 4); + return ((u8) + + /* Ranges (_RNG) - flag bits[1:0] */ + ((resource->address.attribute.io. + range_attribute & 0x03) | + /* Translations (_TTP and _TRS) - flag bits[5:4] */ + ((resource->address.attribute.io. + translation_attribute & 0x03) << 4))); } - return (flags); + return (0); } /******************************************************************************* * - * FUNCTION: acpi_rs_address16_resource + * FUNCTION: acpi_rs_set_address_common * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * Resource - Pointer to the internal resource struct * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert common flag fields from a resource descriptor to an + * AML descriptor * ******************************************************************************/ -acpi_status -acpi_rs_address16_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +static void +acpi_rs_set_address_common(union aml_resource *aml, + struct acpi_resource *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_ENTRY(); - ACPI_FUNCTION_TRACE("rs_address16_resource"); + /* Set the Resource Type (Memory, Io, bus_number, etc.) */ - /* Get the Descriptor Length field */ + aml->address.resource_type = (u8) resource->data.address.resource_type; - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Set the general flags */ - /* Validate minimum descriptor length */ + aml->address.flags = acpi_rs_encode_general_flags(&resource->data); - if (temp16 < 13) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } + /* Set the type-specific flags */ - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_ADDRESS16; + aml->address.specific_flags = + acpi_rs_encode_specific_flags(&resource->data); +} - /* Get the Resource Type (Byte3) */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_address_common + * + * PARAMETERS: Resource - Pointer to the internal resource struct + * Aml - Pointer to the AML resource descriptor + * + * RETURN: TRUE if the resource_type field is OK, FALSE otherwise + * + * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor + * to an internal resource descriptor + * + ******************************************************************************/ - buffer += 2; - temp8 = *buffer; +static u8 +acpi_rs_get_address_common(struct acpi_resource *resource, + union aml_resource *aml) +{ + ACPI_FUNCTION_ENTRY(); - /* Values 0-2 and 0xC0-0xFF are valid */ + /* Validate resource type */ - if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + if ((aml->address.resource_type > 2) + && (aml->address.resource_type < 0xC0)) { + return (FALSE); } - output_struct->data.address16.resource_type = temp8; - - /* Get the General Flags (Byte4) */ - - buffer += 1; - acpi_rs_decode_general_flags(&output_struct->data, *buffer); - - /* Get the Type Specific Flags (Byte5) */ - - buffer += 1; - acpi_rs_decode_specific_flags(&output_struct->data, *buffer); - - /* Get Granularity (Bytes 6-7) */ - - buffer += 1; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer); + /* Get the Resource Type (Memory, Io, bus_number, etc.) */ - /* Get min_address_range (Bytes 8-9) */ + resource->data.address.resource_type = aml->address.resource_type; - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, - buffer); + /* Get the General Flags */ - /* Get max_address_range (Bytes 10-11) */ + acpi_rs_decode_general_flags(&resource->data, aml->address.flags); - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, - buffer); + /* Get the Type-Specific Flags */ - /* Get address_translation_offset (Bytes 12-13) */ - - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16. - address_translation_offset, buffer); + acpi_rs_decode_specific_flags(&resource->data, + aml->address.specific_flags); + return (TRUE); +} - /* Get address_length (Bytes 14-15) */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_address16 + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. + * + ******************************************************************************/ - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, - buffer); +acpi_status +acpi_rs_get_address16(union aml_resource * aml, + u16 aml_resource_length, struct acpi_resource * resource) +{ + ACPI_FUNCTION_TRACE("rs_get_address16"); - /* Resource Source Index (if present) */ + /* Get the Resource Type, general flags, and type-specific flags */ - buffer += 2; + if (!acpi_rs_get_address_common(resource, aml)) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length */ - if (*bytes_consumed > (16 + 1)) { - /* Dereference the Index */ - - output_struct->data.address16.resource_source.index = - (u32) * buffer; - - /* Point to the String */ + acpi_rs_move_data(&resource->data.address16.granularity, + &aml->address16.granularity, 5, + ACPI_MOVE_TYPE_16_TO_32); - buffer += 1; + /* Get the optional resource_source (index and string) */ - /* Point the String pointer to the end of this structure */ + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + + acpi_rs_get_resource_source(aml_resource_length, + sizeof(struct aml_resource_address16), + &resource->data.address16. + resource_source, aml, NULL); - output_struct->data.address16.resource_source.string_ptr = - (char *)((u8 *) output_struct + struct_size); + /* Complete the resource header */ - temp_ptr = (u8 *) - output_struct->data.address16.resource_source.string_ptr; - - /* Copy the resource_source string into the buffer */ - - index = 0; - while (*buffer) { - *temp_ptr = *buffer; - - temp_ptr++; - buffer++; - index++; - } - - /* Add the terminating null and set the string length */ - - *temp_ptr = 0; - output_struct->data.address16.resource_source.string_length = - index + 1; - - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } else { - output_struct->data.address16.resource_source.index = 0; - output_struct->data.address16.resource_source.string_length = 0; - output_struct->data.address16.resource_source.string_ptr = NULL; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_ADDRESS16; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address16_stream + * FUNCTION: acpi_rs_set_address16 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_address16_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u8 *length_field; - acpi_size actual_bytes; - - ACPI_FUNCTION_TRACE("rs_address16_stream"); - - /* Set the Descriptor Type field */ + acpi_size descriptor_length; - *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; - buffer += 1; + ACPI_FUNCTION_TRACE("rs_set_address16"); - /* Save a pointer to the Length field - to be filled in later */ + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - length_field = buffer; - buffer += 2; - - /* Set the Resource Type (Memory, Io, bus_number) */ - - *buffer = (u8) (resource->data.address16.resource_type & 0x03); - buffer += 1; - - /* Set the general flags */ + acpi_rs_set_address_common(aml, resource); - *buffer = acpi_rs_encode_general_flags(&resource->data); - buffer += 1; - - /* Set the type specific flags */ - - *buffer = acpi_rs_encode_specific_flags(&resource->data); - buffer += 1; - - /* Set the address space granularity */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.granularity); - buffer += 2; - - /* Set the address range minimum */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.min_address_range); - buffer += 2; - - /* Set the address range maximum */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.max_address_range); - buffer += 2; - - /* Set the address translation offset */ - - ACPI_MOVE_32_TO_16(buffer, - &resource->data.address16. - address_translation_offset); - buffer += 2; - - /* Set the address length */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.address_length); - buffer += 2; + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&aml->address16.granularity, + &resource->data.address16.granularity, 5, + ACPI_MOVE_TYPE_32_TO_16); /* Resource Source Index and Resource Source are optional */ - if (resource->data.address16.resource_source.string_length) { - *buffer = (u8) resource->data.address16.resource_source.index; - buffer += 1; + descriptor_length = acpi_rs_set_resource_source(aml, + sizeof(struct + aml_resource_address16), + &resource->data. + address16. + resource_source); - /* Copy the resource_source string */ + /* Complete the AML descriptor header */ - ACPI_STRCPY((char *)buffer, - resource->data.address16.resource_source. - string_ptr); - - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.address16.resource_source. - string_ptr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer); - *bytes_consumed = actual_bytes; - - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - actual_bytes -= 3; - ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16, + descriptor_length, aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address32_resource + * FUNCTION: acpi_rs_get_address32 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_address32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_address32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u16 temp16; - u8 temp8; - u8 *temp_ptr; - u32 index; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); - - ACPI_FUNCTION_TRACE("rs_address32_resource"); - - /* Get the Descriptor Length field */ - - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - /* Validate minimum descriptor length */ + ACPI_FUNCTION_TRACE("rs_get_address32"); - if (temp16 < 23) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_ADDRESS32; - - /* Get the Resource Type (Byte3) */ - - buffer += 2; - temp8 = *buffer; + /* Get the Resource Type, general flags, and type-specific flags */ - /* Values 0-2 and 0xC0-0xFF are valid */ - - if ((temp8 > 2) && (temp8 < 0xC0)) { + if (!acpi_rs_get_address_common(resource, (void *)aml)) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - output_struct->data.address32.resource_type = temp8; - - /* Get the General Flags (Byte4) */ - - buffer += 1; - acpi_rs_decode_general_flags(&output_struct->data, *buffer); - - /* Get the Type Specific Flags (Byte5) */ - - buffer += 1; - acpi_rs_decode_specific_flags(&output_struct->data, *buffer); - - /* Get Granularity (Bytes 6-9) */ - - buffer += 1; - 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); - - /* Get max_address_range (Bytes 14-17) */ - - buffer += 4; - 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); - - /* Get address_length (Bytes 22-25) */ - - buffer += 4; - ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length, - buffer); - - /* Resource Source Index (if present) */ - - buffer += 4; - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length */ - if (*bytes_consumed > (26 + 1)) { - /* Dereference the Index */ - - output_struct->data.address32.resource_source.index = - (u32) * buffer; - - /* Point to the String */ + acpi_rs_move_data(&resource->data.address32.granularity, + &aml->address32.granularity, 5, + ACPI_MOVE_TYPE_32_TO_32); - buffer += 1; + /* Get the optional resource_source (index and string) */ - /* Point the String pointer to the end of this structure */ + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + + acpi_rs_get_resource_source(aml_resource_length, + sizeof(struct aml_resource_address32), + &resource->data.address32. + resource_source, aml, NULL); - output_struct->data.address32.resource_source.string_ptr = - (char *)((u8 *) output_struct + struct_size); + /* Complete the resource header */ - temp_ptr = (u8 *) - output_struct->data.address32.resource_source.string_ptr; - - /* Copy the resource_source string into the buffer */ - - index = 0; - while (*buffer) { - *temp_ptr = *buffer; - - temp_ptr++; - buffer++; - index++; - } - - /* Add the terminating null and set the string length */ - - *temp_ptr = 0; - output_struct->data.address32.resource_source.string_length = - index + 1; - - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } else { - output_struct->data.address32.resource_source.index = 0; - output_struct->data.address32.resource_source.string_length = 0; - output_struct->data.address32.resource_source.string_ptr = NULL; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_ADDRESS32; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address32_stream + * FUNCTION: acpi_rs_set_address32 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_address32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer; - u16 *length_field; - - ACPI_FUNCTION_TRACE("rs_address32_stream"); - - buffer = *output_buffer; + acpi_size descriptor_length; - /* Set the Descriptor Type field */ + ACPI_FUNCTION_TRACE("rs_set_address32"); - *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; - buffer += 1; + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - /* Save a pointer to the Length field - to be filled in later */ + acpi_rs_set_address_common(aml, resource); - length_field = ACPI_CAST_PTR(u16, buffer); - buffer += 2; - - /* Set the Resource Type (Memory, Io, bus_number) */ - - *buffer = (u8) (resource->data.address32.resource_type & 0x03); - buffer += 1; - - /* Set the general flags */ - - *buffer = acpi_rs_encode_general_flags(&resource->data); - buffer += 1; - - /* Set the type specific flags */ - - *buffer = acpi_rs_encode_specific_flags(&resource->data); - buffer += 1; - - /* Set the address space granularity */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.granularity); - buffer += 4; - - /* Set the address range minimum */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.min_address_range); - buffer += 4; - - /* Set the address range maximum */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.max_address_range); - buffer += 4; - - /* Set the address translation offset */ - - ACPI_MOVE_32_TO_32(buffer, - &resource->data.address32. - address_translation_offset); - buffer += 4; - - /* Set the address length */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.address_length); - buffer += 4; + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&aml->address32.granularity, + &resource->data.address32.granularity, 5, + ACPI_MOVE_TYPE_32_TO_32); /* Resource Source Index and Resource Source are optional */ - if (resource->data.address32.resource_source.string_length) { - *buffer = (u8) resource->data.address32.resource_source.index; - buffer += 1; - - /* Copy the resource_source string */ + descriptor_length = acpi_rs_set_resource_source(aml, + sizeof(struct + aml_resource_address32), + &resource->data. + address32. + resource_source); - ACPI_STRCPY((char *)buffer, - resource->data.address32.resource_source. - string_ptr); + /* Complete the AML descriptor header */ - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.address32.resource_source. - string_ptr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - *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); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32, + descriptor_length, aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address64_resource + * FUNCTION: acpi_rs_get_address64 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_address64_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_address64(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u16 temp16; - u8 temp8; - u8 resource_type; - u8 *temp_ptr; - u32 index; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); - - ACPI_FUNCTION_TRACE("rs_address64_resource"); - - /* Get the Descriptor Type */ - - resource_type = *buffer; - - /* Get the Descriptor Length field */ - - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - /* Validate minimum descriptor length */ - - if (temp16 < 43) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_ADDRESS64; - - /* Get the Resource Type (Byte3) */ + ACPI_FUNCTION_TRACE("rs_get_address64"); - buffer += 2; - temp8 = *buffer; + /* Get the Resource Type, general Flags, and type-specific Flags */ - /* Values 0-2 and 0xC0-0xFF are valid */ - - if ((temp8 > 2) && (temp8 < 0xC0)) { + if (!acpi_rs_get_address_common(resource, aml)) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - output_struct->data.address64.resource_type = temp8; - - /* Get the General Flags (Byte4) */ - - buffer += 1; - acpi_rs_decode_general_flags(&output_struct->data, *buffer); - - /* Get the Type Specific Flags (Byte5) */ - - buffer += 1; - acpi_rs_decode_specific_flags(&output_struct->data, *buffer); - - if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { - /* Move past revision_id and Reserved byte */ - - buffer += 2; - } - - /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ - - buffer += 1; - 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); - - /* 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); - - /* 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); + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&resource->data.address64.granularity, + &aml->address64.granularity, 5, + ACPI_MOVE_TYPE_64_TO_64); - /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ + /* Get the optional resource_source (index and string) */ - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, - buffer); + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + + acpi_rs_get_resource_source(aml_resource_length, + sizeof(struct aml_resource_address64), + &resource->data.address64. + resource_source, aml, NULL); - output_struct->data.address64.resource_source.index = 0; - output_struct->data.address64.resource_source.string_length = 0; - output_struct->data.address64.resource_source.string_ptr = NULL; + /* Complete the resource header */ - if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { - /* Get type_specific_attribute (Bytes 48-55) */ + resource->type = ACPI_RESOURCE_TYPE_ADDRESS64; + return_ACPI_STATUS(AE_OK); +} - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64. - type_specific_attributes, buffer); - } else { - output_struct->data.address64.type_specific_attributes = 0; +/******************************************************************************* + * + * FUNCTION: acpi_rs_set_address64 + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ - /* Resource Source Index (if present) */ +acpi_status +acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml) +{ + acpi_size descriptor_length; - buffer += 8; + ACPI_FUNCTION_TRACE("rs_set_address64"); - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*bytes_consumed > (46 + 1)) { - /* Dereference the Index */ + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - output_struct->data.address64.resource_source.index = - (u32) * buffer; + acpi_rs_set_address_common(aml, resource); - /* Point to the String */ + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&aml->address64.granularity, + &resource->data.address64.granularity, 5, + ACPI_MOVE_TYPE_64_TO_64); - buffer += 1; + /* Resource Source Index and Resource Source are optional */ - /* Point the String pointer to the end of this structure */ + descriptor_length = acpi_rs_set_resource_source(aml, + sizeof(struct + aml_resource_address64), + &resource->data. + address64. + resource_source); - output_struct->data.address64.resource_source. - string_ptr = - (char *)((u8 *) output_struct + struct_size); + /* Complete the AML descriptor header */ - temp_ptr = (u8 *) - output_struct->data.address64.resource_source. - string_ptr; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64, + descriptor_length, aml); + return_ACPI_STATUS(AE_OK); +} - /* Copy the resource_source string into the buffer */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_ext_address64 + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. + * + ******************************************************************************/ - index = 0; - while (*buffer) { - *temp_ptr = *buffer; +acpi_status +acpi_rs_get_ext_address64(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource) +{ - temp_ptr++; - buffer++; - index++; - } + ACPI_FUNCTION_TRACE("rs_get_ext_address64"); - /* - * Add the terminating null and set the string length - */ - *temp_ptr = 0; - output_struct->data.address64.resource_source. - string_length = index + 1; + /* Get the Resource Type, general flags, and type-specific flags */ - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } + if (!acpi_rs_get_address_common(resource, aml)) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - /* Set the Length parameter */ + /* + * Get and validate the Revision ID + * Note: Only one revision ID is currently supported + */ + resource->data.ext_address64.revision_iD = + aml->ext_address64.revision_iD; + if (aml->ext_address64.revision_iD != + AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { + return_ACPI_STATUS(AE_SUPPORT); + } - output_struct->length = (u32) struct_size; + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + * Type-Specific Attribute + */ + acpi_rs_move_data(&resource->data.ext_address64.granularity, + &aml->ext_address64.granularity, 6, + ACPI_MOVE_TYPE_64_TO_64); - /* Return the final size of the structure */ + /* Complete the resource header */ - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address64_stream + * FUNCTION: acpi_rs_set_ext_address64 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_address64_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_ext_address64(struct acpi_resource *resource, + union aml_resource *aml) { - u8 *buffer; - u16 *length_field; - - ACPI_FUNCTION_TRACE("rs_address64_stream"); - - buffer = *output_buffer; - - /* Set the Descriptor Type field */ - - *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; - buffer += 1; - - /* Save a pointer to the Length field - to be filled in later */ - - length_field = ACPI_CAST_PTR(u16, buffer); - buffer += 2; - - /* Set the Resource Type (Memory, Io, bus_number) */ - - *buffer = (u8) (resource->data.address64.resource_type & 0x03); - buffer += 1; - - /* Set the general flags */ - - *buffer = acpi_rs_encode_general_flags(&resource->data); - buffer += 1; - - /* Set the type specific flags */ - - *buffer = acpi_rs_encode_specific_flags(&resource->data); - buffer += 1; - - /* Set the address space granularity */ + ACPI_FUNCTION_TRACE("rs_set_ext_address64"); - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.granularity); - buffer += 8; + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - /* Set the address range minimum */ + acpi_rs_set_address_common(aml, resource); - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.min_address_range); - buffer += 8; + /* Only one Revision ID is currently supported */ - /* Set the address range maximum */ - - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.max_address_range); - buffer += 8; - - /* Set the address translation offset */ - - ACPI_MOVE_64_TO_64(buffer, - &resource->data.address64. - address_translation_offset); - buffer += 8; - - /* Set the address length */ - - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.address_length); - buffer += 8; - - /* Resource Source Index and Resource Source are optional */ - - if (resource->data.address64.resource_source.string_length) { - *buffer = (u8) resource->data.address64.resource_source.index; - buffer += 1; - - /* Copy the resource_source string */ - - ACPI_STRCPY((char *)buffer, - resource->data.address64.resource_source. - string_ptr); - - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.address64.resource_source. - string_ptr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; + aml->ext_address64.reserved = 0; /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + * Type-Specific Attribute */ - *length_field = (u16) (*bytes_consumed - 3); + acpi_rs_move_data(&aml->ext_address64.granularity, + &resource->data.address64.granularity, 6, + ACPI_MOVE_TYPE_64_TO_64); + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, + sizeof(struct + aml_resource_extended_address64), + aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 2da7c6a8182..d170dee07ce 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -44,87 +44,14 @@ #include #include #include -#include #include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rscalc") -/* - * Base sizes for external resource descriptors, indexed by internal type. - * Includes size of the descriptor header (1 byte for small descriptors, - * 3 bytes for large descriptors) - */ -static u8 acpi_gbl_stream_sizes[] = { - 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */ - 3, /* ACPI_RSTYPE_DMA */ - 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */ - 1, /* ACPI_RSTYPE_END_DPF */ - 8, /* ACPI_RSTYPE_IO */ - 4, /* ACPI_RSTYPE_FIXED_IO */ - 1, /* ACPI_RSTYPE_VENDOR */ - 2, /* ACPI_RSTYPE_END_TAG */ - 12, /* ACPI_RSTYPE_MEM24 */ - 20, /* ACPI_RSTYPE_MEM32 */ - 12, /* ACPI_RSTYPE_FIXED_MEM32 */ - 16, /* ACPI_RSTYPE_ADDRESS16 */ - 26, /* ACPI_RSTYPE_ADDRESS32 */ - 46, /* ACPI_RSTYPE_ADDRESS64 */ - 9, /* ACPI_RSTYPE_EXT_IRQ */ - 15 /* ACPI_RSTYPE_GENERIC_REG */ -}; - -/* - * Base sizes of resource descriptors, both the actual AML stream length and - * size of the internal struct representation. - */ -struct acpi_resource_sizes { - u8 minimum_stream_size; - u8 minimum_struct_size; -}; - -static struct acpi_resource_sizes acpi_gbl_sm_resource_sizes[] = { - {0, 0}, /* 0x00, Reserved */ - {0, 0}, /* 0x01, Reserved */ - {0, 0}, /* 0x02, Reserved */ - {0, 0}, /* 0x03, Reserved */ - {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, /* ACPI_RDESC_TYPE_IRQ_FORMAT */ - {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, /* ACPI_RDESC_TYPE_DMA_FORMAT */ - {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf)}, /* ACPI_RDESC_TYPE_START_DEPENDENT */ - {1, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_DEPENDENT */ - {8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, /* ACPI_RDESC_TYPE_IO_PORT */ - {4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ - {0, 0}, /* 0x0A, Reserved */ - {0, 0}, /* 0x0B, Reserved */ - {0, 0}, /* 0x0C, Reserved */ - {0, 0}, /* 0x0D, Reserved */ - {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_SMALL_VENDOR */ - {2, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_TAG */ -}; - -static struct acpi_resource_sizes acpi_gbl_lg_resource_sizes[] = { - {0, 0}, /* 0x00, Reserved */ - {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24)}, /* ACPI_RDESC_TYPE_MEMORY_24 */ - {15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg)}, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ - {0, 0}, /* 0x03, Reserved */ - {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_LARGE_VENDOR */ - {20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32)}, /* ACPI_RDESC_TYPE_MEMORY_32 */ - {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32)}, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ - {26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ - {16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ - {9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq)}, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ - {46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ - {56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ -}; - /* Local prototypes */ - static u8 acpi_rs_count_set_bits(u16 bit_field); -static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type); - -static u16 acpi_rs_get_resource_length(u8 * resource); - static acpi_size acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); @@ -159,90 +86,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) return (bits_set); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_resource_sizes - * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor - * - * RETURN: Pointer to the resource conversion handler - * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. - * - ******************************************************************************/ - -static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type) -{ - struct acpi_resource_sizes *size_info; - - ACPI_FUNCTION_ENTRY(); - - /* Determine if this is a small or large resource */ - - if (resource_type & ACPI_RDESC_TYPE_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - if (resource_type > ACPI_RDESC_LARGE_MAX) { - return (NULL); - } - - size_info = &acpi_gbl_lg_resource_sizes[(resource_type & - ACPI_RDESC_LARGE_MASK)]; - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - size_info = &acpi_gbl_sm_resource_sizes[((resource_type & - ACPI_RDESC_SMALL_MASK) - >> 3)]; - } - - /* Zero entry indicates an invalid resource type */ - - if (!size_info->minimum_stream_size) { - return (NULL); - } - - return (size_info); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_resource_length - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * - * RETURN: Byte length of the (AML byte stream) descriptor. By definition, - * this does not include the size of the descriptor header and the - * length field itself. - * - * DESCRIPTION: Extract the length of a resource descriptor. - * - ******************************************************************************/ - -static u16 acpi_rs_get_resource_length(u8 * resource) -{ - u16 resource_length; - - ACPI_FUNCTION_ENTRY(); - - /* Determine if this is a small or large resource */ - - if (*resource & ACPI_RDESC_TYPE_LARGE) { - /* Large Resource type -- length is in bytes 1-2 */ - - ACPI_MOVE_16_TO_16(&resource_length, (resource + 1)); - - } else { - /* Small Resource Type -- bits 2:0 of byte 0 contain the length */ - - resource_length = - (u16) (*resource & ACPI_RDESC_SMALL_LENGTH_MASK); - } - - return (resource_length); -} - /******************************************************************************* * * FUNCTION: acpi_rs_struct_option_length @@ -291,10 +134,10 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) ******************************************************************************/ static u32 -acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) +acpi_rs_stream_option_length(u32 resource_length, + u32 minimum_aml_resource_length) { u32 string_length = 0; - u32 minimum_resource_length; ACPI_FUNCTION_ENTRY(); @@ -303,11 +146,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) * Large-type resource descriptors. */ - /* Compute minimum size of the data part of the resource descriptor */ - - minimum_resource_length = - minimum_total_length - sizeof(struct asl_large_header); - /* * If the length of the actual resource descriptor is greater than the ACPI * spec-defined minimum length, it means that a resource_source_index exists @@ -315,10 +153,11 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) * (including the null terminator) is the resource length minus the minimum * length, minus one byte for the resource_source_index itself. */ - if (resource_length > minimum_resource_length) { + if (resource_length > minimum_aml_resource_length) { /* Compute the length of the optional string */ - string_length = resource_length - minimum_resource_length - 1; + string_length = + resource_length - minimum_aml_resource_length - 1; } /* Round up length to 32 bits for internal structure alignment */ @@ -328,7 +167,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) /******************************************************************************* * - * FUNCTION: acpi_rs_get_byte_stream_length + * FUNCTION: acpi_rs_get_aml_length * * PARAMETERS: Resource - Pointer to the resource linked list * size_needed - Where the required size is returned @@ -342,62 +181,62 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) ******************************************************************************/ acpi_status -acpi_rs_get_byte_stream_length(struct acpi_resource * resource, - acpi_size * size_needed) +acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) { - acpi_size byte_stream_size_needed = 0; + acpi_size aml_size_needed = 0; acpi_size segment_size; - ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); + ACPI_FUNCTION_TRACE("rs_get_aml_length"); /* Traverse entire list of internal resource descriptors */ while (resource) { /* Validate the descriptor type */ - if (resource->type > ACPI_RSTYPE_MAX) { + if (resource->type > ACPI_RESOURCE_TYPE_MAX) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } /* Get the base size of the (external stream) resource descriptor */ - segment_size = acpi_gbl_stream_sizes[resource->type]; + segment_size = acpi_gbl_aml_resource_sizes[resource->type]; /* * Augment the base size for descriptors with optional and/or * variable-length fields */ switch (resource->type) { - case ACPI_RSTYPE_VENDOR: + case ACPI_RESOURCE_TYPE_VENDOR: /* * Vendor Defined Resource: * For a Vendor Specific resource, if the Length is between 1 and 7 * it will be created as a Small Resource data type, otherwise it * is a Large Resource data type. */ - if (resource->data.vendor_specific.length > 7) { + if (resource->data.vendor.byte_length > 7) { /* Base size of a Large resource descriptor */ - segment_size = 3; + segment_size = + sizeof(struct aml_resource_large_header); } /* Add the size of the vendor-specific data */ - segment_size += resource->data.vendor_specific.length; + segment_size += resource->data.vendor.byte_length; break; - case ACPI_RSTYPE_END_TAG: + case ACPI_RESOURCE_TYPE_END_TAG: /* * End Tag: * We are done -- return the accumulated total size. */ - *size_needed = byte_stream_size_needed + segment_size; + *size_needed = aml_size_needed + segment_size; /* Normal exit */ return_ACPI_STATUS(AE_OK); - case ACPI_RSTYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS16: /* * 16-Bit Address Resource: * Add the size of the optional resource_source info @@ -408,7 +247,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, resource_source); break; - case ACPI_RSTYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS32: /* * 32-Bit Address Resource: * Add the size of the optional resource_source info @@ -419,7 +258,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, resource_source); break; - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS64: /* * 64-Bit Address Resource: * Add the size of the optional resource_source info @@ -430,7 +269,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, resource_source); break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: /* * Extended IRQ Resource: * Add the size of each additional optional interrupt beyond the @@ -438,7 +277,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, */ segment_size += (((acpi_size) resource->data.extended_irq. - number_of_interrupts - 1) * 4); + interrupt_count - 1) * 4); /* Add the size of the optional resource_source info */ @@ -454,7 +293,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, /* Update the total */ - byte_stream_size_needed += segment_size; + aml_size_needed += segment_size; /* Point to the next object */ @@ -471,9 +310,9 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, * * FUNCTION: acpi_rs_get_list_length * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * byte_stream_buffer_length - Size of byte_stream_buffer - * size_needed - Where the size needed is returned + * PARAMETERS: aml_buffer - Pointer to the resource byte stream + * aml_buffer_length - Size of aml_buffer + * size_needed - Where the size needed is returned * * RETURN: Status * @@ -484,11 +323,11 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ******************************************************************************/ 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 * aml_buffer, + u32 aml_buffer_length, acpi_size * size_needed) { u8 *buffer; - struct acpi_resource_sizes *resource_info; + struct acpi_resource_info *resource_info; u32 buffer_size = 0; u32 bytes_parsed = 0; u8 resource_type; @@ -499,14 +338,14 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_FUNCTION_TRACE("rs_get_list_length"); - while (bytes_parsed < byte_stream_buffer_length) { + while (bytes_parsed < aml_buffer_length) { /* The next byte in the stream is the resource descriptor type */ - resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); + resource_type = acpi_rs_get_resource_type(*aml_buffer); /* Get the base stream size and structure sizes for the descriptor */ - resource_info = acpi_rs_get_resource_sizes(resource_type); + resource_info = acpi_rs_get_resource_info(resource_type); if (!resource_info) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } @@ -514,43 +353,46 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, /* Get the Length field from the input resource descriptor */ resource_length = - acpi_rs_get_resource_length(byte_stream_buffer); + acpi_rs_get_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); /* Augment the size for descriptors with optional fields */ extra_struct_bytes = 0; - if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) { + if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) { /* * Small resource descriptors */ - header_length = 1; - buffer = byte_stream_buffer + header_length; + header_length = + sizeof(struct aml_resource_small_header); + buffer = aml_buffer + header_length; switch (resource_type) { - case ACPI_RDESC_TYPE_IRQ_FORMAT: + case ACPI_RESOURCE_NAME_IRQ: /* * IRQ Resource: * Get the number of bits set in the IRQ word */ ACPI_MOVE_16_TO_16(&temp16, buffer); - extra_struct_bytes = (acpi_rs_count_set_bits(temp16) * sizeof(u32)); break; - case ACPI_RDESC_TYPE_DMA_FORMAT: + case ACPI_RESOURCE_NAME_DMA: /* * DMA Resource: * Get the number of bits set in the DMA channels byte */ + ACPI_MOVE_16_TO_16(&temp16, buffer); extra_struct_bytes = - (acpi_rs_count_set_bits((u16) * buffer) * + (acpi_rs_count_set_bits(temp16) * sizeof(u32)); break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: + case ACPI_RESOURCE_NAME_VENDOR_SMALL: /* * Vendor Specific Resource: * Ensure a 32-bit boundary for the structure @@ -559,12 +401,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_ROUND_UP_to_32_bITS(resource_length); break; - case ACPI_RDESC_TYPE_END_TAG: + case ACPI_RESOURCE_NAME_END_TAG: /* * End Tag: * Terminate the loop now */ - byte_stream_buffer_length = bytes_parsed; + aml_buffer_length = bytes_parsed; break; default: @@ -574,11 +416,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, /* * Large resource descriptors */ - header_length = sizeof(struct asl_large_header); - buffer = byte_stream_buffer + header_length; + header_length = + sizeof(struct aml_resource_large_header); + buffer = aml_buffer + header_length; switch (resource_type) { - case ACPI_RDESC_TYPE_LARGE_VENDOR: + case ACPI_RESOURCE_NAME_VENDOR_LARGE: /* * Vendor Defined Resource: * Add vendor data and ensure a 32-bit boundary for the structure @@ -587,8 +430,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_ROUND_UP_to_32_bITS(resource_length); break; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: + case ACPI_RESOURCE_NAME_ADDRESS32: + case ACPI_RESOURCE_NAME_ADDRESS16: /* * 32-Bit or 16-bit Address Resource: * Add the size of any optional data (resource_source) @@ -596,10 +439,11 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, extra_struct_bytes = acpi_rs_stream_option_length (resource_length, - resource_info->minimum_stream_size); + resource_info-> + minimum_aml_resource_length); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: + case ACPI_RESOURCE_NAME_EXTENDED_IRQ: /* * Extended IRQ: * Point past the interrupt_vector_flags to get the @@ -622,10 +466,10 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, - extra_struct_bytes, resource_info-> - minimum_stream_size); + minimum_aml_resource_length); break; - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: + case ACPI_RESOURCE_NAME_ADDRESS64: /* * 64-Bit Address Resource: * Add the size of any optional data (resource_source) @@ -635,7 +479,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_ROUND_UP_to_64_bITS (acpi_rs_stream_option_length (resource_length, - resource_info->minimum_stream_size)); + resource_info-> + minimum_aml_resource_length)); break; default: @@ -646,7 +491,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, /* Update the required buffer size for the internal descriptor structs */ temp16 = - (u16) (resource_info->minimum_struct_size + + (u16) (resource_info->minimum_internal_struct_length + extra_struct_bytes); buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); @@ -656,7 +501,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, */ temp16 = (u16) (header_length + resource_length); bytes_parsed += temp16; - byte_stream_buffer += temp16; + aml_buffer += temp16; } /* This is the data the caller needs */ @@ -758,8 +603,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, (*sub_object_list)->string. length + 1); } else { - temp_size_needed += - acpi_ns_get_pathname_length((*sub_object_list)->reference.node); + temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); } } else { /* diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 0911526b7ad..6c7c6c56063 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate") * * FUNCTION: acpi_rs_create_resource_list * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * output_buffer - Pointer to the user's buffer + * PARAMETERS: aml_buffer - Pointer to the resource byte stream + * output_buffer - Pointer to the user's buffer * - * RETURN: Status - AE_OK if okay, else a valid acpi_status code + * RETURN: Status: AE_OK if okay, else a valid acpi_status code * If output_buffer is not large enough, output_buffer_length * indicates how large output_buffer should be, else it * indicates how may u8 elements of output_buffer are valid. @@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate") * ******************************************************************************/ acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, +acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, struct acpi_buffer *output_buffer) { acpi_status status; - u8 *byte_stream_start; + u8 *aml_start; acpi_size list_size_needed = 0; - u32 byte_stream_buffer_length; + u32 aml_buffer_length; 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, "aml_buffer = %p\n", aml_buffer)); /* Params already validated, so we don't re-validate here */ - byte_stream_buffer_length = byte_stream_buffer->buffer.length; - byte_stream_start = byte_stream_buffer->buffer.pointer; + aml_buffer_length = aml_buffer->buffer.length; + aml_start = aml_buffer->buffer.pointer; /* - * Pass the byte_stream_buffer into a module that can calculate + * Pass the aml_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); + status = acpi_rs_get_list_length(aml_start, aml_buffer_length, + &list_size_needed); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", status, (u32) list_size_needed)); @@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, /* Do the conversion */ - status = - acpi_rs_byte_stream_to_list(byte_stream_start, - byte_stream_buffer_length, - output_buffer->pointer); + status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -360,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /******************************************************************************* * - * FUNCTION: acpi_rs_create_byte_stream + * FUNCTION: acpi_rs_create_aml_resources * * PARAMETERS: linked_list_buffer - Pointer to the resource linked list * output_buffer - Pointer to the user's buffer @@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ******************************************************************************/ acpi_status -acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer) { acpi_status status; - acpi_size byte_stream_size_needed = 0; + acpi_size aml_size_needed = 0; - ACPI_FUNCTION_TRACE("rs_create_byte_stream"); + ACPI_FUNCTION_TRACE("rs_create_aml_resources"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", linked_list_buffer)); @@ -394,11 +389,10 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, * 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); + status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", - (u32) byte_stream_size_needed, + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", + (u32) aml_size_needed, acpi_format_exception(status))); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, /* Validate/Allocate/Clear caller buffer */ - status = - acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); + status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, /* Do the conversion */ status = - acpi_rs_list_to_byte_stream(linked_list_buffer, - byte_stream_size_needed, - output_buffer->pointer); + acpi_rs_convert_resources_to_aml(linked_list_buffer, + aml_size_needed, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 9d93ee5f006..2f8990845b2 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -49,38 +49,6 @@ ACPI_MODULE_NAME("rsdump") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* Local prototypes */ -static void acpi_rs_dump_irq(union acpi_resource_data *resource); - -static void acpi_rs_dump_address16(union acpi_resource_data *resource); - -static void acpi_rs_dump_address32(union acpi_resource_data *resource); - -static void acpi_rs_dump_address64(union acpi_resource_data *resource); - -static void acpi_rs_dump_dma(union acpi_resource_data *resource); - -static void acpi_rs_dump_io(union acpi_resource_data *resource); - -static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource); - -static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); - -static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); - -static void acpi_rs_dump_memory24(union acpi_resource_data *resource); - -static void acpi_rs_dump_memory32(union acpi_resource_data *resource); - -static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource); - -static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource); - -static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); - -static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource); - -static void acpi_rs_dump_end_tag(union acpi_resource_data *resource); - static void acpi_rs_out_string(char *title, char *value); static void acpi_rs_out_integer8(char *title, u8 value); @@ -104,30 +72,6 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); static void acpi_rs_dump_address_common(union acpi_resource_data *resource); -/* Dispatch table for resource dump functions */ - -typedef -void (*ACPI_DUMP_RESOURCE) (union acpi_resource_data * data); - -static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = { - acpi_rs_dump_irq, /* ACPI_RSTYPE_IRQ */ - acpi_rs_dump_dma, /* ACPI_RSTYPE_DMA */ - acpi_rs_dump_start_depend_fns, /* ACPI_RSTYPE_START_DPF */ - acpi_rs_dump_end_depend_fns, /* ACPI_RSTYPE_END_DPF */ - acpi_rs_dump_io, /* ACPI_RSTYPE_IO */ - acpi_rs_dump_fixed_io, /* ACPI_RSTYPE_FIXED_IO */ - acpi_rs_dump_vendor_specific, /* ACPI_RSTYPE_VENDOR */ - acpi_rs_dump_end_tag, /* ACPI_RSTYPE_END_TAG */ - acpi_rs_dump_memory24, /* ACPI_RSTYPE_MEM24 */ - acpi_rs_dump_memory32, /* ACPI_RSTYPE_MEM32 */ - acpi_rs_dump_fixed_memory32, /* ACPI_RSTYPE_FIXED_MEM32 */ - acpi_rs_dump_address16, /* ACPI_RSTYPE_ADDRESS16 */ - acpi_rs_dump_address32, /* ACPI_RSTYPE_ADDRESS32 */ - acpi_rs_dump_address64, /* ACPI_RSTYPE_ADDRESS64 */ - acpi_rs_dump_extended_irq, /* ACPI_RSTYPE_EXT_IRQ */ - acpi_rs_dump_generic_reg /* ACPI_RSTYPE_GENERIC_REG */ -}; - /******************************************************************************* * * FUNCTION: acpi_rs_out* @@ -144,32 +88,32 @@ static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = { static void acpi_rs_out_string(char *title, char *value) { - acpi_os_printf("%30s : %s\n", title, value); + acpi_os_printf("%27s : %s\n", title, value); } static void acpi_rs_out_integer8(char *title, u8 value) { - acpi_os_printf("%30s : %2.2X\n", title, value); + acpi_os_printf("%27s : %2.2X\n", title, value); } static void acpi_rs_out_integer16(char *title, u16 value) { - acpi_os_printf("%30s : %4.4X\n", title, value); + acpi_os_printf("%27s : %4.4X\n", title, value); } static void acpi_rs_out_integer32(char *title, u32 value) { - acpi_os_printf("%30s : %8.8X\n", title, value); + acpi_os_printf("%27s : %8.8X\n", title, value); } static void acpi_rs_out_integer64(char *title, u64 value) { - acpi_os_printf("%30s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); + acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); } static void acpi_rs_out_title(char *title) { - acpi_os_printf("%30s : ", title); + acpi_os_printf("%27s : ", title); } /******************************************************************************* @@ -190,7 +134,7 @@ static void acpi_rs_dump_byte_list(u32 length, u8 * data) u32 i; for (i = 0; i < length; i++) { - acpi_os_printf("%28s%2.2X : %2.2X\n", "Byte", i, data[i]); + acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); } } @@ -199,7 +143,7 @@ static void acpi_rs_dump_dword_list(u32 length, u32 * data) u32 i; for (i = 0; i < length; i++) { - acpi_os_printf("%28s%2.2X : %8.8X\n", "Dword", i, data[i]); + acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); } } @@ -213,6 +157,14 @@ static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) acpi_os_printf("\n"); } +static void acpi_rs_dump_memory_attribute(u32 read_write_attribute) +{ + + acpi_rs_out_string("Read/Write Attribute", + ACPI_READ_WRITE_MEMORY == read_write_attribute ? + "Read/Write" : "Read-Only"); +} + /******************************************************************************* * * FUNCTION: acpi_rs_dump_resource_source @@ -229,6 +181,7 @@ static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) static void acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) { + ACPI_FUNCTION_ENTRY(); if (resource_source->index == 0xFF) { return; @@ -290,11 +243,8 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) break; } - acpi_rs_out_string("Read/Write Attribute", - ACPI_READ_WRITE_MEMORY == - resource->address.attribute.memory. - read_write_attribute ? "Read/Write" : - "Read Only"); + acpi_rs_dump_memory_attribute(resource->address.attribute. + memory.read_write_attribute); break; case ACPI_IO_RANGE: @@ -392,7 +342,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Validate Type before dispatch */ - if (resource_list->type > ACPI_RSTYPE_MAX) { + if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) { acpi_os_printf ("Invalid descriptor type (%X) in resource list\n", resource_list->type); @@ -406,7 +356,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Exit on end tag */ - if (resource_list->type == ACPI_RSTYPE_END_TAG) { + if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) { return; } @@ -431,7 +381,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) * ******************************************************************************/ -static void acpi_rs_dump_irq(union acpi_resource_data *resource) +void acpi_rs_dump_irq(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -439,22 +389,21 @@ static void acpi_rs_dump_irq(union acpi_resource_data *resource) acpi_rs_out_string("Triggering", ACPI_LEVEL_SENSITIVE == - resource->irq.edge_level ? "Level" : "Edge"); + resource->irq.triggering ? "Level" : "Edge"); acpi_rs_out_string("Active", ACPI_ACTIVE_LOW == - resource->irq.active_high_low ? "Low" : "High"); + resource->irq.polarity ? "Low" : "High"); acpi_rs_out_string("Sharing", ACPI_SHARED == - resource->irq. - shared_exclusive ? "Shared" : "Exclusive"); + resource->irq.sharable ? "Shared" : "Exclusive"); acpi_rs_out_integer8("Interrupt Count", - (u8) resource->irq.number_of_interrupts); + (u8) resource->irq.interrupt_count); acpi_rs_out_title("Interrupt List"); - acpi_rs_dump_short_byte_list(resource->irq.number_of_interrupts, + acpi_rs_dump_short_byte_list(resource->irq.interrupt_count, resource->irq.interrupts); } @@ -470,7 +419,7 @@ static void acpi_rs_dump_irq(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_dma(union acpi_resource_data *resource) +void acpi_rs_dump_dma(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -523,16 +472,16 @@ static void acpi_rs_dump_dma(union acpi_resource_data *resource) } acpi_rs_out_integer8("DMA Channel Count", - (u8) resource->dma.number_of_channels); + (u8) resource->dma.channel_count); acpi_rs_out_title("Channel List"); - acpi_rs_dump_short_byte_list(resource->dma.number_of_channels, + acpi_rs_dump_short_byte_list(resource->dma.channel_count, resource->dma.channels); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_start_depend_fns + * FUNCTION: acpi_rs_dump_start_dpf * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -542,7 +491,7 @@ static void acpi_rs_dump_dma(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource) +void acpi_rs_dump_start_dpf(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -600,7 +549,7 @@ static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_io(union acpi_resource_data *resource) +void acpi_rs_dump_io(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -610,15 +559,13 @@ static void acpi_rs_dump_io(union acpi_resource_data *resource) ACPI_DECODE_16 == resource->io.io_decode ? "16-bit" : "10-bit"); - acpi_rs_out_integer32("Range Minimum Base", - resource->io.min_base_address); + acpi_rs_out_integer32("Address Minimum", resource->io.minimum); - acpi_rs_out_integer32("Range Maximum Base", - resource->io.max_base_address); + acpi_rs_out_integer32("Address Maximum", resource->io.maximum); acpi_rs_out_integer32("Alignment", resource->io.alignment); - acpi_rs_out_integer32("Range Length", resource->io.range_length); + acpi_rs_out_integer32("Address Length", resource->io.address_length); } /******************************************************************************* @@ -633,21 +580,21 @@ static void acpi_rs_dump_io(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) +void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("Fixed I/O Resource\n"); - acpi_rs_out_integer32("Range Base Address", - resource->fixed_io.base_address); + acpi_rs_out_integer32("Address", resource->fixed_io.address); - acpi_rs_out_integer32("Range Length", resource->fixed_io.range_length); + acpi_rs_out_integer32("Address Length", + resource->fixed_io.address_length); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_vendor_specific + * FUNCTION: acpi_rs_dump_vendor * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -657,16 +604,16 @@ static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource) +void acpi_rs_dump_vendor(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("Vendor Specific Resource\n"); - acpi_rs_out_integer16("Length", (u16) resource->vendor_specific.length); + acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length); - acpi_rs_dump_byte_list(resource->vendor_specific.length, - resource->vendor_specific.reserved); + acpi_rs_dump_byte_list(resource->vendor.byte_length, + resource->vendor.byte_data); } /******************************************************************************* @@ -681,27 +628,24 @@ static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_memory24(union acpi_resource_data *resource) +void acpi_rs_dump_memory24(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("24-Bit Memory Range Resource\n"); - acpi_rs_out_string("Attribute", - ACPI_READ_WRITE_MEMORY == - resource->memory24.read_write_attribute ? - "Read/Write" : "Read Only"); + acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute); - acpi_rs_out_integer16("Range Minimum Base", - (u16) resource->memory24.min_base_address); + acpi_rs_out_integer16("Address Minimum", + (u16) resource->memory24.minimum); - acpi_rs_out_integer16("Range Maximum Base", - (u16) resource->memory24.max_base_address); + acpi_rs_out_integer16("Address Maximum", + (u16) resource->memory24.maximum); acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment); - acpi_rs_out_integer16("Range Length", - (u16) resource->memory24.range_length); + acpi_rs_out_integer16("Address Length", + (u16) resource->memory24.address_length); } /******************************************************************************* @@ -716,26 +660,22 @@ static void acpi_rs_dump_memory24(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_memory32(union acpi_resource_data *resource) +void acpi_rs_dump_memory32(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("32-Bit Memory Range Resource\n"); - acpi_rs_out_string("Attribute", - ACPI_READ_WRITE_MEMORY == - resource->memory32.read_write_attribute ? - "Read/Write" : "Read Only"); + acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute); - acpi_rs_out_integer32("Range Minimum Base", - resource->memory32.min_base_address); + acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum); - acpi_rs_out_integer32("Range Maximum Base", - resource->memory32.max_base_address); + acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum); acpi_rs_out_integer32("Alignment", resource->memory32.alignment); - acpi_rs_out_integer32("Range Length", resource->memory32.range_length); + acpi_rs_out_integer32("Address Length", + resource->memory32.address_length); } /******************************************************************************* @@ -750,22 +690,19 @@ static void acpi_rs_dump_memory32(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) +void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); - acpi_rs_out_string("Attribute", - ACPI_READ_WRITE_MEMORY == - resource->fixed_memory32.read_write_attribute ? - "Read/Write" : "Read Only"); + acpi_rs_dump_memory_attribute(resource->fixed_memory32. + read_write_attribute); - acpi_rs_out_integer32("Range Base Address", - resource->fixed_memory32.range_base_address); + acpi_rs_out_integer32("Address", resource->fixed_memory32.address); - acpi_rs_out_integer32("Range Length", - resource->fixed_memory32.range_length); + acpi_rs_out_integer32("Address Length", + resource->fixed_memory32.address_length); } /******************************************************************************* @@ -780,26 +717,25 @@ static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_address16(union acpi_resource_data *resource) +void acpi_rs_dump_address16(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); - acpi_os_printf("16-Bit Address Space Resource\n"); + acpi_os_printf("16-Bit WORD Address Space Resource\n"); acpi_rs_dump_address_common(resource); acpi_rs_out_integer16("Granularity", (u16) resource->address16.granularity); - acpi_rs_out_integer16("Address Range Min", - (u16) resource->address16.min_address_range); + acpi_rs_out_integer16("Address Minimum", + (u16) resource->address16.minimum); - acpi_rs_out_integer16("Address Range Max", - (u16) resource->address16.max_address_range); + acpi_rs_out_integer16("Address Maximum", + (u16) resource->address16.maximum); - acpi_rs_out_integer16("Address Translation Offset", - (u16) resource->address16. - address_translation_offset); + acpi_rs_out_integer16("Translation Offset", + (u16) resource->address16.translation_offset); acpi_rs_out_integer16("Address Length", (u16) resource->address16.address_length); @@ -819,24 +755,22 @@ static void acpi_rs_dump_address16(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_address32(union acpi_resource_data *resource) +void acpi_rs_dump_address32(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); - acpi_os_printf("32-Bit Address Space Resource\n"); + acpi_os_printf("32-Bit DWORD Address Space Resource\n"); acpi_rs_dump_address_common(resource); acpi_rs_out_integer32("Granularity", resource->address32.granularity); - acpi_rs_out_integer32("Address Range Min", - resource->address32.min_address_range); + acpi_rs_out_integer32("Address Minimum", resource->address32.minimum); - acpi_rs_out_integer32("Address Range Max", - resource->address32.max_address_range); + acpi_rs_out_integer32("Address Maximum", resource->address32.maximum); - acpi_rs_out_integer32("Address Translation Offset", - resource->address32.address_translation_offset); + acpi_rs_out_integer32("Translation Offset", + resource->address32.translation_offset); acpi_rs_out_integer32("Address Length", resource->address32.address_length); @@ -856,37 +790,32 @@ static void acpi_rs_dump_address32(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_address64(union acpi_resource_data *resource) +void acpi_rs_dump_address64(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); - acpi_os_printf("64-Bit Address Space Resource\n"); + acpi_os_printf("64-Bit QWORD Address Space Resource\n"); acpi_rs_dump_address_common(resource); acpi_rs_out_integer64("Granularity", resource->address64.granularity); - acpi_rs_out_integer64("Address Range Min", - resource->address64.min_address_range); + acpi_rs_out_integer64("Address Minimum", resource->address64.minimum); - acpi_rs_out_integer64("Address Range Max", - resource->address64.max_address_range); + acpi_rs_out_integer64("Address Maximum", resource->address64.maximum); - acpi_rs_out_integer64("Address Translation Offset", - resource->address64.address_translation_offset); + acpi_rs_out_integer64("Translation Offset", + resource->address64.translation_offset); acpi_rs_out_integer64("Address Length", resource->address64.address_length); - acpi_rs_out_integer64("Type Specific Attributes", - resource->address64.type_specific_attributes); - acpi_rs_dump_resource_source(&resource->address64.resource_source); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_extended_irq + * FUNCTION: acpi_rs_dump_ext_address64 * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -896,7 +825,46 @@ static void acpi_rs_dump_address64(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) +void acpi_rs_dump_ext_address64(union acpi_resource_data *resource) +{ + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("64-Bit Extended Address Space Resource\n"); + + acpi_rs_dump_address_common(resource); + + acpi_rs_out_integer64("Granularity", + resource->ext_address64.granularity); + + acpi_rs_out_integer64("Address Minimum", + resource->ext_address64.minimum); + + acpi_rs_out_integer64("Address Maximum", + resource->ext_address64.maximum); + + acpi_rs_out_integer64("Translation Offset", + resource->ext_address64.translation_offset); + + acpi_rs_out_integer64("Address Length", + resource->ext_address64.address_length); + + acpi_rs_out_integer64("Type-Specific Attribute", + resource->ext_address64.type_specific_attributes); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_ext_irq + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void acpi_rs_dump_ext_irq(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -910,24 +878,22 @@ static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) acpi_rs_out_string("Triggering", ACPI_LEVEL_SENSITIVE == resource->extended_irq. - edge_level ? "Level" : "Edge"); + triggering ? "Level" : "Edge"); acpi_rs_out_string("Active", - ACPI_ACTIVE_LOW == - resource->extended_irq. - active_high_low ? "Low" : "High"); + ACPI_ACTIVE_LOW == resource->extended_irq.polarity ? + "Low" : "High"); acpi_rs_out_string("Sharing", - ACPI_SHARED == - resource->extended_irq. - shared_exclusive ? "Shared" : "Exclusive"); + ACPI_SHARED == resource->extended_irq.sharable ? + "Shared" : "Exclusive"); acpi_rs_dump_resource_source(&resource->extended_irq.resource_source); acpi_rs_out_integer8("Interrupts", - (u8) resource->extended_irq.number_of_interrupts); + (u8) resource->extended_irq.interrupt_count); - acpi_rs_dump_dword_list(resource->extended_irq.number_of_interrupts, + acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count, resource->extended_irq.interrupts); } @@ -943,9 +909,8 @@ static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) +void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) { - ACPI_FUNCTION_ENTRY(); acpi_os_printf("Generic Register Resource\n"); @@ -957,15 +922,15 @@ static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) acpi_rs_out_integer8("Bit Offset", (u8) resource->generic_reg.bit_offset); - acpi_rs_out_integer8("Address Size", - (u8) resource->generic_reg.address_size); + acpi_rs_out_integer8("Access Size", + (u8) resource->generic_reg.access_size); acpi_rs_out_integer64("Address", resource->generic_reg.address); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_end_depend_fns + * FUNCTION: acpi_rs_dump_end_dpf * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -975,7 +940,7 @@ static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource) +void acpi_rs_dump_end_dpf(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -994,7 +959,7 @@ static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_end_tag(union acpi_resource_data *resource) +void acpi_rs_dump_end_tag(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 49a5f81c727..b31cb33ec56 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -207,7 +207,7 @@ struct acpi_resource_info acpi_gbl_lg_resource_info[] = { {0, ACPI_RLARGE(struct aml_resource_memory24), ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, {0, ACPI_RLARGE(struct aml_resource_generic_register), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_registerister)}, + ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)}, {0, 0, 0}, {1, ACPI_RLARGE(struct aml_resource_vendor_large), ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 6574e2ae2e5..0dab8cdfa80 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -49,426 +49,269 @@ ACPI_MODULE_NAME("rsio") /******************************************************************************* * - * FUNCTION: acpi_rs_io_resource + * FUNCTION: acpi_rs_get_io * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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_get_io"); - ACPI_FUNCTION_TRACE("rs_io_resource"); + /* Get the Decode flag */ - /* The number of bytes consumed are Constant */ + resource->data.io.io_decode = aml->io.information & 0x01; - *bytes_consumed = 8; + /* + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Alignment + * Length + */ + ACPI_MOVE_16_TO_32(&resource->data.io.minimum, &aml->io.minimum); + ACPI_MOVE_16_TO_32(&resource->data.io.maximum, &aml->io.maximum); + resource->data.io.alignment = aml->io.alignment; + resource->data.io.address_length = aml->io.address_length; - output_struct->type = ACPI_RSTYPE_IO; + /* Complete the resource header */ - /* Check Decode */ - - buffer += 1; - temp8 = *buffer; - - output_struct->data.io.io_decode = temp8 & 0x01; - - /* Check min_base Address */ - - buffer += 1; - 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); - - output_struct->data.io.max_base_address = temp16; - - /* Check Base alignment */ - - buffer += 2; - temp8 = *buffer; - - output_struct->data.io.alignment = temp8; - - /* Check range_length */ - - buffer += 1; - temp8 = *buffer; - - output_struct->data.io.range_length = temp8; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_IO; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_io_resource + * FUNCTION: acpi_rs_set_io * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml) { - 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"); + ACPI_FUNCTION_TRACE("rs_set_io"); - /* The number of bytes consumed are Constant */ + /* I/O Information Byte */ - *bytes_consumed = 4; + aml->io.information = (u8) (resource->data.io.io_decode & 0x01); - output_struct->type = ACPI_RSTYPE_FIXED_IO; + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Alignment + * Length + */ + ACPI_MOVE_32_TO_16(&aml->io.minimum, &resource->data.io.minimum); + ACPI_MOVE_32_TO_16(&aml->io.maximum, &resource->data.io.maximum); + aml->io.alignment = (u8) resource->data.io.alignment; + aml->io.address_length = (u8) resource->data.io.address_length; - /* Check Range Base Address */ + /* Complete the AML descriptor header */ - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - output_struct->data.fixed_io.base_address = temp16; - - /* Check range_length */ - - buffer += 2; - temp8 = *buffer; - - output_struct->data.fixed_io.range_length = temp8; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO, + sizeof(struct aml_resource_io), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_io_stream + * FUNCTION: acpi_rs_get_fixed_io * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_get_fixed_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_io_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07; - buffer += 1; - - /* Io Information Byte */ - - temp8 = (u8) (resource->data.io.io_decode & 0x01); - - *buffer = temp8; - buffer += 1; - - /* Set the Range minimum base address */ - - temp16 = (u16) resource->data.io.min_base_address; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set the Range maximum base address */ + ACPI_FUNCTION_TRACE("rs_get_fixed_io"); - temp16 = (u16) resource->data.io.max_base_address; + /* + * Get the following contiguous fields from the AML descriptor: + * Base Address + * Length + */ + ACPI_MOVE_16_TO_32(&resource->data.fixed_io.address, + &aml->fixed_io.address); + resource->data.fixed_io.address_length = aml->fixed_io.address_length; - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + /* Complete the resource header */ - /* Set the base alignment */ - - temp8 = (u8) resource->data.io.alignment; - - *buffer = temp8; - buffer += 1; - - /* Set the range length */ - - temp8 = (u8) resource->data.io.range_length; - - *buffer = temp8; - buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_io_stream + * FUNCTION: acpi_rs_set_fixed_io * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03; - buffer += 1; - - /* Set the Range base address */ - - temp16 = (u16) resource->data.fixed_io.base_address; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set the range length */ - - temp8 = (u8) resource->data.fixed_io.range_length; - - *buffer = temp8; - buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + ACPI_FUNCTION_TRACE("rs_set_fixed_io"); + + /* + * Set the following contiguous fields in the AML descriptor: + * Base Address + * Length + */ + ACPI_MOVE_32_TO_16(&aml->fixed_io.address, + &resource->data.fixed_io.address); + aml->fixed_io.address_length = + (u8) resource->data.fixed_io.address_length; + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO, + sizeof(struct aml_resource_fixed_io), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_dma_resource + * FUNCTION: acpi_rs_get_dma * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_dma_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_dma(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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); + u32 channel_count = 0; + u32 i; + u8 temp8; - ACPI_FUNCTION_TRACE("rs_dma_resource"); - - /* The number of bytes consumed are Constant */ - - *bytes_consumed = 3; - output_struct->type = ACPI_RSTYPE_DMA; - - /* Point to the 8-bits of Byte 1 */ - - buffer += 1; - temp8 = *buffer; + ACPI_FUNCTION_TRACE("rs_get_dma"); /* Decode the DMA channel bits */ - for (i = 0, index = 0; index < 8; index++) { - if ((temp8 >> index) & 0x01) { - output_struct->data.dma.channels[i] = index; - i++; + for (i = 0; i < 8; i++) { + if ((aml->dma.dma_channel_mask >> i) & 0x01) { + resource->data.dma.channels[channel_count] = i; + channel_count++; } } - /* Zero DMA channels is valid */ - - output_struct->data.dma.number_of_channels = i; - if (i > 0) { - /* Calculate the structure size based upon the number of interrupts */ + resource->length = 0; + resource->data.dma.channel_count = channel_count; - struct_size += ((acpi_size) i - 1) * 4; + /* + * Calculate the structure size based upon the number of channels + * Note: Zero DMA channels is valid + */ + if (channel_count > 0) { + resource->length = (u32) (channel_count - 1) * 4; } - /* Point to Byte 2 */ + /* Get the flags: transfer preference, bus mastering, channel speed */ - buffer += 1; - temp8 = *buffer; + temp8 = aml->dma.flags; + resource->data.dma.transfer = temp8 & 0x03; + resource->data.dma.bus_master = (temp8 >> 2) & 0x01; + resource->data.dma.type = (temp8 >> 5) & 0x03; - /* Check for transfer preference (Bits[1:0]) */ - - output_struct->data.dma.transfer = temp8 & 0x03; - - if (0x03 == output_struct->data.dma.transfer) { + if (resource->data.dma.transfer == 0x03) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); return_ACPI_STATUS(AE_BAD_DATA); } - /* Get bus master preference (Bit[2]) */ - - output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; - - /* Get channel speed support (Bits[6:5]) */ + /* Complete the resource header */ - output_struct->data.dma.type = (temp8 >> 5) & 0x03; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_DMA; + resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_dma_stream + * FUNCTION: acpi_rs_set_dma * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_dma_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - ACPI_FUNCTION_TRACE("rs_dma_stream"); - - /* The Descriptor Type field is static */ + u8 i; - *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02; - buffer += 1; - temp8 = 0; + ACPI_FUNCTION_TRACE("rs_set_dma"); - /* Loop through all of the Channels and set the mask bits */ + /* Convert channel list to 8-bit DMA channel bitmask */ - for (index = 0; index < resource->data.dma.number_of_channels; index++) { - temp16 = (u16) resource->data.dma.channels[index]; - temp8 |= 0x1 << temp16; + aml->dma.dma_channel_mask = 0; + for (i = 0; i < resource->data.dma.channel_count; i++) { + aml->dma.dma_channel_mask |= + (1 << resource->data.dma.channels[i]); } - *buffer = temp8; - buffer += 1; - - /* Set the DMA Info */ - - temp8 = (u8) ((resource->data.dma.type & 0x03) << 5); - temp8 |= ((resource->data.dma.bus_master & 0x01) << 2); - temp8 |= (resource->data.dma.transfer & 0x03); + /* Set the DMA Flag bits */ - *buffer = temp8; - buffer += 1; + aml->dma.flags = (u8) + (((resource->data.dma.type & 0x03) << 5) | + ((resource->data.dma.bus_master & 0x01) << 2) | + (resource->data.dma.transfer & 0x03)); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA, + sizeof(struct aml_resource_dma), aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 75df962115c..4e854ba7081 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -49,93 +49,67 @@ ACPI_MODULE_NAME("rsirq") /******************************************************************************* * - * FUNCTION: acpi_rs_irq_resource + * FUNCTION: acpi_rs_get_irq * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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 - * (Bits:0-1) - */ - temp8 = *buffer; - *bytes_consumed = (temp8 & 0x03) + 1; - output_struct->type = ACPI_RSTYPE_IRQ; + u32 interrupt_count = 0; + u32 i; + u32 resource_length; - /* Point to the 16-bits of Bytes 1 and 2 */ + ACPI_FUNCTION_TRACE("rs_get_irq"); - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Get the IRQ mask (bytes 1:2) */ - output_struct->data.irq.number_of_interrupts = 0; + ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask); - /* Decode the IRQ bits */ + /* Decode the IRQ bits (up to 16 possible) */ - for (i = 0, index = 0; index < 16; index++) { - if ((temp16 >> index) & 0x01) { - output_struct->data.irq.interrupts[i] = index; - i++; + for (i = 0; i < 16; i++) { + if ((temp16 >> i) & 0x01) { + resource->data.irq.interrupts[interrupt_count] = i; + interrupt_count++; } } /* Zero interrupts is valid */ - output_struct->data.irq.number_of_interrupts = i; - if (i > 0) { + resource_length = 0; + resource->data.irq.interrupt_count = interrupt_count; + if (interrupt_count > 0) { /* Calculate the structure size based upon the number of interrupts */ - struct_size += ((acpi_size) i - 1) * 4; + resource_length = (u32) (interrupt_count - 1) * 4; } - /* Point to Byte 3 if it is used */ - - if (4 == *bytes_consumed) { - buffer += 2; - temp8 = *buffer; + /* Get Flags (Byte 3) if it is used */ + if (aml_resource_length == 3) { /* Check for HE, LL interrupts */ - switch (temp8 & 0x09) { + switch (aml->irq.flags & 0x09) { case 0x01: /* HE */ - output_struct->data.irq.edge_level = - ACPI_EDGE_SENSITIVE; - output_struct->data.irq.active_high_low = - ACPI_ACTIVE_HIGH; + resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; + resource->data.irq.polarity = 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; + resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE; + resource->data.irq.polarity = ACPI_ACTIVE_LOW; break; default: @@ -146,170 +120,131 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, */ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list, %X\n", - temp8)); + aml->irq.flags)); return_ACPI_STATUS(AE_BAD_DATA); } - /* Check for sharable */ + /* Get Sharing flag */ - output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; + resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01; } else { /* - * Assume Edge Sensitive, Active High, Non-Sharable - * per ACPI Specification + * Default configuration: assume Edge Sensitive, Active High, + * Non-Sharable as per the ACPI Specification */ - output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; - output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH; - output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; + resource->data.irq.polarity = ACPI_ACTIVE_HIGH; + resource->data.irq.sharable = ACPI_EXCLUSIVE; } - /* Set the Length parameter */ + /* Complete the resource header */ - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_IRQ; + resource->length = + resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_irq_stream + * FUNCTION: acpi_rs_set_irq * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 IRqinfo_byte_needed; + acpi_size descriptor_length; + u16 irq_mask; + u8 i; + + ACPI_FUNCTION_TRACE("rs_set_irq"); - ACPI_FUNCTION_TRACE("rs_irq_stream"); + /* Convert interrupt list to 16-bit IRQ bitmask */ + + irq_mask = 0; + for (i = 0; i < resource->data.irq.interrupt_count; i++) { + irq_mask |= (1 << resource->data.irq.interrupts[i]); + } + + /* Set the interrupt mask */ + + ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask); /* * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ - if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level && - ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low && - ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) { - *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02; - IRqinfo_byte_needed = FALSE; - } else { - *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03; - IRqinfo_byte_needed = TRUE; - } - - buffer += 1; - temp16 = 0; - - /* Loop through all of the interrupts and set the mask bits */ + if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) && + (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) && + (resource->data.irq.sharable == ACPI_EXCLUSIVE)) { + /* irq_no_flags() descriptor can be used */ - for (index = 0; - index < resource->data.irq.number_of_interrupts; index++) { - temp8 = (u8) resource->data.irq.interrupts[index]; - temp16 |= 0x1 << temp8; - } + descriptor_length = sizeof(struct aml_resource_irq_noflags); + } else { + /* Irq() descriptor must be used */ - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + descriptor_length = sizeof(struct aml_resource_irq); - /* Set the IRQ Info byte if needed. */ + /* Set the IRQ Info byte */ - if (IRqinfo_byte_needed) { - temp8 = 0; - temp8 = (u8) ((resource->data.irq.shared_exclusive & - 0x01) << 4); + aml->irq.flags = (u8) + ((resource->data.irq.sharable & 0x01) << 4); - if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level && - ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) { - temp8 |= 0x08; + if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering && + ACPI_ACTIVE_LOW == resource->data.irq.polarity) { + aml->irq.flags |= 0x08; } else { - temp8 |= 0x01; + aml->irq.flags |= 0x01; } - - *buffer = temp8; - buffer += 1; } - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length, + aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_extended_irq_resource + * FUNCTION: acpi_rs_get_ext_irq * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_ext_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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"); + char *out_resource_string; + u8 temp8; - /* Get the Descriptor Length field */ + ACPI_FUNCTION_TRACE("rs_get_ext_irq"); - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Get the flag bits */ - /* Validate minimum descriptor length */ - - if (temp16 < 6) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_EXT_IRQ; - - /* Point to the Byte3 */ - - buffer += 2; - temp8 = *buffer; - - output_struct->data.extended_irq.producer_consumer = temp8 & 0x01; + temp8 = aml->extended_irq.flags; + resource->data.extended_irq.producer_consumer = temp8 & 0x01; + resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01; + resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01; /* * Check for Interrupt Mode @@ -319,165 +254,80 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, * * - Edge/Level are defined opposite in the table vs the headers */ - output_struct->data.extended_irq.edge_level = + resource->data.extended_irq.triggering = (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; - /* Check Interrupt Polarity */ - - output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; - - /* Check for sharable */ - - output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; - - /* Point to Byte4 (IRQ Table length) */ - - buffer += 1; - temp8 = *buffer; - - /* Must have at least one IRQ */ + /* Get the IRQ Table length (Byte4) */ + temp8 = aml->extended_irq.table_length; + resource->data.extended_irq.interrupt_count = temp8; if (temp8 < 1) { + /* Must have at least one IRQ */ + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } - output_struct->data.extended_irq.number_of_interrupts = temp8; - /* * Add any additional structure size to properly calculate * the next pointer at the end of this function */ - struct_size += (temp8 - 1) * 4; + resource->length = (temp8 - 1) * 4; + out_resource_string = ACPI_CAST_PTR(char, + (&resource->data.extended_irq. + interrupts[0] + temp8)); - /* Point to Byte5 (First IRQ Number) */ + /* Get every IRQ in the table, each is 32 bits */ - buffer += 1; + acpi_rs_move_data(resource->data.extended_irq.interrupts, + aml->extended_irq.interrupt_number, + (u16) temp8, ACPI_MOVE_TYPE_32_TO_32); - /* Cycle through every IRQ in the table */ + /* Get the optional resource_source (index and string) */ - for (index = 0; index < temp8; index++) { - ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq. - interrupts[index], buffer); + resource->length += + acpi_rs_get_resource_source(aml_resource_length, + (acpi_size) resource->length + + sizeof(struct + aml_resource_extended_irq), + &resource->data.extended_irq. + resource_source, aml, + out_resource_string); - /* Point to the next IRQ */ + /* Complete the resource header */ - buffer += 4; - } - - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*bytes_consumed > - ((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; - - /* Point to the String */ - - buffer += 1; - - /* 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); - - temp_ptr = (u8 *) - output_struct->data.extended_irq.resource_source.string_ptr; - - /* Copy the string into the buffer */ - - index = 0; - while (*buffer) { - *temp_ptr = *buffer; - - temp_ptr += 1; - buffer += 1; - index += 1; - } - - /* Add the terminating null */ - - *temp_ptr = 0; - output_struct->data.extended_irq.resource_source.string_length = - index + 1; - - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } else { - output_struct->data.extended_irq.resource_source.index = 0; - output_struct->data.extended_irq.resource_source.string_length = - 0; - output_struct->data.extended_irq.resource_source.string_ptr = - NULL; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + resource->length += + ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_extended_irq_stream + * FUNCTION: acpi_rs_set_ext_irq * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 *length_field; - u8 temp8 = 0; - u8 index; - - ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); - - /* Set the Descriptor Type field */ - - *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT; - buffer += 1; + acpi_size descriptor_length; - /* Save a pointer to the Length field - to be filled in later */ - - length_field = ACPI_CAST_PTR(u16, buffer); - buffer += 2; + ACPI_FUNCTION_TRACE("rs_set_ext_irq"); /* Set the Interrupt vector flags */ - temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01); - temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3); + aml->extended_irq.flags = (u8) + ((resource->data.extended_irq.producer_consumer & 0x01) | + ((resource->data.extended_irq.sharable & 0x01) << 3) | + ((resource->data.extended_irq.polarity & 0x1) << 2)); /* * Set the Interrupt Mode @@ -488,64 +338,36 @@ acpi_rs_extended_irq_stream(struct acpi_resource *resource, * * - Edge/Level are defined opposite in the table vs the headers */ - if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) { - temp8 |= 0x2; + if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) { + aml->extended_irq.flags |= 0x02; } - /* Set the Interrupt Polarity */ - - temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2); - - *buffer = temp8; - buffer += 1; - /* Set the Interrupt table length */ - temp8 = (u8) resource->data.extended_irq.number_of_interrupts; - - *buffer = temp8; - buffer += 1; + aml->extended_irq.table_length = (u8) + resource->data.extended_irq.interrupt_count; - for (index = 0; - index < resource->data.extended_irq.number_of_interrupts; - index++) { - ACPI_MOVE_32_TO_32(buffer, - &resource->data.extended_irq. - interrupts[index]); - buffer += 4; - } - - /* Resource Source Index and Resource Source are optional */ + descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) + + ((acpi_size) resource->data.extended_irq.interrupt_count * + sizeof(u32)); - if (0 != resource->data.extended_irq.resource_source.string_length) { - *buffer = - (u8) resource->data.extended_irq.resource_source.index; - buffer += 1; + /* Set each interrupt value */ - /* Copy the string */ + acpi_rs_move_data(aml->extended_irq.interrupt_number, + resource->data.extended_irq.interrupts, + (u16) resource->data.extended_irq.interrupt_count, + ACPI_MOVE_TYPE_32_TO_32); - ACPI_STRCPY((char *)buffer, - resource->data.extended_irq.resource_source. - string_ptr); - - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.extended_irq.resource_source. - string_ptr) + 1); - } + /* Resource Source Index and Resource Source are optional */ - /* Return the number of bytes consumed in this operation */ + descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length, + &resource->data. + extended_irq. + resource_source); - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + /* Complete the AML descriptor header */ - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - *length_field = (u16) (*bytes_consumed - 3); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ, + descriptor_length, aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 87e75349dd0..f72d42e0927 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -47,106 +47,70 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rslist") -/* Dispatch table for convert-to-stream functions */ -typedef -acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource, - u8 ** output_buffer, - acpi_size * bytes_consumed); - -static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = { - acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */ - acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */ - acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */ - acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */ - acpi_rs_io_stream, /* ACPI_RSTYPE_IO */ - acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */ - acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */ - acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */ - acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */ - acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */ - acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */ - acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */ - acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */ - acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */ - acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */ - acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */ -}; - -/* Dispatch tables for convert-to-resource functions */ - -typedef -acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); - -static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = { - NULL, /* 0x00, Reserved */ - NULL, /* 0x01, Reserved */ - NULL, /* 0x02, Reserved */ - NULL, /* 0x03, Reserved */ - acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */ - acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */ - acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */ - acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */ - acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */ - acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ - NULL, /* 0x0A, Reserved */ - NULL, /* 0x0B, Reserved */ - NULL, /* 0x0C, Reserved */ - NULL, /* 0x0D, Reserved */ - acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */ - acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */ -}; - -static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = { - NULL, /* 0x00, Reserved */ - acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */ - acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ - NULL, /* 0x03, Reserved */ - acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */ - acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */ - acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ - acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ - acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ - acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ - acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ - acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ -}; - /* Local prototypes */ +static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); -static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); +static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); /******************************************************************************* * - * FUNCTION: acpi_rs_get_resource_type + * FUNCTION: acpi_rs_validate_resource_length * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * PARAMETERS: Aml - Pointer to the AML resource descriptor * - * RETURN: The Resource Type with no extraneous bits (except the large/ - * small bit -- left alone) + * RETURN: Status - AE_OK if the resource length appears valid * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. + * DESCRIPTION: Validate the resource_length. Fixed-length descriptors must + * have the exact length; variable-length descriptors must be + * at least as long as the minimum. Certain Small descriptors + * can vary in size by at most one byte. * ******************************************************************************/ -u8 acpi_rs_get_resource_type(u8 resource_type) +static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) { + struct acpi_resource_info *resource_info; + u16 minimum_aml_resource_length; + u16 resource_length; + ACPI_FUNCTION_ENTRY(); - /* Determine if this is a small or large resource */ + /* Get the size and type info about this resource descriptor */ - if (resource_type & ACPI_RDESC_TYPE_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ + resource_info = + acpi_rs_get_resource_info(aml->small_header.descriptor_type); + if (!resource_info) { + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + resource_length = acpi_rs_get_resource_length(aml); + minimum_aml_resource_length = + resource_info->minimum_aml_resource_length; + + /* Validate based upon the type of resource, fixed length or variable */ + + if (resource_info->length_type == ACPI_FIXED_LENGTH) { + /* Fixed length resource, length must match exactly */ - return (resource_type); + if (resource_length != minimum_aml_resource_length) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + } else if (resource_info->length_type == ACPI_VARIABLE_LENGTH) { + /* Variable length resource, must be at least the minimum */ + + if (resource_length < minimum_aml_resource_length) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } } else { - /* Small Resource Type -- bits 6:3 contain the name */ + /* Small variable length resource, allowed to be (Min) or (Min-1) */ - return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK)); + if ((resource_length > minimum_aml_resource_length) || + (resource_length < (minimum_aml_resource_length - 1))) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } } + + return (AE_OK); } /******************************************************************************* @@ -162,38 +126,38 @@ u8 acpi_rs_get_resource_type(u8 resource_type) * ******************************************************************************/ -static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) +static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) { ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ - if (resource_type & ACPI_RDESC_TYPE_LARGE) { + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { /* Large Resource Type -- bits 6:0 contain the name */ - if (resource_type > ACPI_RDESC_LARGE_MAX) { + if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { return (NULL); } - return (acpi_gbl_lg_resource_dispatch[(resource_type & - ACPI_RDESC_LARGE_MASK)]); + return (acpi_gbl_lg_get_resource_dispatch[(resource_type & + ACPI_RESOURCE_NAME_LARGE_MASK)]); } else { /* Small Resource Type -- bits 6:3 contain the name */ - return (acpi_gbl_sm_resource_dispatch[((resource_type & - ACPI_RDESC_SMALL_MASK) - >> 3)]); + return (acpi_gbl_sm_get_resource_dispatch[((resource_type & + ACPI_RESOURCE_NAME_SMALL_MASK) + >> 3)]); } } /******************************************************************************* * - * FUNCTION: acpi_rs_byte_stream_to_list + * FUNCTION: acpi_rs_convert_aml_to_resources * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * byte_stream_buffer_length - Length of byte_stream_buffer - * output_buffer - Pointer to the buffer that will - * contain the output structures + * PARAMETERS: aml_buffer - Pointer to the resource byte stream + * aml_buffer_length - Length of aml_buffer + * output_buffer - Pointer to the buffer that will + * contain the output structures * * RETURN: Status * @@ -203,37 +167,60 @@ static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) ******************************************************************************/ acpi_status -acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, u8 * output_buffer) +acpi_rs_convert_aml_to_resources(u8 * aml_buffer, + u32 aml_buffer_length, u8 * output_buffer) { u8 *buffer = output_buffer; acpi_status status; acpi_size bytes_parsed = 0; - acpi_size bytes_consumed = 0; - acpi_size structure_size = 0; struct acpi_resource *resource; - ACPI_RESOURCE_HANDLER handler; + u16 resource_length; + u32 descriptor_length; + ACPI_GET_RESOURCE_HANDLER handler; - ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); + ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); /* Loop until end-of-buffer or an end_tag is found */ - while (bytes_parsed < byte_stream_buffer_length) { + while (bytes_parsed < aml_buffer_length) { /* Get the handler associated with this Descriptor Type */ - handler = acpi_rs_get_resource_handler(*byte_stream_buffer); - if (handler) { - /* Convert a byte stream resource to local resource struct */ + handler = acpi_rs_get_resource_handler(*aml_buffer); + if (!handler) { + /* No handler indicates invalid resource type */ - status = handler(byte_stream_buffer, &bytes_consumed, - &buffer, &structure_size); - } else { - /* Invalid resource type */ + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } - status = AE_AML_INVALID_RESOURCE_TYPE; + resource_length = + acpi_rs_get_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); + + descriptor_length = + acpi_rs_get_descriptor_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); + + /* + * Perform limited validation of the resource length, based upon + * what we know about the resource type + */ + status = + acpi_rs_validate_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } + /* Convert a byte stream resource to local resource struct */ + + status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer), + resource_length, + ACPI_CAST_PTR(struct acpi_resource, buffer)); if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -245,19 +232,19 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, /* Normal exit on completion of an end_tag resource descriptor */ - if (acpi_rs_get_resource_type(*byte_stream_buffer) == - ACPI_RDESC_TYPE_END_TAG) { + if (acpi_rs_get_resource_type(*aml_buffer) == + ACPI_RESOURCE_NAME_END_TAG) { return_ACPI_STATUS(AE_OK); } /* Update counter and point to the next input resource */ - bytes_parsed += bytes_consumed; - byte_stream_buffer += bytes_consumed; + bytes_parsed += descriptor_length; + aml_buffer += descriptor_length; /* Point to the next structure in the output buffer */ - buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); + buffer += resource->length; } /* Completed buffer, but did not find an end_tag resource descriptor */ @@ -267,17 +254,15 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, /******************************************************************************* * - * FUNCTION: acpi_rs_list_to_byte_stream + * FUNCTION: acpi_rs_convert_resources_to_aml * - * PARAMETERS: Resource - Pointer to the resource linked list - * byte_steam_size_needed - Calculated size of the byte stream - * needed from calling - * acpi_rs_get_byte_stream_length() - * The size of the output_buffer is - * guaranteed to be >= - * byte_stream_size_needed - * output_buffer - Pointer to the buffer that will - * contain the byte stream + * PARAMETERS: Resource - Pointer to the resource linked list + * aml_size_needed - Calculated size of the byte stream + * needed from calling acpi_rs_get_aml_length() + * The size of the output_buffer is + * guaranteed to be >= aml_size_needed + * output_buffer - Pointer to the buffer that will + * contain the byte stream * * RETURN: Status * @@ -287,52 +272,69 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_list_to_byte_stream(struct acpi_resource *resource, - acpi_size byte_stream_size_needed, - u8 * output_buffer) +acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, + acpi_size aml_size_needed, u8 * output_buffer) { - u8 *buffer = output_buffer; - acpi_size bytes_consumed = 0; + u8 *aml_buffer = output_buffer; acpi_status status; - ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); + ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); /* Convert each resource descriptor in the list */ while (1) { - /* Validate Type before dispatch */ + /* Validate Resource Descriptor Type before dispatch */ - if (resource->type > ACPI_RSTYPE_MAX) { + if (resource->type > ACPI_RESOURCE_TYPE_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", resource->type)); return_ACPI_STATUS(AE_BAD_DATA); } - /* Perform the conversion, per resource type */ + /* Perform the conversion per resource type */ + + status = + acpi_gbl_set_resource_dispatch[resource->type] (resource, + ACPI_CAST_PTR + (union + aml_resource, + aml_buffer)); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); + return_ACPI_STATUS(status); + } + + /* Perform final sanity check on the new AML resource descriptor */ - status = acpi_gbl_stream_dispatch[resource->type] (resource, - &buffer, - &bytes_consumed); + status = + acpi_rs_validate_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Check for end-of-list */ + /* Check for end-of-list, normal exit */ - if (resource->type == ACPI_RSTYPE_END_TAG) { - /* An End Tag indicates the end of the Resource Template */ + if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + /* An End Tag indicates the end of the input Resource Template */ return_ACPI_STATUS(AE_OK); } - /* Set the Buffer to point to the next (output) resource descriptor */ + /* Extract the total length of the new descriptor */ + /* Set the aml_buffer to point to the next (output) resource descriptor */ - buffer += bytes_consumed; + aml_buffer += + acpi_rs_get_descriptor_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); - /* Point to the next input resource object */ + /* Point to the next input resource descriptor */ - resource = ACPI_PTR_ADD(struct acpi_resource, - resource, resource->length); + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); } } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 418f1afb10a..47e979e7ba3 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -49,446 +49,260 @@ ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * - * FUNCTION: acpi_rs_memory24_resource + * FUNCTION: acpi_rs_get_memory24 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_memory24_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_memory24(union aml_resource * aml, + u16 aml_resource_length, struct acpi_resource * 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_get_memory24"); - ACPI_FUNCTION_TRACE("rs_memory24_resource"); + /* Get the Read/Write bit */ - /* Point past the Descriptor to get the number of bytes consumed */ + resource->data.memory24.read_write_attribute = + (aml->memory24.information & 0x01); - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - buffer += 2; - *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->type = ACPI_RSTYPE_MEM24; - - /* Check Byte 3 the Read/Write bit */ - - temp8 = *buffer; - buffer += 1; - output_struct->data.memory24.read_write_attribute = temp8 & 0x01; - - /* Get min_base_address (Bytes 4-5) */ - - 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); - buffer += 2; - output_struct->data.memory24.max_base_address = temp16; - - /* Get Alignment (Bytes 8-9) */ - - 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); - output_struct->data.memory24.range_length = temp16; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; + /* + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + acpi_rs_move_data(&resource->data.memory24.minimum, + &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32); - /* Return the final size of the structure */ + /* Complete the resource header */ - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_MEMORY24; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_memory24_stream + * FUNCTION: acpi_rs_set_memory24 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_memory24_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_memory24_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_MEMORY_24; - buffer += 1; - - /* The length field is static */ - - temp16 = 0x09; - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + ACPI_FUNCTION_TRACE("rs_set_memory24"); /* Set the Information Byte */ - temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01); - *buffer = temp8; - buffer += 1; - - /* Set the Range minimum base address */ + aml->memory24.information = (u8) + (resource->data.memory24.read_write_attribute & 0x01); - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address); - buffer += 2; - - /* Set the Range maximum base address */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address); - buffer += 2; - - /* Set the base alignment */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment); - buffer += 2; - - /* Set the range length */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length); - buffer += 2; + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + acpi_rs_move_data(&aml->memory24.minimum, + &resource->data.memory24.minimum, 4, + ACPI_MOVE_TYPE_32_TO_16); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24, + sizeof(struct aml_resource_memory24), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_memory32_range_resource + * FUNCTION: acpi_rs_get_memory32 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_memory32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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"); + ACPI_FUNCTION_TRACE("rs_get_memory32"); - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Read/Write bit */ - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - buffer += 2; - *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->type = ACPI_RSTYPE_MEM32; + resource->data.memory32.read_write_attribute = + (aml->memory32.information & 0x01); /* - * Point to the place in the output buffer where the data portion will - * begin. - * 1. Set the RESOURCE_DATA * Data to point to its own address, then - * 2. Set the pointer to the next address. - * - * NOTE: output_struct->Data is cast to u8, otherwise, this addition adds - * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length */ + acpi_rs_move_data(&resource->data.memory32.minimum, + &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32); - /* Check Byte 3 the Read/Write bit */ - - temp8 = *buffer; - buffer += 1; - - output_struct->data.memory32.read_write_attribute = temp8 & 0x01; - - /* Get min_base_address (Bytes 4-7) */ - - 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); - buffer += 4; - - /* Get Alignment (Bytes 12-15) */ - - 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); - - /* Set the Length parameter */ + /* Complete the resource header */ - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_MEMORY32; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_memory32_resource + * FUNCTION: acpi_rs_set_memory32 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml) { - 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); - - buffer += 2; - *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->type = ACPI_RSTYPE_FIXED_MEM32; - - /* Check Byte 3 the Read/Write bit */ - - temp8 = *buffer; - buffer += 1; - output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; - - /* Get range_base_address (Bytes 4-7) */ - - ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32. - range_base_address, buffer); - buffer += 4; - - /* Get range_length (Bytes 8-11) */ + ACPI_FUNCTION_TRACE("rs_set_memory32"); - ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length, - buffer); + /* Set the Information Byte */ - /* Set the Length parameter */ + aml->memory32.information = (u8) + (resource->data.memory32.read_write_attribute & 0x01); - output_struct->length = (u32) struct_size; + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + acpi_rs_move_data(&aml->memory32.minimum, + &resource->data.memory32.minimum, 4, + ACPI_MOVE_TYPE_32_TO_32); - /* Return the final size of the structure */ + /* Complete the AML descriptor header */ - *structure_size = struct_size; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32, + sizeof(struct aml_resource_memory32), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_memory32_range_stream + * FUNCTION: acpi_rs_get_fixed_memory32 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_memory32_range_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_get_fixed_memory32(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); - - /* The Descriptor Type field is static */ + ACPI_FUNCTION_TRACE("rs_get_fixed_memory32"); - *buffer = ACPI_RDESC_TYPE_MEMORY_32; - buffer += 1; - - /* The length field is static */ - - temp16 = 0x11; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set the Information Byte */ + /* Get the Read/Write bit */ - temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01); - *buffer = temp8; - buffer += 1; + resource->data.fixed_memory32.read_write_attribute = + (aml->fixed_memory32.information & 0x01); - /* Set the Range minimum base address */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address); - buffer += 4; - - /* Set the Range maximum base address */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address); - buffer += 4; - - /* Set the base alignment */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment); - buffer += 4; - - /* Set the range length */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length); - buffer += 4; + /* + * Get the following contiguous fields from the AML descriptor: + * Base Address + * Range Length + */ + ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address, + &aml->fixed_memory32.address); + ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length, + &aml->fixed_memory32.address_length); - /* Return the number of bytes consumed in this operation */ + /* Complete the resource header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_memory32_stream + * FUNCTION: acpi_rs_set_fixed_memory32 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_fixed_memory32(struct acpi_resource *resource, + union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32; - buffer += 1; - - /* The length field is static */ - - temp16 = 0x09; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + ACPI_FUNCTION_TRACE("rs_set_fixed_memory32"); /* Set the Information Byte */ - temp8 = - (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01); - *buffer = temp8; - buffer += 1; + aml->fixed_memory32.information = (u8) + (resource->data.fixed_memory32.read_write_attribute & 0x01); - /* Set the Range base address */ - - ACPI_MOVE_32_TO_32(buffer, - &resource->data.fixed_memory32.range_base_address); - buffer += 4; - - /* Set the range length */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length); - buffer += 4; + /* + * Set the following contiguous fields in the AML descriptor: + * Base Address + * Range Length + */ + ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address, + &resource->data.fixed_memory32.address); + ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length, + &resource->data.fixed_memory32.address_length); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32, + sizeof(struct aml_resource_fixed_memory32), + aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index fa7f5a85b61..337a0f01cb2 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -49,641 +49,432 @@ ACPI_MODULE_NAME("rsmisc") /******************************************************************************* * - * FUNCTION: acpi_rs_generic_register_resource + * FUNCTION: acpi_rs_get_generic_reg * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_generic_register_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size) +acpi_rs_get_generic_reg(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16; - u8 temp8; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg); + ACPI_FUNCTION_TRACE("rs_get_generic_reg"); - ACPI_FUNCTION_TRACE("rs_generic_register_resource"); - - /* Byte 0 is the Descriptor Type */ - - buffer += 1; - - /* Get the Descriptor Length field (Bytes 1-2) */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - buffer += 2; - - /* Validate the descriptor length */ - - if (temp16 != 12) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - /* The number of bytes consumed is fixed (12 + 3) */ - - *bytes_consumed = 15; - - /* Fill out the structure */ - - output_struct->type = ACPI_RSTYPE_GENERIC_REG; - - /* Get space_id (Byte 3) */ - - temp8 = *buffer; - output_struct->data.generic_reg.space_id = temp8; - buffer += 1; - - /* Get register_bit_width (Byte 4) */ - - temp8 = *buffer; - output_struct->data.generic_reg.bit_width = temp8; - buffer += 1; - - /* Get register_bit_offset (Byte 5) */ - - temp8 = *buffer; - output_struct->data.generic_reg.bit_offset = temp8; - buffer += 1; - - /* Get address_size (Byte 6) */ - - temp8 = *buffer; - output_struct->data.generic_reg.address_size = temp8; - buffer += 1; - - /* Get register_address (Bytes 7-14) */ - - ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer); - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + /* + * Get the following fields from the AML descriptor: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size + * Register Address + */ + resource->data.generic_reg.space_id = aml->generic_reg.address_space_id; + resource->data.generic_reg.bit_width = aml->generic_reg.bit_width; + resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset; + resource->data.generic_reg.access_size = aml->generic_reg.access_size; + ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address, + &aml->generic_reg.address); + + /* Complete the resource header */ + + resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_generic_register_stream + * FUNCTION: acpi_rs_set_generic_reg * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_generic_register_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16; - - ACPI_FUNCTION_TRACE("rs_generic_register_stream"); - - /* Set the Descriptor Type (Byte 0) */ - - *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER; - buffer += 1; - - /* Set the Descriptor Length (Bytes 1-2) */ - - temp16 = 12; - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set space_id (Byte 3) */ - - *buffer = (u8) resource->data.generic_reg.space_id; - buffer += 1; - - /* Set register_bit_width (Byte 4) */ - - *buffer = (u8) resource->data.generic_reg.bit_width; - buffer += 1; - - /* Set register_bit_offset (Byte 5) */ - - *buffer = (u8) resource->data.generic_reg.bit_offset; - buffer += 1; - - /* Set address_size (Byte 6) */ - - *buffer = (u8) resource->data.generic_reg.address_size; - buffer += 1; - - /* Set register_address (Bytes 7-14) */ + ACPI_FUNCTION_TRACE("rs_set_generic_reg"); - ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address); - buffer += 8; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + /* + * Set the following fields in the AML descriptor: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size + * Register Address + */ + aml->generic_reg.address_space_id = + (u8) resource->data.generic_reg.space_id; + aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width; + aml->generic_reg.bit_offset = + (u8) resource->data.generic_reg.bit_offset; + aml->generic_reg.access_size = + (u8) resource->data.generic_reg.access_size; + ACPI_MOVE_64_TO_64(&aml->generic_reg.address, + &resource->data.generic_reg.address); + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER, + sizeof(struct + aml_resource_generic_register), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_tag_resource + * FUNCTION: acpi_rs_get_vendor * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_end_tag_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_vendor(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - ACPI_FUNCTION_TRACE("rs_end_tag_resource"); + u8 *aml_byte_data; - /* The number of bytes consumed is static */ + ACPI_FUNCTION_TRACE("rs_get_vendor"); - *bytes_consumed = 2; + /* Determine if this is a large or small vendor specific item */ - /* Fill out the structure */ + if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large item, Point to the first vendor byte */ - output_struct->type = ACPI_RSTYPE_END_TAG; + aml_byte_data = + ((u8 *) aml) + sizeof(struct aml_resource_large_header); + } else { + /* Small item, Point to the first vendor byte */ - /* Set the Length parameter */ + aml_byte_data = + ((u8 *) aml) + sizeof(struct aml_resource_small_header); + } - output_struct->length = 0; + /* Copy the vendor-specific bytes */ - /* Return the final size of the structure */ + ACPI_MEMCPY(resource->data.vendor.byte_data, + aml_byte_data, aml_resource_length); + resource->data.vendor.byte_length = aml_resource_length; - *structure_size = struct_size; + /* + * In order for the struct_size to fall on a 32-bit boundary, + * calculate the length of the vendor string and expand the + * struct_size to the next 32-bit boundary. + */ + resource->type = ACPI_RESOURCE_TYPE_VENDOR; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + ACPI_ROUND_UP_to_32_bITS(aml_resource_length); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_tag_stream + * FUNCTION: acpi_rs_set_vendor * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_end_tag_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; + u32 resource_length; + u8 *source; + u8 *destination; - ACPI_FUNCTION_TRACE("rs_end_tag_stream"); + ACPI_FUNCTION_TRACE("rs_set_vendor"); - /* The Descriptor Type field is static */ + resource_length = resource->data.vendor.byte_length; + source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data); - *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01; - buffer += 1; + /* Length determines if this is a large or small resource */ - /* - * Set the Checksum - zero means that the resource data is treated as if - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) - */ - temp8 = 0; + if (resource_length > 7) { + /* Large item, get pointer to the data part of the descriptor */ + + destination = + ((u8 *) aml) + sizeof(struct aml_resource_large_header); + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE, + (u32) (resource_length + + sizeof(struct + aml_resource_large_header)), + aml); + } else { + /* Small item, get pointer to the data part of the descriptor */ - *buffer = temp8; - buffer += 1; + destination = + ((u8 *) aml) + sizeof(struct aml_resource_small_header); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL, + (u32) (resource_length + + sizeof(struct + aml_resource_small_header)), + aml); + } + + /* Copy the vendor-specific bytes */ + + ACPI_MEMCPY(destination, source, resource_length); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_vendor_resource + * FUNCTION: acpi_rs_get_start_dpf * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_vendor_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_start_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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. */ + ACPI_FUNCTION_TRACE("rs_get_start_dpf"); - temp8 = *buffer; + /* Get the flags byte if present */ - if (temp8 & ACPI_RDESC_TYPE_LARGE) { - /* Large Item, point to the length field */ + if (aml_resource_length == 1) { + /* Get the Compatibility priority */ - buffer += 1; + resource->data.start_dpf.compatibility_priority = + (aml->start_dpf.flags & 0x03); - /* Dereference */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - - /* Calculate bytes consumed */ + if (resource->data.start_dpf.compatibility_priority >= 3) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + } - *bytes_consumed = (acpi_size) temp16 + 3; + /* Get the Performance/Robustness preference */ - /* Point to the first vendor byte */ + resource->data.start_dpf.performance_robustness = + ((aml->start_dpf.flags >> 2) & 0x03); - buffer += 2; + if (resource->data.start_dpf.performance_robustness >= 3) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + } } else { - /* Small Item, dereference the size */ - - temp16 = (u8) (*buffer & 0x07); - - /* Calculate bytes consumed */ + /* start_dependent_no_pri(), no flags byte, set defaults */ - *bytes_consumed = (acpi_size) temp16 + 1; - - /* Point to the first vendor byte */ + resource->data.start_dpf.compatibility_priority = + ACPI_ACCEPTABLE_CONFIGURATION; - buffer += 1; + resource->data.start_dpf.performance_robustness = + ACPI_ACCEPTABLE_CONFIGURATION; } - output_struct->type = ACPI_RSTYPE_VENDOR; - output_struct->data.vendor_specific.length = temp16; - - for (index = 0; index < temp16; index++) { - output_struct->data.vendor_specific.reserved[index] = *buffer; - buffer += 1; - } + /* Complete the resource header */ - /* - * In order for the struct_size to fall on a 32-bit boundary, - * 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); - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_vendor_stream + * FUNCTION: acpi_rs_set_start_dpf * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_vendor_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml) { - 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 (resource->data.vendor_specific.length > 7) { - /* Large Item, Set the descriptor field and length bytes */ + ACPI_FUNCTION_TRACE("rs_set_start_dpf"); - *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR; - buffer += 1; - - temp16 = (u16) resource->data.vendor_specific.length; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + /* + * The descriptor type field is set based upon whether a byte is needed + * to contain Priority data. + */ + if (ACPI_ACCEPTABLE_CONFIGURATION == + resource->data.start_dpf.compatibility_priority && + ACPI_ACCEPTABLE_CONFIGURATION == + resource->data.start_dpf.performance_robustness) { + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof(struct + aml_resource_start_dependent_noprio), + aml); } else { - /* Small Item, Set the descriptor field */ - - temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR; - temp8 |= (u8) resource->data.vendor_specific.length; - - *buffer = temp8; - buffer += 1; - } - - /* Loop through all of the Vendor Specific fields */ - - for (index = 0; index < resource->data.vendor_specific.length; index++) { - temp8 = resource->data.vendor_specific.reserved[index]; - - *buffer = temp8; - buffer += 1; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof(struct + aml_resource_start_dependent), + aml); + + /* Set the Flags byte */ + + aml->start_dpf.flags = (u8) + (((resource->data.start_dpf. + performance_robustness & 0x03) << 2) | (resource->data. + start_dpf. + compatibility_priority + & 0x03)); } - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_start_depend_fns_resource + * FUNCTION: acpi_rs_get_end_dpf * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ 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_get_end_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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) */ - - temp8 = *buffer; - - *bytes_consumed = (temp8 & 0x01) + 1; - - output_struct->type = ACPI_RSTYPE_START_DPF; - - /* Point to Byte 1 if it is used */ - - if (2 == *bytes_consumed) { - buffer += 1; - temp8 = *buffer; - - /* Check Compatibility priority */ - - 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); - } + ACPI_FUNCTION_TRACE("rs_get_end_dpf"); - /* Check Performance/Robustness preference */ + /* Complete the resource header */ - 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); - } - } else { - output_struct->data.start_dpf.compatibility_priority = - ACPI_ACCEPTABLE_CONFIGURATION; - - output_struct->data.start_dpf.performance_robustness = - ACPI_ACCEPTABLE_CONFIGURATION; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT; + resource->length = (u32) ACPI_RESOURCE_LENGTH; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_depend_fns_resource + * FUNCTION: acpi_rs_set_end_dpf * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ 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_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml) { - 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 */ - - *bytes_consumed = 1; + ACPI_FUNCTION_TRACE("rs_set_end_dpf"); - /* Fill out the structure */ + /* Complete the AML descriptor header */ - output_struct->type = ACPI_RSTYPE_END_DPF; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT, + sizeof(struct aml_resource_end_dependent), + aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_start_depend_fns_stream + * FUNCTION: acpi_rs_get_end_tag * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - u32 pointer that is filled with - * the number of bytes of the - * output_buffer used + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_get_end_tag(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); + ACPI_FUNCTION_TRACE("rs_get_end_tag"); - /* - * The descriptor type field is set based upon whether a byte is needed - * to contain Priority data. - */ - if (ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.compatibility_priority && - ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.performance_robustness) { - *buffer = ACPI_RDESC_TYPE_START_DEPENDENT; - } else { - *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01; - buffer += 1; - - /* Set the Priority Byte Definition */ + /* Complete the resource header */ - temp8 = 0; - temp8 = (u8) ((resource->data.start_dpf.performance_robustness & - 0x03) << 2); - temp8 |= (resource->data.start_dpf.compatibility_priority & - 0x03); - *buffer = temp8; - } - - buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + resource->type = ACPI_RESOURCE_TYPE_END_TAG; + resource->length = ACPI_RESOURCE_LENGTH; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_depend_fns_stream + * FUNCTION: acpi_rs_set_end_tag * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - - ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); + ACPI_FUNCTION_TRACE("rs_set_end_tag"); - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_END_DEPENDENT; - buffer += 1; + /* + * Set the Checksum - zero means that the resource data is treated as if + * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) + */ + aml->end_tag.checksum = 0; - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG, + sizeof(struct aml_resource_end_tag), aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 4446778eaf7..9d503de1a34 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -48,6 +48,438 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsutils") +/******************************************************************************* + * + * FUNCTION: acpi_rs_move_data + * + * PARAMETERS: Destination - Pointer to the destination descriptor + * Source - Pointer to the source descriptor + * item_count - How many items to move + * move_type - Byte width + * + * RETURN: None + * + * DESCRIPTION: Move multiple data items from one descriptor to another. Handles + * alignment issues and endian issues if necessary, as configured + * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) + * + ******************************************************************************/ +void +acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) +{ + acpi_native_uint i; + + /* One move per item */ + + for (i = 0; i < item_count; i++) { + switch (move_type) { + case ACPI_MOVE_TYPE_16_TO_32: + ACPI_MOVE_16_TO_32(&((u32 *) destination)[i], + &((u16 *) source)[i]); + break; + + case ACPI_MOVE_TYPE_32_TO_16: + ACPI_MOVE_32_TO_16(&((u16 *) destination)[i], + &((u32 *) source)[i]); + break; + + case ACPI_MOVE_TYPE_32_TO_32: + ACPI_MOVE_32_TO_32(&((u32 *) destination)[i], + &((u32 *) source)[i]); + break; + + case ACPI_MOVE_TYPE_64_TO_64: + ACPI_MOVE_64_TO_64(&((u64 *) destination)[i], + &((u64 *) source)[i]); + break; + + default: + return; + } + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_info + * + * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * + * RETURN: Pointer to the resource conversion handler + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type) +{ + struct acpi_resource_info *size_info; + + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { + return (NULL); + } + + size_info = &acpi_gbl_lg_resource_info[(resource_type & + ACPI_RESOURCE_NAME_LARGE_MASK)]; + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + size_info = &acpi_gbl_sm_resource_info[((resource_type & + ACPI_RESOURCE_NAME_SMALL_MASK) + >> 3)]; + } + + /* Zero entry indicates an invalid resource type */ + + if (!size_info->minimum_internal_struct_length) { + return (NULL); + } + + return (size_info); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte Length + * + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By + * definition, this does not include the size of the descriptor + * header or the length field itself. + * + ******************************************************************************/ + +u16 acpi_rs_get_resource_length(union aml_resource * aml) +{ + u16 resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_16(&resource_length, + &aml->large_header.resource_length); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = (u16) (aml->small_header.descriptor_type & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + } + + return (resource_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_descriptor_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte length + * + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the + * length of the descriptor header and the length field itself. + * Used to walk descriptor lists. + * + ******************************************************************************/ + +u32 acpi_rs_get_descriptor_length(union aml_resource * aml) +{ + u32 descriptor_length; + + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_32(&descriptor_length, + &aml->large_header.resource_length); + descriptor_length += sizeof(struct aml_resource_large_header); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + descriptor_length = (u32) (aml->small_header.descriptor_type & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + descriptor_length += sizeof(struct aml_resource_small_header); + } + + return (descriptor_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_set_resource_header + * + * PARAMETERS: descriptor_type - Byte to be inserted as the type + * total_length - Length of the AML descriptor, including + * the header and length fields. + * Aml - Pointer to the raw AML descriptor + * + * RETURN: None + * + * DESCRIPTION: Set the descriptor_type and resource_length fields of an AML + * resource descriptor, both Large and Small descriptors are + * supported automatically + * + ******************************************************************************/ + +void +acpi_rs_set_resource_header(u8 descriptor_type, + acpi_size total_length, union aml_resource *aml) +{ + u16 resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* Set the descriptor type */ + + aml->small_header.descriptor_type = descriptor_type; + + /* Determine if this is a small or large resource */ + + if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + resource_length = + (u16) (total_length - + sizeof(struct aml_resource_large_header)); + + /* Insert length into the Large descriptor length field */ + + ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, + &resource_length); + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = + (u16) (total_length - + sizeof(struct aml_resource_small_header)); + + /* Insert length into the descriptor type byte */ + + aml->small_header.descriptor_type |= (u8) resource_length; + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_type + * + * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * + * RETURN: The Resource Type with no extraneous bits (except the + * Large/Small descriptor bit -- this is left alone) + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +u8 acpi_rs_get_resource_type(u8 resource_type) +{ + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (resource_type); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_strcpy + * + * PARAMETERS: Destination - Pointer to the destination string + * Source - Pointer to the source string + * + * RETURN: String length, including NULL terminator + * + * DESCRIPTION: Local string copy that returns the string length, saving a + * strcpy followed by a strlen. + * + ******************************************************************************/ + +static u16 acpi_rs_strcpy(char *destination, char *source) +{ + u16 i; + + ACPI_FUNCTION_ENTRY(); + + for (i = 0; source[i]; i++) { + destination[i] = source[i]; + } + + destination[i] = 0; + + /* Return string length including the NULL terminator */ + + return ((u16) (i + 1)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_source + * + * PARAMETERS: resource_length - Length field of the descriptor + * minimum_length - Minimum length of the descriptor (minus + * any optional fields) + * resource_source - Where the resource_source is returned + * Aml - Pointer to the raw AML descriptor + * string_ptr - (optional) where to store the actual + * resource_source string + * + * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit + * + * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor + * to an internal resource descriptor + * + ******************************************************************************/ + +u16 +acpi_rs_get_resource_source(u16 resource_length, + acpi_size minimum_length, + struct acpi_resource_source * resource_source, + union aml_resource * aml, char *string_ptr) +{ + acpi_size total_length; + u8 *aml_resource_source; + + ACPI_FUNCTION_ENTRY(); + + total_length = + resource_length + sizeof(struct aml_resource_large_header); + aml_resource_source = ((u8 *) aml) + minimum_length; + + /* + * resource_source is present if the length of the descriptor is longer than + * the minimum length. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the minimum length. + */ + if (total_length > (minimum_length + 1)) { + /* Get the resource_source_index */ + + resource_source->index = aml_resource_source[0]; + + resource_source->string_ptr = string_ptr; + if (!string_ptr) { + /* + * String destination pointer is not specified; Set the String + * pointer to the end of the current resource_source structure. + */ + resource_source->string_ptr = (char *) + ((u8 *) resource_source) + + sizeof(struct acpi_resource_source); + } + + /* Copy the resource_source string to the destination */ + + resource_source->string_length = + acpi_rs_strcpy(resource_source->string_ptr, + (char *)&aml_resource_source[1]); + + /* + * In order for the struct_size to fall on a 32-bit boundary, + * calculate the length of the string and expand the + * struct_size to the next 32-bit boundary. + */ + return ((u16) + ACPI_ROUND_UP_to_32_bITS(resource_source-> + string_length)); + } else { + /* resource_source is not present */ + + resource_source->index = 0; + resource_source->string_length = 0; + resource_source->string_ptr = NULL; + return (0); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_set_resource_source + * + * PARAMETERS: Aml - Pointer to the raw AML descriptor + * minimum_length - Minimum length of the descriptor (minus + * any optional fields) + * resource_source - Internal resource_source + + * + * RETURN: Total length of the AML descriptor + * + * DESCRIPTION: Convert an optoinal resource_source from internal format to a + * raw AML resource descriptor + * + ******************************************************************************/ + +acpi_size +acpi_rs_set_resource_source(union aml_resource * aml, + acpi_size minimum_length, + struct acpi_resource_source * resource_source) +{ + u8 *aml_resource_source; + acpi_size descriptor_length; + + ACPI_FUNCTION_ENTRY(); + + descriptor_length = minimum_length; + + /* Non-zero string length indicates presence of a resource_source */ + + if (resource_source->string_length) { + /* Point to the end of the AML descriptor */ + + aml_resource_source = ((u8 *) aml) + minimum_length; + + /* Copy the resource_source_index */ + + aml_resource_source[0] = (u8) resource_source->index; + + /* Copy the resource_source string */ + + ACPI_STRCPY((char *)&aml_resource_source[1], + resource_source->string_ptr); + + /* + * Add the length of the string (+ 1 for null terminator) to the + * final descriptor length + */ + descriptor_length += + ((acpi_size) resource_source->string_length + 1); + } + + /* Return the new total length of the AML descriptor */ + + return (descriptor_length); +} + /******************************************************************************* * * FUNCTION: acpi_rs_get_prt_method_data @@ -65,8 +497,9 @@ ACPI_MODULE_NAME("rsutils") * 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; @@ -284,7 +717,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) * Convert the linked list into a byte stream */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer); + status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 1a87c4c7bd9..9d179beb17a 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -59,9 +59,9 @@ ACPI_MODULE_NAME("rsxface") ACPI_COPY_FIELD(out, in, max_address_fixed); \ ACPI_COPY_FIELD(out, in, attribute); \ ACPI_COPY_FIELD(out, in, granularity); \ - ACPI_COPY_FIELD(out, in, min_address_range); \ - ACPI_COPY_FIELD(out, in, max_address_range); \ - ACPI_COPY_FIELD(out, in, address_translation_offset); \ + ACPI_COPY_FIELD(out, in, minimum); \ + ACPI_COPY_FIELD(out, in, maximum); \ + ACPI_COPY_FIELD(out, in, translation_offset); \ ACPI_COPY_FIELD(out, in, address_length); \ ACPI_COPY_FIELD(out, in, resource_source); /******************************************************************************* @@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle, /* Walk the resource list */ for (;;) { - if (!resource || resource->type == ACPI_RSTYPE_END_TAG) { + if (!resource || resource->type == ACPI_RESOURCE_TYPE_END_TAG) { break; } @@ -382,19 +382,19 @@ acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address32 *address32; switch (resource->type) { - case ACPI_RSTYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS16: address16 = (struct acpi_resource_address16 *)&resource->data; ACPI_COPY_ADDRESS(out, address16); break; - case ACPI_RSTYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS32: address32 = (struct acpi_resource_address32 *)&resource->data; ACPI_COPY_ADDRESS(out, address32); break; - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS64: /* Simple copy for 64 bit source */ diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index ad0252c2f7d..3cee0cee4cc 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -251,7 +251,7 @@ acpi_status acpi_tb_get_table_rsdt(void) } ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", + "RSDP located at %p, points to RSDT physical=%8.8X%8.8X\n", acpi_gbl_RSDP, ACPI_FORMAT_UINT64(address.pointer.value))); diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 3b8a7e063e8..b01a4b2ae7d 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -251,7 +251,7 @@ acpi_get_firmware_table(acpi_string signature, acpi_tb_get_rsdt_address(&address); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", + "RSDP located at %p, RSDT physical=%8.8X%8.8X\n", acpi_gbl_RSDP, ACPI_FORMAT_UINT64(address.pointer.value))); diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 068450b3647..dc7f24b3a1c 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -304,7 +304,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) if (!size) { _ACPI_REPORT_ERROR(module, line, component, - ("ut_allocate: Attempt to allocate zero bytes\n")); + ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); size = 1; } @@ -347,8 +347,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) if (!size) { _ACPI_REPORT_ERROR(module, line, component, - ("ut_callocate: Attempt to allocate zero bytes\n")); - return_PTR(NULL); + ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); + size = 1; } allocation = acpi_os_allocate(size); diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 399e64b5188..7f72839841c 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -825,6 +825,9 @@ void acpi_ut_init_globals(void) acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_owner_id_mask = 0; + acpi_gbl_trace_method_name = 0; + acpi_gbl_trace_dbg_level = 0; + acpi_gbl_trace_dbg_layer = 0; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index aa1dcd851f8..b57afa7421e 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -811,15 +811,15 @@ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) while (buffer < end_buffer) { buffer_byte = *buffer; - if (buffer_byte & ACPI_RDESC_TYPE_LARGE) { + if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) { /* Large Descriptor - Length is next 2 bytes */ buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); } else { /* Small Descriptor. End Tag will be found here */ - if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == - ACPI_RDESC_TYPE_END_TAG) { + if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) == + ACPI_RESOURCE_NAME_END_TAG) { /* Found the end tag descriptor, all done. */ return (buffer); diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 5172d4e1236..66a2fee06eb 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -927,9 +927,9 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) if (ACPI_SUCCESS(status)) { unsigned long size; - size = addr.max_address_range - addr.min_address_range + 1; - hdp->hd_phys_address = addr.min_address_range; - hdp->hd_address = ioremap(addr.min_address_range, size); + size = addr.maximum - addr.minimum + 1; + hdp->hd_phys_address = addr.minimum; + hdp->hd_address = ioremap(addr.minimum, size); if (hpet_is_known(hdp)) { printk(KERN_DEBUG "%s: 0x%lx is busy\n", @@ -937,15 +937,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) iounmap(hdp->hd_address); return -EBUSY; } - } else if (res->type == ACPI_RSTYPE_FIXED_MEM32) { - struct acpi_resource_fixed_mem32 *fixmem32; + } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) { + struct acpi_resource_fixed_memory32 *fixmem32; fixmem32 = &res->data.fixed_memory32; if (!fixmem32) return -EINVAL; - hdp->hd_phys_address = fixmem32->range_base_address; - hdp->hd_address = ioremap(fixmem32->range_base_address, + hdp->hd_phys_address = fixmem32->address; + hdp->hd_address = ioremap(fixmem32->address, HPET_RANGE_SIZE); if (hpet_is_known(hdp)) { @@ -954,20 +954,20 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) iounmap(hdp->hd_address); return -EBUSY; } - } else if (res->type == ACPI_RSTYPE_EXT_IRQ) { - struct acpi_resource_ext_irq *irqp; + } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { + struct acpi_resource_extended_irq *irqp; int i; irqp = &res->data.extended_irq; - if (irqp->number_of_interrupts > 0) { - hdp->hd_nirqs = irqp->number_of_interrupts; + if (irqp->interrupt_count > 0) { + hdp->hd_nirqs = irqp->interrupt_count; for (i = 0; i < hdp->hd_nirqs; i++) { int rc = acpi_register_gsi(irqp->interrupts[i], - irqp->edge_level, - irqp->active_high_low); + irqp->triggering, + irqp->polarity); if (rc < 0) return AE_ERROR; hdp->hd_irq[i] = rc; diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 15ec05f69dd..f4adebde615 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -3,7 +3,7 @@ * * Copyright (c) 2004 Matthieu Castet * Copyright (c) 2004 Li Shaohua - * + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any @@ -32,17 +32,17 @@ /* * Allocated Resources */ -static int irq_flags(int edge_level, int active_high_low) +static int irq_flags(int triggering, int polarity) { int flag; - if (edge_level == ACPI_LEVEL_SENSITIVE) { - if(active_high_low == ACPI_ACTIVE_LOW) + if (triggering == ACPI_LEVEL_SENSITIVE) { + if(polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWLEVEL; else flag = IORESOURCE_IRQ_HIGHLEVEL; } else { - if(active_high_low == ACPI_ACTIVE_LOW) + if(polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWEDGE; else flag = IORESOURCE_IRQ_HIGHEDGE; @@ -50,31 +50,31 @@ static int irq_flags(int edge_level, int active_high_low) return flag; } -static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) +static void decode_irq_flags(int flag, int *triggering, int *polarity) { switch (flag) { case IORESOURCE_IRQ_LOWLEVEL: - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; + *triggering = ACPI_LEVEL_SENSITIVE; + *polarity = ACPI_ACTIVE_LOW; break; case IORESOURCE_IRQ_HIGHLEVEL: - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_HIGH; + *triggering = ACPI_LEVEL_SENSITIVE; + *polarity = ACPI_ACTIVE_HIGH; break; case IORESOURCE_IRQ_LOWEDGE: - *edge_level = ACPI_EDGE_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; + *triggering = ACPI_EDGE_SENSITIVE; + *polarity = ACPI_ACTIVE_LOW; break; case IORESOURCE_IRQ_HIGHEDGE: - *edge_level = ACPI_EDGE_SENSITIVE; - *active_high_low = ACPI_ACTIVE_HIGH; + *triggering = ACPI_EDGE_SENSITIVE; + *polarity = ACPI_ACTIVE_HIGH; break; } } static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, - int edge_level, int active_high_low) + int triggering, int polarity) { int i = 0; int irq; @@ -89,7 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, return; res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag - irq = acpi_register_gsi(gsi, edge_level, active_high_low); + irq = acpi_register_gsi(gsi, triggering, polarity); if (irq < 0) { res->irq_resource[i].flags |= IORESOURCE_DISABLED; return; @@ -164,73 +164,73 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, int i; switch (res->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: /* * Per spec, only one interrupt per descriptor is allowed in * _CRS, but some firmware violates this, so parse them all. */ - for (i = 0; i < res->data.irq.number_of_interrupts; i++) { + for (i = 0; i < res->data.irq.interrupt_count; i++) { pnpacpi_parse_allocated_irqresource(res_table, res->data.irq.interrupts[i], - res->data.irq.edge_level, - res->data.irq.active_high_low); + res->data.irq.triggering, + res->data.irq.polarity); } break; - case ACPI_RSTYPE_EXT_IRQ: - for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) { + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { pnpacpi_parse_allocated_irqresource(res_table, res->data.extended_irq.interrupts[i], - res->data.extended_irq.edge_level, - res->data.extended_irq.active_high_low); + res->data.extended_irq.triggering, + res->data.extended_irq.polarity); } break; - case ACPI_RSTYPE_DMA: - if (res->data.dma.number_of_channels > 0) - pnpacpi_parse_allocated_dmaresource(res_table, + case ACPI_RESOURCE_TYPE_DMA: + if (res->data.dma.channel_count > 0) + pnpacpi_parse_allocated_dmaresource(res_table, res->data.dma.channels[0]); break; - case ACPI_RSTYPE_IO: - pnpacpi_parse_allocated_ioresource(res_table, - res->data.io.min_base_address, - res->data.io.range_length); + case ACPI_RESOURCE_TYPE_IO: + pnpacpi_parse_allocated_ioresource(res_table, + res->data.io.minimum, + res->data.io.address_length); break; - case ACPI_RSTYPE_FIXED_IO: - pnpacpi_parse_allocated_ioresource(res_table, - res->data.fixed_io.base_address, - res->data.fixed_io.range_length); + case ACPI_RESOURCE_TYPE_FIXED_IO: + pnpacpi_parse_allocated_ioresource(res_table, + res->data.fixed_io.address, + res->data.fixed_io.address_length); break; - case ACPI_RSTYPE_MEM24: - pnpacpi_parse_allocated_memresource(res_table, - res->data.memory24.min_base_address, - res->data.memory24.range_length); + case ACPI_RESOURCE_TYPE_MEMORY24: + pnpacpi_parse_allocated_memresource(res_table, + res->data.memory24.minimum, + res->data.memory24.address_length); break; - case ACPI_RSTYPE_MEM32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.memory32.min_base_address, - res->data.memory32.range_length); + case ACPI_RESOURCE_TYPE_MEMORY32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.memory32.minimum, + res->data.memory32.address_length); break; - case ACPI_RSTYPE_FIXED_MEM32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.fixed_memory32.range_base_address, - res->data.fixed_memory32.range_length); + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.fixed_memory32.address, + res->data.fixed_memory32.address_length); break; - case ACPI_RSTYPE_ADDRESS16: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address16.min_address_range, + case ACPI_RESOURCE_TYPE_ADDRESS16: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address16.minimum, res->data.address16.address_length); break; - case ACPI_RSTYPE_ADDRESS32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address32.min_address_range, + case ACPI_RESOURCE_TYPE_ADDRESS32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address32.minimum, res->data.address32.address_length); break; - case ACPI_RSTYPE_ADDRESS64: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address64.min_address_range, + case ACPI_RESOURCE_TYPE_ADDRESS64: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address64.minimum, res->data.address64.address_length); break; - case ACPI_RSTYPE_VENDOR: + case ACPI_RESOURCE_TYPE_VENDOR: break; default: pnp_warn("PnPACPI: unknown resource type %d", res->type); @@ -253,13 +253,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso int i; struct pnp_dma * dma; - if (p->number_of_channels == 0) + if (p->channel_count == 0) return; dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); if (!dma) return; - for(i = 0; i < p->number_of_channels; i++) + for(i = 0; i < p->channel_count; i++) dma->map |= 1 << p->channels[i]; dma->flags = 0; if (p->bus_master) @@ -309,37 +309,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, int i; struct pnp_irq * irq; - if (p->number_of_interrupts == 0) + if (p->interrupt_count == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; - for(i = 0; i < p->number_of_interrupts; i++) + for(i = 0; i < p->interrupt_count; i++) if (p->interrupts[i]) __set_bit(p->interrupts[i], irq->map); - irq->flags = irq_flags(p->edge_level, p->active_high_low); + irq->flags = irq_flags(p->triggering, p->polarity); pnp_register_irq_resource(option, irq); return; } static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, - struct acpi_resource_ext_irq *p) + struct acpi_resource_extended_irq *p) { int i; struct pnp_irq * irq; - if (p->number_of_interrupts == 0) + if (p->interrupt_count == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; - for(i = 0; i < p->number_of_interrupts; i++) + for(i = 0; i < p->interrupt_count; i++) if (p->interrupts[i]) __set_bit(p->interrupts[i], irq->map); - irq->flags = irq_flags(p->edge_level, p->active_high_low); + irq->flags = irq_flags(p->triggering, p->polarity); pnp_register_irq_resource(option, irq); return; @@ -351,16 +351,16 @@ pnpacpi_parse_port_option(struct pnp_option *option, { struct pnp_port * port; - if (io->range_length == 0) + if (io->address_length == 0) return; port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; - port->min = io->min_base_address; - port->max = io->max_base_address; + port->min = io->minimum; + port->max = io->maximum; port->align = io->alignment; - port->size = io->range_length; - port->flags = ACPI_DECODE_16 == io->io_decode ? + port->size = io->address_length; + port->flags = ACPI_DECODE_16 == io->io_decode ? PNP_PORT_FLAG_16BITADDR : 0; pnp_register_port_resource(option,port); return; @@ -372,13 +372,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, { struct pnp_port * port; - if (io->range_length == 0) + if (io->address_length == 0) return; port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; - port->min = port->max = io->base_address; - port->size = io->range_length; + port->min = port->max = io->address; + port->size = io->address_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; pnp_register_port_resource(option,port); @@ -387,19 +387,19 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, static void pnpacpi_parse_mem24_option(struct pnp_option *option, - struct acpi_resource_mem24 *p) + struct acpi_resource_memory24 *p) { struct pnp_mem * mem; - if (p->range_length == 0) + if (p->address_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = p->min_base_address; - mem->max = p->max_base_address; + mem->min = p->minimum; + mem->max = p->maximum; mem->align = p->alignment; - mem->size = p->range_length; + mem->size = p->address_length; mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; @@ -410,19 +410,19 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, static void pnpacpi_parse_mem32_option(struct pnp_option *option, - struct acpi_resource_mem32 *p) + struct acpi_resource_memory32 *p) { struct pnp_mem * mem; - if (p->range_length == 0) + if (p->address_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = p->min_base_address; - mem->max = p->max_base_address; + mem->min = p->minimum; + mem->max = p->maximum; mem->align = p->alignment; - mem->size = p->range_length; + mem->size = p->address_length; mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; @@ -433,17 +433,17 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, - struct acpi_resource_fixed_mem32 *p) + struct acpi_resource_fixed_memory32 *p) { struct pnp_mem * mem; - if (p->range_length == 0) + if (p->address_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = mem->max = p->range_base_address; - mem->size = p->range_length; + mem->min = mem->max = p->address; + mem->size = p->address_length; mem->align = 0; mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? @@ -459,7 +459,7 @@ struct acpipnp_parse_option_s { struct pnp_dev *dev; }; -static acpi_status pnpacpi_option_resource(struct acpi_resource *res, +static acpi_status pnpacpi_option_resource(struct acpi_resource *res, void *data) { int priority = 0; @@ -468,34 +468,34 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, struct pnp_option *option = parse_data->option; switch (res->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: pnpacpi_parse_irq_option(option, &res->data.irq); break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: pnpacpi_parse_ext_irq_option(option, &res->data.extended_irq); break; - case ACPI_RSTYPE_DMA: + case ACPI_RESOURCE_TYPE_DMA: pnpacpi_parse_dma_option(option, &res->data.dma); break; - case ACPI_RSTYPE_IO: + case ACPI_RESOURCE_TYPE_IO: pnpacpi_parse_port_option(option, &res->data.io); break; - case ACPI_RSTYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: pnpacpi_parse_fixed_port_option(option, &res->data.fixed_io); break; - case ACPI_RSTYPE_MEM24: + case ACPI_RESOURCE_TYPE_MEMORY24: pnpacpi_parse_mem24_option(option, &res->data.memory24); break; - case ACPI_RSTYPE_MEM32: + case ACPI_RESOURCE_TYPE_MEMORY32: pnpacpi_parse_mem32_option(option, &res->data.memory32); break; - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: pnpacpi_parse_fixed_mem32_option(option, &res->data.fixed_memory32); break; - case ACPI_RSTYPE_START_DPF: + case ACPI_RESOURCE_TYPE_START_DEPENDENT: switch (res->data.start_dpf.compatibility_priority) { case ACPI_GOOD_CONFIGURATION: priority = PNP_RES_PRIORITY_PREFERRED; @@ -518,7 +518,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, return AE_ERROR; parse_data->option = option; break; - case ACPI_RSTYPE_END_DPF: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: /*only one EndDependentFn is allowed*/ if (!parse_data->option_independent) { pnp_warn("PnPACPI: more than one EndDependentFn"); @@ -535,7 +535,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, return AE_OK; } -acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, +acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, struct pnp_dev *dev) { acpi_status status; @@ -546,7 +546,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, return AE_ERROR; parse_data.option_independent = parse_data.option; parse_data.dev = dev; - status = acpi_walk_resources(handle, METHOD_NAME__PRS, + status = acpi_walk_resources(handle, METHOD_NAME__PRS, pnpacpi_option_resource, &parse_data); return status; @@ -560,18 +560,18 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, { int *res_cnt = (int *)data; switch (res->type) { - case ACPI_RSTYPE_IRQ: - case ACPI_RSTYPE_EXT_IRQ: - case ACPI_RSTYPE_DMA: - case ACPI_RSTYPE_IO: - case ACPI_RSTYPE_FIXED_IO: - case ACPI_RSTYPE_MEM24: - case ACPI_RSTYPE_MEM32: - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RESOURCE_TYPE_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_MEMORY24: + case ACPI_RESOURCE_TYPE_MEMORY32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: #if 0 - case ACPI_RSTYPE_ADDRESS16: - case ACPI_RSTYPE_ADDRESS32: - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: #endif (*res_cnt) ++; default: @@ -585,18 +585,18 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, { struct acpi_resource **resource = (struct acpi_resource **)data; switch (res->type) { - case ACPI_RSTYPE_IRQ: - case ACPI_RSTYPE_EXT_IRQ: - case ACPI_RSTYPE_DMA: - case ACPI_RSTYPE_IO: - case ACPI_RSTYPE_FIXED_IO: - case ACPI_RSTYPE_MEM24: - case ACPI_RSTYPE_MEM32: - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RESOURCE_TYPE_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_MEMORY24: + case ACPI_RESOURCE_TYPE_MEMORY32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: #if 0 - case ACPI_RSTYPE_ADDRESS16: - case ACPI_RSTYPE_ADDRESS32: - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: #endif (*resource)->type = res->type; (*resource)++; @@ -607,14 +607,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, return AE_OK; } -int pnpacpi_build_resource_template(acpi_handle handle, +int pnpacpi_build_resource_template(acpi_handle handle, struct acpi_buffer *buffer) { struct acpi_resource *resource; int res_cnt = 0; acpi_status status; - status = acpi_walk_resources(handle, METHOD_NAME__CRS, + status = acpi_walk_resources(handle, METHOD_NAME__CRS, pnpacpi_count_resources, &res_cnt); if (ACPI_FAILURE(status)) { pnp_err("Evaluate _CRS failed"); @@ -628,7 +628,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, return -ENOMEM; pnp_dbg("Res cnt %d", res_cnt); resource = (struct acpi_resource *)buffer->pointer; - status = acpi_walk_resources(handle, METHOD_NAME__CRS, + status = acpi_walk_resources(handle, METHOD_NAME__CRS, pnpacpi_type_resources, &resource); if (ACPI_FAILURE(status)) { kfree(buffer->pointer); @@ -636,54 +636,54 @@ int pnpacpi_build_resource_template(acpi_handle handle, return -EINVAL; } /* resource will pointer the end resource now */ - resource->type = ACPI_RSTYPE_END_TAG; + resource->type = ACPI_RESOURCE_TYPE_END_TAG; return 0; } -static void pnpacpi_encode_irq(struct acpi_resource *resource, +static void pnpacpi_encode_irq(struct acpi_resource *resource, struct resource *p) { - int edge_level, active_high_low; + int triggering, polarity; - decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, - &active_high_low); - resource->type = ACPI_RSTYPE_IRQ; + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, + &polarity); + resource->type = ACPI_RESOURCE_TYPE_IRQ; resource->length = sizeof(struct acpi_resource); - resource->data.irq.edge_level = edge_level; - resource->data.irq.active_high_low = active_high_low; - if (edge_level == ACPI_EDGE_SENSITIVE) - resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->data.irq.triggering = triggering; + resource->data.irq.polarity = polarity; + if (triggering == ACPI_EDGE_SENSITIVE) + resource->data.irq.sharable = ACPI_EXCLUSIVE; else - resource->data.irq.shared_exclusive = ACPI_SHARED; - resource->data.irq.number_of_interrupts = 1; + resource->data.irq.sharable = ACPI_SHARED; + resource->data.irq.interrupt_count = 1; resource->data.irq.interrupts[0] = p->start; } static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, struct resource *p) { - int edge_level, active_high_low; + int triggering, polarity; - decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, - &active_high_low); - resource->type = ACPI_RSTYPE_EXT_IRQ; + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, + &polarity); + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; resource->length = sizeof(struct acpi_resource); resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource->data.extended_irq.edge_level = edge_level; - resource->data.extended_irq.active_high_low = active_high_low; - if (edge_level == ACPI_EDGE_SENSITIVE) - resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->data.extended_irq.triggering = triggering; + resource->data.extended_irq.polarity = polarity; + if (triggering == ACPI_EDGE_SENSITIVE) + resource->data.irq.sharable = ACPI_EXCLUSIVE; else - resource->data.irq.shared_exclusive = ACPI_SHARED; - resource->data.extended_irq.number_of_interrupts = 1; + resource->data.irq.sharable = ACPI_SHARED; + resource->data.extended_irq.interrupt_count = 1; resource->data.extended_irq.interrupts[0] = p->start; } static void pnpacpi_encode_dma(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_DMA; + resource->type = ACPI_RESOURCE_TYPE_DMA; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ if (p->flags & IORESOURCE_DMA_COMPATIBLE) @@ -701,75 +701,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, else if (p->flags & IORESOURCE_DMA_16BIT) resource->data.dma.transfer = ACPI_TRANSFER_16; resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; - resource->data.dma.number_of_channels = 1; + resource->data.dma.channel_count = 1; resource->data.dma.channels[0] = p->start; } static void pnpacpi_encode_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_IO; + resource->type = ACPI_RESOURCE_TYPE_IO; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? - ACPI_DECODE_16 : ACPI_DECODE_10; - resource->data.io.min_base_address = p->start; - resource->data.io.max_base_address = p->end; + ACPI_DECODE_16 : ACPI_DECODE_10; + resource->data.io.minimum = p->start; + resource->data.io.maximum = p->end; resource->data.io.alignment = 0; /* Correct? */ - resource->data.io.range_length = p->end - p->start + 1; + resource->data.io.address_length = p->end - p->start + 1; } static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_FIXED_IO; + resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; resource->length = sizeof(struct acpi_resource); - resource->data.fixed_io.base_address = p->start; - resource->data.fixed_io.range_length = p->end - p->start + 1; + resource->data.fixed_io.address = p->start; + resource->data.fixed_io.address_length = p->end - p->start + 1; } static void pnpacpi_encode_mem24(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_MEM24; + resource->type = ACPI_RESOURCE_TYPE_MEMORY24; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ resource->data.memory24.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.memory24.min_base_address = p->start; - resource->data.memory24.max_base_address = p->end; + resource->data.memory24.minimum = p->start; + resource->data.memory24.maximum = p->end; resource->data.memory24.alignment = 0; - resource->data.memory24.range_length = p->end - p->start + 1; + resource->data.memory24.address_length = p->end - p->start + 1; } static void pnpacpi_encode_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_MEM32; + resource->type = ACPI_RESOURCE_TYPE_MEMORY32; resource->length = sizeof(struct acpi_resource); resource->data.memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.memory32.min_base_address = p->start; - resource->data.memory32.max_base_address = p->end; + resource->data.memory32.minimum = p->start; + resource->data.memory32.maximum = p->end; resource->data.memory32.alignment = 0; - resource->data.memory32.range_length = p->end - p->start + 1; + resource->data.memory32.address_length = p->end - p->start + 1; } static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_FIXED_MEM32; + resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; resource->length = sizeof(struct acpi_resource); resource->data.fixed_memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.fixed_memory32.range_base_address = p->start; - resource->data.fixed_memory32.range_length = p->end - p->start + 1; + resource->data.fixed_memory32.address = p->start; + resource->data.fixed_memory32.address_length = p->end - p->start + 1; } -int pnpacpi_encode_resources(struct pnp_resource_table *res_table, +int pnpacpi_encode_resources(struct pnp_resource_table *res_table, struct acpi_buffer *buffer) { int i = 0; @@ -781,50 +781,50 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, pnp_dbg("res cnt %d", res_cnt); while (i < res_cnt) { switch(resource->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: pnp_dbg("Encode irq"); - pnpacpi_encode_irq(resource, + pnpacpi_encode_irq(resource, &res_table->irq_resource[irq]); irq++; break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: pnp_dbg("Encode ext irq"); - pnpacpi_encode_ext_irq(resource, + pnpacpi_encode_ext_irq(resource, &res_table->irq_resource[irq]); irq++; break; - case ACPI_RSTYPE_DMA: + case ACPI_RESOURCE_TYPE_DMA: pnp_dbg("Encode dma"); - pnpacpi_encode_dma(resource, + pnpacpi_encode_dma(resource, &res_table->dma_resource[dma]); dma ++; break; - case ACPI_RSTYPE_IO: + case ACPI_RESOURCE_TYPE_IO: pnp_dbg("Encode io"); - pnpacpi_encode_io(resource, + pnpacpi_encode_io(resource, &res_table->port_resource[port]); port ++; break; - case ACPI_RSTYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: pnp_dbg("Encode fixed io"); pnpacpi_encode_fixed_io(resource, &res_table->port_resource[port]); port ++; break; - case ACPI_RSTYPE_MEM24: + case ACPI_RESOURCE_TYPE_MEMORY24: pnp_dbg("Encode mem24"); pnpacpi_encode_mem24(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RSTYPE_MEM32: + case ACPI_RESOURCE_TYPE_MEMORY32: pnp_dbg("Encode mem32"); pnpacpi_encode_mem32(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: pnp_dbg("Encode fixed mem32"); pnpacpi_encode_fixed_mem32(resource, &res_table->mem_resource[mem]); diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c index 36681ba7b03..809f89ab965 100644 --- a/drivers/serial/8250_acpi.c +++ b/drivers/serial/8250_acpi.c @@ -27,7 +27,7 @@ struct serial_private { static acpi_status acpi_serial_mmio(struct uart_port *port, struct acpi_resource_address64 *addr) { - port->mapbase = addr->min_address_range; + port->mapbase = addr->minimum; port->iotype = UPIO_MEM; port->flags |= UPF_IOREMAP; return AE_OK; @@ -36,8 +36,8 @@ static acpi_status acpi_serial_mmio(struct uart_port *port, static acpi_status acpi_serial_port(struct uart_port *port, struct acpi_resource_io *io) { - if (io->range_length) { - port->iobase = io->min_base_address; + if (io->address_length) { + port->iobase = io->minimum; port->iotype = UPIO_PORT; } else printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__); @@ -45,13 +45,13 @@ static acpi_status acpi_serial_port(struct uart_port *port, } static acpi_status acpi_serial_ext_irq(struct uart_port *port, - struct acpi_resource_ext_irq *ext_irq) + struct acpi_resource_extended_irq *ext_irq) { int rc; - if (ext_irq->number_of_interrupts > 0) { + if (ext_irq->interrupt_count > 0) { rc = acpi_register_gsi(ext_irq->interrupts[0], - ext_irq->edge_level, ext_irq->active_high_low); + ext_irq->triggering, ext_irq->polarity); if (rc < 0) return AE_ERROR; port->irq = rc; @@ -64,9 +64,9 @@ static acpi_status acpi_serial_irq(struct uart_port *port, { int rc; - if (irq->number_of_interrupts > 0) { + if (irq->interrupt_count > 0) { rc = acpi_register_gsi(irq->interrupts[0], - irq->edge_level, irq->active_high_low); + irq->triggering, irq->polarity); if (rc < 0) return AE_ERROR; port->irq = rc; @@ -83,11 +83,11 @@ static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data) status = acpi_resource_to_address64(res, &addr); if (ACPI_SUCCESS(status)) return acpi_serial_mmio(port, &addr); - else if (res->type == ACPI_RSTYPE_IO) + else if (res->type == ACPI_RESOURCE_TYPE_IO) return acpi_serial_port(port, &res->data.io); - else if (res->type == ACPI_RSTYPE_EXT_IRQ) + else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) return acpi_serial_ext_irq(port, &res->data.extended_irq); - else if (res->type == ACPI_RSTYPE_IRQ) + else if (res->type == ACPI_RESOURCE_TYPE_IRQ) return acpi_serial_irq(port, &res->data.irq); return AE_OK; } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 1427c5cf430..cb59b018c84 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20050916 +#define ACPI_CA_VERSION 0x20050930 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 759b4cff4f8..b2921b869bb 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -187,73 +187,67 @@ void acpi_dm_decode_attribute(u8 attribute); * dmresrcl */ void -acpi_dm_word_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_dword_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_extended_descriptor(union asl_resource_desc *resource, +acpi_dm_extended_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_qword_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_memory24_descriptor(union asl_resource_desc *resource, +acpi_dm_memory24_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_memory32_descriptor(union asl_resource_desc *resource, +acpi_dm_memory32_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_fixed_memory32_descriptor(union asl_resource_desc *resource, +acpi_dm_fixed_memory32_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_generic_register_descriptor(union asl_resource_desc *resource, +acpi_dm_generic_register_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_interrupt_descriptor(union asl_resource_desc *resource, +acpi_dm_interrupt_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_vendor_large_descriptor(union asl_resource_desc *resource, +acpi_dm_vendor_large_descriptor(union aml_resource *resource, u32 length, u32 level); /* * dmresrcs */ void -acpi_dm_irq_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_dma_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level); -void -acpi_dm_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level); +void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_fixed_io_descriptor(union asl_resource_desc *resource, +acpi_dm_fixed_io_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_start_dependent_descriptor(union asl_resource_desc *resource, +acpi_dm_start_dependent_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_end_dependent_descriptor(union asl_resource_desc *resource, +acpi_dm_end_dependent_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_vendor_small_descriptor(union asl_resource_desc *resource, +acpi_dm_vendor_small_descriptor(union aml_resource *resource, u32 length, u32 level); /* diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index e9c2790139e..cef51b1ddf9 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -80,6 +80,15 @@ extern u32 acpi_dbg_layer; extern u32 acpi_gbl_nesting_level; +/* Support for dynamic control method tracing mechanism */ + +ACPI_EXTERN u32 acpi_gbl_original_dbg_level; +ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; +ACPI_EXTERN acpi_name acpi_gbl_trace_method_name; +ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; +ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; +ACPI_EXTERN u32 acpi_gbl_trace_flags; + /***************************************************************************** * * Runtime configuration (static defaults that can be overriden at runtime) diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 76ac1533c40..dca0d40ea39 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -735,59 +735,52 @@ struct acpi_bit_register_info { /* resource_type values */ -#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 -#define ACPI_RESOURCE_TYPE_IO_RANGE 1 -#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 +#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 +#define ACPI_ADDRESS_TYPE_IO_RANGE 1 +#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 /* Resource descriptor types and masks */ -#define ACPI_RDESC_TYPE_LARGE 0x80 -#define ACPI_RDESC_TYPE_SMALL 0x00 +#define ACPI_RESOURCE_NAME_LARGE 0x80 +#define ACPI_RESOURCE_NAME_SMALL 0x00 -#define ACPI_RDESC_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ -#define ACPI_RDESC_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ -#define ACPI_RDESC_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ +#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ +#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ +#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ /* - * Small resource descriptor types + * Small resource descriptor "names" as defined by the ACPI specification. * Note: Bits 2:0 are used for the descriptor length */ -#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 -#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 -#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 -#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 -#define ACPI_RDESC_TYPE_IO_PORT 0x40 -#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 -#define ACPI_RDESC_TYPE_RESERVED_S1 0x50 -#define ACPI_RDESC_TYPE_RESERVED_S2 0x58 -#define ACPI_RDESC_TYPE_RESERVED_S3 0x60 -#define ACPI_RDESC_TYPE_RESERVED_S4 0x68 -#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 -#define ACPI_RDESC_TYPE_END_TAG 0x78 +#define ACPI_RESOURCE_NAME_IRQ 0x20 +#define ACPI_RESOURCE_NAME_DMA 0x28 +#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 +#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 +#define ACPI_RESOURCE_NAME_IO 0x40 +#define ACPI_RESOURCE_NAME_FIXED_IO 0x48 +#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 +#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 +#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 +#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 +#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 +#define ACPI_RESOURCE_NAME_END_TAG 0x78 /* - * Large resource descriptor types + * Large resource descriptor "names" as defined by the ACPI specification. + * Note: includes the Large Descriptor bit in bit[7] */ -#define ACPI_RDESC_TYPE_MEMORY_24 0x81 -#define ACPI_RDESC_TYPE_GENERIC_REGISTER 0x82 -#define ACPI_RDESC_TYPE_RESERVED_L1 0x83 -#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 -#define ACPI_RDESC_TYPE_MEMORY_32 0x85 -#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 -#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 -#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 -#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 -#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A -#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B -#define ACPI_RDESC_LARGE_MAX 0x8B - -/* - * Minimum lengths for descriptors with optional fields - */ -#define ACPI_RDESC_QWORD_MIN 43 -#define ACPI_RDESC_DWORD_MIN 23 -#define ACPI_RDESC_WORD_MIN 13 -#define ACPI_RDESC_EXT_XRUPT_MIN 6 +#define ACPI_RESOURCE_NAME_MEMORY24 0x81 +#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 +#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 +#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 +#define ACPI_RESOURCE_NAME_MEMORY32 0x85 +#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 +#define ACPI_RESOURCE_NAME_ADDRESS32 0x87 +#define ACPI_RESOURCE_NAME_ADDRESS16 0x88 +#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 +#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A +#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B +#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B /***************************************************************************** * @@ -795,7 +788,7 @@ struct acpi_bit_register_info { * ****************************************************************************/ -#define ACPI_ASCII_ZERO 0x30 +#define ACPI_ASCII_ZERO 0x30 /***************************************************************************** * diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 702cc4e57f5..258cfe5e2aa 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -525,6 +525,9 @@ * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_acpi_function_name" is defined. + * + * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining + * about these constructs. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -532,10 +535,55 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({ \ + acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ + return;}) +/* + * There are two versions of most of the return macros. The default version is + * safer, since it avoids side-effects by guaranteeing that the argument will + * not be evaluated twice. + * + * A less-safe version of the macros is provided for optional use if the + * compiler uses excessive CPU stack (for example, this may happen in the + * debug case if code optimzation is disabled.) + */ +#ifndef ACPI_SIMPLE_RETURN_MACROS + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + register acpi_status _s = (s); \ + acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + register void *_s = (void *) (s); \ + acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ + return (_s); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + register acpi_integer _s = (s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ + register u8 _s = (u8) (s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ + register u32 _s = (u32) (s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#else /* Use original less-safe macros */ + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ + return((s)); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ + return((s)); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ + return((s)); }) +#define return_UINT8(s) return_VALUE(s) +#define return_UINT32(s) return_VALUE(s) + +#endif /* ACPI_SIMPLE_RETURN_MACROS */ /* Conditional execution */ @@ -612,6 +660,8 @@ #define return_VOID return #define return_ACPI_STATUS(s) return(s) #define return_VALUE(s) return(s) +#define return_UINT8(s) return(s) +#define return_UINT32(s) return(s) #define return_PTR(s) return(s) #endif diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index c1b4e1f882e..b425f9bb6d4 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -52,8 +52,8 @@ /* ACPI PCI Interrupt Link (pci_link.c) */ int acpi_irq_penalty_init(void); -int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, - int *active_high_low, char **name); +int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, + int *polarity, char **name); int acpi_pci_link_free_irq(acpi_handle handle); /* ACPI PCI Interrupt Routing (pci_irq.c) */ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2a9dbc13b0f..02f00a8fee0 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -149,6 +149,9 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler); acpi_status acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); +acpi_status +acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); + /* * Object manipulation and enumeration */ diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ce2cf72fd4c..b66994e9e4e 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -44,6 +44,51 @@ #ifndef __ACRESRC_H__ #define __ACRESRC_H__ +/* Need the AML resource descriptor structs */ + +#include "amlresrc.h" + +/* + * Resource dispatch and info tables + */ +struct acpi_resource_info { + u8 length_type; + u8 minimum_aml_resource_length; + u8 minimum_internal_struct_length; +}; + +/* Types for length_type above */ + +#define ACPI_FIXED_LENGTH 0 +#define ACPI_VARIABLE_LENGTH 1 +#define ACPI_SMALL_VARIABLE_LENGTH 2 + +/* Handlers */ + +typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * + resource, + union aml_resource * aml); + +typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, + u16 aml_resource_length, + struct acpi_resource * + resource); + +typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); + +/* Tables indexed by internal resource type */ + +extern u8 acpi_gbl_aml_resource_sizes[]; +extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[]; +extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[]; + +/* Tables indexed by raw AML resource descriptor type */ + +extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; +extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; +extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; +extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; + /* * Function prototypes called from Acpi* APIs */ @@ -66,12 +111,12 @@ acpi_status acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, +acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer); +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer); acpi_status acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, @@ -90,184 +135,240 @@ void acpi_rs_dump_irq_list(u8 * route_table); * rscalc */ acpi_status -acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, - u8 ** byte_stream_start, u32 * size); - -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 * aml_buffer, + u32 aml_buffer_length, acpi_size * size_needed); acpi_status -acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, - acpi_size * size_needed); +acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, + acpi_size * size_needed); acpi_status acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, acpi_size * buffer_size_needed); acpi_status -acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, u8 * output_buffer); +acpi_rs_convert_aml_to_resources(u8 * aml_buffer, + u32 aml_buffer_length, u8 * output_buffer); acpi_status -acpi_rs_list_to_byte_stream(struct acpi_resource *resource, - acpi_size byte_stream_size_needed, - u8 * output_buffer); +acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, + acpi_size aml_size_needed, u8 * output_buffer); +/* + * rsio + */ acpi_status -acpi_rs_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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_set_io(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_fixed_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_fixed_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_dma(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml); +/* + * rsirq + */ acpi_status -acpi_rs_dma_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_dma_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_address16_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_ext_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_address16_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml); + +/* + * rsaddr + */ +acpi_status +acpi_rs_get_address16(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_address32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_address32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_address32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_address64_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_address64_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_address64(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); 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_set_address64(struct acpi_resource *resource, union aml_resource *aml); + +acpi_status +acpi_rs_get_ext_address64(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource); + +acpi_status +acpi_rs_set_ext_address64(struct acpi_resource *resource, + union aml_resource *aml); + +/* + * rsmemory + */ +acpi_status +acpi_rs_get_memory24(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *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_set_memory24(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, - acpi_size * bytes_consumed); +acpi_rs_get_memory32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_memory24_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_fixed_memory32(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource); acpi_status -acpi_rs_memory24_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_fixed_memory32(struct acpi_resource *resource, + union aml_resource *aml); +/* + * rsmisc + */ acpi_status -acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +acpi_rs_get_generic_reg(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *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_set_generic_reg(struct acpi_resource *resource, + union aml_resource *aml); acpi_status -acpi_rs_memory32_range_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_vendor(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_start_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_end_tag_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_end_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_end_tag_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_vendor_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_end_tag(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_vendor_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml); + +/* + * rsutils + */ +void +acpi_rs_move_data(void *destination, + void *source, u16 item_count, u8 move_type); + +/* Types used in move_type above */ + +#define ACPI_MOVE_TYPE_16_TO_32 0 +#define ACPI_MOVE_TYPE_32_TO_16 1 +#define ACPI_MOVE_TYPE_32_TO_32 2 +#define ACPI_MOVE_TYPE_64_TO_64 3 + +u16 +acpi_rs_get_resource_source(u16 resource_length, + acpi_size minimum_length, + struct acpi_resource_source *resource_source, + union aml_resource *aml, char *string_ptr); + +acpi_size +acpi_rs_set_resource_source(union aml_resource *aml, + acpi_size minimum_length, + struct acpi_resource_source *resource_source); u8 acpi_rs_get_resource_type(u8 resource_start_byte); +u32 acpi_rs_get_descriptor_length(union aml_resource *aml); + +u16 acpi_rs_get_resource_length(union aml_resource *aml); + +void +acpi_rs_set_resource_header(u8 descriptor_type, + acpi_size total_length, union aml_resource *aml); + +struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* - * rsmisc + * rsdump */ -acpi_status -acpi_rs_generic_register_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +void acpi_rs_dump_irq(union acpi_resource_data *resource); -acpi_status -acpi_rs_generic_register_stream(struct acpi_resource *resource, - u8 ** output_buffer, - acpi_size * bytes_consumed); +void acpi_rs_dump_address16(union acpi_resource_data *resource); + +void acpi_rs_dump_address32(union acpi_resource_data *resource); + +void acpi_rs_dump_address64(union acpi_resource_data *resource); + +void acpi_rs_dump_ext_address64(union acpi_resource_data *resource); + +void acpi_rs_dump_dma(union acpi_resource_data *resource); + +void acpi_rs_dump_io(union acpi_resource_data *resource); + +void acpi_rs_dump_ext_irq(union acpi_resource_data *resource); + +void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); + +void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); + +void acpi_rs_dump_memory24(union acpi_resource_data *resource); + +void acpi_rs_dump_memory32(union acpi_resource_data *resource); + +void acpi_rs_dump_start_dpf(union acpi_resource_data *resource); + +void acpi_rs_dump_vendor(union acpi_resource_data *resource); + +void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); + +void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); + +void acpi_rs_dump_end_tag(union acpi_resource_data *resource); + +#endif #endif /* __ACRESRC_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 1dfa64fae4e..43f7c509317 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -978,10 +978,10 @@ struct acpi_mem_space_context { * Structures used to describe device resources */ struct acpi_resource_irq { - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; + u32 triggering; + u32 polarity; + u32 sharable; + u32 interrupt_count; u32 interrupts[1]; }; @@ -989,11 +989,11 @@ struct acpi_resource_dma { u32 type; u32 bus_master; u32 transfer; - u32 number_of_channels; + u32 channel_count; u32 channels[1]; }; -struct acpi_resource_start_dpf { +struct acpi_resource_start_dependent { u32 compatibility_priority; u32 performance_robustness; }; @@ -1005,46 +1005,46 @@ struct acpi_resource_start_dpf { struct acpi_resource_io { u32 io_decode; - u32 min_base_address; - u32 max_base_address; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; struct acpi_resource_fixed_io { - u32 base_address; - u32 range_length; + u32 address; + u32 address_length; }; struct acpi_resource_vendor { - u32 length; - u8 reserved[1]; + u32 byte_length; + u8 byte_data[1]; }; struct acpi_resource_end_tag { u8 checksum; }; -struct acpi_resource_mem24 { +struct acpi_resource_memory24 { u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; -struct acpi_resource_mem32 { +struct acpi_resource_memory32 { u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; -struct acpi_resource_fixed_mem32 { +struct acpi_resource_fixed_memory32 { u32 read_write_attribute; - u32 range_base_address; - u32 range_length; + u32 address; + u32 address_length; }; struct acpi_memory_attribute { @@ -1089,93 +1089,105 @@ ACPI_RESOURCE_ADDRESS_COMMON}; struct acpi_resource_address16 { ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; + u32 minimum; + u32 maximum; + u32 translation_offset; u32 address_length; struct acpi_resource_source resource_source; }; struct acpi_resource_address32 { ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; + u32 minimum; + u32 maximum; + u32 translation_offset; u32 address_length; struct acpi_resource_source resource_source; }; struct acpi_resource_address64 { ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; - u64 min_address_range; - u64 max_address_range; - u64 address_translation_offset; + u64 minimum; + u64 maximum; + u64 translation_offset; u64 address_length; - u64 type_specific_attributes; struct acpi_resource_source resource_source; }; -struct acpi_resource_ext_irq { +struct acpi_resource_extended_address64 { + ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; + u64 type_specific_attributes; + u8 revision_iD; +}; + +struct acpi_resource_extended_irq { u32 producer_consumer; - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; + u32 triggering; + u32 polarity; + u32 sharable; + u32 interrupt_count; struct acpi_resource_source resource_source; u32 interrupts[1]; }; -struct acpi_resource_generic_reg { +struct acpi_resource_generic_register { u32 space_id; u32 bit_width; u32 bit_offset; - u32 address_size; + u32 access_size; u64 address; }; /* ACPI_RESOURCE_TYPEs */ -#define ACPI_RSTYPE_IRQ 0 -#define ACPI_RSTYPE_DMA 1 -#define ACPI_RSTYPE_START_DPF 2 -#define ACPI_RSTYPE_END_DPF 3 -#define ACPI_RSTYPE_IO 4 -#define ACPI_RSTYPE_FIXED_IO 5 -#define ACPI_RSTYPE_VENDOR 6 -#define ACPI_RSTYPE_END_TAG 7 -#define ACPI_RSTYPE_MEM24 8 -#define ACPI_RSTYPE_MEM32 9 -#define ACPI_RSTYPE_FIXED_MEM32 10 -#define ACPI_RSTYPE_ADDRESS16 11 -#define ACPI_RSTYPE_ADDRESS32 12 -#define ACPI_RSTYPE_ADDRESS64 13 -#define ACPI_RSTYPE_EXT_IRQ 14 -#define ACPI_RSTYPE_GENERIC_REG 15 -#define ACPI_RSTYPE_MAX 15 - -typedef u32 acpi_resource_type; +#define ACPI_RESOURCE_TYPE_IRQ 0 +#define ACPI_RESOURCE_TYPE_DMA 1 +#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 +#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 +#define ACPI_RESOURCE_TYPE_IO 4 +#define ACPI_RESOURCE_TYPE_FIXED_IO 5 +#define ACPI_RESOURCE_TYPE_VENDOR 6 +#define ACPI_RESOURCE_TYPE_END_TAG 7 +#define ACPI_RESOURCE_TYPE_MEMORY24 8 +#define ACPI_RESOURCE_TYPE_MEMORY32 9 +#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 +#define ACPI_RESOURCE_TYPE_ADDRESS16 11 +#define ACPI_RESOURCE_TYPE_ADDRESS32 12 +#define ACPI_RESOURCE_TYPE_ADDRESS64 13 +#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ +#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 +#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 +#define ACPI_RESOURCE_TYPE_MAX 16 union acpi_resource_data { struct acpi_resource_irq irq; struct acpi_resource_dma dma; - struct acpi_resource_start_dpf start_dpf; + struct acpi_resource_start_dependent start_dpf; struct acpi_resource_io io; struct acpi_resource_fixed_io fixed_io; - struct acpi_resource_vendor vendor_specific; + struct acpi_resource_vendor vendor; struct acpi_resource_end_tag end_tag; - struct acpi_resource_mem24 memory24; - struct acpi_resource_mem32 memory32; - struct acpi_resource_fixed_mem32 fixed_memory32; - struct acpi_resource_address address; /* Common 16/32/64 address fields */ + struct acpi_resource_memory24 memory24; + struct acpi_resource_memory32 memory32; + struct acpi_resource_fixed_memory32 fixed_memory32; struct acpi_resource_address16 address16; struct acpi_resource_address32 address32; struct acpi_resource_address64 address64; - struct acpi_resource_ext_irq extended_irq; - struct acpi_resource_generic_reg generic_reg; + struct acpi_resource_extended_address64 ext_address64; + struct acpi_resource_extended_irq extended_irq; + struct acpi_resource_generic_register generic_reg; + + /* Common fields */ + + struct acpi_resource_address address; /* Common 16/32/64 address fields */ }; struct acpi_resource { - acpi_resource_type type; + u32 type; u32 length; union acpi_resource_data data; }; @@ -1183,7 +1195,7 @@ struct acpi_resource { #define ACPI_RESOURCE_LENGTH 12 #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ -#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) +#define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index a3c46ba6358..103aff07db1 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -96,165 +96,159 @@ struct asl_resource_node { * Resource descriptors defined in the ACPI specification. * * Packing/alignment must be BYTE because these descriptors - * are used to overlay the AML byte stream. + * are used to overlay the raw AML byte stream. */ #pragma pack(1) -struct asl_irq_format_desc { - u8 descriptor_type; - u16 irq_mask; +/* + * SMALL descriptors + */ +#define AML_RESOURCE_SMALL_HEADER_COMMON \ + u8 descriptor_type; + +struct aml_resource_small_header { +AML_RESOURCE_SMALL_HEADER_COMMON}; + +struct aml_resource_irq { + AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; u8 flags; }; -struct asl_irq_noflags_desc { - u8 descriptor_type; - u16 irq_mask; +struct aml_resource_irq_noflags { + AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; }; -struct asl_dma_format_desc { - u8 descriptor_type; - u8 dma_channel_mask; +struct aml_resource_dma { + AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask; u8 flags; }; -struct asl_start_dependent_desc { - u8 descriptor_type; - u8 flags; +struct aml_resource_start_dependent { + AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; }; -struct asl_start_dependent_noprio_desc { - u8 descriptor_type; -}; +struct aml_resource_start_dependent_noprio { +AML_RESOURCE_SMALL_HEADER_COMMON}; -struct asl_end_dependent_desc { - u8 descriptor_type; -}; +struct aml_resource_end_dependent { +AML_RESOURCE_SMALL_HEADER_COMMON}; -struct asl_io_port_desc { - u8 descriptor_type; - u8 information; - u16 address_min; - u16 address_max; +struct aml_resource_io { + AML_RESOURCE_SMALL_HEADER_COMMON u8 information; + u16 minimum; + u16 maximum; u8 alignment; - u8 length; + u8 address_length; }; -struct asl_fixed_io_port_desc { - u8 descriptor_type; - u16 base_address; - u8 length; +struct aml_resource_fixed_io { + AML_RESOURCE_SMALL_HEADER_COMMON u16 address; + u8 address_length; }; -struct asl_small_vendor_desc { - u8 descriptor_type; - u8 vendor_defined[7]; -}; +struct aml_resource_vendor_small { +AML_RESOURCE_SMALL_HEADER_COMMON}; -struct asl_end_tag_desc { - u8 descriptor_type; - u8 checksum; +struct aml_resource_end_tag { + AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; }; -/* LARGE descriptors */ - -#define ASL_LARGE_HEADER_COMMON \ +/* + * LARGE descriptors + */ +#define AML_RESOURCE_LARGE_HEADER_COMMON \ u8 descriptor_type;\ - u16 length; + u16 resource_length; -struct asl_large_header { -ASL_LARGE_HEADER_COMMON}; +struct aml_resource_large_header { +AML_RESOURCE_LARGE_HEADER_COMMON}; -struct asl_memory_24_desc { - ASL_LARGE_HEADER_COMMON u8 information; - u16 address_min; - u16 address_max; +struct aml_resource_memory24 { + AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + u16 minimum; + u16 maximum; u16 alignment; - u16 range_length; + u16 address_length; }; -struct asl_large_vendor_desc { - ASL_LARGE_HEADER_COMMON u8 vendor_defined[1]; -}; +struct aml_resource_vendor_large { +AML_RESOURCE_LARGE_HEADER_COMMON}; -struct asl_memory_32_desc { - ASL_LARGE_HEADER_COMMON u8 information; - u32 address_min; - u32 address_max; +struct aml_resource_memory32 { + AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; -struct asl_fixed_memory_32_desc { - ASL_LARGE_HEADER_COMMON u8 information; - u32 base_address; - u32 range_length; +struct aml_resource_fixed_memory32 { + AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + u32 address; + u32 address_length; }; -struct asl_extended_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u8 revision_iD; +#define AML_RESOURCE_ADDRESS_COMMON \ + u8 resource_type; \ + u8 flags; \ + u8 specific_flags; + +struct aml_resource_address { +AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; + +struct aml_resource_extended_address64 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u8 revision_iD; u8 reserved; u64 granularity; - u64 address_min; - u64 address_max; + u64 minimum; + u64 maximum; u64 translation_offset; u64 address_length; u64 type_specific_attributes; - u8 optional_fields[2]; /* Used for length calculation only */ }; -#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ +#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ -struct asl_qword_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u64 granularity; - u64 address_min; - u64 address_max; +struct aml_resource_address64 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u64 granularity; + u64 minimum; + u64 maximum; u64 translation_offset; u64 address_length; - u8 optional_fields[2]; }; -struct asl_dword_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u32 granularity; - u32 address_min; - u32 address_max; +struct aml_resource_address32 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u32 granularity; + u32 minimum; + u32 maximum; u32 translation_offset; u32 address_length; - u8 optional_fields[2]; }; -struct asl_word_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u16 granularity; - u16 address_min; - u16 address_max; +struct aml_resource_address16 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u16 granularity; + u16 minimum; + u16 maximum; u16 translation_offset; u16 address_length; - u8 optional_fields[2]; }; -struct asl_extended_xrupt_desc { - ASL_LARGE_HEADER_COMMON u8 flags; +struct aml_resource_extended_irq { + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u8 table_length; u32 interrupt_number[1]; /* res_source_index, res_source optional fields follow */ }; -struct asl_generic_register_desc { - ASL_LARGE_HEADER_COMMON u8 address_space_id; +struct aml_resource_generic_register { + AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id; u8 bit_width; u8 bit_offset; - u8 access_size; /* ACPI 3.0, was Reserved */ + u8 access_size; /* ACPI 3.0, was previously Reserved */ u64 address; }; @@ -264,27 +258,39 @@ struct asl_generic_register_desc { /* Union of all resource descriptors, so we can allocate the worst case */ -union asl_resource_desc { - struct asl_irq_format_desc irq; - struct asl_dma_format_desc dma; - struct asl_io_port_desc iop; - struct asl_fixed_io_port_desc fio; - struct asl_start_dependent_desc std; - struct asl_end_dependent_desc end; - struct asl_small_vendor_desc smv; - struct asl_end_tag_desc et; - - struct asl_large_header lhd; - struct asl_memory_24_desc M24; - struct asl_large_vendor_desc lgv; - struct asl_memory_32_desc M32; - struct asl_fixed_memory_32_desc F32; - struct asl_qword_address_desc qas; - struct asl_dword_address_desc das; - struct asl_word_address_desc was; - struct asl_extended_address_desc eas; - struct asl_extended_xrupt_desc exx; - struct asl_generic_register_desc grg; +union aml_resource { + /* Descriptor headers */ + + struct aml_resource_small_header small_header; + struct aml_resource_large_header large_header; + + /* Small resource descriptors */ + + struct aml_resource_irq irq; + struct aml_resource_dma dma; + struct aml_resource_start_dependent start_dpf; + struct aml_resource_end_dependent end_dpf; + struct aml_resource_io io; + struct aml_resource_fixed_io fixed_io; + struct aml_resource_vendor_small vendor_small; + struct aml_resource_end_tag end_tag; + + /* Large resource descriptors */ + + struct aml_resource_memory24 memory24; + struct aml_resource_generic_register generic_reg; + struct aml_resource_vendor_large vendor_large; + struct aml_resource_memory32 memory32; + struct aml_resource_fixed_memory32 fixed_memory32; + struct aml_resource_address16 address16; + struct aml_resource_address32 address32; + struct aml_resource_address64 address64; + struct aml_resource_extended_address64 ext_address64; + struct aml_resource_extended_irq extended_irq; + + /* Utility overlays */ + + struct aml_resource_address address; u32 u32_item; u16 u16_item; u8 U8item; diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 6f8a17d105a..ac59045e7ba 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h @@ -188,7 +188,7 @@ extern void mp_register_lapic_address (u64 address); extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); extern void mp_config_acpi_legacy_irqs (void); -extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); +extern int mp_register_gsi (u32 gsi, int triggering, int polarity); #endif /*CONFIG_X86_IO_APIC*/ #endif diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 026c3c011dc..84d3d9f034c 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -435,7 +435,7 @@ extern int sbf_port ; #endif /* !CONFIG_ACPI */ -int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); +int acpi_register_gsi (u32 gsi, int triggering, int polarity); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); /* -- cgit v1.2.3 From 0897831bb54eb36fd9e2a22da7f0f64be1b20d09 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 21 Oct 2005 00:00:00 -0400 Subject: [ACPI] ACPICA 20051021 Implemented support for the EM64T and other x86_64 processors. This essentially entails recognizing that these processors support non-aligned memory transfers. Previously, all 64-bit processors were assumed to lack hardware support for non-aligned transfers. Completed conversion of the Resource Manager to nearly full table-driven operation. Specifically, the resource conversion code (convert AML to internal format and the reverse) and the debug code to dump internal resource descriptors are fully table-driven, reducing code and data size and improving maintainability. The OSL interfaces for Acquire and Release Lock now use a 64-bit flag word on 64-bit processors instead of a fixed 32-bit word. (Alexey Starikovskiy) Implemented support within the resource conversion code for the Type-Specific byte within the various ACPI 3.0 *WordSpace macros. Fixed some issues within the resource conversion code for the type-specific flags for both Memory and I/O address resource descriptors. For Memory, implemented support for the MTP and TTP flags. For I/O, split the TRS and TTP flags into two separate fields. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- arch/ia64/pci/pci.c | 2 +- drivers/acpi/events/evgpe.c | 8 +- drivers/acpi/events/evgpeblk.c | 10 +- drivers/acpi/events/evxface.c | 4 +- drivers/acpi/executer/exmisc.c | 5 +- drivers/acpi/executer/exregion.c | 4 +- drivers/acpi/osl.c | 6 +- drivers/acpi/resources/rsaddr.c | 745 ++++++----------------- drivers/acpi/resources/rscalc.c | 71 ++- drivers/acpi/resources/rsdump.c | 1207 +++++++++++++++---------------------- drivers/acpi/resources/rsinfo.c | 115 ++-- drivers/acpi/resources/rsio.c | 333 +++++----- drivers/acpi/resources/rsirq.c | 393 ++++-------- drivers/acpi/resources/rslist.c | 92 +-- drivers/acpi/resources/rsmemory.c | 303 ++++------ drivers/acpi/resources/rsmisc.c | 814 +++++++++++++------------ drivers/acpi/resources/rsutils.c | 269 ++++----- drivers/acpi/resources/rsxface.c | 2 +- drivers/acpi/tables/tbutils.c | 5 +- drivers/acpi/utilities/utalloc.c | 2 +- drivers/acpi/utilities/utglobal.c | 64 +- drivers/acpi/utilities/utmisc.c | 146 ++++- drivers/pnp/pnpacpi/rsparser.c | 12 +- include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 17 +- include/acpi/acmacros.h | 6 +- include/acpi/acpiosxf.h | 4 +- include/acpi/acresrc.h | 401 ++++++------ include/acpi/actypes.h | 183 +++--- include/acpi/acutils.h | 7 +- include/acpi/amlresrc.h | 14 +- include/acpi/platform/acenv.h | 11 +- 32 files changed, 2275 insertions(+), 2982 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 25f923d050e..5536027da9d 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -195,7 +195,7 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr) min = addr->minimum; max = min + addr->address_length - 1; - if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) + if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION) sparse = 1; space_nr = new_space(addr->translation_offset, sparse); diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f51c3b16c60..bdd86537738 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -372,14 +372,14 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) { + acpi_status status; + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_register_info *gpe_register_info; u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; u8 enabled_status_byte; - struct acpi_gpe_register_info *gpe_register_info; u32 status_reg; u32 enable_reg; - u32 flags; - acpi_status status; - struct acpi_gpe_block_info *gpe_block; + acpi_native_uint flags; acpi_native_uint i; acpi_native_uint j; diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index b312eb33c43..7ca10c5f291 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; acpi_status status = AE_OK; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); @@ -479,7 +479,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 struct acpi_gpe_xrupt_info *next_gpe_xrupt; struct acpi_gpe_xrupt_info *gpe_xrupt; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); @@ -553,7 +553,7 @@ static acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) { acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); @@ -610,7 +610,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_block; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); @@ -663,7 +663,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) { acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 43b33d19cdf..57d73299298 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -562,7 +562,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); @@ -653,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index a3f4d72bedc..1899ab25139 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -625,9 +625,8 @@ acpi_ex_do_logical_op(u16 opcode, /* Lexicographic compare: compare the data bytes */ - compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, - (const char *)local_operand1->buffer. - pointer, + compare = ACPI_MEMCMP(operand0->buffer.pointer, + local_operand1->buffer.pointer, (length0 > length1) ? length1 : length0); switch (opcode) { diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 9a2f5bea3af..1897379b5f9 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -77,7 +77,7 @@ acpi_ex_system_memory_space_handler(u32 function, struct acpi_mem_space_context *mem_info = region_context; u32 length; acpi_size window_size; -#ifndef ACPI_MISALIGNED_TRANSFERS +#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED u32 remainder; #endif @@ -109,7 +109,7 @@ acpi_ex_system_memory_space_handler(u32 function, return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } -#ifndef ACPI_MISALIGNED_TRANSFERS +#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED /* * Hardware does not support non-aligned data transfers, we must verify * the request. diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index e3cd0b16031..4ece850b2af 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1058,11 +1058,9 @@ EXPORT_SYMBOL(max_cstate); * Acquire a spinlock. * * handle is a pointer to the spinlock_t. - * flags is *not* the result of save_flags - it is an ACPI-specific flag variable - * that indicates whether we are at interrupt level. */ -unsigned long acpi_os_acquire_lock(acpi_handle handle) +acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) { unsigned long flags; spin_lock_irqsave((spinlock_t *) handle, flags); @@ -1073,7 +1071,7 @@ unsigned long acpi_os_acquire_lock(acpi_handle handle) * Release a spinlock. See above. */ -void acpi_os_release_lock(acpi_handle handle, unsigned long flags) +void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) { spin_unlock_irqrestore((spinlock_t *) handle, flags); } diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 6f48ebf3304..4ac942badbc 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -47,683 +47,334 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsaddr") -/* Local prototypes */ -static void -acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags); - -static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource); - -static void -acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); - -static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); - -static void -acpi_rs_set_address_common(union aml_resource *aml, - struct acpi_resource *resource); - -static u8 -acpi_rs_get_address_common(struct acpi_resource *resource, - union aml_resource *aml); - -/******************************************************************************* - * - * FUNCTION: acpi_rs_decode_general_flags - * - * PARAMETERS: Resource - Address resource data struct - * Flags - Raw AML flag byte - * - * RETURN: Decoded flag bits in resource struct - * - * DESCRIPTION: Decode a general flag byte to an address resource struct - * - ******************************************************************************/ - -static void -acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) -{ - ACPI_FUNCTION_ENTRY(); - - /* Producer / Consumer - flag bit[0] */ - - resource->address.producer_consumer = (u32) (flags & 0x01); - - /* Decode (_DEC) - flag bit[1] */ - - resource->address.decode = (u32) ((flags >> 1) & 0x01); - - /* Min Address Fixed (_MIF) - flag bit[2] */ - - resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01); - - /* Max Address Fixed (_MAF) - flag bit[3] */ - - resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_encode_general_flags - * - * PARAMETERS: Resource - Address resource data struct - * - * RETURN: Encoded general flag byte - * - * DESCRIPTION: Construct a general flag byte from an address resource struct - * - ******************************************************************************/ - -static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - return ((u8) - - /* Producer / Consumer - flag bit[0] */ - ((resource->address.producer_consumer & 0x01) | - /* Decode (_DEC) - flag bit[1] */ - ((resource->address.decode & 0x01) << 1) | - /* Min Address Fixed (_MIF) - flag bit[2] */ - ((resource->address.min_address_fixed & 0x01) << 2) | - /* Max Address Fixed (_MAF) - flag bit[3] */ - ((resource->address.max_address_fixed & 0x01) << 3)) - ); -} - /******************************************************************************* * - * FUNCTION: acpi_rs_decode_specific_flags - * - * PARAMETERS: Resource - Address resource data struct - * Flags - Raw AML flag byte - * - * RETURN: Decoded flag bits in attribute struct - * - * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. - * Type-specific flags are only defined for the Memory and IO - * resource types. + * acpi_rs_convert_address16 - All WORD (16-bit) address resources * ******************************************************************************/ +struct acpi_rsconvert_info acpi_rs_convert_address16[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16, + ACPI_RS_SIZE(struct acpi_resource_address16), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address16)}, -static void -acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) -{ - ACPI_FUNCTION_ENTRY(); - - if (resource->address.resource_type == ACPI_MEMORY_RANGE) { - /* Write Status (_RW) - flag bit[0] */ - - resource->address.attribute.memory.read_write_attribute = - (u16) (flags & 0x01); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16, + sizeof(struct aml_resource_address16), + 0}, - /* Memory Attributes (_MEM) - flag bits[2:1] */ + /* Resource Type, General Flags, and Type-Specific Flags */ - resource->address.attribute.memory.cache_attribute = - (u16) ((flags >> 1) & 0x03); - } else if (resource->address.resource_type == ACPI_IO_RANGE) { - /* Ranges (_RNG) - flag bits[1:0] */ - - resource->address.attribute.io.range_attribute = - (u16) (flags & 0x03); - - /* Translations (_TTP and _TRS) - flag bits[5:4] */ - - resource->address.attribute.io.translation_attribute = - (u16) ((flags >> 4) & 0x03); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_encode_specific_flags - * - * PARAMETERS: Resource - Address resource data struct - * - * RETURN: Encoded type-specific flag byte - * - * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. - * Type-specific flags are only defined for the Memory and IO - * resource types. - * - ******************************************************************************/ - -static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - if (resource->address.resource_type == ACPI_MEMORY_RANGE) { - return ((u8) - - /* Write Status (_RW) - flag bit[0] */ - ((resource->address.attribute.memory. - read_write_attribute & 0x01) | - /* Memory Attributes (_MEM) - flag bits[2:1] */ - ((resource->address.attribute.memory. - cache_attribute & 0x03) << 1))); - } else if (resource->address.resource_type == ACPI_IO_RANGE) { - return ((u8) - - /* Ranges (_RNG) - flag bits[1:0] */ - ((resource->address.attribute.io. - range_attribute & 0x03) | - /* Translations (_TTP and _TRS) - flag bits[5:4] */ - ((resource->address.attribute.io. - translation_attribute & 0x03) << 4))); - } - - return (0); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_address_common - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * Resource - Pointer to the internal resource struct - * - * RETURN: None - * - * DESCRIPTION: Convert common flag fields from a resource descriptor to an - * AML descriptor - * - ******************************************************************************/ - -static void -acpi_rs_set_address_common(union aml_resource *aml, - struct acpi_resource *resource) -{ - ACPI_FUNCTION_ENTRY(); - - /* Set the Resource Type (Memory, Io, bus_number, etc.) */ - - aml->address.resource_type = (u8) resource->data.address.resource_type; - - /* Set the general flags */ - - aml->address.flags = acpi_rs_encode_general_flags(&resource->data); - - /* Set the type-specific flags */ - - aml->address.specific_flags = - acpi_rs_encode_specific_flags(&resource->data); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_address_common - * - * PARAMETERS: Resource - Pointer to the internal resource struct - * Aml - Pointer to the AML resource descriptor - * - * RETURN: TRUE if the resource_type field is OK, FALSE otherwise - * - * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor - * to an internal resource descriptor - * - ******************************************************************************/ - -static u8 -acpi_rs_get_address_common(struct acpi_resource *resource, - union aml_resource *aml) -{ - ACPI_FUNCTION_ENTRY(); - - /* Validate resource type */ - - if ((aml->address.resource_type > 2) - && (aml->address.resource_type < 0xC0)) { - return (FALSE); - } - - /* Get the Resource Type (Memory, Io, bus_number, etc.) */ - - resource->data.address.resource_type = aml->address.resource_type; - - /* Get the General Flags */ - - acpi_rs_decode_general_flags(&resource->data, aml->address.flags); - - /* Get the Type-Specific Flags */ - - acpi_rs_decode_specific_flags(&resource->data, - aml->address.specific_flags); - return (TRUE); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_address16 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_address16(union aml_resource * aml, - u16 aml_resource_length, struct acpi_resource * resource) -{ - ACPI_FUNCTION_TRACE("rs_get_address16"); - - /* Get the Resource Type, general flags, and type-specific flags */ - - if (!acpi_rs_get_address_common(resource, aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + {ACPI_RSC_ADDRESS, 0, 0, 0}, /* - * Get the following contiguous fields from the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length */ - acpi_rs_move_data(&resource->data.address16.granularity, - &aml->address16.granularity, 5, - ACPI_MOVE_TYPE_16_TO_32); - - /* Get the optional resource_source (index and string) */ - - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + - acpi_rs_get_resource_source(aml_resource_length, - sizeof(struct aml_resource_address16), - &resource->data.address16. - resource_source, aml, NULL); + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity), + AML_OFFSET(address16.granularity), + 5}, - /* Complete the resource header */ + /* Optional resource_source (Index and String) */ - resource->type = ACPI_RESOURCE_TYPE_ADDRESS16; - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source), + 0, + sizeof(struct aml_resource_address16)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_address16 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_address32 - All DWORD (32-bit) address resources * ******************************************************************************/ -acpi_status -acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; +struct acpi_rsconvert_info acpi_rs_convert_address32[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32, + ACPI_RS_SIZE(struct acpi_resource_address32), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address32)}, - ACPI_FUNCTION_TRACE("rs_set_address16"); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32, + sizeof(struct aml_resource_address32), + 0}, - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + /* Resource Type, General Flags, and Type-Specific Flags */ - acpi_rs_set_address_common(aml, resource); + {ACPI_RSC_ADDRESS, 0, 0, 0}, /* - * Set the following contiguous fields in the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length */ - acpi_rs_move_data(&aml->address16.granularity, - &resource->data.address16.granularity, 5, - ACPI_MOVE_TYPE_32_TO_16); - - /* Resource Source Index and Resource Source are optional */ + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity), + AML_OFFSET(address32.granularity), + 5}, - descriptor_length = acpi_rs_set_resource_source(aml, - sizeof(struct - aml_resource_address16), - &resource->data. - address16. - resource_source); + /* Optional resource_source (Index and String) */ - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source), + 0, + sizeof(struct aml_resource_address32)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_address32 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_address64 - All QWORD (64-bit) address resources * ******************************************************************************/ -acpi_status -acpi_rs_get_address32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ +struct acpi_rsconvert_info acpi_rs_convert_address64[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64, + ACPI_RS_SIZE(struct acpi_resource_address64), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address64)}, - ACPI_FUNCTION_TRACE("rs_get_address32"); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64, + sizeof(struct aml_resource_address64), + 0}, - /* Get the Resource Type, general flags, and type-specific flags */ + /* Resource Type, General Flags, and Type-Specific Flags */ - if (!acpi_rs_get_address_common(resource, (void *)aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + {ACPI_RSC_ADDRESS, 0, 0, 0}, /* - * Get the following contiguous fields from the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length */ - acpi_rs_move_data(&resource->data.address32.granularity, - &aml->address32.granularity, 5, - ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity), + AML_OFFSET(address64.granularity), + 5}, - /* Get the optional resource_source (index and string) */ + /* Optional resource_source (Index and String) */ - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + - acpi_rs_get_resource_source(aml_resource_length, - sizeof(struct aml_resource_address32), - &resource->data.address32. - resource_source, aml, NULL); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_ADDRESS32; - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source), + 0, + sizeof(struct aml_resource_address64)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_address32 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_ext_address64 - All Extended (64-bit) address resources * ******************************************************************************/ -acpi_status -acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; +struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, + ACPI_RS_SIZE(struct acpi_resource_extended_address64), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_address64)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, + sizeof(struct aml_resource_extended_address64), + 0}, - ACPI_FUNCTION_TRACE("rs_set_address32"); + /* Resource Type, General Flags, and Type-Specific Flags */ - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + {ACPI_RSC_ADDRESS, 0, 0, 0}, - acpi_rs_set_address_common(aml, resource); + /* Revision ID */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD), + AML_OFFSET(ext_address64.revision_iD), + 1}, /* - * Set the following contiguous fields in the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length + * Type-Specific Attribute */ - acpi_rs_move_data(&aml->address32.granularity, - &resource->data.address32.granularity, 5, - ACPI_MOVE_TYPE_32_TO_32); - - /* Resource Source Index and Resource Source are optional */ - - descriptor_length = acpi_rs_set_resource_source(aml, - sizeof(struct - aml_resource_address32), - &resource->data. - address32. - resource_source); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity), + AML_OFFSET(ext_address64.granularity), + 6} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_address64 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_general_flags - Flags common to all address descriptors * ******************************************************************************/ -acpi_status -acpi_rs_get_address64(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_address64"); +static struct acpi_rsconvert_info acpi_rs_convert_general_flags[6] = { + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.flags), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_general_flags)}, - /* Get the Resource Type, general Flags, and type-specific Flags */ + /* Resource Type (Memory, Io, bus_number, etc.) */ - if (!acpi_rs_get_address_common(resource, aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type), + AML_OFFSET(address.resource_type), + 1}, - /* - * Get the following contiguous fields from the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - acpi_rs_move_data(&resource->data.address64.granularity, - &aml->address64.granularity, 5, - ACPI_MOVE_TYPE_64_TO_64); + /* General Flags - Consume, Decode, min_fixed, max_fixed */ - /* Get the optional resource_source (index and string) */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer), + AML_OFFSET(address.flags), + 0}, - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + - acpi_rs_get_resource_source(aml_resource_length, - sizeof(struct aml_resource_address64), - &resource->data.address64. - resource_source, aml, NULL); + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode), + AML_OFFSET(address.flags), + 1}, - /* Complete the resource header */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed), + AML_OFFSET(address.flags), + 2}, - resource->type = ACPI_RESOURCE_TYPE_ADDRESS64; - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed), + AML_OFFSET(address.flags), + 3} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_address64 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors * ******************************************************************************/ -acpi_status -acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; +static struct acpi_rsconvert_info acpi_rs_convert_mem_flags[5] = { + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_mem_flags)}, - ACPI_FUNCTION_TRACE("rs_set_address64"); + /* Memory-specific flags */ - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect), + AML_OFFSET(address.specific_flags), + 0}, - acpi_rs_set_address_common(aml, resource); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching), + AML_OFFSET(address.specific_flags), + 1}, - /* - * Set the following contiguous fields in the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - acpi_rs_move_data(&aml->address64.granularity, - &resource->data.address64.granularity, 5, - ACPI_MOVE_TYPE_64_TO_64); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type), + AML_OFFSET(address.specific_flags), + 3}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation), + AML_OFFSET(address.specific_flags), + 5} +}; + +/******************************************************************************* + * + * acpi_rs_convert_io_flags - Flags common to I/O address descriptors + * + ******************************************************************************/ - /* Resource Source Index and Resource Source are optional */ +static struct acpi_rsconvert_info acpi_rs_convert_io_flags[4] = { + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io_flags)}, - descriptor_length = acpi_rs_set_resource_source(aml, - sizeof(struct - aml_resource_address64), - &resource->data. - address64. - resource_source); + /* I/O-specific flags */ - /* Complete the AML descriptor header */ + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type), + AML_OFFSET(address.specific_flags), + 0}, - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation), + AML_OFFSET(address.specific_flags), + 4}, + + {ACPI_RSC_1BITFLAG, + ACPI_RS_OFFSET(data.address.info.io.translation_type), + AML_OFFSET(address.specific_flags), + 5} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_ext_address64 + * FUNCTION: acpi_rs_get_address_common * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned + * PARAMETERS: Resource - Pointer to the internal resource struct + * Aml - Pointer to the AML resource descriptor * - * RETURN: Status + * RETURN: TRUE if the resource_type field is OK, FALSE otherwise * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor + * to an internal resource descriptor * ******************************************************************************/ -acpi_status -acpi_rs_get_ext_address64(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource) +u8 +acpi_rs_get_address_common(struct acpi_resource *resource, + union aml_resource *aml) { + ACPI_FUNCTION_ENTRY(); - ACPI_FUNCTION_TRACE("rs_get_ext_address64"); - - /* Get the Resource Type, general flags, and type-specific flags */ + /* Validate the Resource Type */ - if (!acpi_rs_get_address_common(resource, aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + if ((aml->address.resource_type > 2) + && (aml->address.resource_type < 0xC0)) { + return (FALSE); } - /* - * Get and validate the Revision ID - * Note: Only one revision ID is currently supported - */ - resource->data.ext_address64.revision_iD = - aml->ext_address64.revision_iD; - if (aml->ext_address64.revision_iD != - AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { - return_ACPI_STATUS(AE_SUPPORT); - } + /* Get the Resource Type and General Flags */ - /* - * Get the following contiguous fields from the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - * Type-Specific Attribute - */ - acpi_rs_move_data(&resource->data.ext_address64.granularity, - &aml->ext_address64.granularity, 6, - ACPI_MOVE_TYPE_64_TO_64); + (void)acpi_rs_convert_aml_to_resource(resource, aml, + acpi_rs_convert_general_flags); + + /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ - /* Complete the resource header */ + if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { + (void)acpi_rs_convert_aml_to_resource(resource, aml, + acpi_rs_convert_mem_flags); + } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { + (void)acpi_rs_convert_aml_to_resource(resource, aml, + acpi_rs_convert_io_flags); + } else { + /* Generic resource type, just grab the type_specific byte */ - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64); - return_ACPI_STATUS(AE_OK); + resource->data.address.info.type_specific = + aml->address.specific_flags; + } + + return (TRUE); } /******************************************************************************* * - * FUNCTION: acpi_rs_set_ext_address64 + * FUNCTION: acpi_rs_set_address_common * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * Resource - Pointer to the internal resource struct * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * DESCRIPTION: Convert common flag fields from a resource descriptor to an + * AML descriptor * ******************************************************************************/ -acpi_status -acpi_rs_set_ext_address64(struct acpi_resource *resource, - union aml_resource *aml) +void +acpi_rs_set_address_common(union aml_resource *aml, + struct acpi_resource *resource) { - ACPI_FUNCTION_TRACE("rs_set_ext_address64"); + ACPI_FUNCTION_ENTRY(); - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + /* Set the Resource Type and General Flags */ - acpi_rs_set_address_common(aml, resource); + (void)acpi_rs_convert_resource_to_aml(resource, aml, + acpi_rs_convert_general_flags); - /* Only one Revision ID is currently supported */ + /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ - aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - aml->ext_address64.reserved = 0; + if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { + (void)acpi_rs_convert_resource_to_aml(resource, aml, + acpi_rs_convert_mem_flags); + } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { + (void)acpi_rs_convert_resource_to_aml(resource, aml, + acpi_rs_convert_io_flags); + } else { + /* Generic resource type, just copy the type_specific byte */ - /* - * Set the following contiguous fields in the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - * Type-Specific Attribute - */ - acpi_rs_move_data(&aml->ext_address64.granularity, - &resource->data.address64.granularity, 6, - ACPI_MOVE_TYPE_64_TO_64); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, - sizeof(struct - aml_resource_extended_address64), - aml); - return_ACPI_STATUS(AE_OK); + aml->address.specific_flags = + resource->data.address.info.type_specific; + } } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index d170dee07ce..c29d3a44727 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -52,7 +52,7 @@ ACPI_MODULE_NAME("rscalc") /* Local prototypes */ static u8 acpi_rs_count_set_bits(u16 bit_field); -static acpi_size +static acpi_rs_length acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); static u32 @@ -100,7 +100,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) * ******************************************************************************/ -static acpi_size +static acpi_rs_length acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) { ACPI_FUNCTION_ENTRY(); @@ -111,7 +111,7 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) * resource_source_index (1). */ if (resource_source->string_ptr) { - return ((acpi_size) resource_source->string_length + 1); + return ((acpi_rs_length) (resource_source->string_length + 1)); } return (0); @@ -184,7 +184,7 @@ acpi_status acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) { acpi_size aml_size_needed = 0; - acpi_size segment_size; + acpi_rs_length total_size; ACPI_FUNCTION_TRACE("rs_get_aml_length"); @@ -199,7 +199,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) /* Get the base size of the (external stream) resource descriptor */ - segment_size = acpi_gbl_aml_resource_sizes[resource->type]; + total_size = acpi_gbl_aml_resource_sizes[resource->type]; /* * Augment the base size for descriptors with optional and/or @@ -216,13 +216,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) if (resource->data.vendor.byte_length > 7) { /* Base size of a Large resource descriptor */ - segment_size = + total_size = sizeof(struct aml_resource_large_header); } /* Add the size of the vendor-specific data */ - segment_size += resource->data.vendor.byte_length; + total_size = (acpi_rs_length) + (total_size + resource->data.vendor.byte_length); break; case ACPI_RESOURCE_TYPE_END_TAG: @@ -230,7 +231,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * End Tag: * We are done -- return the accumulated total size. */ - *size_needed = aml_size_needed + segment_size; + *size_needed = aml_size_needed + total_size; /* Normal exit */ @@ -241,10 +242,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * 16-Bit Address Resource: * Add the size of the optional resource_source info */ - segment_size += - acpi_rs_struct_option_length(&resource->data. - address16. - resource_source); + total_size = (acpi_rs_length) + (total_size + + acpi_rs_struct_option_length(&resource->data. + address16. + resource_source)); break; case ACPI_RESOURCE_TYPE_ADDRESS32: @@ -252,10 +254,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * 32-Bit Address Resource: * Add the size of the optional resource_source info */ - segment_size += - acpi_rs_struct_option_length(&resource->data. - address32. - resource_source); + total_size = (acpi_rs_length) + (total_size + + acpi_rs_struct_option_length(&resource->data. + address32. + resource_source)); break; case ACPI_RESOURCE_TYPE_ADDRESS64: @@ -263,10 +266,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * 64-Bit Address Resource: * Add the size of the optional resource_source info */ - segment_size += - acpi_rs_struct_option_length(&resource->data. - address64. - resource_source); + total_size = (acpi_rs_length) + (total_size + + acpi_rs_struct_option_length(&resource->data. + address64. + resource_source)); break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: @@ -275,16 +279,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * Add the size of each additional optional interrupt beyond the * required 1 (4 bytes for each u32 interrupt number) */ - segment_size += (((acpi_size) - resource->data.extended_irq. - interrupt_count - 1) * 4); - - /* Add the size of the optional resource_source info */ - - segment_size += - acpi_rs_struct_option_length(&resource->data. - extended_irq. - resource_source); + total_size = (acpi_rs_length) + (total_size + + ((resource->data.extended_irq.interrupt_count - + 1) * 4) + + /* Add the size of the optional resource_source info */ + acpi_rs_struct_option_length(&resource->data. + extended_irq. + resource_source)); break; default: @@ -293,7 +295,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) /* Update the total */ - aml_size_needed += segment_size; + aml_size_needed += total_size; /* Point to the next object */ @@ -341,7 +343,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, while (bytes_parsed < aml_buffer_length) { /* The next byte in the stream is the resource descriptor type */ - resource_type = acpi_rs_get_resource_type(*aml_buffer); + resource_type = acpi_ut_get_resource_type(aml_buffer); /* Get the base stream size and structure sizes for the descriptor */ @@ -352,10 +354,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, /* Get the Length field from the input resource descriptor */ - resource_length = - acpi_rs_get_resource_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + resource_length = acpi_ut_get_resource_length(aml_buffer); /* Augment the size for descriptors with optional fields */ diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 2f8990845b2..27172a3d55d 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -43,6 +43,7 @@ #include #include +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsdump") @@ -61,108 +62,448 @@ static void acpi_rs_out_integer64(char *title, u64 value); static void acpi_rs_out_title(char *title); -static void acpi_rs_dump_byte_list(u32 length, u8 * data); +static void acpi_rs_dump_byte_list(u16 length, u8 * data); -static void acpi_rs_dump_dword_list(u32 length, u32 * data); +static void acpi_rs_dump_dword_list(u8 length, u32 * data); -static void acpi_rs_dump_short_byte_list(u32 length, u32 * data); +static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); static void acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); static void acpi_rs_dump_address_common(union acpi_resource_data *resource); +static void +acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); + +#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) +#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) +#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) + /******************************************************************************* * - * FUNCTION: acpi_rs_out* - * - * PARAMETERS: Title - Name of the resource field - * Value - Value of the resource field - * - * RETURN: None + * Resource Descriptor info tables * - * DESCRIPTION: Miscellaneous helper functions to consistently format the - * output of the resource dump routines + * Note: The first table entry must be a Title or Literal and must contain + * the table length (number of table entries) * ******************************************************************************/ -static void acpi_rs_out_string(char *title, char *value) -{ - acpi_os_printf("%27s : %s\n", title, value); -} +struct acpi_rsdump_info acpi_rs_dump_irq[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", + acpi_gbl_HEdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", + acpi_gbl_LLdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", + acpi_gbl_SHRdecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), + "Interrupt Count", NULL}, + {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), + "Interrupt List", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_dma[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", + acpi_gbl_TYPdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", + acpi_gbl_BMdecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", + acpi_gbl_SIZdecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", + NULL}, + {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), + "Start-Dependent-Functions", NULL}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), + "Compatibility Priority", acpi_gbl_config_decode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), + "Performance/Robustness", acpi_gbl_config_decode} +}; + +struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), + "End-Dependent-Functions", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_io[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", + acpi_gbl_io_decode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), + "Fixed I/O", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), + "Vendor Specific", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, + {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), + "24-Bit Memory Range", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), + "32-Bit Memory Range", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), + "32-Bit Fixed Memory Range", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_address16[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), + "16-Bit WORD Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), + "Address Length", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_address32[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), + "32-Bit DWORD Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), + "Address Length", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_address64[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), + "64-Bit QWORD Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", + NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), + "Address Length", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), + "64-Bit Extended Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), + "Granularity", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), + "Address Minimum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), + "Address Maximum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), + "Address Length", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), + "Type-Specific Attribute", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), + "Extended IRQ", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), + "Type", acpi_gbl_consume_decode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), + "Triggering", acpi_gbl_HEdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", + acpi_gbl_LLdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", + acpi_gbl_SHRdecode}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), + "Interrupt Count", NULL}, + {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), + "Interrupt List", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), + "Generic Register", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), + "Access Size", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} +}; -static void acpi_rs_out_integer8(char *title, u8 value) -{ - acpi_os_printf("%27s : %2.2X\n", title, value); -} - -static void acpi_rs_out_integer16(char *title, u16 value) -{ - acpi_os_printf("%27s : %4.4X\n", title, value); -} - -static void acpi_rs_out_integer32(char *title, u32 value) -{ - acpi_os_printf("%27s : %8.8X\n", title, value); -} - -static void acpi_rs_out_integer64(char *title, u64 value) -{ - acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); -} +/* + * Tables used for common address descriptor flag fields + */ +static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, + NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), + "Consumer/Producer", acpi_gbl_consume_decode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", + acpi_gbl_DECdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), + "Min Relocatability", acpi_gbl_min_decode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), + "Max Relocatability", acpi_gbl_max_decode} +}; + +static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), + "Resource Type", "Memory Range"}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), + "Caching", acpi_gbl_MEMdecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), + "Range Type", acpi_gbl_MTPdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), + "Translation", acpi_gbl_TTPdecode} +}; + +static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), + "Resource Type", "I/O Range"}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), + "Range Type", acpi_gbl_RNGdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), + "Translation", acpi_gbl_TTPdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), + "Translation Type", acpi_gbl_TRSdecode} +}; -static void acpi_rs_out_title(char *title) -{ - acpi_os_printf("%27s : ", title); -} +/* + * Table used to dump _PRT contents + */ +static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, + {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, + {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, + {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, + {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_dump*List + * FUNCTION: acpi_rs_dump_descriptor * - * PARAMETERS: Length - Number of elements in the list - * Data - Start of the list + * PARAMETERS: Resource * * RETURN: None * - * DESCRIPTION: Miscellaneous functions to dump lists of raw data + * DESCRIPTION: * ******************************************************************************/ -static void acpi_rs_dump_byte_list(u32 length, u8 * data) +static void +acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) { - u32 i; + void *target = NULL; + void *previous_target; + char *name; + u8 count; + + /* First table entry must contain the table length (# of table entries) */ + + count = table->offset; + + while (count) { + previous_target = target; + target = ((u8 *) resource) + table->offset; + name = table->name; + + switch (table->opcode) { + case ACPI_RSD_TITLE: + /* + * Optional resource title + */ + if (table->name) { + acpi_os_printf("%s Resource\n", name); + } + break; - for (i = 0; i < length; i++) { - acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); - } -} + /* Strings */ -static void acpi_rs_dump_dword_list(u32 length, u32 * data) -{ - u32 i; + case ACPI_RSD_LITERAL: + acpi_rs_out_string(name, (char *)table->pointer); + break; - for (i = 0; i < length; i++) { - acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); - } -} + case ACPI_RSD_STRING: + acpi_rs_out_string(name, (char *)target); + break; -static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) -{ - u32 i; + /* Data items, 8/16/32/64 bit */ - for (i = 0; i < length; i++) { - acpi_os_printf("%X ", data[i]); - } - acpi_os_printf("\n"); -} + case ACPI_RSD_UINT8: + acpi_rs_out_integer8(name, *(u8 *) target); + break; -static void acpi_rs_dump_memory_attribute(u32 read_write_attribute) -{ + case ACPI_RSD_UINT16: + acpi_rs_out_integer16(name, *(u16 *) target); + break; + + case ACPI_RSD_UINT32: + acpi_rs_out_integer32(name, *(u32 *) target); + break; - acpi_rs_out_string("Read/Write Attribute", - ACPI_READ_WRITE_MEMORY == read_write_attribute ? - "Read/Write" : "Read-Only"); + case ACPI_RSD_UINT64: + acpi_rs_out_integer64(name, *(u64 *) target); + break; + + /* Flags: 1-bit and 2-bit flags supported */ + + case ACPI_RSD_1BITFLAG: + acpi_rs_out_string(name, (char *) + ((const char **)table-> + pointer)[(*(u8 *) target) & 0x01]); + break; + + case ACPI_RSD_2BITFLAG: + acpi_rs_out_string(name, (char *) + ((const char **)table-> + pointer)[(*(u8 *) target) & 0x03]); + break; + + case ACPI_RSD_SHORTLIST: + /* + * Short byte list (single line output) for DMA and IRQ resources + * Note: The list length is obtained from the previous table entry + */ + if (previous_target) { + acpi_rs_out_title(name); + acpi_rs_dump_short_byte_list(* + ((u8 *) + previous_target), + (u8 *) target); + } + break; + + case ACPI_RSD_LONGLIST: + /* + * Long byte list for Vendor resource data + * Note: The list length is obtained from the previous table entry + */ + if (previous_target) { + acpi_rs_dump_byte_list(* + ((u16 *) + previous_target), + (u8 *) target); + } + break; + + case ACPI_RSD_DWORDLIST: + /* + * Dword list for Extended Interrupt resources + * Note: The list length is obtained from the previous table entry + */ + if (previous_target) { + acpi_rs_dump_dword_list(* + ((u8 *) + previous_target), + (u32 *) target); + } + break; + + case ACPI_RSD_ADDRESS: + /* + * Common flags for all Address resources + */ + acpi_rs_dump_address_common((union acpi_resource_data *) + target); + break; + + case ACPI_RSD_SOURCE: + /* + * Optional resource_source for Address resources + */ + acpi_rs_dump_resource_source((struct + acpi_resource_source *) + target); + break; + + default: + acpi_os_printf("**** Invalid table opcode [%X] ****\n", + table->opcode); + return; + } + + table++; + count--; + } } /******************************************************************************* @@ -187,8 +528,7 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) return; } - acpi_rs_out_integer8("Resource Source Index", - (u8) resource_source->index); + acpi_rs_out_integer8("Resource Source Index", resource_source->index); acpi_rs_out_string("Resource Source", resource_source->string_ptr ? @@ -217,65 +557,12 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) switch (resource->address.resource_type) { case ACPI_MEMORY_RANGE: - acpi_rs_out_string("Resource Type", "Memory Range"); - - acpi_rs_out_title("Type-Specific Flags"); - - switch (resource->address.attribute.memory.cache_attribute) { - case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf("Noncacheable memory\n"); - break; - - case ACPI_CACHABLE_MEMORY: - acpi_os_printf("Cacheable memory\n"); - break; - - case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf("Write-combining memory\n"); - break; - - case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf("Prefetchable memory\n"); - break; - - default: - acpi_os_printf("Invalid cache attribute\n"); - break; - } - - acpi_rs_dump_memory_attribute(resource->address.attribute. - memory.read_write_attribute); + acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); break; case ACPI_IO_RANGE: - acpi_rs_out_string("Resource Type", "I/O Range"); - - acpi_rs_out_title("Type-Specific Flags"); - - switch (resource->address.attribute.io.range_attribute) { - case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf("Non-ISA I/O Addresses\n"); - break; - - case ACPI_ISA_ONLY_RANGES: - acpi_os_printf("ISA I/O Addresses\n"); - break; - - case ACPI_ENTIRE_RANGE: - acpi_os_printf("ISA and non-ISA I/O Addresses\n"); - break; - - default: - acpi_os_printf("Invalid range attribute\n"); - break; - } - - acpi_rs_out_string("Translation Attribute", - ACPI_SPARSE_TRANSLATION == - resource->address.attribute.io. - translation_attribute ? "Sparse Translation" - : "Dense Translation"); + acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); break; case ACPI_BUS_NUMBER_RANGE: @@ -292,24 +579,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) /* Decode the general flags */ - acpi_rs_out_string("Resource", - ACPI_CONSUMER == - resource->address. - producer_consumer ? "Consumer" : "Producer"); - - acpi_rs_out_string("Decode", - ACPI_SUB_DECODE == resource->address.decode ? - "Subtractive" : "Positive"); - - acpi_rs_out_string("Min Address", - ACPI_ADDRESS_FIXED == - resource->address. - min_address_fixed ? "Fixed" : "Not Fixed"); - - acpi_rs_out_string("Max Address", - ACPI_ADDRESS_FIXED == - resource->address. - max_address_fixed ? "Fixed" : "Not Fixed"); + acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); } /******************************************************************************* @@ -327,6 +597,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) { u32 count = 0; + u32 type; ACPI_FUNCTION_ENTRY(); @@ -335,14 +606,16 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) return; } - /* Dump all resource descriptors in the list */ + /* Walk list and dump all resource descriptors (END_TAG terminates) */ - while (resource_list) { + do { acpi_os_printf("\n[%02X] ", count); + count++; /* Validate Type before dispatch */ - if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) { + type = resource_list->type; + if (type > ACPI_RESOURCE_TYPE_MAX) { acpi_os_printf ("Invalid descriptor type (%X) in resource list\n", resource_list->type); @@ -351,665 +624,141 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Dump the resource descriptor */ - acpi_gbl_dump_resource_dispatch[resource_list-> - type] (&resource_list->data); - - /* Exit on end tag */ - - if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) { - return; - } + acpi_rs_dump_descriptor(&resource_list->data, + acpi_gbl_dump_resource_dispatch[type]); - /* Get the next resource structure */ + /* Point to the next resource structure */ resource_list = ACPI_PTR_ADD(struct acpi_resource, resource_list, resource_list->length); - count++; - } -} -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_irq - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ + /* Exit when END_TAG descriptor is reached */ -void acpi_rs_dump_irq(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("IRQ Resource\n"); - - acpi_rs_out_string("Triggering", - ACPI_LEVEL_SENSITIVE == - resource->irq.triggering ? "Level" : "Edge"); - - acpi_rs_out_string("Active", - ACPI_ACTIVE_LOW == - resource->irq.polarity ? "Low" : "High"); - - acpi_rs_out_string("Sharing", - ACPI_SHARED == - resource->irq.sharable ? "Shared" : "Exclusive"); - - acpi_rs_out_integer8("Interrupt Count", - (u8) resource->irq.interrupt_count); - - acpi_rs_out_title("Interrupt List"); - acpi_rs_dump_short_byte_list(resource->irq.interrupt_count, - resource->irq.interrupts); + } while (type != ACPI_RESOURCE_TYPE_END_TAG); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_dma + * FUNCTION: acpi_rs_dump_irq_list * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: route_table - Pointer to the routing table to dump. * * RETURN: None * - * DESCRIPTION: Dump the field names and values of the resource descriptor + * DESCRIPTION: Print IRQ routing table * ******************************************************************************/ -void acpi_rs_dump_dma(union acpi_resource_data *resource) +void acpi_rs_dump_irq_list(u8 * route_table) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("DMA Resource\n"); - - acpi_rs_out_title("DMA Type"); - switch (resource->dma.type) { - case ACPI_COMPATIBILITY: - acpi_os_printf("Compatibility mode\n"); - break; - - case ACPI_TYPE_A: - acpi_os_printf("Type A\n"); - break; - - case ACPI_TYPE_B: - acpi_os_printf("Type B\n"); - break; - - case ACPI_TYPE_F: - acpi_os_printf("Type F\n"); - break; - - default: - acpi_os_printf("**** Invalid DMA type\n"); - break; - } - - acpi_rs_out_string("Bus Master", - ACPI_BUS_MASTER == - resource->dma.bus_master ? "Yes" : "No"); - - acpi_rs_out_title("Transfer Type"); - switch (resource->dma.transfer) { - case ACPI_TRANSFER_8: - acpi_os_printf("8-bit transfers only\n"); - break; - - case ACPI_TRANSFER_8_16: - acpi_os_printf("8-bit and 16-bit transfers\n"); - break; - - case ACPI_TRANSFER_16: - acpi_os_printf("16-bit transfers only\n"); - break; - - default: - acpi_os_printf("**** Invalid transfer preference\n"); - break; - } - - acpi_rs_out_integer8("DMA Channel Count", - (u8) resource->dma.channel_count); - - acpi_rs_out_title("Channel List"); - acpi_rs_dump_short_byte_list(resource->dma.channel_count, - resource->dma.channels); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_start_dpf - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ + struct acpi_pci_routing_table *prt_element; + u8 count; -void acpi_rs_dump_start_dpf(union acpi_resource_data *resource) -{ ACPI_FUNCTION_ENTRY(); - acpi_os_printf("Start Dependent Functions Resource\n"); - - acpi_rs_out_title("Compatibility Priority"); - switch (resource->start_dpf.compatibility_priority) { - case ACPI_GOOD_CONFIGURATION: - acpi_os_printf("Good configuration\n"); - break; - - case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf("Acceptable configuration\n"); - break; - - case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf("Sub-optimal configuration\n"); - break; - - default: - acpi_os_printf("**** Invalid compatibility priority\n"); - break; + if (!(acpi_dbg_level & ACPI_LV_RESOURCES) + || !(_COMPONENT & acpi_dbg_layer)) { + return; } - acpi_rs_out_title("Performance/Robustness"); - switch (resource->start_dpf.performance_robustness) { - case ACPI_GOOD_CONFIGURATION: - acpi_os_printf("Good configuration\n"); - break; + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); - case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf("Acceptable configuration\n"); - break; + /* Dump all table elements, Exit on zero length element */ - case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf("Sub-optimal configuration\n"); - break; + for (count = 0; prt_element->length; count++) { + acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", + count); + acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); - default: - acpi_os_printf - ("**** Invalid performance robustness preference\n"); - break; + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, + ((u8 *) prt_element) + + prt_element->length); } } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_io - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_io(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("I/O Resource\n"); - - acpi_rs_out_string("Decode", - ACPI_DECODE_16 == - resource->io.io_decode ? "16-bit" : "10-bit"); - - acpi_rs_out_integer32("Address Minimum", resource->io.minimum); - - acpi_rs_out_integer32("Address Maximum", resource->io.maximum); - - acpi_rs_out_integer32("Alignment", resource->io.alignment); - - acpi_rs_out_integer32("Address Length", resource->io.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_fixed_io - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Fixed I/O Resource\n"); - - acpi_rs_out_integer32("Address", resource->fixed_io.address); - - acpi_rs_out_integer32("Address Length", - resource->fixed_io.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_vendor - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_vendor(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Vendor Specific Resource\n"); - - acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length); - - acpi_rs_dump_byte_list(resource->vendor.byte_length, - resource->vendor.byte_data); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_memory24 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_memory24(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("24-Bit Memory Range Resource\n"); - - acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute); - - acpi_rs_out_integer16("Address Minimum", - (u16) resource->memory24.minimum); - - acpi_rs_out_integer16("Address Maximum", - (u16) resource->memory24.maximum); - - acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment); - - acpi_rs_out_integer16("Address Length", - (u16) resource->memory24.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_memory32 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_memory32(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("32-Bit Memory Range Resource\n"); - - acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute); - - acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum); - - acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum); - - acpi_rs_out_integer32("Alignment", resource->memory32.alignment); - - acpi_rs_out_integer32("Address Length", - resource->memory32.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_fixed_memory32 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); - - acpi_rs_dump_memory_attribute(resource->fixed_memory32. - read_write_attribute); - - acpi_rs_out_integer32("Address", resource->fixed_memory32.address); - - acpi_rs_out_integer32("Address Length", - resource->fixed_memory32.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_address16 + * FUNCTION: acpi_rs_out* * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: Title - Name of the resource field + * Value - Value of the resource field * * RETURN: None * - * DESCRIPTION: Dump the field names and values of the resource descriptor + * DESCRIPTION: Miscellaneous helper functions to consistently format the + * output of the resource dump routines * ******************************************************************************/ -void acpi_rs_dump_address16(union acpi_resource_data *resource) +static void acpi_rs_out_string(char *title, char *value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("16-Bit WORD Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer16("Granularity", - (u16) resource->address16.granularity); - - acpi_rs_out_integer16("Address Minimum", - (u16) resource->address16.minimum); - - acpi_rs_out_integer16("Address Maximum", - (u16) resource->address16.maximum); - - acpi_rs_out_integer16("Translation Offset", - (u16) resource->address16.translation_offset); - - acpi_rs_out_integer16("Address Length", - (u16) resource->address16.address_length); - - acpi_rs_dump_resource_source(&resource->address16.resource_source); + acpi_os_printf("%27s : %s\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_address32 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_address32(union acpi_resource_data *resource) +static void acpi_rs_out_integer8(char *title, u8 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("32-Bit DWORD Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer32("Granularity", resource->address32.granularity); - - acpi_rs_out_integer32("Address Minimum", resource->address32.minimum); - - acpi_rs_out_integer32("Address Maximum", resource->address32.maximum); - - acpi_rs_out_integer32("Translation Offset", - resource->address32.translation_offset); - - acpi_rs_out_integer32("Address Length", - resource->address32.address_length); - - acpi_rs_dump_resource_source(&resource->address32.resource_source); + acpi_os_printf("%27s : %2.2X\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_address64 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_address64(union acpi_resource_data *resource) +static void acpi_rs_out_integer16(char *title, u16 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("64-Bit QWORD Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer64("Granularity", resource->address64.granularity); - - acpi_rs_out_integer64("Address Minimum", resource->address64.minimum); - - acpi_rs_out_integer64("Address Maximum", resource->address64.maximum); - - acpi_rs_out_integer64("Translation Offset", - resource->address64.translation_offset); - - acpi_rs_out_integer64("Address Length", - resource->address64.address_length); - - acpi_rs_dump_resource_source(&resource->address64.resource_source); + acpi_os_printf("%27s : %4.4X\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_ext_address64 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_ext_address64(union acpi_resource_data *resource) +static void acpi_rs_out_integer32(char *title, u32 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("64-Bit Extended Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer64("Granularity", - resource->ext_address64.granularity); - - acpi_rs_out_integer64("Address Minimum", - resource->ext_address64.minimum); - - acpi_rs_out_integer64("Address Maximum", - resource->ext_address64.maximum); - - acpi_rs_out_integer64("Translation Offset", - resource->ext_address64.translation_offset); - - acpi_rs_out_integer64("Address Length", - resource->ext_address64.address_length); - - acpi_rs_out_integer64("Type-Specific Attribute", - resource->ext_address64.type_specific_attributes); + acpi_os_printf("%27s : %8.8X\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_ext_irq - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_ext_irq(union acpi_resource_data *resource) +static void acpi_rs_out_integer64(char *title, u64 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Extended IRQ Resource\n"); - - acpi_rs_out_string("Resource", - ACPI_CONSUMER == - resource->extended_irq. - producer_consumer ? "Consumer" : "Producer"); - - acpi_rs_out_string("Triggering", - ACPI_LEVEL_SENSITIVE == - resource->extended_irq. - triggering ? "Level" : "Edge"); - - acpi_rs_out_string("Active", - ACPI_ACTIVE_LOW == resource->extended_irq.polarity ? - "Low" : "High"); - - acpi_rs_out_string("Sharing", - ACPI_SHARED == resource->extended_irq.sharable ? - "Shared" : "Exclusive"); - - acpi_rs_dump_resource_source(&resource->extended_irq.resource_source); - - acpi_rs_out_integer8("Interrupts", - (u8) resource->extended_irq.interrupt_count); - - acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count, - resource->extended_irq.interrupts); + acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_generic_reg - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) +static void acpi_rs_out_title(char *title) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Generic Register Resource\n"); - - acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id); - - acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width); - - acpi_rs_out_integer8("Bit Offset", - (u8) resource->generic_reg.bit_offset); - - acpi_rs_out_integer8("Access Size", - (u8) resource->generic_reg.access_size); - - acpi_rs_out_integer64("Address", resource->generic_reg.address); + acpi_os_printf("%27s : ", title); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_end_dpf + * FUNCTION: acpi_rs_dump*List * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: Length - Number of elements in the list + * Data - Start of the list * * RETURN: None * - * DESCRIPTION: Print type, no data. + * DESCRIPTION: Miscellaneous functions to dump lists of raw data * ******************************************************************************/ -void acpi_rs_dump_end_dpf(union acpi_resource_data *resource) +static void acpi_rs_dump_byte_list(u16 length, u8 * data) { - ACPI_FUNCTION_ENTRY(); + u8 i; - acpi_os_printf("end_dependent_functions Resource\n"); + for (i = 0; i < length; i++) { + acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); + } } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_end_tag - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Print type, no data. - * - ******************************************************************************/ - -void acpi_rs_dump_end_tag(union acpi_resource_data *resource) +static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) { - ACPI_FUNCTION_ENTRY(); + u8 i; - acpi_os_printf("end_tag Resource\n"); + for (i = 0; i < length; i++) { + acpi_os_printf("%X ", data[i]); + } + acpi_os_printf("\n"); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_irq_list - * - * PARAMETERS: route_table - Pointer to the routing table to dump. - * - * RETURN: None - * - * DESCRIPTION: Print IRQ routing table - * - ******************************************************************************/ - -void acpi_rs_dump_irq_list(u8 * route_table) +static void acpi_rs_dump_dword_list(u8 length, u32 * data) { - u8 *buffer = route_table; - u8 count = 0; - struct acpi_pci_routing_table *prt_element; - - ACPI_FUNCTION_ENTRY(); + u8 i; - if (!(acpi_dbg_level & ACPI_LV_RESOURCES) - || !(_COMPONENT & acpi_dbg_layer)) { - return; - } - - prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); - - /* Dump all table elements, Exit on null length element */ - - while (prt_element->length) { - acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", - count); - - acpi_rs_out_integer64("Address", prt_element->address); - - acpi_rs_out_integer32("Pin", prt_element->pin); - acpi_rs_out_string("Source", prt_element->source); - acpi_rs_out_integer32("Source Index", - prt_element->source_index); - - buffer += prt_element->length; - prt_element = - ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); - count++; + for (i = 0; i < length; i++) { + acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); } } diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index b31cb33ec56..973fc2834cb 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -58,60 +58,60 @@ ACPI_MODULE_NAME("rsinfo") * descriptors are indexed by the acpi_resource_type field. */ /* Dispatch table for resource-to-AML (Set Resource) conversion functions */ -ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ - acpi_rs_set_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ + acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ - acpi_rs_set_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ - acpi_rs_set_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ - acpi_rs_set_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ + acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ + acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ + acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ - acpi_rs_set_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ - acpi_rs_set_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ - acpi_rs_set_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ - acpi_rs_set_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - acpi_rs_set_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ - acpi_rs_set_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ - acpi_rs_set_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ - acpi_rs_set_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ - acpi_rs_set_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - acpi_rs_set_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ + acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ + acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ + acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ + acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ + acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ + acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ + acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ + acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ + acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ -ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { NULL, /* 0x00, Reserved */ NULL, /* 0x01, Reserved */ NULL, /* 0x02, Reserved */ NULL, /* 0x03, Reserved */ acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ - acpi_rs_get_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ + acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ - acpi_rs_get_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ - acpi_rs_get_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ - acpi_rs_get_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ + acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ + acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ + acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ NULL, /* 0x0A, Reserved */ NULL, /* 0x0B, Reserved */ NULL, /* 0x0C, Reserved */ NULL, /* 0x0D, Reserved */ - acpi_rs_get_vendor, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ - acpi_rs_get_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ + acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ + acpi_rs_convert_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ }; -ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[] = { NULL, /* 0x00, Reserved */ - acpi_rs_get_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ - acpi_rs_get_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ + acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ + acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ NULL, /* 0x03, Reserved */ - acpi_rs_get_vendor, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ - acpi_rs_get_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ - acpi_rs_get_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ - acpi_rs_get_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ - acpi_rs_get_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ - acpi_rs_get_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ - acpi_rs_get_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ - acpi_rs_get_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ + acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ + acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ + acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ + acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ + acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ + acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ + acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ + acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ }; #ifdef ACPI_FUTURE_USAGE @@ -119,7 +119,7 @@ ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = { /* Dispatch table for resource dump functions */ -ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = { +struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */ acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */ acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ @@ -136,17 +136,17 @@ ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = { acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - acpi_rs_dump_generic_reg /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; + #endif #endif /* ACPI_FUTURE_USAGE */ - /* * Base sizes for external AML resource descriptors, indexed by internal type. * Includes size of the descriptor header (1 byte for small descriptors, * 3 bytes for large descriptors) */ -u8 acpi_gbl_aml_resource_sizes[] = { +const u8 acpi_gbl_aml_resource_sizes[] = { sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */ sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ @@ -168,8 +168,8 @@ u8 acpi_gbl_aml_resource_sizes[] = { /* Macros used in the tables below */ -#define ACPI_RLARGE(r) sizeof (r) - sizeof (struct aml_resource_large_header) -#define ACPI_RSMALL(r) sizeof (r) - sizeof (struct aml_resource_small_header) +#define ACPI_RLARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) +#define ACPI_RSMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) /* * Base sizes of resource descriptors, both the AML stream resource length @@ -182,47 +182,46 @@ struct acpi_resource_info acpi_gbl_sm_resource_info[] = { {0, 0, 0}, {0, 0, 0}, {2, ACPI_RSMALL(struct aml_resource_irq), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, + ACPI_RS_SIZE(struct acpi_resource_irq)}, {0, ACPI_RSMALL(struct aml_resource_dma), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, + ACPI_RS_SIZE(struct acpi_resource_dma)}, {2, ACPI_RSMALL(struct aml_resource_start_dependent), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent)}, - {0, ACPI_RSMALL(struct aml_resource_end_dependent), - ACPI_RESOURCE_LENGTH}, + ACPI_RS_SIZE(struct acpi_resource_start_dependent)}, + {0, ACPI_RSMALL(struct aml_resource_end_dependent), ACPI_RS_SIZE_MIN}, {0, ACPI_RSMALL(struct aml_resource_io), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, + ACPI_RS_SIZE(struct acpi_resource_io)}, {0, ACPI_RSMALL(struct aml_resource_fixed_io), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, + ACPI_RS_SIZE(struct acpi_resource_fixed_io)}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, ACPI_RSMALL(struct aml_resource_vendor_small), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, - {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RESOURCE_LENGTH} + ACPI_RS_SIZE(struct acpi_resource_vendor)}, + {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RS_SIZE_MIN} }; struct acpi_resource_info acpi_gbl_lg_resource_info[] = { {0, 0, 0}, {0, ACPI_RLARGE(struct aml_resource_memory24), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, + ACPI_RS_SIZE(struct acpi_resource_memory24)}, {0, ACPI_RLARGE(struct aml_resource_generic_register), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)}, + ACPI_RS_SIZE(struct acpi_resource_generic_register)}, {0, 0, 0}, {1, ACPI_RLARGE(struct aml_resource_vendor_large), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, + ACPI_RS_SIZE(struct acpi_resource_vendor)}, {0, ACPI_RLARGE(struct aml_resource_memory32), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32)}, + ACPI_RS_SIZE(struct acpi_resource_memory32)}, {0, ACPI_RLARGE(struct aml_resource_fixed_memory32), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32)}, + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32)}, {1, ACPI_RLARGE(struct aml_resource_address32), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, + ACPI_RS_SIZE(struct acpi_resource_address32)}, {1, ACPI_RLARGE(struct aml_resource_address16), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, + ACPI_RS_SIZE(struct acpi_resource_address16)}, {1, ACPI_RLARGE(struct aml_resource_extended_irq), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq)}, + ACPI_RS_SIZE(struct acpi_resource_extended_irq)}, {1, ACPI_RLARGE(struct aml_resource_address64), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, + ACPI_RS_SIZE(struct acpi_resource_address64)}, {0, ACPI_RLARGE(struct aml_resource_extended_address64), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64)} + ACPI_RS_SIZE(struct acpi_resource_extended_address64)} }; diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 0dab8cdfa80..ef24ba110c6 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -49,269 +49,206 @@ ACPI_MODULE_NAME("rsio") /******************************************************************************* * - * FUNCTION: acpi_rs_get_io - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_io * ******************************************************************************/ -acpi_status -acpi_rs_get_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_io"); +struct acpi_rsconvert_info acpi_rs_convert_io[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, + ACPI_RS_SIZE(struct acpi_resource_io), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io)}, - /* Get the Decode flag */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, + sizeof(struct aml_resource_io), + 0}, - resource->data.io.io_decode = aml->io.information & 0x01; + /* Decode flag */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode), + AML_OFFSET(io.flags), + 0}, /* - * Get the following contiguous fields from the AML descriptor: - * Minimum Base Address - * Maximum Base Address + * These fields are contiguous in both the source and destination: * Address Alignment * Length + * Minimum Base Address + * Maximum Base Address */ - ACPI_MOVE_16_TO_32(&resource->data.io.minimum, &aml->io.minimum); - ACPI_MOVE_16_TO_32(&resource->data.io.maximum, &aml->io.maximum); - resource->data.io.alignment = aml->io.alignment; - resource->data.io.address_length = aml->io.address_length; - - /* Complete the resource header */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment), + AML_OFFSET(io.alignment), + 2}, - resource->type = ACPI_RESOURCE_TYPE_IO; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum), + AML_OFFSET(io.minimum), + 2} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_io - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_fixed_io * ******************************************************************************/ -acpi_status -acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_io"); - - /* I/O Information Byte */ - - aml->io.information = (u8) (resource->data.io.io_decode & 0x01); +struct acpi_rsconvert_info acpi_rs_convert_fixed_io[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, + ACPI_RS_SIZE(struct acpi_resource_fixed_io), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_io)}, + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, + sizeof(struct aml_resource_fixed_io), + 0}, /* - * Set the following contiguous fields in the AML descriptor: - * Minimum Base Address - * Maximum Base Address - * Address Alignment + * These fields are contiguous in both the source and destination: + * Base Address * Length */ - ACPI_MOVE_32_TO_16(&aml->io.minimum, &resource->data.io.minimum); - ACPI_MOVE_32_TO_16(&aml->io.maximum, &resource->data.io.maximum); - aml->io.alignment = (u8) resource->data.io.alignment; - aml->io.address_length = (u8) resource->data.io.address_length; - - /* Complete the AML descriptor header */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length), + AML_OFFSET(fixed_io.address_length), + 1}, - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO, - sizeof(struct aml_resource_io), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address), + AML_OFFSET(fixed_io.address), + 1} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_fixed_io - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_generic_reg * ******************************************************************************/ -acpi_status -acpi_rs_get_fixed_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_fixed_io"); +struct acpi_rsconvert_info acpi_rs_convert_generic_reg[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, + ACPI_RS_SIZE(struct acpi_resource_generic_register), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_generic_reg)}, + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, + sizeof(struct aml_resource_generic_register), + 0}, /* - * Get the following contiguous fields from the AML descriptor: - * Base Address - * Length + * These fields are contiguous in both the source and destination: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size */ - ACPI_MOVE_16_TO_32(&resource->data.fixed_io.address, - &aml->fixed_io.address); - resource->data.fixed_io.address_length = aml->fixed_io.address_length; + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id), + AML_OFFSET(generic_reg.address_space_id), + 4}, - /* Complete the resource header */ + /* Get the Register Address */ - resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address), + AML_OFFSET(generic_reg.address), + 1} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_fixed_io - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned + * acpi_rs_convert_end_dpf * - * RETURN: Status + ******************************************************************************/ + +struct acpi_rsconvert_info acpi_rs_convert_end_dpf[2] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, + ACPI_RS_SIZE_MIN, + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_dpf)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, + sizeof(struct aml_resource_end_dependent), + 0} +}; + +/******************************************************************************* * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_end_tag * ******************************************************************************/ -acpi_status -acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_fixed_io"); +struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, + ACPI_RS_SIZE_MIN, + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_tag)}, /* - * Set the following contiguous fields in the AML descriptor: - * Base Address - * Length + * Note: The checksum field is set to zero, meaning that the resource + * data is treated as if the checksum operation succeeded. + * (ACPI Spec 1.0b Section 6.4.2.8) */ - ACPI_MOVE_32_TO_16(&aml->fixed_io.address, - &resource->data.fixed_io.address); - aml->fixed_io.address_length = - (u8) resource->data.fixed_io.address_length; - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO, - sizeof(struct aml_resource_fixed_io), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, + sizeof(struct aml_resource_end_tag), + 0} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_dma - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_get_start_dpf * ******************************************************************************/ -acpi_status -acpi_rs_get_dma(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - u32 channel_count = 0; - u32 i; - u8 temp8; +struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, + ACPI_RS_SIZE(struct acpi_resource_start_dependent), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, - ACPI_FUNCTION_TRACE("rs_get_dma"); + /* Defaults for Compatibility and Performance priorities */ - /* Decode the DMA channel bits */ + {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + ACPI_ACCEPTABLE_CONFIGURATION, + 2}, - for (i = 0; i < 8; i++) { - if ((aml->dma.dma_channel_mask >> i) & 0x01) { - resource->data.dma.channels[channel_count] = i; - channel_count++; - } - } + /* All done if there is no flag byte present in the descriptor */ - resource->length = 0; - resource->data.dma.channel_count = channel_count; + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, - /* - * Calculate the structure size based upon the number of channels - * Note: Zero DMA channels is valid - */ - if (channel_count > 0) { - resource->length = (u32) (channel_count - 1) * 4; - } - - /* Get the flags: transfer preference, bus mastering, channel speed */ + /* Flag byte is present, get the flags */ - temp8 = aml->dma.flags; - resource->data.dma.transfer = temp8 & 0x03; - resource->data.dma.bus_master = (temp8 >> 2) & 0x01; - resource->data.dma.type = (temp8 >> 5) & 0x03; + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + AML_OFFSET(start_dpf.flags), + 0}, - if (resource->data.dma.transfer == 0x03) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid DMA.Transfer preference (3)\n")); - return_ACPI_STATUS(AE_BAD_DATA); - } - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_DMA; - resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), + AML_OFFSET(start_dpf.flags), + 2} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_dma - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_set_start_dpf * ******************************************************************************/ -acpi_status -acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml) -{ - u8 i; - - ACPI_FUNCTION_TRACE("rs_set_dma"); +struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof(struct aml_resource_start_dependent), + ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, - /* Convert channel list to 8-bit DMA channel bitmask */ + /* Set the default flag values */ - aml->dma.dma_channel_mask = 0; - for (i = 0; i < resource->data.dma.channel_count; i++) { - aml->dma.dma_channel_mask |= - (1 << resource->data.dma.channels[i]); - } + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + AML_OFFSET(start_dpf.flags), + 0}, - /* Set the DMA Flag bits */ + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), + AML_OFFSET(start_dpf.flags), + 2}, + /* + * All done if flags byte is necessary -- if either priority value + * is not ACPI_ACCEPTABLE_CONFIGURATION + */ + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + ACPI_ACCEPTABLE_CONFIGURATION}, - aml->dma.flags = (u8) - (((resource->data.dma.type & 0x03) << 5) | - ((resource->data.dma.bus_master & 0x01) << 2) | - (resource->data.dma.transfer & 0x03)); + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), + ACPI_ACCEPTABLE_CONFIGURATION}, - /* Complete the AML descriptor header */ + /* Flag byte is not necessary */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA, - sizeof(struct aml_resource_dma), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_LENGTH, 0, 0, + sizeof(struct aml_resource_start_dependent_noprio)} +}; diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 4e854ba7081..79e71257b69 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -49,325 +49,182 @@ ACPI_MODULE_NAME("rsirq") /******************************************************************************* * - * FUNCTION: acpi_rs_get_irq - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_get_irq * ******************************************************************************/ -acpi_status -acpi_rs_get_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - u16 temp16 = 0; - u32 interrupt_count = 0; - u32 i; - u32 resource_length; - - ACPI_FUNCTION_TRACE("rs_get_irq"); +struct acpi_rsconvert_info acpi_rs_get_irq[7] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, + ACPI_RS_SIZE(struct acpi_resource_irq), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, /* Get the IRQ mask (bytes 1:2) */ - ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask); - - /* Decode the IRQ bits (up to 16 possible) */ - - for (i = 0; i < 16; i++) { - if ((temp16 >> i) & 0x01) { - resource->data.irq.interrupts[interrupt_count] = i; - interrupt_count++; - } - } - - /* Zero interrupts is valid */ - - resource_length = 0; - resource->data.irq.interrupt_count = interrupt_count; - if (interrupt_count > 0) { - /* Calculate the structure size based upon the number of interrupts */ - - resource_length = (u32) (interrupt_count - 1) * 4; - } - - /* Get Flags (Byte 3) if it is used */ - - if (aml_resource_length == 3) { - /* Check for HE, LL interrupts */ - - switch (aml->irq.flags & 0x09) { - case 0x01: /* HE */ - resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; - resource->data.irq.polarity = ACPI_ACTIVE_HIGH; - break; - - case 0x08: /* LL */ - resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE; - resource->data.irq.polarity = ACPI_ACTIVE_LOW; - break; - - default: - /* - * Only _LL and _HE polarity/trigger interrupts - * 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", - aml->irq.flags)); - return_ACPI_STATUS(AE_BAD_DATA); - } - - /* Get Sharing flag */ - - resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01; - } else { - /* - * Default configuration: assume Edge Sensitive, Active High, - * Non-Sharable as per the ACPI Specification - */ - resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; - resource->data.irq.polarity = ACPI_ACTIVE_HIGH; - resource->data.irq.sharable = ACPI_EXCLUSIVE; - } - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_IRQ; - resource->length = - resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), + AML_OFFSET(irq.irq_mask), + ACPI_RS_OFFSET(data.irq.interrupt_count)}, + + /* Set default flags (others are zero) */ + + {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering), + ACPI_EDGE_SENSITIVE, + 1}, + + /* All done if no flag byte present in descriptor */ + + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, + + /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), + AML_OFFSET(irq.flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), + AML_OFFSET(irq.flags), + 3}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), + AML_OFFSET(irq.flags), + 4} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_irq - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_set_irq * ******************************************************************************/ -acpi_status -acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; - u16 irq_mask; - u8 i; - - ACPI_FUNCTION_TRACE("rs_set_irq"); +struct acpi_rsconvert_info acpi_rs_set_irq[9] = { + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, + sizeof(struct aml_resource_irq), + ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, /* Convert interrupt list to 16-bit IRQ bitmask */ - irq_mask = 0; - for (i = 0; i < resource->data.irq.interrupt_count; i++) { - irq_mask |= (1 << resource->data.irq.interrupts[i]); - } + {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), + AML_OFFSET(irq.irq_mask), + ACPI_RS_OFFSET(data.irq.interrupt_count)}, + + /* Set the flags byte by default */ - /* Set the interrupt mask */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), + AML_OFFSET(irq.flags), + 0}, - ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask); + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), + AML_OFFSET(irq.flags), + 3}, + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), + AML_OFFSET(irq.flags), + 4}, /* - * The descriptor field is set based upon whether a third byte is - * needed to contain the IRQ Information. + * Check if the flags byte is necessary. Not needed if the flags are: + * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE */ - if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) && - (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) && - (resource->data.irq.sharable == ACPI_EXCLUSIVE)) { - /* irq_no_flags() descriptor can be used */ - - descriptor_length = sizeof(struct aml_resource_irq_noflags); - } else { - /* Irq() descriptor must be used */ - - descriptor_length = sizeof(struct aml_resource_irq); - - /* Set the IRQ Info byte */ + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.irq.triggering), + ACPI_EDGE_SENSITIVE}, - aml->irq.flags = (u8) - ((resource->data.irq.sharable & 0x01) << 4); + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.irq.polarity), + ACPI_ACTIVE_HIGH}, - if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering && - ACPI_ACTIVE_LOW == resource->data.irq.polarity) { - aml->irq.flags |= 0x08; - } else { - aml->irq.flags |= 0x01; - } - } + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.irq.sharable), + ACPI_EXCLUSIVE}, - /* Complete the AML descriptor header */ + /* irq_no_flags() descriptor can be used */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length, - aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_ext_irq - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_ext_irq * ******************************************************************************/ -acpi_status -acpi_rs_get_ext_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - char *out_resource_string; - u8 temp8; - - ACPI_FUNCTION_TRACE("rs_get_ext_irq"); - - /* Get the flag bits */ +struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, + ACPI_RS_SIZE(struct acpi_resource_extended_irq), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, - temp8 = aml->extended_irq.flags; - resource->data.extended_irq.producer_consumer = temp8 & 0x01; - resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01; - resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01; + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, + sizeof(struct aml_resource_extended_irq), + 0}, - /* - * Check for Interrupt Mode - * - * The definition of an Extended IRQ changed between ACPI spec v1.0b - * and ACPI spec 2.0 (section 6.4.3.6 in both). - * - * - Edge/Level are defined opposite in the table vs the headers - */ - resource->data.extended_irq.triggering = - (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; + /* Flag bits */ - /* Get the IRQ Table length (Byte4) */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), + AML_OFFSET(extended_irq.flags), + 0}, - temp8 = aml->extended_irq.table_length; - resource->data.extended_irq.interrupt_count = temp8; - if (temp8 < 1) { - /* Must have at least one IRQ */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering), + AML_OFFSET(extended_irq.flags), + 1}, - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity), + AML_OFFSET(extended_irq.flags), + 2}, - /* - * Add any additional structure size to properly calculate - * the next pointer at the end of this function - */ - resource->length = (temp8 - 1) * 4; - out_resource_string = ACPI_CAST_PTR(char, - (&resource->data.extended_irq. - interrupts[0] + temp8)); + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable), + AML_OFFSET(extended_irq.flags), + 3}, - /* Get every IRQ in the table, each is 32 bits */ + /* IRQ Table length (Byte4) */ - acpi_rs_move_data(resource->data.extended_irq.interrupts, - aml->extended_irq.interrupt_number, - (u16) temp8, ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), + AML_OFFSET(extended_irq.interrupt_count), + sizeof(u32)} + , - /* Get the optional resource_source (index and string) */ + /* Copy every IRQ in the table, each is 32 bits */ - resource->length += - acpi_rs_get_resource_source(aml_resource_length, - (acpi_size) resource->length + - sizeof(struct - aml_resource_extended_irq), - &resource->data.extended_irq. - resource_source, aml, - out_resource_string); + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), + AML_OFFSET(extended_irq.interrupts[0]), + 0} + , - /* Complete the resource header */ + /* Optional resource_source (Index and String) */ - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; - resource->length += - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET(data.extended_irq.resource_source), + ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), + sizeof(struct aml_resource_extended_irq)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_ext_irq - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_dma * ******************************************************************************/ -acpi_status -acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; - - ACPI_FUNCTION_TRACE("rs_set_ext_irq"); - - /* Set the Interrupt vector flags */ - - aml->extended_irq.flags = (u8) - ((resource->data.extended_irq.producer_consumer & 0x01) | - ((resource->data.extended_irq.sharable & 0x01) << 3) | - ((resource->data.extended_irq.polarity & 0x1) << 2)); - - /* - * Set the Interrupt Mode - * - * The definition of an Extended IRQ changed between ACPI spec v1.0b - * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not - * implement the more restrictive definition of 1.0b - * - * - Edge/Level are defined opposite in the table vs the headers - */ - if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) { - aml->extended_irq.flags |= 0x02; - } - - /* Set the Interrupt table length */ - - aml->extended_irq.table_length = (u8) - resource->data.extended_irq.interrupt_count; +struct acpi_rsconvert_info acpi_rs_convert_dma[6] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA, + ACPI_RS_SIZE(struct acpi_resource_dma), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_dma)}, - descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) + - ((acpi_size) resource->data.extended_irq.interrupt_count * - sizeof(u32)); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, + sizeof(struct aml_resource_dma), + 0}, - /* Set each interrupt value */ + /* Flags: transfer preference, bus mastering, channel speed */ - acpi_rs_move_data(aml->extended_irq.interrupt_number, - resource->data.extended_irq.interrupts, - (u16) resource->data.extended_irq.interrupt_count, - ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer), + AML_OFFSET(dma.flags), + 0}, - /* Resource Source Index and Resource Source are optional */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master), + AML_OFFSET(dma.flags), + 2}, - descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length, - &resource->data. - extended_irq. - resource_source); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type), + AML_OFFSET(dma.flags), + 5}, - /* Complete the AML descriptor header */ + /* DMA channel mask bits */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]), + AML_OFFSET(dma.dma_channel_mask), + ACPI_RS_OFFSET(data.dma.channel_count)} +}; diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index f72d42e0927..ee17ef3315f 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -48,7 +48,8 @@ ACPI_MODULE_NAME("rslist") /* Local prototypes */ -static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); +static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 + resource_type); static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); @@ -83,7 +84,7 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) return (AE_AML_INVALID_RESOURCE_TYPE); } - resource_length = acpi_rs_get_resource_length(aml); + resource_length = acpi_ut_get_resource_length(aml); minimum_aml_resource_length = resource_info->minimum_aml_resource_length; @@ -115,18 +116,17 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) /******************************************************************************* * - * FUNCTION: acpi_rs_get_resource_handler + * FUNCTION: acpi_rs_get_conversion_info * * PARAMETERS: resource_type - Byte 0 of a resource descriptor * - * RETURN: Pointer to the resource conversion handler + * RETURN: Pointer to the resource conversion info table * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. + * DESCRIPTION: Get the conversion table associated with this resource type * ******************************************************************************/ -static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) +static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) { ACPI_FUNCTION_ENTRY(); @@ -174,33 +174,24 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, acpi_status status; acpi_size bytes_parsed = 0; struct acpi_resource *resource; - u16 resource_length; - u32 descriptor_length; - ACPI_GET_RESOURCE_HANDLER handler; + acpi_rsdesc_size descriptor_length; + struct acpi_rsconvert_info *info; ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); /* Loop until end-of-buffer or an end_tag is found */ while (bytes_parsed < aml_buffer_length) { - /* Get the handler associated with this Descriptor Type */ + /* Get the conversion table associated with this Descriptor Type */ - handler = acpi_rs_get_resource_handler(*aml_buffer); - if (!handler) { - /* No handler indicates invalid resource type */ + info = acpi_rs_get_conversion_info(*aml_buffer); + if (!info) { + /* No table indicates an invalid resource type */ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - resource_length = - acpi_rs_get_resource_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); - - descriptor_length = - acpi_rs_get_descriptor_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + descriptor_length = acpi_ut_get_descriptor_length(aml_buffer); /* * Perform limited validation of the resource length, based upon @@ -214,11 +205,16 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, return_ACPI_STATUS(status); } - /* Convert a byte stream resource to local resource struct */ + /* Convert the AML byte stream resource to a local resource struct */ - status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer), - resource_length, - ACPI_CAST_PTR(struct acpi_resource, buffer)); + status = + acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR + (struct acpi_resource, + buffer), + ACPI_CAST_PTR(union + aml_resource, + aml_buffer), + info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); return_ACPI_STATUS(status); @@ -232,7 +228,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, /* Normal exit on completion of an end_tag resource descriptor */ - if (acpi_rs_get_resource_type(*aml_buffer) == + if (acpi_ut_get_resource_type(aml_buffer) == ACPI_RESOURCE_NAME_END_TAG) { return_ACPI_STATUS(AE_OK); } @@ -276,14 +272,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_size aml_size_needed, u8 * output_buffer) { u8 *aml_buffer = output_buffer; + u8 *end_aml_buffer = output_buffer + aml_size_needed; acpi_status status; ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); - /* Convert each resource descriptor in the list */ + /* Walk the resource descriptor list, convert each descriptor */ - while (1) { - /* Validate Resource Descriptor Type before dispatch */ + while (aml_buffer < end_aml_buffer) { + /* Validate the Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -292,14 +289,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, return_ACPI_STATUS(AE_BAD_DATA); } - /* Perform the conversion per resource type */ + /* Perform the conversion */ - status = - acpi_gbl_set_resource_dispatch[resource->type] (resource, - ACPI_CAST_PTR - (union - aml_resource, - aml_buffer)); + status = acpi_rs_convert_resource_to_aml(resource, + ACPI_CAST_PTR(union + aml_resource, + aml_buffer), + acpi_gbl_set_resource_dispatch + [resource->type]); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); return_ACPI_STATUS(status); @@ -323,18 +320,23 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, return_ACPI_STATUS(AE_OK); } - /* Extract the total length of the new descriptor */ - /* Set the aml_buffer to point to the next (output) resource descriptor */ - - aml_buffer += - acpi_rs_get_descriptor_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + /* + * Extract the total length of the new descriptor and set the + * aml_buffer to point to the next (output) resource descriptor + */ + aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); /* Point to the next input resource descriptor */ resource = ACPI_PTR_ADD(struct acpi_resource, resource, resource->length); + + /* Check for end-of-list, normal exit */ + } + + /* Completed buffer, but did not find an end_tag resource descriptor */ + + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 47e979e7ba3..418a3fb6407 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -49,260 +49,187 @@ ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * - * FUNCTION: acpi_rs_get_memory24 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_memory24 * ******************************************************************************/ -acpi_status -acpi_rs_get_memory24(union aml_resource * aml, - u16 aml_resource_length, struct acpi_resource * resource) -{ - ACPI_FUNCTION_TRACE("rs_get_memory24"); +struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, + ACPI_RS_SIZE(struct acpi_resource_memory24), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)}, - /* Get the Read/Write bit */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, + sizeof(struct aml_resource_memory24), + 0}, - resource->data.memory24.read_write_attribute = - (aml->memory24.information & 0x01); + /* Read/Write bit */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), + AML_OFFSET(memory24.flags), + 0}, /* - * Get the following contiguous fields from the AML descriptor: + * These fields are contiguous in both the source and destination: * Minimum Base Address * Maximum Base Address * Address Base Alignment * Range Length */ - acpi_rs_move_data(&resource->data.memory24.minimum, - &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_MEMORY24; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), + AML_OFFSET(memory24.minimum), + 4} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_memory24 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_memory32 * ******************************************************************************/ -acpi_status -acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_memory24"); +struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, + ACPI_RS_SIZE(struct acpi_resource_memory32), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)}, - /* Set the Information Byte */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, + sizeof(struct aml_resource_memory32), + 0}, - aml->memory24.information = (u8) - (resource->data.memory24.read_write_attribute & 0x01); + /* Read/Write bit */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), + AML_OFFSET(memory32.flags), + 0}, /* - * Set the following contiguous fields in the AML descriptor: + * These fields are contiguous in both the source and destination: * Minimum Base Address * Maximum Base Address * Address Base Alignment * Range Length */ - acpi_rs_move_data(&aml->memory24.minimum, - &resource->data.memory24.minimum, 4, - ACPI_MOVE_TYPE_32_TO_16); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24, - sizeof(struct aml_resource_memory24), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), + AML_OFFSET(memory32.minimum), + 4} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_memory32 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_fixed_memory32 * ******************************************************************************/ -acpi_status -acpi_rs_get_memory32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_memory32"); +struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)}, - /* Get the Read/Write bit */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, + sizeof(struct aml_resource_fixed_memory32), + 0}, - resource->data.memory32.read_write_attribute = - (aml->memory32.information & 0x01); + /* Read/Write bit */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), + AML_OFFSET(fixed_memory32.flags), + 0}, /* - * Get the following contiguous fields from the AML descriptor: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment + * These fields are contiguous in both the source and destination: + * Base Address * Range Length */ - acpi_rs_move_data(&resource->data.memory32.minimum, - &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_MEMORY32; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), + AML_OFFSET(fixed_memory32.address), + 2} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_memory32 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_get_vendor_small * ******************************************************************************/ -acpi_status -acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_memory32"); - - /* Set the Information Byte */ +struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, + ACPI_RS_SIZE(struct acpi_resource_vendor), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)}, - aml->memory32.information = (u8) - (resource->data.memory32.read_write_attribute & 0x01); + /* Length of the vendor data (byte count) */ - /* - * Set the following contiguous fields in the AML descriptor: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment - * Range Length - */ - acpi_rs_move_data(&aml->memory32.minimum, - &resource->data.memory32.minimum, 4, - ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + sizeof(u8)} + , - /* Complete the AML descriptor header */ + /* Vendor data */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32, - sizeof(struct aml_resource_memory32), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_small_header), + 0} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_fixed_memory32 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_get_vendor_large * ******************************************************************************/ -acpi_status -acpi_rs_get_fixed_memory32(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_fixed_memory32"); - - /* Get the Read/Write bit */ +struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, + ACPI_RS_SIZE(struct acpi_resource_vendor), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)}, - resource->data.fixed_memory32.read_write_attribute = - (aml->fixed_memory32.information & 0x01); + /* Length of the vendor data (byte count) */ - /* - * Get the following contiguous fields from the AML descriptor: - * Base Address - * Range Length - */ - ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address, - &aml->fixed_memory32.address); - ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length, - &aml->fixed_memory32.address_length); + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + sizeof(u8)} + , - /* Complete the resource header */ + /* Vendor data */ - resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_large_header), + 0} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_fixed_memory32 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_set_vendor * ******************************************************************************/ -acpi_status -acpi_rs_set_fixed_memory32(struct acpi_resource *resource, - union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_fixed_memory32"); +struct acpi_rsconvert_info acpi_rs_set_vendor[7] = { + /* Default is a small vendor descriptor */ + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, + sizeof(struct aml_resource_small_header), + ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)}, + + /* Get the length and copy the data */ - /* Set the Information Byte */ + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + 0}, - aml->fixed_memory32.information = (u8) - (resource->data.fixed_memory32.read_write_attribute & 0x01); + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_small_header), + 0}, /* - * Set the following contiguous fields in the AML descriptor: - * Base Address - * Range Length + * All done if the Vendor byte length is 7 or less, meaning that it will + * fit within a small descriptor */ - ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address, - &resource->data.fixed_memory32.address); - ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length, - &resource->data.fixed_memory32.address_length); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32, - sizeof(struct aml_resource_fixed_memory32), - aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_EXIT_LE, 0, 0, 7}, + + /* Must create a large vendor descriptor */ + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, + sizeof(struct aml_resource_large_header), + 0}, + + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_large_header), + 0} +}; diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 337a0f01cb2..16ad3bfbee2 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -47,156 +47,267 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsmisc") +#define INIT_RESOURCE_TYPE(i) i->resource_offset +#define INIT_RESOURCE_LENGTH(i) i->aml_offset +#define INIT_TABLE_LENGTH(i) i->value +#define COMPARE_OPCODE(i) i->resource_offset +#define COMPARE_TARGET(i) i->aml_offset +#define COMPARE_VALUE(i) i->value /******************************************************************************* * - * FUNCTION: acpi_rs_get_generic_reg - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ -acpi_status -acpi_rs_get_generic_reg(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_generic_reg"); - - /* - * Get the following fields from the AML descriptor: - * Address Space ID - * Register Bit Width - * Register Bit Offset - * Access Size - * Register Address - */ - resource->data.generic_reg.space_id = aml->generic_reg.address_space_id; - resource->data.generic_reg.bit_width = aml->generic_reg.bit_width; - resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset; - resource->data.generic_reg.access_size = aml->generic_reg.access_size; - ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address, - &aml->generic_reg.address); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register); - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_generic_reg + * FUNCTION: acpi_rs_convert_aml_to_resource * * PARAMETERS: Resource - Pointer to the resource descriptor * Aml - Where the AML descriptor is returned + * Info - Pointer to appropriate conversion table * * RETURN: Status * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_generic_reg"); - - /* - * Set the following fields in the AML descriptor: - * Address Space ID - * Register Bit Width - * Register Bit Offset - * Access Size - * Register Address - */ - aml->generic_reg.address_space_id = - (u8) resource->data.generic_reg.space_id; - aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width; - aml->generic_reg.bit_offset = - (u8) resource->data.generic_reg.bit_offset; - aml->generic_reg.access_size = - (u8) resource->data.generic_reg.access_size; - ACPI_MOVE_64_TO_64(&aml->generic_reg.address, - &resource->data.generic_reg.address); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER, - sizeof(struct - aml_resource_generic_register), aml); - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_vendor - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * DESCRIPTION: Convert an external AML resource descriptor to the corresponding + * internal resource descriptor * ******************************************************************************/ - acpi_status -acpi_rs_get_vendor(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) +acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info) { - u8 *aml_byte_data; - - ACPI_FUNCTION_TRACE("rs_get_vendor"); + acpi_rs_length aml_resource_length; + void *source; + void *destination; + char *target; + u8 count; + u8 flags_mode = FALSE; + u16 item_count = 0; + u16 temp16 = 0; + + ACPI_FUNCTION_TRACE("rs_get_resource"); + + if (((acpi_native_uint) resource) & 0x3) { + acpi_os_printf + ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", + resource, resource->type, resource->length); + } - /* Determine if this is a large or small vendor specific item */ + /* Extract the resource Length field (does not include header length) */ - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large item, Point to the first vendor byte */ + aml_resource_length = acpi_ut_get_resource_length(aml); - aml_byte_data = - ((u8 *) aml) + sizeof(struct aml_resource_large_header); - } else { - /* Small item, Point to the first vendor byte */ + /* + * First table entry must be ACPI_RSC_INITxxx and must contain the + * table length (# of table entries) + */ + count = INIT_TABLE_LENGTH(info); + + while (count) { + /* + * Source is the external AML byte stream buffer, + * destination is the internal resource descriptor + */ + source = ((u8 *) aml) + info->aml_offset; + destination = ((u8 *) resource) + info->resource_offset; + + switch (info->opcode) { + case ACPI_RSC_INITGET: + /* + * Get the resource type and the initial (minimum) length + */ + ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info)); + resource->type = INIT_RESOURCE_TYPE(info); + resource->length = INIT_RESOURCE_LENGTH(info); + break; + + case ACPI_RSC_INITSET: + break; + + case ACPI_RSC_FLAGINIT: + + flags_mode = TRUE; + break; + + case ACPI_RSC_1BITFLAG: + /* + * Mask and shift the flag bit + */ + *((u8 *) destination) = (u8) + ((*((u8 *) source) >> info->value) & 0x01); + break; + + case ACPI_RSC_2BITFLAG: + /* + * Mask and shift the flag bits + */ + *((u8 *) destination) = (u8) + ((*((u8 *) source) >> info->value) & 0x03); + break; + + case ACPI_RSC_COUNT: + + item_count = *((u8 *) source); + *((u8 *) destination) = (u8) item_count; + + resource->length = resource->length + + (info->value * (item_count - 1)); + break; + + case ACPI_RSC_COUNT16: + + item_count = aml_resource_length; + *((u16 *) destination) = item_count; + + resource->length = resource->length + + (info->value * (item_count - 1)); + break; + + case ACPI_RSC_LENGTH: + + resource->length = resource->length + info->value; + break; + + case ACPI_RSC_MOVE8: + case ACPI_RSC_MOVE16: + case ACPI_RSC_MOVE32: + case ACPI_RSC_MOVE64: + /* + * Raw data move. Use the Info value field unless item_count has + * been previously initialized via a COUNT opcode + */ + if (info->value) { + item_count = info->value; + } + acpi_rs_move_data(destination, source, item_count, + info->opcode); + break; + + case ACPI_RSC_SET8: + + ACPI_MEMSET(destination, info->aml_offset, info->value); + break; + + case ACPI_RSC_DATA8: + + target = ((char *)resource) + info->value; + ACPI_MEMCPY(destination, source, + *(ACPI_CAST_PTR(u16, target))); + break; + + case ACPI_RSC_ADDRESS: + /* + * Common handler for address descriptor flags + */ + if (!acpi_rs_get_address_common(resource, aml)) { + return_ACPI_STATUS + (AE_AML_INVALID_RESOURCE_TYPE); + } + break; + + case ACPI_RSC_SOURCE: + /* + * Optional resource_source (Index and String) + */ + resource->length += + acpi_rs_get_resource_source(aml_resource_length, + info->value, + destination, aml, NULL); + break; + + case ACPI_RSC_SOURCEX: + /* + * Optional resource_source (Index and String). This is the more + * complicated case used by the Interrupt() macro + */ + target = + ((char *)resource) + info->aml_offset + + (item_count * 4); + + resource->length += + acpi_rs_get_resource_source(aml_resource_length, + (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); + break; + + case ACPI_RSC_BITMASK: + /* + * 8-bit encoded bitmask (DMA macro) + */ + item_count = + acpi_rs_decode_bitmask(*((u8 *) source), + destination); + if (item_count) { + resource->length += + resource->length + (item_count - 1); + } + + target = ((char *)resource) + info->value; + *((u8 *) target) = (u8) item_count; + break; + + case ACPI_RSC_BITMASK16: + /* + * 16-bit encoded bitmask (IRQ macro) + */ + ACPI_MOVE_16_TO_16(&temp16, source); + + item_count = + acpi_rs_decode_bitmask(temp16, destination); + if (item_count) { + resource->length = + resource->length + (item_count - 1); + } + + target = ((char *)resource) + info->value; + *((u8 *) target) = (u8) item_count; + break; + + case ACPI_RSC_EXIT_NE: + /* + * Control - Exit conversion if not equal + */ + switch (info->resource_offset) { + case ACPI_RSC_COMPARE_AML_LENGTH: + if (aml_resource_length != info->value) { + goto exit; + } + break; + + case ACPI_RSC_COMPARE_VALUE: + if (*((u8 *) source) != info->value) { + goto exit; + } + break; + + default: + acpi_os_printf + ("*** Invalid conversion sub-opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + break; + + default: + + acpi_os_printf("*** Invalid conversion opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } - aml_byte_data = - ((u8 *) aml) + sizeof(struct aml_resource_small_header); + count--; + info++; } - /* Copy the vendor-specific bytes */ - - ACPI_MEMCPY(resource->data.vendor.byte_data, - aml_byte_data, aml_resource_length); - resource->data.vendor.byte_length = aml_resource_length; + exit: + if (!flags_mode) { + /* Round the resource struct length up to the next 32-bit boundary */ - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the vendor string and expand the - * struct_size to the next 32-bit boundary. - */ - resource->type = ACPI_RESOURCE_TYPE_VENDOR; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + - ACPI_ROUND_UP_to_32_bITS(aml_resource_length); + resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); + } return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_set_vendor + * FUNCTION: acpi_rs_convert_resource_to_aml * * PARAMETERS: Resource - Pointer to the resource descriptor * Aml - Where the AML descriptor is returned + * Info - Pointer to appropriate conversion table * * RETURN: Status * @@ -206,275 +317,236 @@ acpi_rs_get_vendor(union aml_resource *aml, ******************************************************************************/ acpi_status -acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml) +acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info) { - u32 resource_length; - u8 *source; - u8 *destination; - - ACPI_FUNCTION_TRACE("rs_set_vendor"); - - resource_length = resource->data.vendor.byte_length; - source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data); - - /* Length determines if this is a large or small resource */ + void *source = NULL; + void *destination; + acpi_rsdesc_size aml_length = 0; + u8 count; + u16 temp16 = 0; + u16 item_count = 0; - if (resource_length > 7) { - /* Large item, get pointer to the data part of the descriptor */ + ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); - destination = - ((u8 *) aml) + sizeof(struct aml_resource_large_header); + /* Validate the Resource pointer, must be 32-bit aligned */ - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE, - (u32) (resource_length + - sizeof(struct - aml_resource_large_header)), - aml); - } else { - /* Small item, get pointer to the data part of the descriptor */ - - destination = - ((u8 *) aml) + sizeof(struct aml_resource_small_header); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL, - (u32) (resource_length + - sizeof(struct - aml_resource_small_header)), - aml); + if (((acpi_native_uint) resource) & 0x3) { + acpi_os_printf + ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n", + resource, resource->type, resource->length); } - /* Copy the vendor-specific bytes */ - - ACPI_MEMCPY(destination, source, resource_length); - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_start_dpf - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_start_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_start_dpf"); - - /* Get the flags byte if present */ - - if (aml_resource_length == 1) { - /* Get the Compatibility priority */ - - resource->data.start_dpf.compatibility_priority = - (aml->start_dpf.flags & 0x03); - - if (resource->data.start_dpf.compatibility_priority >= 3) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); - } - - /* Get the Performance/Robustness preference */ - - resource->data.start_dpf.performance_robustness = - ((aml->start_dpf.flags >> 2) & 0x03); - - if (resource->data.start_dpf.performance_robustness >= 3) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + /* + * First table entry must be ACPI_RSC_INITxxx and must contain the + * table length (# of table entries) + */ + count = INIT_TABLE_LENGTH(info); + + while (count) { + /* + * Source is the internal resource descriptor, + * destination is the external AML byte stream buffer + */ + source = ((u8 *) resource) + info->resource_offset; + destination = ((u8 *) aml) + info->aml_offset; + + switch (info->opcode) { + case ACPI_RSC_INITSET: + + ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info)); + aml_length = INIT_RESOURCE_LENGTH(info); + acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info), + aml_length, aml); + break; + + case ACPI_RSC_INITGET: + break; + + case ACPI_RSC_FLAGINIT: + /* + * Clear the flag byte + */ + *((u8 *) destination) = 0; + break; + + case ACPI_RSC_1BITFLAG: + /* + * Mask and shift the flag bit + */ + *((u8 *) destination) |= (u8) + ((*((u8 *) source) & 0x01) << info->value); + break; + + case ACPI_RSC_2BITFLAG: + /* + * Mask and shift the flag bits + */ + *((u8 *) destination) |= (u8) + ((*((u8 *) source) & 0x03) << info->value); + break; + + case ACPI_RSC_COUNT: + + item_count = *((u8 *) source); + *((u8 *) destination) = (u8) item_count; + + aml_length = (u16) (aml_length + + (info->value * (item_count - 1))); + break; + + case ACPI_RSC_COUNT16: + + item_count = *((u16 *) source); + aml_length = (u16) (aml_length + item_count); + acpi_rs_set_resource_length(aml_length, aml); + break; + + case ACPI_RSC_LENGTH: + + acpi_rs_set_resource_length(info->value, aml); + break; + + case ACPI_RSC_MOVE8: + case ACPI_RSC_MOVE16: + case ACPI_RSC_MOVE32: + case ACPI_RSC_MOVE64: + + if (info->value) { + item_count = info->value; + } + acpi_rs_move_data(destination, source, item_count, + info->opcode); + break; + + case ACPI_RSC_ADDRESS: + + /* Set the Resource Type, General Flags, and Type-Specific Flags */ + + acpi_rs_set_address_common(aml, resource); + break; + + case ACPI_RSC_SOURCEX: + /* + * Optional resource_source (Index and String) + */ + aml_length = + acpi_rs_set_resource_source(aml, + (acpi_rs_length) + aml_length, source); + acpi_rs_set_resource_length(aml_length, aml); + break; + + case ACPI_RSC_SOURCE: + /* + * Optional resource_source (Index and String). This is the more + * complicated case used by the Interrupt() macro + */ + aml_length = + acpi_rs_set_resource_source(aml, info->value, + source); + acpi_rs_set_resource_length(aml_length, aml); + break; + + case ACPI_RSC_BITMASK: + /* + * 8-bit encoded bitmask (DMA macro) + */ + *((u8 *) destination) = (u8) + acpi_rs_encode_bitmask(source, + *(((u8 *) resource) + + info->value)); + break; + + case ACPI_RSC_BITMASK16: + /* + * 16-bit encoded bitmask (IRQ macro) + */ + temp16 = + acpi_rs_encode_bitmask(source, + *(((u8 *) resource) + + info->value)); + ACPI_MOVE_16_TO_16(destination, &temp16); + break; + + case ACPI_RSC_EXIT_LE: + /* + * Control - Exit conversion if less than or equal + */ + if (item_count <= info->value) { + goto exit; + } + break; + + case ACPI_RSC_EXIT_NE: + /* + * Control - Exit conversion if not equal + */ + switch (COMPARE_OPCODE(info)) { + case ACPI_RSC_COMPARE_VALUE: + if (* + ((u8 *) (((u8 *) resource) + + COMPARE_TARGET(info))) != + COMPARE_VALUE(info)) { + goto exit; + } + break; + + default: + acpi_os_printf + ("*** Invalid conversion sub-opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + break; + + default: + + acpi_os_printf("*** Invalid conversion opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - } else { - /* start_dependent_no_pri(), no flags byte, set defaults */ - - resource->data.start_dpf.compatibility_priority = - ACPI_ACCEPTABLE_CONFIGURATION; - resource->data.start_dpf.performance_robustness = - ACPI_ACCEPTABLE_CONFIGURATION; + count--; + info++; } - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent); + exit: return_ACPI_STATUS(AE_OK); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_start_dpf - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_start_dpf"); +#if 0 +/* Previous resource validations */ - /* - * The descriptor type field is set based upon whether a byte is needed - * to contain Priority data. - */ - if (ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.compatibility_priority && - ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.performance_robustness) { - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, - sizeof(struct - aml_resource_start_dependent_noprio), - aml); - } else { - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, - sizeof(struct - aml_resource_start_dependent), - aml); - - /* Set the Flags byte */ - - aml->start_dpf.flags = (u8) - (((resource->data.start_dpf. - performance_robustness & 0x03) << 2) | (resource->data. - start_dpf. - compatibility_priority - & 0x03)); - } - return_ACPI_STATUS(AE_OK); +if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { + return_ACPI_STATUS(AE_SUPPORT); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_end_dpf - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_end_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_end_dpf"); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT; - resource->length = (u32) ACPI_RESOURCE_LENGTH; - return_ACPI_STATUS(AE_OK); +if (resource->data.start_dpf.performance_robustness >= 3) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_end_dpf - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_end_dpf"); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT, - sizeof(struct aml_resource_end_dependent), - aml); - return_ACPI_STATUS(AE_OK); +if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { + /* + * Only [active_high, edge_sensitive] or [active_low, level_sensitive] + * polarity/trigger interrupts 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", + aml->irq.flags)); + return_ACPI_STATUS(AE_BAD_DATA); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_end_tag - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_end_tag(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_end_tag"); - - /* Complete the resource header */ +resource->data.extended_irq.interrupt_count = temp8; +if (temp8 < 1) { + /* Must have at least one IRQ */ - resource->type = ACPI_RESOURCE_TYPE_END_TAG; - resource->length = ACPI_RESOURCE_LENGTH; - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_end_tag - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_end_tag"); - - /* - * Set the Checksum - zero means that the resource data is treated as if - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) - */ - aml->end_tag.checksum = 0; - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG, - sizeof(struct aml_resource_end_tag), aml); - return_ACPI_STATUS(AE_OK); +if (resource->data.dma.transfer == 0x03) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid DMA.Transfer preference (3)\n")); + return_ACPI_STATUS(AE_BAD_DATA); } +#endif diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 9d503de1a34..7613033f5dc 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -48,6 +48,64 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsutils") +/******************************************************************************* + * + * FUNCTION: acpi_rs_decode_bitmask + * + * PARAMETERS: Mask - Bitmask to decode + * List - Where the converted list is returned + * + * RETURN: Count of bits set (length of list) + * + * DESCRIPTION: Convert a bit mask into a list of values + * + ******************************************************************************/ +u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) +{ + acpi_native_uint i; + u8 bit_count; + + /* Decode the mask bits */ + + for (i = 0, bit_count = 0; mask; i++) { + if (mask & 0x0001) { + list[bit_count] = (u8) i; + bit_count++; + } + + mask >>= 1; + } + + return (bit_count); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_encode_bitmask + * + * PARAMETERS: List - List of values to encode + * Count - Length of list + * + * RETURN: Encoded bitmask + * + * DESCRIPTION: Convert a list of values to an encoded bitmask + * + ******************************************************************************/ + +u16 acpi_rs_encode_bitmask(u8 * list, u8 count) +{ + acpi_native_uint i; + u16 mask; + + /* Encode the list into a single bitmask */ + + for (i = 0, mask = 0; i < count; i++) { + mask |= (0x0001 << list[i]); + } + + return (mask); +} + /******************************************************************************* * * FUNCTION: acpi_rs_move_data @@ -64,6 +122,7 @@ ACPI_MODULE_NAME("rsutils") * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) * ******************************************************************************/ + void acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) { @@ -73,22 +132,30 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) for (i = 0; i < item_count; i++) { switch (move_type) { - case ACPI_MOVE_TYPE_16_TO_32: - ACPI_MOVE_16_TO_32(&((u32 *) destination)[i], - &((u16 *) source)[i]); - break; + /* + * For the 8-bit case, we can perform the move all at once + * since there are no alignment or endian issues + */ + case ACPI_RSC_MOVE8: + ACPI_MEMCPY(destination, source, item_count); + return; - case ACPI_MOVE_TYPE_32_TO_16: - ACPI_MOVE_32_TO_16(&((u16 *) destination)[i], - &((u32 *) source)[i]); + /* + * 16-, 32-, and 64-bit cases must use the move macros that perform + * endian conversion and/or accomodate hardware that cannot perform + * misaligned memory transfers + */ + case ACPI_RSC_MOVE16: + ACPI_MOVE_16_TO_16(&((u16 *) destination)[i], + &((u16 *) source)[i]); break; - case ACPI_MOVE_TYPE_32_TO_32: + case ACPI_RSC_MOVE32: ACPI_MOVE_32_TO_32(&((u32 *) destination)[i], &((u32 *) source)[i]); break; - case ACPI_MOVE_TYPE_64_TO_64: + case ACPI_RSC_MOVE64: ACPI_MOVE_64_TO_64(&((u64 *) destination)[i], &((u64 *) source)[i]); break; @@ -148,80 +215,57 @@ struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type) /******************************************************************************* * - * FUNCTION: acpi_rs_get_resource_length + * FUNCTION: acpi_rs_set_resource_length * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * PARAMETERS: total_length - Length of the AML descriptor, including + * the header and length fields. + * Aml - Pointer to the raw AML descriptor * - * RETURN: Byte Length + * RETURN: None * - * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By - * definition, this does not include the size of the descriptor - * header or the length field itself. + * DESCRIPTION: Set the resource_length field of an AML + * resource descriptor, both Large and Small descriptors are + * supported automatically. Note: Descriptor Type field must + * be valid. * ******************************************************************************/ -u16 acpi_rs_get_resource_length(union aml_resource * aml) +void +acpi_rs_set_resource_length(acpi_rsdesc_size total_length, + union aml_resource *aml) { - u16 resource_length; + acpi_rs_length resource_length; ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - ACPI_MOVE_16_TO_16(&resource_length, - &aml->large_header.resource_length); + resource_length = (acpi_rs_length) + (total_length - sizeof(struct aml_resource_large_header)); + + /* Insert length into the Large descriptor length field */ + ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, + &resource_length); } else { /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - resource_length = (u16) (aml->small_header.descriptor_type & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - } - - return (resource_length); -} + resource_length = (acpi_rs_length) + (total_length - sizeof(struct aml_resource_small_header)); -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_descriptor_length - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Byte length - * - * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the - * length of the descriptor header and the length field itself. - * Used to walk descriptor lists. - * - ******************************************************************************/ - -u32 acpi_rs_get_descriptor_length(union aml_resource * aml) -{ - u32 descriptor_length; - - ACPI_FUNCTION_ENTRY(); - - /* Determine if this is a small or large resource */ - - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + /* Insert length into the descriptor type byte */ - ACPI_MOVE_16_TO_32(&descriptor_length, - &aml->large_header.resource_length); - descriptor_length += sizeof(struct aml_resource_large_header); + aml->small_header.descriptor_type = (u8) - } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + /* Clear any existing length, preserving descriptor type bits */ + ((aml->small_header. + descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - descriptor_length = (u32) (aml->small_header.descriptor_type & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - descriptor_length += sizeof(struct aml_resource_small_header); + | resource_length); } - - return (descriptor_length); } /******************************************************************************* @@ -243,71 +287,18 @@ u32 acpi_rs_get_descriptor_length(union aml_resource * aml) void acpi_rs_set_resource_header(u8 descriptor_type, - acpi_size total_length, union aml_resource *aml) + acpi_rsdesc_size total_length, + union aml_resource *aml) { - u16 resource_length; - ACPI_FUNCTION_ENTRY(); - /* Set the descriptor type */ + /* Set the Descriptor Type */ aml->small_header.descriptor_type = descriptor_type; - /* Determine if this is a small or large resource */ - - if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - - resource_length = - (u16) (total_length - - sizeof(struct aml_resource_large_header)); - - /* Insert length into the Large descriptor length field */ - - ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, - &resource_length); - } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - - resource_length = - (u16) (total_length - - sizeof(struct aml_resource_small_header)); - - /* Insert length into the descriptor type byte */ - - aml->small_header.descriptor_type |= (u8) resource_length; - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_resource_type - * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor - * - * RETURN: The Resource Type with no extraneous bits (except the - * Large/Small descriptor bit -- this is left alone) - * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. - * - ******************************************************************************/ - -u8 acpi_rs_get_resource_type(u8 resource_type) -{ - ACPI_FUNCTION_ENTRY(); + /* Set the Resource Length */ - /* Determine if this is a small or large resource */ - - if (resource_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - return (resource_type); - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK)); - } + acpi_rs_set_resource_length(total_length, aml); } /******************************************************************************* @@ -360,13 +351,13 @@ static u16 acpi_rs_strcpy(char *destination, char *source) * ******************************************************************************/ -u16 -acpi_rs_get_resource_source(u16 resource_length, - acpi_size minimum_length, +acpi_rs_length +acpi_rs_get_resource_source(acpi_rs_length resource_length, + acpi_rs_length minimum_length, struct acpi_resource_source * resource_source, union aml_resource * aml, char *string_ptr) { - acpi_size total_length; + acpi_rsdesc_size total_length; u8 *aml_resource_source; ACPI_FUNCTION_ENTRY(); @@ -382,7 +373,7 @@ acpi_rs_get_resource_source(u16 resource_length, * Note: Some resource descriptors will have an additional null, so * we add 1 to the minimum length. */ - if (total_length > (minimum_length + 1)) { + if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { /* Get the resource_source_index */ resource_source->index = aml_resource_source[0]; @@ -398,20 +389,26 @@ acpi_rs_get_resource_source(u16 resource_length, sizeof(struct acpi_resource_source); } + /* + * In order for the struct_size to fall on a 32-bit boundary, calculate + * the length of the string (+1 for the NULL terminator) and expand the + * struct_size to the next 32-bit boundary. + * + * Zero the entire area of the buffer. + */ + total_length = + ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN + ((char *)&aml_resource_source[1]) + + 1); + ACPI_MEMSET(resource_source->string_ptr, 0, total_length); + /* Copy the resource_source string to the destination */ resource_source->string_length = acpi_rs_strcpy(resource_source->string_ptr, (char *)&aml_resource_source[1]); - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - return ((u16) - ACPI_ROUND_UP_to_32_bITS(resource_source-> - string_length)); + return ((acpi_rs_length) total_length); } else { /* resource_source is not present */ @@ -434,18 +431,18 @@ acpi_rs_get_resource_source(u16 resource_length, * * RETURN: Total length of the AML descriptor * - * DESCRIPTION: Convert an optoinal resource_source from internal format to a + * DESCRIPTION: Convert an optional resource_source from internal format to a * raw AML resource descriptor * ******************************************************************************/ -acpi_size +acpi_rsdesc_size acpi_rs_set_resource_source(union aml_resource * aml, - acpi_size minimum_length, + acpi_rs_length minimum_length, struct acpi_resource_source * resource_source) { u8 *aml_resource_source; - acpi_size descriptor_length; + acpi_rsdesc_size descriptor_length; ACPI_FUNCTION_ENTRY(); @@ -472,7 +469,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, * final descriptor length */ descriptor_length += - ((acpi_size) resource_source->string_length + 1); + ((acpi_rsdesc_size) resource_source->string_length + 1); } /* Return the new total length of the AML descriptor */ diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 9d179beb17a..09d250ab987 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -57,7 +57,7 @@ ACPI_MODULE_NAME("rsxface") ACPI_COPY_FIELD(out, in, decode); \ ACPI_COPY_FIELD(out, in, min_address_fixed); \ ACPI_COPY_FIELD(out, in, max_address_fixed); \ - ACPI_COPY_FIELD(out, in, attribute); \ + ACPI_COPY_FIELD(out, in, info); \ ACPI_COPY_FIELD(out, in, granularity); \ ACPI_COPY_FIELD(out, in, minimum); \ ACPI_COPY_FIELD(out, in, maximum); \ diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 4b2fbb592f4..e6dfe688b76 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -94,9 +94,8 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) new_table_desc->pointer->length) && (!ACPI_MEMCMP - ((const char *)table_desc->pointer, - (const char *)new_table_desc->pointer, - (acpi_size) new_table_desc->pointer->length))) { + (table_desc->pointer, new_table_desc->pointer, + new_table_desc->pointer->length))) { /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index dc7f24b3a1c..e04b6119a4d 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -866,7 +866,7 @@ void acpi_ut_dump_allocations(u32 component, char *module) if (!num_outstanding) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No outstanding allocations.\n")); + "No outstanding allocations\n")); } else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "%d(%X) Outstanding allocations\n", diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 7f72839841c..413e1dd8ae3 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -217,23 +217,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to * perform a Notify() operation on it. */ -const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = - { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, -{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, -{"_SB_", ACPI_TYPE_DEVICE, NULL}, -{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, -{"_TZ_", ACPI_TYPE_THERMAL, NULL}, -{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, -{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, -{"_GL_", ACPI_TYPE_MUTEX, (char *)1}, +const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { + {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_SB_", ACPI_TYPE_DEVICE, NULL}, + {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_TZ_", ACPI_TYPE_THERMAL, NULL}, + {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, + {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, + {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) -{"_OSI", ACPI_TYPE_METHOD, (char *)1}, + {"_OSI", ACPI_TYPE_METHOD, (char *)1}, #endif /* Table terminator */ -{NULL, ACPI_TYPE_ANY, NULL} + {NULL, ACPI_TYPE_ANY, NULL} }; /* @@ -503,11 +503,13 @@ char *acpi_ut_get_region_name(u8 space_id) /* Event type decoding */ static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { +/*! [Begin] no source code translation (keep these strings as-is) */ "PM_Timer", - "global_lock", - "power_button", - "sleep_button", - "real_time_clock", + "GlobalLock", + "PowerButton", + "SleepButton", + "RealTimeClock", +/*! [End] no source code translation !*/ }; char *acpi_ut_get_event_name(u32 event_id) @@ -545,12 +547,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; /* Printable names of the ACPI object types */ static const char *acpi_gbl_ns_type_names[] = { +/*! [Begin] no source code translation (keep these strings as-is) */ /* 00 */ "Untyped", /* 01 */ "Integer", /* 02 */ "String", /* 03 */ "Buffer", /* 04 */ "Package", - /* 05 */ "field_unit", + /* 05 */ "FieldUnit", /* 06 */ "Device", /* 07 */ "Event", /* 08 */ "Method", @@ -559,23 +562,24 @@ static const char *acpi_gbl_ns_type_names[] = { /* 11 */ "Power", /* 12 */ "Processor", /* 13 */ "Thermal", - /* 14 */ "buffer_field", - /* 15 */ "ddb_handle", - /* 16 */ "debug_object", - /* 17 */ "region_field", - /* 18 */ "bank_field", - /* 19 */ "index_field", + /* 14 */ "BufferField", + /* 15 */ "DdbHandle", + /* 16 */ "DebugObject", + /* 17 */ "RegionField", + /* 18 */ "BankField", + /* 19 */ "IndexField", /* 20 */ "Reference", /* 21 */ "Alias", - /* 22 */ "method_alias", + /* 22 */ "MethodAlias", /* 23 */ "Notify", - /* 24 */ "addr_handler", - /* 25 */ "resource_desc", - /* 26 */ "resource_fld", + /* 24 */ "AddrHandler", + /* 25 */ "ResourceDesc", + /* 26 */ "ResourceFld", /* 27 */ "Scope", /* 28 */ "Extra", /* 29 */ "Data", /* 30 */ "Invalid" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_type_name(acpi_object_type type) @@ -658,15 +662,16 @@ char *acpi_ut_get_node_name(void *object) /* Printable names of object descriptor types */ static const char *acpi_gbl_desc_type_names[] = { +/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ /* 00 */ "Invalid", /* 01 */ "Cached", /* 02 */ "State-Generic", /* 03 */ "State-Update", /* 04 */ "State-Package", /* 05 */ "State-Control", - /* 06 */ "State-root_parse_scope", - /* 07 */ "State-parse_scope", - /* 08 */ "State-walk_scope", + /* 06 */ "State-RootParseScope", + /* 07 */ "State-ParseScope", + /* 08 */ "State-WalkScope", /* 09 */ "State-Result", /* 10 */ "State-Notify", /* 11 */ "State-Thread", @@ -674,6 +679,7 @@ static const char *acpi_gbl_desc_type_names[] = { /* 13 */ "Parser", /* 14 */ "Operand", /* 15 */ "Node" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_descriptor_name(void *object) diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index b57afa7421e..e9058d4da12 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -43,6 +43,7 @@ #include #include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") @@ -788,6 +789,113 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) return ((u8) (0 - sum)); } +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_type + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: The Resource Type with no extraneous bits (except the + * Large/Small descriptor bit -- this is left alone) + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +u8 acpi_ut_get_resource_type(void *aml) +{ + ACPI_FUNCTION_ENTRY(); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Determine if this is a small or large resource + */ + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (*((u8 *) aml)); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte Length + * + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By + * definition, this does not include the size of the descriptor + * header or the length field itself. + * + ******************************************************************************/ + +u16 acpi_ut_get_resource_length(void *aml) +{ + u16 resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Determine if this is a small or large resource + */ + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = (u16) (*((u8 *) aml) & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + } + + return (resource_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_descriptor_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte length + * + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the + * length of the descriptor header and the length field itself. + * Used to walk descriptor lists. + * + ******************************************************************************/ + +u32 acpi_ut_get_descriptor_length(void *aml) +{ + u32 descriptor_length; + + ACPI_FUNCTION_ENTRY(); + + /* First get the Resource Length (Does not include header length) */ + + descriptor_length = acpi_ut_get_resource_length(aml); + + /* Determine if this is a small or large resource */ + + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + descriptor_length += sizeof(struct aml_resource_large_header); + } else { + descriptor_length += sizeof(struct aml_resource_small_header); + } + + return (descriptor_length); +} + /******************************************************************************* * * FUNCTION: acpi_ut_get_resource_end_tag @@ -796,42 +904,34 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * * RETURN: Pointer to the end tag * - * DESCRIPTION: Find the END_TAG resource descriptor in a resource template + * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template * ******************************************************************************/ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) { - u8 buffer_byte; - u8 *buffer; - u8 *end_buffer; - - buffer = obj_desc->buffer.pointer; - end_buffer = buffer + obj_desc->buffer.length; + u8 *aml; + u8 *end_aml; - while (buffer < end_buffer) { - buffer_byte = *buffer; - if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) { - /* Large Descriptor - Length is next 2 bytes */ + aml = obj_desc->buffer.pointer; + end_aml = aml + obj_desc->buffer.length; - buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); - } else { - /* Small Descriptor. End Tag will be found here */ + /* Walk the resource template, one descriptor per loop */ - if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) == - ACPI_RESOURCE_NAME_END_TAG) { - /* Found the end tag descriptor, all done. */ + while (aml < end_aml) { + if (acpi_ut_get_resource_type(aml) == + ACPI_RESOURCE_NAME_END_TAG) { + /* Found the end_tag descriptor, all done */ - return (buffer); - } + return (aml); + } - /* Length is in the header */ + /* Point to the next resource descriptor */ - buffer += ((buffer_byte & 0x07) + 1); - } + aml += acpi_ut_get_resource_length(aml); } - /* End tag not found */ + /* End tag was not found */ return (NULL); } diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index f4adebde615..b8b46ab54f4 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -401,7 +401,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, mem->align = p->alignment; mem->size = p->address_length; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -424,7 +424,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, mem->align = p->alignment; mem->size = p->address_length; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -446,7 +446,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, mem->size = p->address_length; mem->align = 0; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -734,7 +734,7 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, resource->type = ACPI_RESOURCE_TYPE_MEMORY24; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ - resource->data.memory24.read_write_attribute = + resource->data.memory24.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; resource->data.memory24.minimum = p->start; @@ -748,7 +748,7 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, { resource->type = ACPI_RESOURCE_TYPE_MEMORY32; resource->length = sizeof(struct acpi_resource); - resource->data.memory32.read_write_attribute = + resource->data.memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; resource->data.memory32.minimum = p->start; @@ -762,7 +762,7 @@ static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, { resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; resource->length = sizeof(struct acpi_resource); - resource->data.fixed_memory32.read_write_attribute = + resource->data.fixed_memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; resource->data.fixed_memory32.address = p->start; diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index cb59b018c84..7676afec09a 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20050930 +#define ACPI_CA_VERSION 0x20051021 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index b2921b869bb..99250ee1b9d 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -60,6 +60,7 @@ extern struct acpi_external_list *acpi_gbl_external_list; extern const char *acpi_gbl_io_decode[2]; extern const char *acpi_gbl_word_decode[4]; extern const char *acpi_gbl_consume_decode[2]; +extern const char *acpi_gbl_config_decode[4]; extern const char *acpi_gbl_min_decode[2]; extern const char *acpi_gbl_max_decode[2]; extern const char *acpi_gbl_DECdecode[2]; @@ -171,11 +172,19 @@ u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); /* * dmresrc */ +void acpi_dm_dump_integer8(u8 value, char *name); + +void acpi_dm_dump_integer16(u16 value, char *name); + +void acpi_dm_dump_integer32(u32 value, char *name); + +void acpi_dm_dump_integer64(u64 value, char *name); + void -acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, - u8 * byte_data, u32 byte_count); +acpi_dm_resource_template(struct acpi_op_walk_info *info, + u8 * byte_data, u32 byte_count); -u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); +u8 acpi_dm_is_resource_template(union acpi_parse_object *op); void acpi_dm_indent(u32 level); @@ -223,6 +232,8 @@ void acpi_dm_vendor_large_descriptor(union aml_resource *resource, u32 length, u32 level); +void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); + /* * dmresrcs */ diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 258cfe5e2aa..e42222c3d34 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -202,7 +202,7 @@ #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) -#ifdef ACPI_MISALIGNED_TRANSFERS +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED /* The hardware supports unaligned transfers, just do the little-endian move */ @@ -563,11 +563,11 @@ return (_s); }) #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ register u8 _s = (u8) (s); \ - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ return (_s); }) #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ register u32 _s = (u32) (s); \ - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ return (_s); }) #else /* Use original less-safe macros */ diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 98e0b8cd14e..58473f60755 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -108,9 +108,9 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle); void acpi_os_delete_lock(acpi_handle handle); -unsigned long acpi_os_acquire_lock(acpi_handle handle); +acpi_native_uint acpi_os_acquire_lock(acpi_handle handle); -void acpi_os_release_lock(acpi_handle handle, unsigned long flags); +void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags); /* * Memory allocation and mapping diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index b66994e9e4e..25cff0d5ba5 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -48,49 +48,133 @@ #include "amlresrc.h" +/* + * If possible, pack the following structures to byte alignment, since we + * don't care about performance for debug output + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) +#endif + +/* + * Individual entry for the resource conversion tables + */ +typedef const struct acpi_rsconvert_info { + u8 opcode; + u8 resource_offset; + u8 aml_offset; + u8 value; + +} acpi_rsconvert_info; + +/* Resource conversion opcodes */ + +#define ACPI_RSC_INITGET 0 +#define ACPI_RSC_INITSET 1 +#define ACPI_RSC_FLAGINIT 2 +#define ACPI_RSC_1BITFLAG 3 +#define ACPI_RSC_2BITFLAG 4 +#define ACPI_RSC_COUNT 5 +#define ACPI_RSC_COUNT16 6 +#define ACPI_RSC_LENGTH 7 +#define ACPI_RSC_MOVE8 8 +#define ACPI_RSC_MOVE16 9 +#define ACPI_RSC_MOVE32 10 +#define ACPI_RSC_MOVE64 11 +#define ACPI_RSC_SET8 12 +#define ACPI_RSC_DATA8 13 +#define ACPI_RSC_ADDRESS 14 +#define ACPI_RSC_SOURCE 15 +#define ACPI_RSC_SOURCEX 16 +#define ACPI_RSC_BITMASK 17 +#define ACPI_RSC_BITMASK16 18 +#define ACPI_RSC_EXIT_NE 19 +#define ACPI_RSC_EXIT_LE 20 + +/* Resource Conversion sub-opcodes */ + +#define ACPI_RSC_COMPARE_AML_LENGTH 0 +#define ACPI_RSC_COMPARE_VALUE 1 + +#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info)) + +#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) +#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) + /* * Resource dispatch and info tables */ -struct acpi_resource_info { +typedef const struct acpi_resource_info { u8 length_type; u8 minimum_aml_resource_length; u8 minimum_internal_struct_length; -}; + +} acpi_resource_info; /* Types for length_type above */ -#define ACPI_FIXED_LENGTH 0 -#define ACPI_VARIABLE_LENGTH 1 -#define ACPI_SMALL_VARIABLE_LENGTH 2 +#define ACPI_FIXED_LENGTH 0 +#define ACPI_VARIABLE_LENGTH 1 +#define ACPI_SMALL_VARIABLE_LENGTH 2 + +typedef const struct acpi_rsdump_info { + u8 opcode; + u8 offset; + char *name; + const void *pointer; -/* Handlers */ +} acpi_rsdump_info; -typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * - resource, - union aml_resource * aml); +/* Values for the Opcode field above */ -typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, - u16 aml_resource_length, - struct acpi_resource * - resource); +#define ACPI_RSD_TITLE 0 +#define ACPI_RSD_LITERAL 1 +#define ACPI_RSD_STRING 2 +#define ACPI_RSD_UINT8 3 +#define ACPI_RSD_UINT16 4 +#define ACPI_RSD_UINT32 5 +#define ACPI_RSD_UINT64 6 +#define ACPI_RSD_1BITFLAG 7 +#define ACPI_RSD_2BITFLAG 8 +#define ACPI_RSD_SHORTLIST 9 +#define ACPI_RSD_LONGLIST 10 +#define ACPI_RSD_DWORDLIST 11 +#define ACPI_RSD_ADDRESS 12 +#define ACPI_RSD_SOURCE 13 -typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); +/* restore default alignment */ -/* Tables indexed by internal resource type */ +#pragma pack() -extern u8 acpi_gbl_aml_resource_sizes[]; -extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[]; -extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[]; +/* Resource tables indexed by internal resource type */ -/* Tables indexed by raw AML resource descriptor type */ +extern const u8 acpi_gbl_aml_resource_sizes[]; +extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; + +/* Resource tables indexed by raw AML resource descriptor type */ extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; -extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; -extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; +extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[]; +extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[]; + +/* + * rscreate + */ +acpi_status +acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, + struct acpi_buffer *output_buffer); + +acpi_status +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer); + +acpi_status +acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, + struct acpi_buffer *output_buffer); /* - * Function prototypes called from Acpi* APIs + * rsutils */ acpi_status acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); @@ -110,27 +194,6 @@ acpi_rs_get_method_data(acpi_handle handle, acpi_status acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); -acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, - struct acpi_buffer *output_buffer); - -acpi_status -acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer); - -acpi_status -acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, - struct acpi_buffer *output_buffer); - -/* - * rsdump - */ -#ifdef ACPI_FUTURE_USAGE -void acpi_rs_dump_resource_list(struct acpi_resource *resource); - -void acpi_rs_dump_irq_list(u8 * route_table); -#endif /* ACPI_FUTURE_USAGE */ - /* * rscalc */ @@ -154,145 +217,29 @@ acpi_status acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_size aml_size_needed, u8 * output_buffer); -/* - * rsio - */ -acpi_status -acpi_rs_get_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_fixed_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_dma(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml); - -/* - * rsirq - */ -acpi_status -acpi_rs_get_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_ext_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml); - /* * rsaddr */ -acpi_status -acpi_rs_get_address16(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_address32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_address64(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_ext_address64(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource); - -acpi_status -acpi_rs_set_ext_address64(struct acpi_resource *resource, - union aml_resource *aml); - -/* - * rsmemory - */ -acpi_status -acpi_rs_get_memory24(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_memory32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_fixed_memory32(union aml_resource *aml, - u16 aml_resource_length, +void +acpi_rs_set_address_common(union aml_resource *aml, struct acpi_resource *resource); -acpi_status -acpi_rs_set_fixed_memory32(struct acpi_resource *resource, +u8 +acpi_rs_get_address_common(struct acpi_resource *resource, union aml_resource *aml); /* * rsmisc */ acpi_status -acpi_rs_get_generic_reg(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource); - -acpi_status -acpi_rs_set_generic_reg(struct acpi_resource *resource, - union aml_resource *aml); - -acpi_status -acpi_rs_get_vendor(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_start_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_end_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml); +acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info); acpi_status -acpi_rs_get_end_tag(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml); +acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info); /* * rsutils @@ -301,74 +248,94 @@ void acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type); -/* Types used in move_type above */ +u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); -#define ACPI_MOVE_TYPE_16_TO_32 0 -#define ACPI_MOVE_TYPE_32_TO_16 1 -#define ACPI_MOVE_TYPE_32_TO_32 2 -#define ACPI_MOVE_TYPE_64_TO_64 3 +u16 acpi_rs_encode_bitmask(u8 * list, u8 count); -u16 -acpi_rs_get_resource_source(u16 resource_length, - acpi_size minimum_length, +acpi_rs_length +acpi_rs_get_resource_source(acpi_rs_length resource_length, + acpi_rs_length minimum_length, struct acpi_resource_source *resource_source, union aml_resource *aml, char *string_ptr); -acpi_size +acpi_rsdesc_size acpi_rs_set_resource_source(union aml_resource *aml, - acpi_size minimum_length, + acpi_rs_length minimum_length, struct acpi_resource_source *resource_source); -u8 acpi_rs_get_resource_type(u8 resource_start_byte); - -u32 acpi_rs_get_descriptor_length(union aml_resource *aml); - -u16 acpi_rs_get_resource_length(union aml_resource *aml); - void acpi_rs_set_resource_header(u8 descriptor_type, - acpi_size total_length, union aml_resource *aml); + acpi_rsdesc_size total_length, + union aml_resource *aml); + +void +acpi_rs_set_resource_length(acpi_rsdesc_size total_length, + union aml_resource *aml); struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* * rsdump */ -void acpi_rs_dump_irq(union acpi_resource_data *resource); - -void acpi_rs_dump_address16(union acpi_resource_data *resource); - -void acpi_rs_dump_address32(union acpi_resource_data *resource); - -void acpi_rs_dump_address64(union acpi_resource_data *resource); - -void acpi_rs_dump_ext_address64(union acpi_resource_data *resource); - -void acpi_rs_dump_dma(union acpi_resource_data *resource); - -void acpi_rs_dump_io(union acpi_resource_data *resource); - -void acpi_rs_dump_ext_irq(union acpi_resource_data *resource); - -void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); - -void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); - -void acpi_rs_dump_memory24(union acpi_resource_data *resource); - -void acpi_rs_dump_memory32(union acpi_resource_data *resource); - -void acpi_rs_dump_start_dpf(union acpi_resource_data *resource); - -void acpi_rs_dump_vendor(union acpi_resource_data *resource); +void acpi_rs_dump_resource_list(struct acpi_resource *resource); -void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); +void acpi_rs_dump_irq_list(u8 * route_table); -void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); +/* + * Resource conversion tables + */ +extern struct acpi_rsconvert_info acpi_rs_convert_dma[]; +extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[]; +extern struct acpi_rsconvert_info acpi_rs_convert_io[]; +extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[]; +extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[]; +extern struct acpi_rsconvert_info acpi_rs_convert_memory24[]; +extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[]; +extern struct acpi_rsconvert_info acpi_rs_convert_memory32[]; +extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[]; +extern struct acpi_rsconvert_info acpi_rs_convert_address32[]; +extern struct acpi_rsconvert_info acpi_rs_convert_address16[]; +extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; +extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; +extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; + +/* These resources require separate get/set tables */ + +extern struct acpi_rsconvert_info acpi_rs_get_irq[]; +extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[]; +extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[]; +extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[]; + +extern struct acpi_rsconvert_info acpi_rs_set_irq[]; +extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[]; +extern struct acpi_rsconvert_info acpi_rs_set_vendor[]; -void acpi_rs_dump_end_tag(union acpi_resource_data *resource); +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +/* + * rsinfo + */ +extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; +/* + * rsdump + */ +extern struct acpi_rsdump_info acpi_rs_dump_irq[]; +extern struct acpi_rsdump_info acpi_rs_dump_dma[]; +extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; +extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; +extern struct acpi_rsdump_info acpi_rs_dump_io[]; +extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; +extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; +extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; +extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; +extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; +extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; +extern struct acpi_rsdump_info acpi_rs_dump_address16[]; +extern struct acpi_rsdump_info acpi_rs_dump_address32[]; +extern struct acpi_rsdump_info acpi_rs_dump_address64[]; +extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; +extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; +extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; #endif #endif /* __ACRESRC_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 43f7c509317..29b887017b1 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -83,10 +83,11 @@ typedef COMPILER_DEPENDENT_UINT64 u64; * UINT32 32-bit (4 byte) unsigned value * INT64 64-bit (8 byte) signed value * UINT64 64-bit (8 byte) unsigned value - * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value - * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value + * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value */ +typedef unsigned long acpi_native_uint; + #ifndef ACPI_MACHINE_WIDTH #error ACPI_MACHINE_WIDTH not defined #endif @@ -108,9 +109,6 @@ typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s64 acpi_native_int; -typedef u64 acpi_native_uint; - typedef u64 acpi_table_ptr; typedef u64 acpi_io_address; typedef u64 acpi_physical_address; @@ -121,9 +119,22 @@ typedef u64 acpi_size; #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX +/* + * In the case of the Itanium Processor Family (IPF), the hardware does not + * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag + * to indicate that special precautions must be taken to avoid alignment faults. + * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) + * + * Note: Em64_t and other X86-64 processors do support misaligned transfers, + * so there is no need to define this flag. + */ +#if defined (__IA64__) || defined (__ia64__) +#define ACPI_MISALIGNMENT_NOT_SUPPORTED +#endif + #elif ACPI_MACHINE_WIDTH == 16 -/*! [Begin] no source code translation (keep the typedefs) */ +/*! [Begin] no source code translation (keep the typedefs as-is) */ /* * 16-bit type definitions @@ -142,16 +153,12 @@ struct { /*! [End] no source code translation !*/ -typedef u16 acpi_native_uint; -typedef s16 acpi_native_int; - typedef u32 acpi_table_ptr; typedef u32 acpi_io_address; typedef char *acpi_physical_address; typedef u16 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 -#define ACPI_MISALIGNED_TRANSFERS #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX @@ -179,16 +186,12 @@ typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s32 acpi_native_int; -typedef u32 acpi_native_uint; - typedef u64 acpi_table_ptr; typedef u32 acpi_io_address; typedef u64 acpi_physical_address; typedef u32 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 -#define ACPI_MISALIGNED_TRANSFERS #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX @@ -895,6 +898,8 @@ struct acpi_mem_space_context { /* * Definitions for Resource Attributes */ +typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ +typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ /* * Memory Attributes @@ -927,8 +932,8 @@ struct acpi_mem_space_context { /* * IRQ Attributes */ -#define ACPI_EDGE_SENSITIVE (u8) 0x00 -#define ACPI_LEVEL_SENSITIVE (u8) 0x01 +#define ACPI_LEVEL_SENSITIVE (u8) 0x00 +#define ACPI_EDGE_SENSITIVE (u8) 0x01 #define ACPI_ACTIVE_HIGH (u8) 0x00 #define ACPI_ACTIVE_LOW (u8) 0x01 @@ -974,28 +979,35 @@ struct acpi_mem_space_context { #define ACPI_PRODUCER (u8) 0x00 #define ACPI_CONSUMER (u8) 0x01 +/* + * If possible, pack the following structures to byte alignment + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) +#endif + /* * Structures used to describe device resources */ struct acpi_resource_irq { - u32 triggering; - u32 polarity; - u32 sharable; - u32 interrupt_count; - u32 interrupts[1]; + u8 triggering; + u8 polarity; + u8 sharable; + u8 interrupt_count; + u8 interrupts[1]; }; struct acpi_resource_dma { - u32 type; - u32 bus_master; - u32 transfer; - u32 channel_count; - u32 channels[1]; + u8 type; + u8 bus_master; + u8 transfer; + u8 channel_count; + u8 channels[1]; }; struct acpi_resource_start_dependent { - u32 compatibility_priority; - u32 performance_robustness; + u8 compatibility_priority; + u8 performance_robustness; }; /* @@ -1004,20 +1016,20 @@ struct acpi_resource_start_dependent { */ struct acpi_resource_io { - u32 io_decode; - u32 minimum; - u32 maximum; - u32 alignment; - u32 address_length; + u8 io_decode; + u8 alignment; + u8 address_length; + u16 minimum; + u16 maximum; }; struct acpi_resource_fixed_io { - u32 address; - u32 address_length; + u16 address; + u8 address_length; }; struct acpi_resource_vendor { - u32 byte_length; + u16 byte_length; u8 byte_data[1]; }; @@ -1026,15 +1038,15 @@ struct acpi_resource_end_tag { }; struct acpi_resource_memory24 { - u32 read_write_attribute; - u32 minimum; - u32 maximum; - u32 alignment; - u32 address_length; + u8 write_protect; + u16 minimum; + u16 maximum; + u16 alignment; + u16 address_length; }; struct acpi_resource_memory32 { - u32 read_write_attribute; + u8 write_protect; u32 minimum; u32 maximum; u32 alignment; @@ -1042,57 +1054,59 @@ struct acpi_resource_memory32 { }; struct acpi_resource_fixed_memory32 { - u32 read_write_attribute; + u8 write_protect; u32 address; u32 address_length; }; struct acpi_memory_attribute { - u16 cache_attribute; - u16 read_write_attribute; + u8 write_protect; + u8 caching; + u8 range_type; + u8 translation; }; struct acpi_io_attribute { - u16 range_attribute; - u16 translation_attribute; -}; - -struct acpi_bus_attribute { - u16 reserved1; - u16 reserved2; + u8 range_type; + u8 translation; + u8 translation_type; + u8 reserved1; }; union acpi_resource_attribute { - struct acpi_memory_attribute memory; + struct acpi_memory_attribute mem; struct acpi_io_attribute io; - struct acpi_bus_attribute bus; + + /* Used for the *word_space macros */ + + u8 type_specific; }; struct acpi_resource_source { - u32 index; - u32 string_length; + u8 index; + u16 string_length; char *string_ptr; }; /* Fields common to all address descriptors, 16/32/64 bit */ #define ACPI_RESOURCE_ADDRESS_COMMON \ - u32 resource_type; \ - u32 producer_consumer; \ - u32 decode; \ - u32 min_address_fixed; \ - u32 max_address_fixed; \ - union acpi_resource_attribute attribute; + u8 resource_type; \ + u8 producer_consumer; \ + u8 decode; \ + u8 min_address_fixed; \ + u8 max_address_fixed; \ + union acpi_resource_attribute info; struct acpi_resource_address { ACPI_RESOURCE_ADDRESS_COMMON}; struct acpi_resource_address16 { - ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 minimum; - u32 maximum; - u32 translation_offset; - u32 address_length; + ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; + u16 minimum; + u16 maximum; + u16 translation_offset; + u16 address_length; struct acpi_resource_source resource_source; }; @@ -1115,30 +1129,30 @@ struct acpi_resource_address64 { }; struct acpi_resource_extended_address64 { - ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; + ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; + u64 granularity; u64 minimum; u64 maximum; u64 translation_offset; u64 address_length; - u64 type_specific_attributes; - u8 revision_iD; + u64 type_specific; }; struct acpi_resource_extended_irq { - u32 producer_consumer; - u32 triggering; - u32 polarity; - u32 sharable; - u32 interrupt_count; + u8 producer_consumer; + u8 triggering; + u8 polarity; + u8 sharable; + u8 interrupt_count; struct acpi_resource_source resource_source; u32 interrupts[1]; }; struct acpi_resource_generic_register { - u32 space_id; - u32 bit_width; - u32 bit_offset; - u32 access_size; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; u64 address; }; @@ -1192,14 +1206,17 @@ struct acpi_resource { union acpi_resource_data data; }; -#define ACPI_RESOURCE_LENGTH 12 -#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ +/* restore default alignment */ + +#pragma pack() -#define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) +#define ACPI_RS_SIZE_MIN 12 +#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ +#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) -#ifdef ACPI_MISALIGNED_TRANSFERS +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) #else #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index c1086452696..7386eb81bd2 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -159,7 +159,6 @@ extern const u8 _acpi_ctype[]; #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) -#define ACPI_IS_ASCII(c) ((c) < 0x80) #endif /* ACPI_USE_SYSTEM_CLIBRARY */ @@ -419,6 +418,12 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); #define ACPI_ANY_BASE 0 +u32 acpi_ut_get_descriptor_length(void *aml); + +u16 acpi_ut_get_resource_length(void *aml); + +u8 acpi_ut_get_resource_type(void *aml); + u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 103aff07db1..3112be52773 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -134,7 +134,7 @@ struct aml_resource_end_dependent { AML_RESOURCE_SMALL_HEADER_COMMON}; struct aml_resource_io { - AML_RESOURCE_SMALL_HEADER_COMMON u8 information; + AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; u16 minimum; u16 maximum; u8 alignment; @@ -164,7 +164,7 @@ struct aml_resource_large_header { AML_RESOURCE_LARGE_HEADER_COMMON}; struct aml_resource_memory24 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u16 minimum; u16 maximum; u16 alignment; @@ -175,7 +175,7 @@ struct aml_resource_vendor_large { AML_RESOURCE_LARGE_HEADER_COMMON}; struct aml_resource_memory32 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u32 minimum; u32 maximum; u32 alignment; @@ -183,7 +183,7 @@ struct aml_resource_memory32 { }; struct aml_resource_fixed_memory32 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u32 address; u32 address_length; }; @@ -205,7 +205,7 @@ struct aml_resource_extended_address64 { u64 maximum; u64 translation_offset; u64 address_length; - u64 type_specific_attributes; + u64 type_specific; }; #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ @@ -239,8 +239,8 @@ struct aml_resource_address16 { struct aml_resource_extended_irq { AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; - u8 table_length; - u32 interrupt_number[1]; + u8 interrupt_count; + u32 interrupts[1]; /* res_source_index, res_source optional fields follow */ }; diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 08539125696..53aa997f05f 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -206,6 +206,8 @@ * *****************************************************************************/ +#define ACPI_IS_ASCII(c) ((c) < 0x80) + #ifdef ACPI_USE_SYSTEM_CLIBRARY /* * Use the standard C library headers. @@ -235,7 +237,7 @@ #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) -#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) @@ -247,7 +249,6 @@ #define ACPI_IS_UPPER(i) isupper((int) (i)) #define ACPI_IS_PRINT(i) isprint((int) (i)) #define ACPI_IS_ALPHA(i) isalpha((int) (i)) -#define ACPI_IS_ASCII(i) isascii((int) (i)) #else @@ -274,8 +275,8 @@ typedef char *va_list; /* * Storage alignment properties */ -#define _AUPBND (sizeof (acpi_native_int) - 1) -#define _ADNBND (sizeof (acpi_native_int) - 1) +#define _AUPBND (sizeof (acpi_native_uint) - 1) +#define _ADNBND (sizeof (acpi_native_uint) - 1) /* * Variable argument list macro definitions @@ -297,7 +298,7 @@ typedef char *va_list; #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) -#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) #define ACPI_TOUPPER acpi_ut_to_upper -- cgit v1.2.3 From 96db255c8f014ae3497507104e8df809785a619f Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Wed, 2 Nov 2005 00:00:00 -0500 Subject: [ACPI] ACPICA 20051102 Modified the subsystem initialization sequence to improve GPE support. The GPE initialization has been split into two parts in order to defer execution of the _PRW methods (Power Resources for Wake) until after the hardware is fully initialized and the SCI handler is installed. This allows the _PRW methods to access fields protected by the Global Lock. This will fix systems where a NO_GLOBAL_LOCK exception has been seen during initialization. Fixed a regression with the ConcatenateResTemplate() ASL operator introduced in the 20051021 release. Implemented support for "local" internal ACPI object types within the debugger "Object" command and the acpi_walk_namespace() external interfaces. These local types include RegionFields, BankFields, IndexFields, Alias, and reference objects. Moved common AML resource handling code into a new file, "utresrc.c". This code is shared by both the Resource Manager and the AML Debugger. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/events/evevent.c | 42 +++ drivers/acpi/events/evgpeblk.c | 159 +++++---- drivers/acpi/events/evxfevnt.c | 7 + drivers/acpi/executer/exdump.c | 656 +++++++++++++++++++++++--------------- drivers/acpi/executer/exmisc.c | 47 ++- drivers/acpi/namespace/nsxfeval.c | 2 +- drivers/acpi/resources/rscalc.c | 253 +++++++-------- drivers/acpi/resources/rsdump.c | 70 ++-- drivers/acpi/resources/rsinfo.c | 97 +++--- drivers/acpi/resources/rslist.c | 195 ++--------- drivers/acpi/resources/rsutils.c | 88 ++--- drivers/acpi/utilities/Makefile | 5 +- drivers/acpi/utilities/utmisc.c | 148 --------- drivers/acpi/utilities/utresrc.c | 428 +++++++++++++++++++++++++ drivers/acpi/utilities/utstate.c | 2 +- drivers/acpi/utilities/utxface.c | 52 ++- include/acpi/acconfig.h | 2 +- include/acpi/acevents.h | 6 + include/acpi/acinterp.h | 46 ++- include/acpi/acresrc.h | 27 +- include/acpi/acutils.h | 17 +- include/acpi/amlresrc.h | 5 + 22 files changed, 1368 insertions(+), 986 deletions(-) create mode 100644 drivers/acpi/utilities/utresrc.c diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 842d1e3fb37..9522c643b88 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c @@ -98,6 +98,48 @@ acpi_status acpi_ev_initialize_events(void) return_ACPI_STATUS(status); } +/******************************************************************************* + * + * FUNCTION: acpi_ev_install_fadt_gpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks + * (0 and 1). This causes the _PRW methods to be run, so the HW + * must be fully initialized at this point, including global lock + * support. + * + ******************************************************************************/ + +acpi_status acpi_ev_install_fadt_gpes(void) +{ + acpi_status status; + + ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); + + /* Namespace must be locked */ + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return (status); + } + + /* FADT GPE Block 0 */ + + (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, + acpi_gbl_gpe_fadt_blocks[0]); + + /* FADT GPE Block 1 */ + + (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, + acpi_gbl_gpe_fadt_blocks[1]); + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(AE_OK); +} + /******************************************************************************* * * FUNCTION: acpi_ev_install_xrupt_handlers diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 7ca10c5f291..8efca2eac27 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -78,7 +78,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block); * * RETURN: TRUE if the gpe_event is valid * - * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. + * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. * Should be called only when the GPE lists are semaphore locked * and not subject to change. * @@ -264,7 +264,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, * 2) Edge/Level determination is based on the 2nd character * of the method name * - * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE + * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE * if a _PRW object is found that points to this GPE. */ switch (name[1]) { @@ -313,14 +313,14 @@ acpi_ev_save_method_info(acpi_handle obj_handle, /* * Now we can add this information to the gpe_event_info block - * for use during dispatch of this GPE. Default type is RUNTIME, although + * for use during dispatch of this GPE. Default type is RUNTIME, although * this may change when the _PRW methods are executed later. */ gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; - gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | - ACPI_GPE_TYPE_RUNTIME); + gpe_event_info->flags = (u8) + (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); gpe_event_info->dispatch.method_node = (struct acpi_namespace_node *)obj_handle; @@ -341,11 +341,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle, * * PARAMETERS: Callback from walk_namespace * - * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is + * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is * not aborted on a single _PRW failure. * * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a - * Device. Run the _PRW method. If present, extract the GPE + * Device. Run the _PRW method. If present, extract the GPE * number and mark the GPE as a WAKE GPE. * ******************************************************************************/ @@ -443,6 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, gpe_event_info->flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); + status = acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); if (ACPI_FAILURE(status)) { @@ -466,7 +467,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, * * RETURN: A GPE interrupt block * - * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt + * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt * block per unique interrupt level used for GPEs. * Should be called only when the GPE lists are semaphore locked * and not subject to change. @@ -566,8 +567,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) /* Disable this interrupt */ - status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, - acpi_ev_gpe_xrupt_handler); + status = + acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, + acpi_ev_gpe_xrupt_handler); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -750,7 +752,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) /* * Allocate the GPE event_info block. There are eight distinct GPEs - * per register. Initialization to zeros is sufficient. + * per register. Initialization to zeros is sufficient. */ gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> register_count * @@ -769,9 +771,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) gpe_block->event_info = gpe_event_info; /* - * Initialize the GPE Register and Event structures. A goal of these + * Initialize the GPE Register and Event structures. A goal of these * tables is to hide the fact that there are two separate GPE register sets - * in a given gpe hardware block, the status registers occupy the first half, + * in a given GPE hardware block, the status registers occupy the first half, * and the enable registers occupy the second half. */ this_register = gpe_register_info; @@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) this_event++; } - /* - * Clear the status/enable registers. Note that status registers - * are cleared by writing a '1', while enable registers are cleared - * by writing a '0'. - */ + /* Disable all GPEs within this register */ + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, &this_register-> enable_address); @@ -824,6 +823,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) goto error_exit; } + /* Clear any pending GPE events within this register */ + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, &this_register-> status_address); @@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) * * RETURN: Status * - * DESCRIPTION: Create and Install a block of GPE registers + * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within + * the block are disabled at exit. + * Note: Assumes namespace is locked. * ******************************************************************************/ @@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block) { - struct acpi_gpe_block_info *gpe_block; - struct acpi_gpe_event_info *gpe_event_info; - acpi_native_uint i; - acpi_native_uint j; - u32 wake_gpe_count; - u32 gpe_enabled_count; acpi_status status; - struct acpi_gpe_walk_info gpe_info; + struct acpi_gpe_block_info *gpe_block; ACPI_FUNCTION_TRACE("ev_create_gpe_block"); @@ -896,22 +893,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, /* Initialize the new GPE block */ + gpe_block->node = gpe_device; gpe_block->register_count = register_count; gpe_block->block_base_number = gpe_block_base_number; - gpe_block->node = gpe_device; ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, sizeof(struct acpi_generic_address)); - /* Create the register_info and event_info sub-structures */ - + /* + * Create the register_info and event_info sub-structures + * Note: disables and clears all GPEs in the block + */ status = acpi_ev_create_gpe_info_blocks(gpe_block); if (ACPI_FAILURE(status)) { ACPI_MEM_FREE(gpe_block); return_ACPI_STATUS(status); } - /* Install the new block in the global list(s) */ + /* Install the new block in the global lists */ status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); if (ACPI_FAILURE(status)) { @@ -926,16 +925,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, acpi_ev_save_method_info, gpe_block, NULL); + /* Return the new block */ + + if (return_gpe_block) { + (*return_gpe_block) = gpe_block; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", + (u32) gpe_block->block_base_number, + (u32) (gpe_block->block_base_number + + ((gpe_block->register_count * + ACPI_GPE_REGISTER_WIDTH) - 1)), + gpe_device->name.ascii, gpe_block->register_count, + interrupt_number)); + + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ev_initialize_gpe_block + * + * PARAMETERS: gpe_device - Handle to the parent GPE block + * gpe_block - Gpe Block info + * + * RETURN: Status + * + * DESCRIPTION: Initialize and enable a GPE block. First find and run any + * _PRT methods associated with the block, then enable the + * appropriate GPEs. + * Note: Assumes namespace is locked. + * + ******************************************************************************/ + +acpi_status +acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, + struct acpi_gpe_block_info *gpe_block) +{ + acpi_status status; + struct acpi_gpe_event_info *gpe_event_info; + struct acpi_gpe_walk_info gpe_info; + u32 wake_gpe_count; + u32 gpe_enabled_count; + acpi_native_uint i; + acpi_native_uint j; + + ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); + + /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ + + if (!gpe_block) { + return_ACPI_STATUS(AE_OK); + } + /* - * Runtime option: Should Wake GPEs be enabled at runtime? The default - * is No, they should only be enabled just as the machine goes to sleep. + * Runtime option: Should wake GPEs be enabled at runtime? The default + * is no, they should only be enabled just as the machine goes to sleep. */ if (acpi_gbl_leave_wake_gpes_disabled) { /* - * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. - * (Each GPE that has one or more _PRWs that reference it is by - * definition a WAKE GPE and will not be enabled while the machine - * is running.) + * Differentiate runtime vs wake GPEs, via the _PRW control methods. + * Each GPE that has one or more _PRWs that reference it is by + * definition a wake GPE and will not be enabled while the machine + * is running. */ gpe_info.gpe_block = gpe_block; gpe_info.gpe_device = gpe_device; @@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, } /* - * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, - * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must - * be enabled via the acpi_enable_gpe() external interface. + * Enable all GPEs in this block that have these attributes: + * 1) are "runtime" or "run/wake" GPEs, and + * 2) have a corresponding _Lxx or _Exx method + * + * Any other GPEs within this block must be enabled via the acpi_enable_gpe() + * external interface. */ wake_gpe_count = 0; gpe_enabled_count = 0; @@ -976,32 +1032,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, } } - /* Dump info about this GPE block */ - - ACPI_DEBUG_PRINT((ACPI_DB_INIT, - "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", - (u32) gpe_block->block_base_number, - (u32) (gpe_block->block_base_number + - ((gpe_block->register_count * - ACPI_GPE_REGISTER_WIDTH) - 1)), - gpe_device->name.ascii, gpe_block->register_count, - interrupt_number)); - - /* Enable all valid GPEs found above */ - - status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); - ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Found %u Wake, Enabled %u Runtime GPEs in this block\n", wake_gpe_count, gpe_enabled_count)); - /* Return the new block */ + /* Enable all valid runtime GPEs found above */ - if (return_gpe_block) { - (*return_gpe_block) = gpe_block; + status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not enable GPEs in gpe_block %p\n", + gpe_block)); } - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(status); } /******************************************************************************* diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 887ff9f28a0..c1b89892825 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -626,6 +626,13 @@ acpi_install_gpe_block(acpi_handle gpe_device, goto unlock_and_exit; } + /* Run the _PRW methods and enable the GPEs */ + + status = acpi_ev_initialize_gpe_block(node, gpe_block); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + /* Get the device_object attached to the node */ obj_desc = acpi_ns_get_attached_object(node); diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 4477a62fed5..5a4cca171af 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -55,20 +55,386 @@ ACPI_MODULE_NAME("exdump") */ #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* Local prototypes */ -#ifdef ACPI_FUTURE_USAGE static void acpi_ex_out_string(char *title, char *value); static void acpi_ex_out_pointer(char *title, void *value); -static void acpi_ex_out_integer(char *title, u32 value); - static void acpi_ex_out_address(char *title, acpi_physical_address value); -static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); +static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); static void -acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); -#endif /* ACPI_FUTURE_USAGE */ +acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, + u32 level, u32 index); + +/******************************************************************************* + * + * Object Descriptor info tables + * + * Note: The first table entry must be an INIT opcode and must contain + * the table length (number of table entries) + * + ******************************************************************************/ + +static struct acpi_exdump_info acpi_ex_dump_integer[2] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL}, + {ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"} +}; + +static struct acpi_exdump_info acpi_ex_dump_string[4] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"}, + {ACPI_EXD_STRING, 0, NULL} +}; + +static struct acpi_exdump_info acpi_ex_dump_buffer[4] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"}, + {ACPI_EXD_BUFFER, 0, NULL} +}; + +static struct acpi_exdump_info acpi_ex_dump_package[5] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"}, + {ACPI_EXD_PACKAGE, 0, NULL} +}; + +static struct acpi_exdump_info acpi_ex_dump_device[4] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify), + "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.device_notify), + "Device Notify"} +}; + +static struct acpi_exdump_info acpi_ex_dump_event[2] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} +}; + +static struct acpi_exdump_info acpi_ex_dump_method[7] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} +}; + +static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, + {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), + "Acquire Depth"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"} +}; + +static struct acpi_exdump_info acpi_ex_dump_region[7] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"}, + {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"} +}; + +static struct acpi_exdump_info acpi_ex_dump_power[5] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level), + "System Level"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order), + "Resource Order"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify), + "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify), + "Device Notify"} +}; + +static struct acpi_exdump_info acpi_ex_dump_processor[7] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"}, + {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify), + "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify), + "Device Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"} +}; + +static struct acpi_exdump_info acpi_ex_dump_thermal[4] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify), + "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify), + "Device Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"} +}; + +static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL}, + {ACPI_EXD_FIELD, 0, NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj), + "Buffer Object"} +}; + +static struct acpi_exdump_info acpi_ex_dump_region_field[3] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL}, + {ACPI_EXD_FIELD, 0, NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"} +}; + +static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, + {ACPI_EXD_FIELD, 0, NULL}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj), + "Region Object"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"} +}; + +static struct acpi_exdump_info acpi_ex_dump_index_field[5] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, + {ACPI_EXD_FIELD, 0, NULL}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj), + "Index Object"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} +}; + +static struct acpi_exdump_info acpi_ex_dump_reference[7] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, + {ACPI_EXD_REFERENCE, 0, NULL} +}; + +static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler), + NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list), + "Region List"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} +}; + +static struct acpi_exdump_info acpi_ex_dump_notify[3] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"} +}; + +/* Miscellaneous tables */ + +static struct acpi_exdump_info acpi_ex_dump_common[4] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL}, + {ACPI_EXD_TYPE, 0, NULL}, + {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count), + "Reference Count"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"} +}; + +static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags), + "Field Flags"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width), + "Access Byte Width"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length), + "Bit Length"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset), + "Field Bit Offset"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset), + "Base Byte Offset"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} +}; + +static struct acpi_exdump_info acpi_ex_dump_node[6] = { + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, + {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, + {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), + "Reference Count"}, + {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, + {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} +}; + +/* Dispatch table, indexed by object type */ + +static struct acpi_exdump_info *acpi_ex_dump_info[] = { + NULL, + acpi_ex_dump_integer, + acpi_ex_dump_string, + acpi_ex_dump_buffer, + acpi_ex_dump_package, + NULL, + acpi_ex_dump_device, + acpi_ex_dump_event, + acpi_ex_dump_method, + acpi_ex_dump_mutex, + acpi_ex_dump_region, + acpi_ex_dump_power, + acpi_ex_dump_processor, + acpi_ex_dump_thermal, + acpi_ex_dump_buffer_field, + NULL, + NULL, + acpi_ex_dump_region_field, + acpi_ex_dump_bank_field, + acpi_ex_dump_index_field, + acpi_ex_dump_reference, + NULL, + NULL, + acpi_ex_dump_notify, + acpi_ex_dump_address_handler, + NULL, + NULL, + NULL +}; + +/******************************************************************************* + * + * FUNCTION: acpi_ex_dump_object + * + * PARAMETERS: obj_desc - Descriptor to dump + * Info - Info table corresponding to this object + * type + * + * RETURN: None + * + * DESCRIPTION: Walk the info table for this object + * + ******************************************************************************/ + +static void +acpi_ex_dump_object(union acpi_operand_object *obj_desc, + struct acpi_exdump_info *info) +{ + u8 *target; + char *name; + u8 count; + + if (!info) { + acpi_os_printf + ("ex_dump_object: Display not implemented for object type %s\n", + acpi_ut_get_object_type_name(obj_desc)); + return; + } + + /* First table entry must contain the table length (# of table entries) */ + + count = info->offset; + + while (count) { + target = ((u8 *) obj_desc) + info->offset; + name = info->name; + + switch (info->opcode) { + case ACPI_EXD_INIT: + break; + + case ACPI_EXD_TYPE: + acpi_ex_out_string("Type", + acpi_ut_get_object_type_name + (obj_desc)); + break; + + case ACPI_EXD_UINT8: + + acpi_os_printf("%20s : %2.2X\n", name, *target); + break; + + case ACPI_EXD_UINT16: + + acpi_os_printf("%20s : %4.4X\n", name, + *ACPI_CAST_PTR(u16, target)); + break; + + case ACPI_EXD_UINT32: + + acpi_os_printf("%20s : %8.8X\n", name, + *ACPI_CAST_PTR(u32, target)); + break; + + case ACPI_EXD_UINT64: + + acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", + ACPI_FORMAT_UINT64(*ACPI_CAST_PTR + (u64, target))); + break; + + case ACPI_EXD_POINTER: + + acpi_ex_out_pointer(name, + *ACPI_CAST_PTR(void *, target)); + break; + + case ACPI_EXD_ADDRESS: + + acpi_ex_out_address(name, + *ACPI_CAST_PTR + (acpi_physical_address, target)); + break; + + case ACPI_EXD_STRING: + + acpi_ut_print_string(obj_desc->string.pointer, + ACPI_UINT8_MAX); + acpi_os_printf("\n"); + break; + + case ACPI_EXD_BUFFER: + + ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, + obj_desc->buffer.length); + break; + + case ACPI_EXD_PACKAGE: + + /* Dump the package contents */ + + acpi_os_printf("\nPackage Contents:\n"); + acpi_ex_dump_package_obj(obj_desc, 0, 0); + break; + + case ACPI_EXD_FIELD: + + acpi_ex_dump_object(obj_desc, + acpi_ex_dump_field_common); + break; + + case ACPI_EXD_REFERENCE: + + acpi_ex_out_string("Opcode", + (acpi_ps_get_opcode_info + (obj_desc->reference.opcode))-> + name); + acpi_ex_dump_reference_obj(obj_desc); + break; + + default: + acpi_os_printf("**** Invalid table opcode [%X] ****\n", + info->opcode); + return; + } + + info++; + count--; + } +} /******************************************************************************* * @@ -441,7 +807,6 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, return; } -#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * * FUNCTION: acpi_ex_out* functions @@ -465,11 +830,6 @@ static void acpi_ex_out_pointer(char *title, void *value) acpi_os_printf("%20s : %p\n", title, value); } -static void acpi_ex_out_integer(char *title, u32 value) -{ - acpi_os_printf("%20s : %.2X\n", title, value); -} - static void acpi_ex_out_address(char *title, acpi_physical_address value) { @@ -482,16 +842,16 @@ static void acpi_ex_out_address(char *title, acpi_physical_address value) /******************************************************************************* * - * FUNCTION: acpi_ex_dump_node + * FUNCTION: acpi_ex_dump_namespace_node * - * PARAMETERS: *Node - Descriptor to dump + * PARAMETERS: Node - Descriptor to dump * Flags - Force display if TRUE * * DESCRIPTION: Dumps the members of the given.Node * ******************************************************************************/ -void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) +void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) { ACPI_FUNCTION_ENTRY(); @@ -506,19 +866,17 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); - acpi_ex_out_integer("Flags", node->flags); - acpi_ex_out_integer("Owner Id", node->owner_id); - acpi_ex_out_integer("Reference Count", node->reference_count); acpi_ex_out_pointer("Attached Object", acpi_ns_get_attached_object(node)); - acpi_ex_out_pointer("child_list", node->child); - acpi_ex_out_pointer("next_peer", node->peer); acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); + + acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), + acpi_ex_dump_node); } /******************************************************************************* * - * FUNCTION: acpi_ex_dump_reference + * FUNCTION: acpi_ex_dump_reference_obj * * PARAMETERS: Object - Descriptor to dump * @@ -526,14 +884,16 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) * ******************************************************************************/ -static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) +static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) { struct acpi_buffer ret_buf; acpi_status status; + ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; + if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { acpi_os_printf("Named Object %p ", obj_desc->reference.node); - ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; + status = acpi_ns_handle_to_pathname(obj_desc->reference.node, &ret_buf); @@ -551,9 +911,9 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) /******************************************************************************* * - * FUNCTION: acpi_ex_dump_package + * FUNCTION: acpi_ex_dump_package_obj * - * PARAMETERS: Object - Descriptor to dump + * PARAMETERS: obj_desc - Descriptor to dump * Level - Indentation Level * Index - Package index for this object * @@ -562,7 +922,8 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) ******************************************************************************/ static void -acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) +acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, + u32 level, u32 index) { u32 i; @@ -622,15 +983,15 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) obj_desc->package.count); for (i = 0; i < obj_desc->package.count; i++) { - acpi_ex_dump_package(obj_desc->package.elements[i], - level + 1, i); + acpi_ex_dump_package_obj(obj_desc->package.elements[i], + level + 1, i); } break; case ACPI_TYPE_LOCAL_REFERENCE: acpi_os_printf("[Object Reference] "); - acpi_ex_dump_reference(obj_desc); + acpi_ex_dump_reference_obj(obj_desc); break; default: @@ -645,7 +1006,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) * * FUNCTION: acpi_ex_dump_object_descriptor * - * PARAMETERS: Object - Descriptor to dump + * PARAMETERS: obj_desc - Descriptor to dump * Flags - Force display if TRUE * * DESCRIPTION: Dumps the members of the object descriptor given. @@ -670,11 +1031,13 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) } if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { - acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, - flags); + acpi_ex_dump_namespace_node((struct acpi_namespace_node *) + obj_desc, flags); + acpi_os_printf("\nAttached Object (%p):\n", ((struct acpi_namespace_node *)obj_desc)-> object); + acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) obj_desc)->object, flags); return_VOID; @@ -687,233 +1050,18 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) return_VOID; } - /* Common Fields */ - - acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); - acpi_ex_out_integer("Reference Count", - obj_desc->common.reference_count); - acpi_ex_out_integer("Flags", obj_desc->common.flags); - - /* Object-specific Fields */ - - switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { - case ACPI_TYPE_INTEGER: - - acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64(obj_desc->integer.value)); - break; - - case ACPI_TYPE_STRING: - - acpi_ex_out_integer("Length", obj_desc->string.length); - - acpi_os_printf("%20s : %p ", "Pointer", - obj_desc->string.pointer); - acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); - acpi_os_printf("\n"); - break; - - case ACPI_TYPE_BUFFER: - - acpi_ex_out_integer("Length", obj_desc->buffer.length); - acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); - ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, - obj_desc->buffer.length); - break; - - case ACPI_TYPE_PACKAGE: - - acpi_ex_out_integer("Flags", obj_desc->package.flags); - acpi_ex_out_integer("Elements", obj_desc->package.count); - acpi_ex_out_pointer("Element List", obj_desc->package.elements); - - /* Dump the package contents */ - - acpi_os_printf("\nPackage Contents:\n"); - acpi_ex_dump_package(obj_desc, 0, 0); - break; - - case ACPI_TYPE_DEVICE: - - acpi_ex_out_pointer("Handler", obj_desc->device.handler); - acpi_ex_out_pointer("system_notify", - obj_desc->device.system_notify); - acpi_ex_out_pointer("device_notify", - obj_desc->device.device_notify); - break; - - case ACPI_TYPE_EVENT: - - acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); - break; - - case ACPI_TYPE_METHOD: - - acpi_ex_out_integer("param_count", - obj_desc->method.param_count); - acpi_ex_out_integer("Concurrency", - obj_desc->method.concurrency); - acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); - acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); - acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); - acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); - break; - - case ACPI_TYPE_MUTEX: - - acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); - acpi_ex_out_pointer("owner_thread", - obj_desc->mutex.owner_thread); - acpi_ex_out_integer("acquire_depth", - obj_desc->mutex.acquisition_depth); - acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); - break; - - case ACPI_TYPE_REGION: - - acpi_ex_out_integer("space_id", obj_desc->region.space_id); - acpi_ex_out_integer("Flags", obj_desc->region.flags); - acpi_ex_out_address("Address", obj_desc->region.address); - acpi_ex_out_integer("Length", obj_desc->region.length); - acpi_ex_out_pointer("Handler", obj_desc->region.handler); - acpi_ex_out_pointer("Next", obj_desc->region.next); - break; - - case ACPI_TYPE_POWER: - - acpi_ex_out_integer("system_level", - obj_desc->power_resource.system_level); - acpi_ex_out_integer("resource_order", - obj_desc->power_resource.resource_order); - acpi_ex_out_pointer("system_notify", - obj_desc->power_resource.system_notify); - acpi_ex_out_pointer("device_notify", - obj_desc->power_resource.device_notify); - break; - - case ACPI_TYPE_PROCESSOR: - - acpi_ex_out_integer("Processor ID", - obj_desc->processor.proc_id); - acpi_ex_out_integer("Length", obj_desc->processor.length); - acpi_ex_out_address("Address", - (acpi_physical_address) obj_desc->processor. - address); - acpi_ex_out_pointer("system_notify", - obj_desc->processor.system_notify); - acpi_ex_out_pointer("device_notify", - obj_desc->processor.device_notify); - acpi_ex_out_pointer("Handler", obj_desc->processor.handler); - break; - - case ACPI_TYPE_THERMAL: - - acpi_ex_out_pointer("system_notify", - obj_desc->thermal_zone.system_notify); - acpi_ex_out_pointer("device_notify", - obj_desc->thermal_zone.device_notify); - acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); - break; - - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - acpi_ex_out_integer("field_flags", - obj_desc->common_field.field_flags); - acpi_ex_out_integer("access_byte_width", - obj_desc->common_field.access_byte_width); - acpi_ex_out_integer("bit_length", - obj_desc->common_field.bit_length); - acpi_ex_out_integer("fld_bit_offset", - obj_desc->common_field. - start_field_bit_offset); - acpi_ex_out_integer("base_byte_offset", - obj_desc->common_field.base_byte_offset); - acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); - - switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { - case ACPI_TYPE_BUFFER_FIELD: - acpi_ex_out_pointer("buffer_obj", - obj_desc->buffer_field.buffer_obj); - break; - - case ACPI_TYPE_LOCAL_REGION_FIELD: - acpi_ex_out_pointer("region_obj", - obj_desc->field.region_obj); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - acpi_ex_out_integer("Value", - obj_desc->bank_field.value); - acpi_ex_out_pointer("region_obj", - obj_desc->bank_field.region_obj); - acpi_ex_out_pointer("bank_obj", - obj_desc->bank_field.bank_obj); - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_ex_out_integer("Value", - obj_desc->index_field.value); - acpi_ex_out_pointer("Index", - obj_desc->index_field.index_obj); - acpi_ex_out_pointer("Data", - obj_desc->index_field.data_obj); - break; - - default: - /* All object types covered above */ - break; - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - acpi_ex_out_integer("target_type", - obj_desc->reference.target_type); - acpi_ex_out_string("Opcode", - (acpi_ps_get_opcode_info - (obj_desc->reference.opcode))->name); - acpi_ex_out_integer("Offset", obj_desc->reference.offset); - acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); - acpi_ex_out_pointer("Node", obj_desc->reference.node); - acpi_ex_out_pointer("Where", obj_desc->reference.where); - - acpi_ex_dump_reference(obj_desc); - break; - - case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: - - acpi_ex_out_integer("space_id", - obj_desc->address_space.space_id); - acpi_ex_out_pointer("Next", obj_desc->address_space.next); - acpi_ex_out_pointer("region_list", - obj_desc->address_space.region_list); - acpi_ex_out_pointer("Node", obj_desc->address_space.node); - acpi_ex_out_pointer("Context", obj_desc->address_space.context); - break; + if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) { + return_VOID; + } - case ACPI_TYPE_LOCAL_NOTIFY: + /* Common Fields */ - acpi_ex_out_pointer("Node", obj_desc->notify.node); - acpi_ex_out_pointer("Context", obj_desc->notify.context); - break; + acpi_ex_dump_object(obj_desc, acpi_ex_dump_common); - case ACPI_TYPE_LOCAL_ALIAS: - case ACPI_TYPE_LOCAL_METHOD_ALIAS: - case ACPI_TYPE_LOCAL_EXTRA: - case ACPI_TYPE_LOCAL_DATA: - default: - - acpi_os_printf - ("ex_dump_object_descriptor: Display not implemented for object type %s\n", - acpi_ut_get_object_type_name(obj_desc)); - break; - } + /* Object-specific fields */ + acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]); return_VOID; } -#endif /* ACPI_FUTURE_USAGE */ #endif diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 1899ab25139..00a25f8188f 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -45,6 +45,7 @@ #include #include #include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exmisc") @@ -157,40 +158,52 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, union acpi_operand_object **actual_return_desc, struct acpi_walk_state *walk_state) { + acpi_status status; union acpi_operand_object *return_desc; u8 *new_buf; - u8 *end_tag1; - u8 *end_tag2; + u8 *end_tag; + acpi_size length0; acpi_size length1; - acpi_size length2; ACPI_FUNCTION_TRACE("ex_concat_template"); - /* Find the end_tags in each resource template */ + /* + * Find the end_tag descriptor in each resource template. + * Note: returned pointers point TO the end_tag, not past it. + * + * Compute the length of each resource template + */ + status = acpi_ut_get_resource_end_tag(operand0, &end_tag); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } - end_tag1 = acpi_ut_get_resource_end_tag(operand0); - end_tag2 = acpi_ut_get_resource_end_tag(operand1); - if (!end_tag1 || !end_tag2) { - return_ACPI_STATUS(AE_AML_OPERAND_TYPE); + length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); + + status = acpi_ut_get_resource_end_tag(operand1, &end_tag); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - /* Compute the length of each part */ + /* Include the end_tag in the second template length */ - length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); - length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ + length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) + + sizeof(struct aml_resource_end_tag); /* Create a new buffer object for the result */ - return_desc = acpi_ut_create_buffer_object(length1 + length2); + return_desc = acpi_ut_create_buffer_object(length0 + length1); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } - /* Copy the templates to the new descriptor */ - + /* + * Copy the templates to the new buffer, 0 first, then 1 follows. One + * end_tag descriptor is copied from Operand1. + */ new_buf = return_desc->buffer.pointer; - ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); - ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); + ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); + ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); /* Compute the new checksum */ @@ -198,7 +211,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, acpi_ut_generate_checksum(return_desc->buffer.pointer, (return_desc->buffer.length - 1)); - /* Return the completed template descriptor */ + /* Return the completed resource template */ *actual_return_desc = return_desc; return_ACPI_STATUS(AE_OK); diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index c07b046659f..8167af1fa57 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -399,7 +399,7 @@ acpi_walk_namespace(acpi_object_type type, /* Parameter validation */ - if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { + if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) { return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index c29d3a44727..eca7439ee9d 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -299,13 +299,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) /* Point to the next object */ - resource = ACPI_PTR_ADD(struct acpi_resource, - resource, resource->length); + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); } - /* Did not find an END_TAG descriptor */ + /* Did not find an end_tag resource descriptor */ - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } /******************************************************************************* @@ -328,185 +329,155 @@ acpi_status acpi_rs_get_list_length(u8 * aml_buffer, u32 aml_buffer_length, acpi_size * size_needed) { + acpi_status status; + u8 *end_aml; u8 *buffer; - struct acpi_resource_info *resource_info; u32 buffer_size = 0; - u32 bytes_parsed = 0; - u8 resource_type; u16 temp16; u16 resource_length; - u16 header_length; u32 extra_struct_bytes; + u8 resource_index; + u8 minimum_aml_resource_length; ACPI_FUNCTION_TRACE("rs_get_list_length"); - while (bytes_parsed < aml_buffer_length) { - /* The next byte in the stream is the resource descriptor type */ + end_aml = aml_buffer + aml_buffer_length; - resource_type = acpi_ut_get_resource_type(aml_buffer); + /* Walk the list of AML resource descriptors */ - /* Get the base stream size and structure sizes for the descriptor */ + while (aml_buffer < end_aml) { + /* Validate the Resource Type and Resource Length */ - resource_info = acpi_rs_get_resource_info(resource_type); - if (!resource_info) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + status = acpi_ut_validate_resource(aml_buffer, &resource_index); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - /* Get the Length field from the input resource descriptor */ + /* Get the resource length and base (minimum) AML size */ resource_length = acpi_ut_get_resource_length(aml_buffer); + minimum_aml_resource_length = + acpi_gbl_resource_aml_sizes[resource_index]; - /* Augment the size for descriptors with optional fields */ - + /* + * Augment the size for descriptors with optional + * and/or variable length fields + */ extra_struct_bytes = 0; + buffer = + aml_buffer + acpi_ut_get_resource_header_length(aml_buffer); - if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) { + switch (acpi_ut_get_resource_type(aml_buffer)) { + case ACPI_RESOURCE_NAME_IRQ: /* - * Small resource descriptors + * IRQ Resource: + * Get the number of bits set in the 16-bit IRQ mask */ - header_length = - sizeof(struct aml_resource_small_header); - buffer = aml_buffer + header_length; - - switch (resource_type) { - case ACPI_RESOURCE_NAME_IRQ: - /* - * IRQ Resource: - * Get the number of bits set in the IRQ word - */ - ACPI_MOVE_16_TO_16(&temp16, buffer); - extra_struct_bytes = - (acpi_rs_count_set_bits(temp16) * - sizeof(u32)); - break; - - case ACPI_RESOURCE_NAME_DMA: - /* - * DMA Resource: - * Get the number of bits set in the DMA channels byte - */ - ACPI_MOVE_16_TO_16(&temp16, buffer); - extra_struct_bytes = - (acpi_rs_count_set_bits(temp16) * - sizeof(u32)); - break; - - case ACPI_RESOURCE_NAME_VENDOR_SMALL: - /* - * Vendor Specific Resource: - * Ensure a 32-bit boundary for the structure - */ - extra_struct_bytes = - ACPI_ROUND_UP_to_32_bITS(resource_length); - break; + ACPI_MOVE_16_TO_16(&temp16, buffer); + extra_struct_bytes = + acpi_rs_count_set_bits(temp16) * sizeof(u32); + break; - case ACPI_RESOURCE_NAME_END_TAG: - /* - * End Tag: - * Terminate the loop now - */ - aml_buffer_length = bytes_parsed; - break; + case ACPI_RESOURCE_NAME_DMA: + /* + * DMA Resource: + * Get the number of bits set in the 8-bit DMA mask + */ + extra_struct_bytes = + acpi_rs_count_set_bits(*buffer) * sizeof(u32); + break; - default: - break; - } - } else { + case ACPI_RESOURCE_NAME_VENDOR_SMALL: /* - * Large resource descriptors + * Vendor Resource: + * Ensure a 32-bit boundary for the structure */ - header_length = - sizeof(struct aml_resource_large_header); - buffer = aml_buffer + header_length; + extra_struct_bytes = + ACPI_ROUND_UP_to_32_bITS(resource_length) - + resource_length; + break; - switch (resource_type) { - case ACPI_RESOURCE_NAME_VENDOR_LARGE: - /* - * Vendor Defined Resource: - * Add vendor data and ensure a 32-bit boundary for the structure - */ - extra_struct_bytes = - ACPI_ROUND_UP_to_32_bITS(resource_length); - break; + case ACPI_RESOURCE_NAME_END_TAG: + /* + * End Tag: This is the normal exit + */ + *size_needed = buffer_size; + return_ACPI_STATUS(AE_OK); - case ACPI_RESOURCE_NAME_ADDRESS32: - case ACPI_RESOURCE_NAME_ADDRESS16: - /* - * 32-Bit or 16-bit Address Resource: - * Add the size of any optional data (resource_source) - */ - extra_struct_bytes = - acpi_rs_stream_option_length - (resource_length, - resource_info-> - minimum_aml_resource_length); - break; - - case ACPI_RESOURCE_NAME_EXTENDED_IRQ: - /* - * Extended IRQ: - * Point past the interrupt_vector_flags to get the - * interrupt_table_length. - */ - buffer++; + case ACPI_RESOURCE_NAME_VENDOR_LARGE: + /* + * Vendor Resource: + * Add vendor data and ensure a 32-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_32_bITS(resource_length) - + resource_length; + break; - /* - * Add 4 bytes for each additional interrupt. Note: at least one - * interrupt is required and is included in the minimum - * descriptor size - */ - extra_struct_bytes = - ((*buffer - 1) * sizeof(u32)); + case ACPI_RESOURCE_NAME_ADDRESS32: + case ACPI_RESOURCE_NAME_ADDRESS16: + /* + * 32-Bit or 16-bit Address Resource: + * Add the size of any optional data (resource_source) + */ + extra_struct_bytes = + acpi_rs_stream_option_length(resource_length, + minimum_aml_resource_length); + break; - /* Add the size of any optional data (resource_source) */ + case ACPI_RESOURCE_NAME_EXTENDED_IRQ: + /* + * Extended IRQ: + * Point past the interrupt_vector_flags to get the + * interrupt_table_length. + */ + buffer++; + + extra_struct_bytes = + /* + * Add 4 bytes for each additional interrupt. Note: at + * least one interrupt is required and is included in + * the minimum descriptor size + */ + ((*buffer - 1) * sizeof(u32)) + + /* Add the size of any optional data (resource_source) */ + acpi_rs_stream_option_length(resource_length - + extra_struct_bytes, + minimum_aml_resource_length); + break; - extra_struct_bytes += - acpi_rs_stream_option_length(resource_length - - - extra_struct_bytes, - resource_info-> - minimum_aml_resource_length); - break; + case ACPI_RESOURCE_NAME_ADDRESS64: + /* + * 64-Bit Address Resource: + * Add the size of any optional data (resource_source) + * Ensure a 64-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_64_bITS + (acpi_rs_stream_option_length + (resource_length, minimum_aml_resource_length)); + break; - case ACPI_RESOURCE_NAME_ADDRESS64: - /* - * 64-Bit Address Resource: - * Add the size of any optional data (resource_source) - * Ensure a 64-bit boundary for the structure - */ - extra_struct_bytes = - ACPI_ROUND_UP_to_64_bITS - (acpi_rs_stream_option_length - (resource_length, - resource_info-> - minimum_aml_resource_length)); - break; - - default: - break; - } + default: + break; } /* Update the required buffer size for the internal descriptor structs */ - temp16 = - (u16) (resource_info->minimum_internal_struct_length + - extra_struct_bytes); + temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + + extra_struct_bytes); buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); /* - * Update byte count and point to the next resource within the stream + * Point to the next resource within the stream * using the size of the header plus the length contained in the header */ - temp16 = (u16) (header_length + resource_length); - bytes_parsed += temp16; - aml_buffer += temp16; + aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); } - /* This is the data the caller needs */ + /* Did not find an end_tag resource descriptor */ - *size_needed = buffer_size; - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } /******************************************************************************* diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 27172a3d55d..f617ca80c5a 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -324,7 +324,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), - "Resource Type", "Memory Range"}, + "Resource Type", (void *)"Memory Range"}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), "Write Protect", acpi_gbl_RWdecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), @@ -337,7 +337,7 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), - "Resource Type", "I/O Range"}, + "Resource Type", (void *)"I/O Range"}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), "Range Type", acpi_gbl_RNGdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), @@ -372,8 +372,8 @@ static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { static void acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) { - void *target = NULL; - void *previous_target; + u8 *target = NULL; + u8 *previous_target; char *name; u8 count; @@ -399,43 +399,49 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) /* Strings */ case ACPI_RSD_LITERAL: - acpi_rs_out_string(name, (char *)table->pointer); + acpi_rs_out_string(name, + ACPI_CAST_PTR(char, table->pointer)); break; case ACPI_RSD_STRING: - acpi_rs_out_string(name, (char *)target); + acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); break; /* Data items, 8/16/32/64 bit */ case ACPI_RSD_UINT8: - acpi_rs_out_integer8(name, *(u8 *) target); + acpi_rs_out_integer8(name, *ACPI_CAST_PTR(u8, target)); break; case ACPI_RSD_UINT16: - acpi_rs_out_integer16(name, *(u16 *) target); + acpi_rs_out_integer16(name, + *ACPI_CAST_PTR(u16, target)); break; case ACPI_RSD_UINT32: - acpi_rs_out_integer32(name, *(u32 *) target); + acpi_rs_out_integer32(name, + *ACPI_CAST_PTR(u32, target)); break; case ACPI_RSD_UINT64: - acpi_rs_out_integer64(name, *(u64 *) target); + acpi_rs_out_integer64(name, + *ACPI_CAST_PTR(u64, target)); break; /* Flags: 1-bit and 2-bit flags supported */ case ACPI_RSD_1BITFLAG: - acpi_rs_out_string(name, (char *) - ((const char **)table-> - pointer)[(*(u8 *) target) & 0x01]); + acpi_rs_out_string(name, ACPI_CAST_PTR(char, + table-> + pointer[*target & + 0x01])); break; case ACPI_RSD_2BITFLAG: - acpi_rs_out_string(name, (char *) - ((const char **)table-> - pointer)[(*(u8 *) target) & 0x03]); + acpi_rs_out_string(name, ACPI_CAST_PTR(char, + table-> + pointer[*target & + 0x03])); break; case ACPI_RSD_SHORTLIST: @@ -445,10 +451,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) */ if (previous_target) { acpi_rs_out_title(name); - acpi_rs_dump_short_byte_list(* - ((u8 *) - previous_target), - (u8 *) target); + acpi_rs_dump_short_byte_list(*previous_target, + target); } break; @@ -458,10 +462,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) * Note: The list length is obtained from the previous table entry */ if (previous_target) { - acpi_rs_dump_byte_list(* - ((u16 *) - previous_target), - (u8 *) target); + acpi_rs_dump_byte_list(*ACPI_CAST_PTR + (u16, previous_target), + target); } break; @@ -471,10 +474,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) * Note: The list length is obtained from the previous table entry */ if (previous_target) { - acpi_rs_dump_dword_list(* - ((u8 *) - previous_target), - (u32 *) target); + acpi_rs_dump_dword_list(*previous_target, + ACPI_CAST_PTR(u32, + target)); } break; @@ -482,17 +484,19 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) /* * Common flags for all Address resources */ - acpi_rs_dump_address_common((union acpi_resource_data *) - target); + acpi_rs_dump_address_common(ACPI_CAST_PTR + (union acpi_resource_data, + target)); break; case ACPI_RSD_SOURCE: /* * Optional resource_source for Address resources */ - acpi_rs_dump_resource_source((struct - acpi_resource_source *) - target); + acpi_rs_dump_resource_source(ACPI_CAST_PTR + (struct + acpi_resource_source, + target)); break; default: diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 973fc2834cb..623b0668933 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -80,7 +80,9 @@ struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ -struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = { + /* Small descriptors */ + NULL, /* 0x00, Reserved */ NULL, /* 0x01, Reserved */ NULL, /* 0x02, Reserved */ @@ -96,10 +98,10 @@ struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { NULL, /* 0x0C, Reserved */ NULL, /* 0x0D, Reserved */ acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ - acpi_rs_convert_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ -}; + acpi_rs_convert_end_tag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ + + /* Large descriptors */ -struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[] = { NULL, /* 0x00, Reserved */ acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ @@ -138,7 +140,6 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; - #endif #endif /* ACPI_FUTURE_USAGE */ /* @@ -166,62 +167,38 @@ const u8 acpi_gbl_aml_resource_sizes[] = { sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; -/* Macros used in the tables below */ +const u8 acpi_gbl_resource_struct_sizes[] = { + /* Small descriptors */ -#define ACPI_RLARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) -#define ACPI_RSMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) + 0, + 0, + 0, + 0, + ACPI_RS_SIZE(struct acpi_resource_irq), + ACPI_RS_SIZE(struct acpi_resource_dma), + ACPI_RS_SIZE(struct acpi_resource_start_dependent), + ACPI_RS_SIZE_MIN, + ACPI_RS_SIZE(struct acpi_resource_io), + ACPI_RS_SIZE(struct acpi_resource_fixed_io), + 0, + 0, + 0, + 0, + ACPI_RS_SIZE(struct acpi_resource_vendor), + ACPI_RS_SIZE_MIN, -/* - * Base sizes of resource descriptors, both the AML stream resource length - * (minus size of header and length fields),and the size of the internal - * struct representation. - */ -struct acpi_resource_info acpi_gbl_sm_resource_info[] = { - {0, 0, 0}, - {0, 0, 0}, - {0, 0, 0}, - {0, 0, 0}, - {2, ACPI_RSMALL(struct aml_resource_irq), - ACPI_RS_SIZE(struct acpi_resource_irq)}, - {0, ACPI_RSMALL(struct aml_resource_dma), - ACPI_RS_SIZE(struct acpi_resource_dma)}, - {2, ACPI_RSMALL(struct aml_resource_start_dependent), - ACPI_RS_SIZE(struct acpi_resource_start_dependent)}, - {0, ACPI_RSMALL(struct aml_resource_end_dependent), ACPI_RS_SIZE_MIN}, - {0, ACPI_RSMALL(struct aml_resource_io), - ACPI_RS_SIZE(struct acpi_resource_io)}, - {0, ACPI_RSMALL(struct aml_resource_fixed_io), - ACPI_RS_SIZE(struct acpi_resource_fixed_io)}, - {0, 0, 0}, - {0, 0, 0}, - {0, 0, 0}, - {0, 0, 0}, - {1, ACPI_RSMALL(struct aml_resource_vendor_small), - ACPI_RS_SIZE(struct acpi_resource_vendor)}, - {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RS_SIZE_MIN} -}; + /* Large descriptors */ -struct acpi_resource_info acpi_gbl_lg_resource_info[] = { - {0, 0, 0}, - {0, ACPI_RLARGE(struct aml_resource_memory24), - ACPI_RS_SIZE(struct acpi_resource_memory24)}, - {0, ACPI_RLARGE(struct aml_resource_generic_register), - ACPI_RS_SIZE(struct acpi_resource_generic_register)}, - {0, 0, 0}, - {1, ACPI_RLARGE(struct aml_resource_vendor_large), - ACPI_RS_SIZE(struct acpi_resource_vendor)}, - {0, ACPI_RLARGE(struct aml_resource_memory32), - ACPI_RS_SIZE(struct acpi_resource_memory32)}, - {0, ACPI_RLARGE(struct aml_resource_fixed_memory32), - ACPI_RS_SIZE(struct acpi_resource_fixed_memory32)}, - {1, ACPI_RLARGE(struct aml_resource_address32), - ACPI_RS_SIZE(struct acpi_resource_address32)}, - {1, ACPI_RLARGE(struct aml_resource_address16), - ACPI_RS_SIZE(struct acpi_resource_address16)}, - {1, ACPI_RLARGE(struct aml_resource_extended_irq), - ACPI_RS_SIZE(struct acpi_resource_extended_irq)}, - {1, ACPI_RLARGE(struct aml_resource_address64), - ACPI_RS_SIZE(struct acpi_resource_address64)}, - {0, ACPI_RLARGE(struct aml_resource_extended_address64), - ACPI_RS_SIZE(struct acpi_resource_extended_address64)} + 0, + ACPI_RS_SIZE(struct acpi_resource_memory24), + ACPI_RS_SIZE(struct acpi_resource_generic_register), + 0, + ACPI_RS_SIZE(struct acpi_resource_vendor), + ACPI_RS_SIZE(struct acpi_resource_memory32), + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), + ACPI_RS_SIZE(struct acpi_resource_address32), + ACPI_RS_SIZE(struct acpi_resource_address16), + ACPI_RS_SIZE(struct acpi_resource_extended_irq), + ACPI_RS_SIZE(struct acpi_resource_address64), + ACPI_RS_SIZE(struct acpi_resource_extended_address64) }; diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index ee17ef3315f..b83996233c1 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -47,115 +47,12 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rslist") -/* Local prototypes */ -static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 - resource_type); - -static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); - -/******************************************************************************* - * - * FUNCTION: acpi_rs_validate_resource_length - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * - * RETURN: Status - AE_OK if the resource length appears valid - * - * DESCRIPTION: Validate the resource_length. Fixed-length descriptors must - * have the exact length; variable-length descriptors must be - * at least as long as the minimum. Certain Small descriptors - * can vary in size by at most one byte. - * - ******************************************************************************/ - -static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) -{ - struct acpi_resource_info *resource_info; - u16 minimum_aml_resource_length; - u16 resource_length; - - ACPI_FUNCTION_ENTRY(); - - /* Get the size and type info about this resource descriptor */ - - resource_info = - acpi_rs_get_resource_info(aml->small_header.descriptor_type); - if (!resource_info) { - return (AE_AML_INVALID_RESOURCE_TYPE); - } - - resource_length = acpi_ut_get_resource_length(aml); - minimum_aml_resource_length = - resource_info->minimum_aml_resource_length; - - /* Validate based upon the type of resource, fixed length or variable */ - - if (resource_info->length_type == ACPI_FIXED_LENGTH) { - /* Fixed length resource, length must match exactly */ - - if (resource_length != minimum_aml_resource_length) { - return (AE_AML_BAD_RESOURCE_LENGTH); - } - } else if (resource_info->length_type == ACPI_VARIABLE_LENGTH) { - /* Variable length resource, must be at least the minimum */ - - if (resource_length < minimum_aml_resource_length) { - return (AE_AML_BAD_RESOURCE_LENGTH); - } - } else { - /* Small variable length resource, allowed to be (Min) or (Min-1) */ - - if ((resource_length > minimum_aml_resource_length) || - (resource_length < (minimum_aml_resource_length - 1))) { - return (AE_AML_BAD_RESOURCE_LENGTH); - } - } - - return (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_conversion_info - * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor - * - * RETURN: Pointer to the resource conversion info table - * - * DESCRIPTION: Get the conversion table associated with this resource type - * - ******************************************************************************/ - -static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) -{ - ACPI_FUNCTION_ENTRY(); - - /* Determine if this is a small or large resource */ - - if (resource_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { - return (NULL); - } - - return (acpi_gbl_lg_get_resource_dispatch[(resource_type & - ACPI_RESOURCE_NAME_LARGE_MASK)]); - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - return (acpi_gbl_sm_get_resource_dispatch[((resource_type & - ACPI_RESOURCE_NAME_SMALL_MASK) - >> 3)]); - } -} - /******************************************************************************* * * FUNCTION: acpi_rs_convert_aml_to_resources * - * PARAMETERS: aml_buffer - Pointer to the resource byte stream - * aml_buffer_length - Length of aml_buffer + * PARAMETERS: Aml - Pointer to the resource byte stream + * aml_length - Length of Aml * output_buffer - Pointer to the buffer that will * contain the output structures * @@ -165,42 +62,24 @@ static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) * linked list of resources in the caller's output buffer * ******************************************************************************/ - acpi_status -acpi_rs_convert_aml_to_resources(u8 * aml_buffer, - u32 aml_buffer_length, u8 * output_buffer) +acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) { - u8 *buffer = output_buffer; + struct acpi_resource *resource = (void *)output_buffer; acpi_status status; - acpi_size bytes_parsed = 0; - struct acpi_resource *resource; - acpi_rsdesc_size descriptor_length; - struct acpi_rsconvert_info *info; + u8 resource_index; + u8 *end_aml; ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); - /* Loop until end-of-buffer or an end_tag is found */ - - while (bytes_parsed < aml_buffer_length) { - /* Get the conversion table associated with this Descriptor Type */ - - info = acpi_rs_get_conversion_info(*aml_buffer); - if (!info) { - /* No table indicates an invalid resource type */ + end_aml = aml + aml_length; - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + /* Loop until end-of-buffer or an end_tag is found */ - descriptor_length = acpi_ut_get_descriptor_length(aml_buffer); + while (aml < end_aml) { + /* Validate the Resource Type and Resource Length */ - /* - * Perform limited validation of the resource length, based upon - * what we know about the resource type - */ - status = - acpi_rs_validate_resource_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + status = acpi_ut_validate_resource(aml, &resource_index); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -208,42 +87,36 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, /* Convert the AML byte stream resource to a local resource struct */ status = - acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR - (struct acpi_resource, - buffer), + acpi_rs_convert_aml_to_resource(resource, ACPI_CAST_PTR(union aml_resource, - aml_buffer), - info); + aml), + acpi_gbl_get_resource_dispatch + [resource_index]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status))); return_ACPI_STATUS(status); } - /* Set the aligned length of the new resource descriptor */ - - resource = ACPI_CAST_PTR(struct acpi_resource, buffer); - resource->length = - (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length); - /* Normal exit on completion of an end_tag resource descriptor */ - if (acpi_ut_get_resource_type(aml_buffer) == + if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_END_TAG) { return_ACPI_STATUS(AE_OK); } - /* Update counter and point to the next input resource */ + /* Point to the next input AML resource */ - bytes_parsed += descriptor_length; - aml_buffer += descriptor_length; + aml += acpi_ut_get_descriptor_length(aml); /* Point to the next structure in the output buffer */ - buffer += resource->length; + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); } - /* Completed buffer, but did not find an end_tag resource descriptor */ + /* Did not find an end_tag resource descriptor */ return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } @@ -271,16 +144,16 @@ acpi_status acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_size aml_size_needed, u8 * output_buffer) { - u8 *aml_buffer = output_buffer; - u8 *end_aml_buffer = output_buffer + aml_size_needed; + u8 *aml = output_buffer; + u8 *end_aml = output_buffer + aml_size_needed; acpi_status status; ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); /* Walk the resource descriptor list, convert each descriptor */ - while (aml_buffer < end_aml_buffer) { - /* Validate the Resource Type */ + while (aml < end_aml) { + /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -294,7 +167,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, status = acpi_rs_convert_resource_to_aml(resource, ACPI_CAST_PTR(union aml_resource, - aml_buffer), + aml), acpi_gbl_set_resource_dispatch [resource->type]); if (ACPI_FAILURE(status)) { @@ -305,9 +178,8 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Perform final sanity check on the new AML resource descriptor */ status = - acpi_rs_validate_resource_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + acpi_ut_validate_resource(ACPI_CAST_PTR + (union aml_resource, aml), NULL); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -322,18 +194,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* * Extract the total length of the new descriptor and set the - * aml_buffer to point to the next (output) resource descriptor + * Aml to point to the next (output) resource descriptor */ - aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); + aml += acpi_ut_get_descriptor_length(aml); /* Point to the next input resource descriptor */ resource = ACPI_PTR_ADD(struct acpi_resource, resource, resource->length); - - /* Check for end-of-list, normal exit */ - } /* Completed buffer, but did not find an end_tag resource descriptor */ diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 7613033f5dc..a1eac0f1df5 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -65,6 +65,8 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) acpi_native_uint i; u8 bit_count; + ACPI_FUNCTION_ENTRY(); + /* Decode the mask bits */ for (i = 0, bit_count = 0; mask; i++) { @@ -97,6 +99,8 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count) acpi_native_uint i; u16 mask; + ACPI_FUNCTION_ENTRY(); + /* Encode the list into a single bitmask */ for (i = 0, mask = 0; i < count; i++) { @@ -128,6 +132,8 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) { acpi_native_uint i; + ACPI_FUNCTION_ENTRY(); + /* One move per item */ for (i = 0; i < item_count; i++) { @@ -166,53 +172,6 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) } } -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_resource_info - * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor - * - * RETURN: Pointer to the resource conversion handler - * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. - * - ******************************************************************************/ - -struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type) -{ - struct acpi_resource_info *size_info; - - ACPI_FUNCTION_ENTRY(); - - /* Determine if this is a small or large resource */ - - if (resource_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { - return (NULL); - } - - size_info = &acpi_gbl_lg_resource_info[(resource_type & - ACPI_RESOURCE_NAME_LARGE_MASK)]; - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - size_info = &acpi_gbl_sm_resource_info[((resource_type & - ACPI_RESOURCE_NAME_SMALL_MASK) - >> 3)]; - } - - /* Zero entry indicates an invalid resource type */ - - if (!size_info->minimum_internal_struct_length) { - return (NULL); - } - - return (size_info); -} - /******************************************************************************* * * FUNCTION: acpi_rs_set_resource_length @@ -238,25 +197,20 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, ACPI_FUNCTION_ENTRY(); - /* Determine if this is a small or large resource */ + /* Length is the total descriptor length minus the header length */ - if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + resource_length = (acpi_rs_length) + (total_length - acpi_ut_get_resource_header_length(aml)); - resource_length = (acpi_rs_length) - (total_length - sizeof(struct aml_resource_large_header)); + /* Length is stored differently for large and small descriptors */ - /* Insert length into the Large descriptor length field */ + if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large descriptor -- bytes 1-2 contain the 16-bit length */ ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, &resource_length); } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - - resource_length = (acpi_rs_length) - (total_length - sizeof(struct aml_resource_small_header)); - - /* Insert length into the descriptor type byte */ + /* Small descriptor -- bits 2:0 of byte 0 contain the length */ aml->small_header.descriptor_type = (u8) @@ -292,7 +246,7 @@ acpi_rs_set_resource_header(u8 descriptor_type, { ACPI_FUNCTION_ENTRY(); - /* Set the Descriptor Type */ + /* Set the Resource Type */ aml->small_header.descriptor_type = descriptor_type; @@ -409,14 +363,14 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, (char *)&aml_resource_source[1]); return ((acpi_rs_length) total_length); - } else { - /* resource_source is not present */ - - resource_source->index = 0; - resource_source->string_length = 0; - resource_source->string_ptr = NULL; - return (0); } + + /* resource_source is not present */ + + resource_source->index = 0; + resource_source->string_length = 0; + resource_source->string_ptr = NULL; + return (0); } /******************************************************************************* diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile index e87108b7338..88eff14c489 100644 --- a/drivers/acpi/utilities/Makefile +++ b/drivers/acpi/utilities/Makefile @@ -2,7 +2,8 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ - utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o +obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ + utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ + utstate.o utmutex.o utobject.o utcache.o utresrc.o EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index e9058d4da12..2a9110c0639 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -43,7 +43,6 @@ #include #include -#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") @@ -789,153 +788,6 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) return ((u8) (0 - sum)); } -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_resource_type - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: The Resource Type with no extraneous bits (except the - * Large/Small descriptor bit -- this is left alone) - * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. - * - ******************************************************************************/ - -u8 acpi_ut_get_resource_type(void *aml) -{ - ACPI_FUNCTION_ENTRY(); - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Determine if this is a small or large resource - */ - if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - return (*((u8 *) aml)); - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_resource_length - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Byte Length - * - * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By - * definition, this does not include the size of the descriptor - * header or the length field itself. - * - ******************************************************************************/ - -u16 acpi_ut_get_resource_length(void *aml) -{ - u16 resource_length; - - ACPI_FUNCTION_ENTRY(); - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Determine if this is a small or large resource - */ - if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - - ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); - - } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - - resource_length = (u16) (*((u8 *) aml) & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - } - - return (resource_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_descriptor_length - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Byte length - * - * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the - * length of the descriptor header and the length field itself. - * Used to walk descriptor lists. - * - ******************************************************************************/ - -u32 acpi_ut_get_descriptor_length(void *aml) -{ - u32 descriptor_length; - - ACPI_FUNCTION_ENTRY(); - - /* First get the Resource Length (Does not include header length) */ - - descriptor_length = acpi_ut_get_resource_length(aml); - - /* Determine if this is a small or large resource */ - - if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { - descriptor_length += sizeof(struct aml_resource_large_header); - } else { - descriptor_length += sizeof(struct aml_resource_small_header); - } - - return (descriptor_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_resource_end_tag - * - * PARAMETERS: obj_desc - The resource template buffer object - * - * RETURN: Pointer to the end tag - * - * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template - * - ******************************************************************************/ - -u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) -{ - u8 *aml; - u8 *end_aml; - - aml = obj_desc->buffer.pointer; - end_aml = aml + obj_desc->buffer.length; - - /* Walk the resource template, one descriptor per loop */ - - while (aml < end_aml) { - if (acpi_ut_get_resource_type(aml) == - ACPI_RESOURCE_NAME_END_TAG) { - /* Found the end_tag descriptor, all done */ - - return (aml); - } - - /* Point to the next resource descriptor */ - - aml += acpi_ut_get_resource_length(aml); - } - - /* End tag was not found */ - - return (NULL); -} - /******************************************************************************* * * FUNCTION: acpi_ut_report_error diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c new file mode 100644 index 00000000000..07a314c710d --- /dev/null +++ b/drivers/acpi/utilities/utresrc.c @@ -0,0 +1,428 @@ +/******************************************************************************* + * + * Module Name: utresrc - Resource managment utilities + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2005, R. Byron Moore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include +#include + +#define _COMPONENT ACPI_UTILITIES +ACPI_MODULE_NAME("utmisc") + +/* + * Base sizes of the raw AML resource descriptors, indexed by resource type. + * Zero indicates a reserved (and therefore invalid) resource type. + */ +const u8 acpi_gbl_resource_aml_sizes[] = { + /* Small descriptors */ + + 0, + 0, + 0, + 0, + ACPI_AML_SIZE_SMALL(struct aml_resource_irq), + ACPI_AML_SIZE_SMALL(struct aml_resource_dma), + ACPI_AML_SIZE_SMALL(struct aml_resource_start_dependent), + ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent), + ACPI_AML_SIZE_SMALL(struct aml_resource_io), + ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io), + 0, + 0, + 0, + 0, + ACPI_AML_SIZE_SMALL(struct aml_resource_vendor_small), + ACPI_AML_SIZE_SMALL(struct aml_resource_end_tag), + + /* Large descriptors */ + + 0, + ACPI_AML_SIZE_LARGE(struct aml_resource_memory24), + ACPI_AML_SIZE_LARGE(struct aml_resource_generic_register), + 0, + ACPI_AML_SIZE_LARGE(struct aml_resource_vendor_large), + ACPI_AML_SIZE_LARGE(struct aml_resource_memory32), + ACPI_AML_SIZE_LARGE(struct aml_resource_fixed_memory32), + ACPI_AML_SIZE_LARGE(struct aml_resource_address32), + ACPI_AML_SIZE_LARGE(struct aml_resource_address16), + ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq), + ACPI_AML_SIZE_LARGE(struct aml_resource_address64), + ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64) +}; + +/* + * Resource types, used to validate the resource length field. + * The length of fixed-length types must match exactly, variable + * lengths must meet the minimum required length, etc. + * Zero indicates a reserved (and therefore invalid) resource type. + */ +static const u8 acpi_gbl_resource_types[] = { + /* Small descriptors */ + + 0, + 0, + 0, + 0, + ACPI_SMALL_VARIABLE_LENGTH, + ACPI_FIXED_LENGTH, + ACPI_SMALL_VARIABLE_LENGTH, + ACPI_FIXED_LENGTH, + ACPI_FIXED_LENGTH, + ACPI_FIXED_LENGTH, + 0, + 0, + 0, + 0, + ACPI_VARIABLE_LENGTH, + ACPI_FIXED_LENGTH, + + /* Large descriptors */ + + 0, + ACPI_FIXED_LENGTH, + ACPI_FIXED_LENGTH, + 0, + ACPI_VARIABLE_LENGTH, + ACPI_FIXED_LENGTH, + ACPI_FIXED_LENGTH, + ACPI_VARIABLE_LENGTH, + ACPI_VARIABLE_LENGTH, + ACPI_VARIABLE_LENGTH, + ACPI_VARIABLE_LENGTH, + ACPI_FIXED_LENGTH +}; + +/******************************************************************************* + * + * FUNCTION: acpi_ut_validate_resource + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * return_index - Where the resource index is returned. NULL + * if the index is not required. + * + * RETURN: Status, and optionally the Index into the global resource tables + * + * DESCRIPTION: Validate an AML resource descriptor by checking the Resource + * Type and Resource Length. Returns an index into the global + * resource information/dispatch tables for later use. + * + ******************************************************************************/ + +acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) +{ + u8 resource_type; + u8 resource_index; + acpi_rs_length resource_length; + acpi_rs_length minimum_resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* + * 1) Validate the resource_type field (Byte 0) + */ + resource_type = *((u8 *) aml); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Examine the large/small bit in the resource header + */ + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { + /* Verify the large resource type (name) against the max */ + + if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + /* + * Large Resource Type -- bits 6:0 contain the name + * Translate range 0x80-0x8B to index range 0x10-0x1B + */ + resource_index = (u8) (resource_type - 0x70); + } else { + /* + * Small Resource Type -- bits 6:3 contain the name + * Shift range to index range 0x00-0x0F + */ + resource_index = (u8) + ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); + } + + /* Check validity of the resource type, zero indicates name is invalid */ + + if (!acpi_gbl_resource_types[resource_index]) { + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + /* + * 2) Validate the resource_length field. This ensures that the length + * is at least reasonable, and guarantees that it is non-zero. + */ + resource_length = acpi_ut_get_resource_length(aml); + minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index]; + + /* Validate based upon the type of resource - fixed length or variable */ + + switch (acpi_gbl_resource_types[resource_index]) { + case ACPI_FIXED_LENGTH: + + /* Fixed length resource, length must match exactly */ + + if (resource_length != minimum_resource_length) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + break; + + case ACPI_VARIABLE_LENGTH: + + /* Variable length resource, length must be at least the minimum */ + + if (resource_length < minimum_resource_length) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + break; + + case ACPI_SMALL_VARIABLE_LENGTH: + + /* Small variable length resource, length can be (Min) or (Min-1) */ + + if ((resource_length > minimum_resource_length) || + (resource_length < (minimum_resource_length - 1))) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + break; + + default: + + /* Shouldn't happen (because of validation earlier), but be sure */ + + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + /* Optionally return the resource table index */ + + if (return_index) { + *return_index = resource_index; + } + + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_type + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: The Resource Type with no extraneous bits (except the + * Large/Small descriptor bit -- this is left alone) + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +u8 acpi_ut_get_resource_type(void *aml) +{ + ACPI_FUNCTION_ENTRY(); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Examine the large/small bit in the resource header + */ + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (*((u8 *) aml)); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte Length + * + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By + * definition, this does not include the size of the descriptor + * header or the length field itself. + * + ******************************************************************************/ + +u16 acpi_ut_get_resource_length(void *aml) +{ + acpi_rs_length resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Examine the large/small bit in the resource header + */ + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = (u16) (*((u8 *) aml) & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + } + + return (resource_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_header_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Length of the AML header (depends on large/small descriptor) + * + * DESCRIPTION: Get the length of the header for this resource. + * + ******************************************************************************/ + +u8 acpi_ut_get_resource_header_length(void *aml) +{ + ACPI_FUNCTION_ENTRY(); + + /* Examine the large/small bit in the resource header */ + + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + return (sizeof(struct aml_resource_large_header)); + } else { + return (sizeof(struct aml_resource_small_header)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_descriptor_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte length + * + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the + * length of the descriptor header and the length field itself. + * Used to walk descriptor lists. + * + ******************************************************************************/ + +u32 acpi_ut_get_descriptor_length(void *aml) +{ + ACPI_FUNCTION_ENTRY(); + + /* + * Get the Resource Length (does not include header length) and add + * the header length (depends on if this is a small or large resource) + */ + return (acpi_ut_get_resource_length(aml) + + acpi_ut_get_resource_header_length(aml)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_end_tag + * + * PARAMETERS: obj_desc - The resource template buffer object + * + * RETURN: Pointer to the end tag + * + * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template + * + ******************************************************************************/ + +acpi_status +acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, + u8 ** end_tag) +{ + acpi_status status; + u8 *aml; + u8 *end_aml; + + ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); + + /* Get start and end pointers */ + + aml = obj_desc->buffer.pointer; + end_aml = aml + obj_desc->buffer.length; + + /* Walk the resource template, one descriptor per iteration */ + + while (aml < end_aml) { + /* Validate the Resource Type and Resource Length */ + + status = acpi_ut_validate_resource(aml, NULL); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* end_tag resource indicates the end of the resource template */ + + if (acpi_ut_get_resource_type(aml) == + ACPI_RESOURCE_NAME_END_TAG) { + /* Return the pointer to the end_tag */ + + *end_tag = aml; + return_ACPI_STATUS(AE_OK); + } + + /* + * Point to the next resource descriptor in the AML buffer. The + * descriptor length is guaranteed to be non-zero by resource + * validation above. + */ + aml += acpi_ut_get_descriptor_length(aml); + } + + /* Did not find an end_tag resource descriptor */ + + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); +} diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index c1cb27583be..6ff1d707334 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -63,7 +63,7 @@ acpi_status acpi_ut_create_pkg_state_and_push(void *internal_object, void *external_object, u16 index, - union acpi_generic_state ** state_list) + union acpi_generic_state **state_list) { union acpi_generic_state *state; diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index f06bd5e5e9d..57adc5bc02f 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -178,10 +178,14 @@ acpi_status acpi_enable_subsystem(u32 flags) /* * Initialize ACPI Event handling (Fixed and General Purpose) * - * NOTE: We must have the hardware AND events initialized before we can - * execute ANY control methods SAFELY. Any control method can require - * ACPI hardware support, so the hardware MUST be initialized before - * execution! + * Note1: We must have the hardware and events initialized before we can + * execute any control methods safely. Any control method can require + * ACPI hardware support, so the hardware must be fully initialized before + * any method execution! + * + * Note2: Fixed events are initialized and enabled here. GPEs are + * initialized, but cannot be enabled until after the hardware is + * completely initialized (SCI and global_lock activated) */ if (!(flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -193,8 +197,10 @@ acpi_status acpi_enable_subsystem(u32 flags) } } - /* Install the SCI handler and Global Lock handler */ - + /* + * Install the SCI handler and Global Lock handler. This completes the + * hardware initialization. + */ if (!(flags & ACPI_NO_HANDLER_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); @@ -205,6 +211,24 @@ acpi_status acpi_enable_subsystem(u32 flags) } } + /* + * Complete the GPE initialization for the GPE blocks defined in the FADT + * (GPE block 0 and 1). + * + * Note1: This is where the _PRW methods are executed for the GPEs. These + * methods can only be executed after the SCI and Global Lock handlers are + * installed and initialized. + * + * Note2: Currently, there seems to be no need to run the _REG methods + * before execution of the _PRW methods and enabling of the GPEs. + */ + if (!(flags & ACPI_NO_EVENT_INIT)) { + status = acpi_ev_install_fadt_gpes(); + if (ACPI_FAILURE(status)) { + return (status); + } + } + return_ACPI_STATUS(status); } @@ -230,9 +254,9 @@ acpi_status acpi_initialize_objects(u32 flags) /* * Run all _REG methods * - * NOTE: Any objects accessed - * by the _REG methods will be automatically initialized, even if they - * contain executable AML (see call to acpi_ns_initialize_objects below). + * Note: Any objects accessed by the _REG methods will be automatically + * initialized, even if they contain executable AML (see the call to + * acpi_ns_initialize_objects below). */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -245,9 +269,9 @@ acpi_status acpi_initialize_objects(u32 flags) } /* - * Initialize the objects that remain uninitialized. This - * runs the executable AML that may be part of the declaration of these - * objects: operation_regions, buffer_fields, Buffers, and Packages. + * Initialize the objects that remain uninitialized. This runs the + * executable AML that may be part of the declaration of these objects: + * operation_regions, buffer_fields, Buffers, and Packages. */ if (!(flags & ACPI_NO_OBJECT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -260,8 +284,8 @@ acpi_status acpi_initialize_objects(u32 flags) } /* - * Initialize all device objects in the namespace - * This runs the _STA and _INI methods. + * Initialize all device objects in the namespace. This runs the device + * _STA and _INI methods. */ if (!(flags & ACPI_NO_DEVICE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 7676afec09a..d371ec6b981 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20051021 +#define ACPI_CA_VERSION 0x20051102 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index bfa54600ecd..b40062c3ba7 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -51,6 +51,8 @@ acpi_status acpi_ev_initialize_events(void); acpi_status acpi_ev_install_xrupt_handlers(void); +acpi_status acpi_ev_install_fadt_gpes(void); + u32 acpi_ev_fixed_event_detect(void); /* @@ -105,6 +107,10 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block); +acpi_status +acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, + struct acpi_gpe_block_info *gpe_block); + acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); u32 diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 2c9c1a1d1b7..87e5e44572c 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -44,7 +44,49 @@ #ifndef __ACINTERP_H__ #define __ACINTERP_H__ -#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) +#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) + +/* Macros for tables used for debug output */ + +#define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f) +#define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f) +#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info)) + +/* + * If possible, pack the following structure to byte alignment, since we + * don't care about performance for debug output + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) +#endif + +typedef const struct acpi_exdump_info { + u8 opcode; + u8 offset; + char *name; + +} acpi_exdump_info; + +/* Values for the Opcode field above */ + +#define ACPI_EXD_INIT 0 +#define ACPI_EXD_TYPE 1 +#define ACPI_EXD_UINT8 2 +#define ACPI_EXD_UINT16 3 +#define ACPI_EXD_UINT32 4 +#define ACPI_EXD_UINT64 5 +#define ACPI_EXD_LITERAL 6 +#define ACPI_EXD_POINTER 7 +#define ACPI_EXD_ADDRESS 8 +#define ACPI_EXD_STRING 9 +#define ACPI_EXD_BUFFER 10 +#define ACPI_EXD_PACKAGE 11 +#define ACPI_EXD_FIELD 12 +#define ACPI_EXD_REFERENCE 13 + +/* restore default alignment */ + +#pragma pack() /* * exconvrt - object conversion @@ -327,7 +369,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, void acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); -void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags); +void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags); #endif /* ACPI_FUTURE_USAGE */ /* diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index 25cff0d5ba5..2bf53940f25 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -101,27 +101,11 @@ typedef const struct acpi_rsconvert_info { #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) -/* - * Resource dispatch and info tables - */ -typedef const struct acpi_resource_info { - u8 length_type; - u8 minimum_aml_resource_length; - u8 minimum_internal_struct_length; - -} acpi_resource_info; - -/* Types for length_type above */ - -#define ACPI_FIXED_LENGTH 0 -#define ACPI_VARIABLE_LENGTH 1 -#define ACPI_SMALL_VARIABLE_LENGTH 2 - typedef const struct acpi_rsdump_info { u8 opcode; u8 offset; char *name; - const void *pointer; + const char **pointer; } acpi_rsdump_info; @@ -153,10 +137,9 @@ extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; /* Resource tables indexed by raw AML resource descriptor type */ -extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; -extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; -extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[]; -extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[]; +extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; + +extern const u8 acpi_gbl_resource_struct_sizes[]; /* * rscreate @@ -272,8 +255,6 @@ void acpi_rs_set_resource_length(acpi_rsdesc_size total_length, union aml_resource *aml); -struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); - /* * rsdump */ diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 7386eb81bd2..4ff963323de 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -44,6 +44,15 @@ #ifndef _ACUTILS_H #define _ACUTILS_H +extern const u8 acpi_gbl_resource_aml_sizes[]; + +/* Types for Resource descriptor entries */ + +#define ACPI_INVALID_RESOURCE 0 +#define ACPI_FIXED_LENGTH 1 +#define ACPI_VARIABLE_LENGTH 2 +#define ACPI_SMALL_VARIABLE_LENGTH 3 + typedef acpi_status(*acpi_pkg_callback) (u8 object_type, union acpi_operand_object * source_object, @@ -418,13 +427,19 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); #define ACPI_ANY_BASE 0 +acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); + u32 acpi_ut_get_descriptor_length(void *aml); u16 acpi_ut_get_resource_length(void *aml); +u8 acpi_ut_get_resource_header_length(void *aml); + u8 acpi_ut_get_resource_type(void *aml); -u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); +acpi_status +acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, + u8 ** end_tag); u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 3112be52773..2e3382c1e5e 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -92,6 +92,11 @@ struct asl_resource_node { struct asl_resource_node *next; }; +/* Macros used to generate AML resource length fields */ + +#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) +#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) + /* * Resource descriptors defined in the ACPI specification. * -- cgit v1.2.3 From c51a4de85de720670f2fbc592a6f8040af72ad87 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Thu, 17 Nov 2005 13:07:00 -0500 Subject: [ACPI] ACPICA 20051117 Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsinit.c | 25 +++-- drivers/acpi/dispatcher/dswload.c | 2 +- drivers/acpi/executer/exconvrt.c | 12 +-- drivers/acpi/executer/exdump.c | 15 +-- drivers/acpi/executer/exmisc.c | 38 +++---- drivers/acpi/executer/exnames.c | 2 +- drivers/acpi/executer/exoparg2.c | 10 +- drivers/acpi/executer/exregion.c | 16 +-- drivers/acpi/executer/exstorob.c | 4 +- drivers/acpi/parser/psargs.c | 152 +++++++++++++--------------- drivers/acpi/parser/psparse.c | 35 ++++--- drivers/acpi/parser/psxface.c | 2 +- drivers/acpi/resources/rscalc.c | 14 ++- drivers/acpi/resources/rsdump.c | 24 ++--- drivers/acpi/resources/rslist.c | 4 +- drivers/acpi/resources/rsmisc.c | 92 ++++++++--------- drivers/acpi/resources/rsutils.c | 22 ++-- drivers/acpi/resources/rsxface.c | 208 +++++++++++++++++++++++++++++--------- drivers/acpi/scan.c | 2 +- drivers/acpi/tables/tbconvrt.c | 4 +- drivers/acpi/tables/tbgetall.c | 4 +- drivers/acpi/tables/tbutils.c | 8 +- drivers/acpi/utilities/utcopy.c | 19 ++-- drivers/acpi/utilities/utglobal.c | 4 +- drivers/acpi/utilities/utmisc.c | 34 +++++-- drivers/acpi/utilities/utresrc.c | 19 ++-- include/acpi/acconfig.h | 14 +-- include/acpi/acglobal.h | 1 + include/acpi/aclocal.h | 4 +- include/acpi/acmacros.h | 27 +++-- include/acpi/acpixf.h | 8 +- include/acpi/acresrc.h | 7 +- include/acpi/actypes.h | 23 ++++- include/acpi/platform/aclinux.h | 4 + 34 files changed, 515 insertions(+), 344 deletions(-) diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index 8693c704aea..4fa80abfe6c 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -117,14 +117,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle, case ACPI_TYPE_METHOD: - /* - * Print a dot for each method unless we are going to print - * the entire pathname - */ - if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); - } - /* * Set the execution data width (32 or 64) based upon the * revision number of the parent ACPI table. @@ -134,6 +126,21 @@ acpi_ds_init_one_object(acpi_handle obj_handle, if (info->table_desc->pointer->revision == 1) { node->flags |= ANOBJ_DATA_WIDTH_32; } +#ifdef ACPI_INIT_PARSE_METHODS + /* + * Note 11/2005: Removed this code to parse all methods during table + * load because it causes problems if there are any errors during the + * parse. Also, it seems like overkill and we probably don't want to + * abort a table load because of an issue with a single method. + */ + + /* + * Print a dot for each method unless we are going to print + * the entire pathname + */ + if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); + } /* * Always parse methods to detect errors, we will delete @@ -149,7 +156,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, /* This parse failed, but we will continue parsing more methods */ } - +#endif info->method_count++; break; diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 411731261c2..89d318cbc8a 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -311,7 +311,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, op->named.name = node->name.integer; #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) - op->named.path = (u8 *) path; + op->named.path = ACPI_CAST_PTR(u8, path); #endif /* diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 04e5194989a..fa9e75d4ec6 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -504,18 +504,12 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, } /* - * Perform the conversion. + * Create a new string object and string buffer * (-1 because of extra separator included in string_length from above) */ - string_length--; - if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ - return_ACPI_STATUS(AE_AML_STRING_LIMIT); - } - - /* Create a new string object and string buffer */ - return_desc = - acpi_ut_create_string_object((acpi_size) string_length); + acpi_ut_create_string_object((acpi_size) + (string_length - 1)); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 5a4cca171af..17c79cd91b3 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -117,12 +117,13 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} }; -static struct acpi_exdump_info acpi_ex_dump_method[7] = { +static struct acpi_exdump_info acpi_ex_dump_method[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} }; @@ -339,7 +340,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, count = info->offset; while (count) { - target = ((u8 *) obj_desc) + info->offset; + target = ACPI_ADD_PTR(u8, obj_desc, info->offset); name = info->name; switch (info->opcode) { @@ -360,20 +361,19 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, case ACPI_EXD_UINT16: acpi_os_printf("%20s : %4.4X\n", name, - *ACPI_CAST_PTR(u16, target)); + ACPI_GET16(target)); break; case ACPI_EXD_UINT32: acpi_os_printf("%20s : %8.8X\n", name, - *ACPI_CAST_PTR(u32, target)); + ACPI_GET32(target)); break; case ACPI_EXD_UINT64: acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64(*ACPI_CAST_PTR - (u64, target))); + ACPI_FORMAT_UINT64(ACPI_GET64(target))); break; case ACPI_EXD_POINTER: @@ -969,7 +969,8 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, acpi_os_printf("[Buffer] Length %.2X = ", obj_desc->buffer.length); if (obj_desc->buffer.length) { - acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, + acpi_ut_dump_buffer(ACPI_CAST_PTR + (u8, obj_desc->buffer.pointer), obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); } else { diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 00a25f8188f..0778bff632b 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -205,11 +205,9 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); - /* Compute the new checksum */ + /* Set the end_tag checksum to zero, means "ignore checksum" */ - new_buf[return_desc->buffer.length - 1] = - acpi_ut_generate_checksum(return_desc->buffer.pointer, - (return_desc->buffer.length - 1)); + new_buf[return_desc->buffer.length - 1] = 0; /* Return the completed resource template */ @@ -242,7 +240,6 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, union acpi_operand_object *return_desc; char *new_buf; acpi_status status; - acpi_size new_length; ACPI_FUNCTION_TRACE("ex_do_concatenate"); @@ -269,7 +266,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, break; default: - ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", + ACPI_REPORT_ERROR(("Concatanate - invalid object type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; } @@ -309,8 +306,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Copy the first integer, LSB first */ - ACPI_MEMCPY(new_buf, - &operand0->integer.value, + ACPI_MEMCPY(new_buf, &operand0->integer.value, acpi_gbl_integer_byte_width); /* Copy the second integer (LSB first) after the first */ @@ -324,14 +320,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Result of two Strings is a String */ - new_length = (acpi_size) operand0->string.length + - (acpi_size) local_operand1->string.length; - if (new_length > ACPI_MAX_STRING_CONVERSION) { - status = AE_AML_STRING_LIMIT; - goto cleanup; - } - - return_desc = acpi_ut_create_string_object(new_length); + return_desc = acpi_ut_create_string_object((acpi_size) + (operand0->string. + length + + local_operand1-> + string.length)); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -351,11 +344,10 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Result of two Buffers is a Buffer */ return_desc = acpi_ut_create_buffer_object((acpi_size) - operand0->buffer. - length + - (acpi_size) - local_operand1-> - buffer.length); + (operand0->buffer. + length + + local_operand1-> + buffer.length)); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -365,8 +357,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Concatenate the buffers */ - ACPI_MEMCPY(new_buf, - operand0->buffer.pointer, operand0->buffer.length); + ACPI_MEMCPY(new_buf, operand0->buffer.pointer, + operand0->buffer.length); ACPI_MEMCPY(new_buf + operand0->buffer.length, local_operand1->buffer.pointer, local_operand1->buffer.length); diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index dff41121a30..7bb5e17b568 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -216,7 +216,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) *aml_address, aml_address)); } - *in_aml_address = (u8 *) aml_address; + *in_aml_address = ACPI_CAST_PTR(u8, aml_address); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 8d70c6beef0..d8472842c1f 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -344,10 +344,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) (length < operand[1]->integer.value) && (operand[0]->buffer.pointer[length])) { length++; - if (length > ACPI_MAX_STRING_CONVERSION) { - status = AE_AML_STRING_LIMIT; - goto cleanup; - } } /* Allocate a new string object */ @@ -358,8 +354,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) goto cleanup; } - /* Copy the raw buffer data with no transform. NULL terminated already */ - + /* + * Copy the raw buffer data with no transform. + * (NULL terminated already) + */ ACPI_MEMCPY(return_desc->string.pointer, operand[0]->buffer.pointer, length); break; diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 1897379b5f9..80118be3f54 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -199,20 +199,20 @@ acpi_ex_system_memory_space_handler(u32 function, *value = 0; switch (bit_width) { case 8: - *value = (acpi_integer) * ((u8 *) logical_addr_ptr); + *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); break; case 16: - *value = (acpi_integer) * ((u16 *) logical_addr_ptr); + *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); break; case 32: - *value = (acpi_integer) * ((u32 *) logical_addr_ptr); + *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); break; #if ACPI_MACHINE_WIDTH != 16 case 64: - *value = (acpi_integer) * ((u64 *) logical_addr_ptr); + *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); break; #endif default: @@ -225,20 +225,20 @@ acpi_ex_system_memory_space_handler(u32 function, switch (bit_width) { case 8: - *(u8 *) logical_addr_ptr = (u8) * value; + ACPI_SET8(logical_addr_ptr) = (u8) * value; break; case 16: - *(u16 *) logical_addr_ptr = (u16) * value; + ACPI_SET16(logical_addr_ptr) = (u16) * value; break; case 32: - *(u32 *) logical_addr_ptr = (u32) * value; + ACPI_SET32(logical_addr_ptr) = (u32) * value; break; #if ACPI_MACHINE_WIDTH != 16 case 64: - *(u64 *) logical_addr_ptr = (u64) * value; + ACPI_SET64(logical_addr_ptr) = (u64) * value; break; #endif diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index c4ff654a669..855db713075 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c @@ -71,7 +71,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, /* We know that source_desc is a buffer by now */ - buffer = (u8 *) source_desc->buffer.pointer; + buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); length = source_desc->buffer.length; /* @@ -160,7 +160,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, /* We know that source_desc is a string by now */ - buffer = (u8 *) source_desc->string.pointer; + buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer); length = source_desc->string.length; /* diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 562d0f822ab..6eae35febcc 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -62,61 +62,51 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state * * PARAMETERS: parser_state - Current parser state object * - * RETURN: Decoded package length. On completion, the AML pointer points + * RETURN: Decoded package length. On completion, the AML pointer points * past the length byte or bytes. * - * DESCRIPTION: Decode and return a package length field + * DESCRIPTION: Decode and return a package length field. + * Note: Largest package length is 28 bits, from ACPI specification * ******************************************************************************/ static u32 acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) { - u32 encoded_length; - u32 length = 0; + u8 *aml = parser_state->aml; + u32 package_length = 0; + acpi_native_uint byte_count; + u8 byte_zero_mask = 0x3F; /* Default [0:5] */ ACPI_FUNCTION_TRACE("ps_get_next_package_length"); - encoded_length = (u32) ACPI_GET8(parser_state->aml); - parser_state->aml++; - - switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */ - case 0: /* 1-byte encoding (bits 0-5) */ - - length = (encoded_length & 0x3F); - break; - - case 1: /* 2-byte encoding (next byte + bits 0-3) */ - - length = ((ACPI_GET8(parser_state->aml) << 04) | - (encoded_length & 0x0F)); - parser_state->aml++; - break; - - case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ - - length = ((ACPI_GET8(parser_state->aml + 1) << 12) | - (ACPI_GET8(parser_state->aml) << 04) | - (encoded_length & 0x0F)); - parser_state->aml += 2; - break; - - case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ + /* + * Byte 0 bits [6:7] contain the number of additional bytes + * used to encode the package length, either 0,1,2, or 3 + */ + byte_count = (aml[0] >> 6); + parser_state->aml += (byte_count + 1); - length = ((ACPI_GET8(parser_state->aml + 2) << 20) | - (ACPI_GET8(parser_state->aml + 1) << 12) | - (ACPI_GET8(parser_state->aml) << 04) | - (encoded_length & 0x0F)); - parser_state->aml += 3; - break; + /* Get bytes 3, 2, 1 as needed */ - default: + while (byte_count) { + /* + * Final bit positions for the package length bytes: + * Byte3->[20:27] + * Byte2->[12:19] + * Byte1->[04:11] + * Byte0->[00:03] + */ + package_length |= (aml[byte_count] << ((byte_count << 3) - 4)); - /* Can't get here, only 2 bits / 4 cases */ - break; + byte_zero_mask = 0x0F; /* Use bits [0:3] of byte 0 */ + byte_count--; } - return_UINT32(length); + /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ + + package_length |= (aml[0] & byte_zero_mask); + return_UINT32(package_length); } /******************************************************************************* @@ -135,16 +125,15 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) { u8 *start = parser_state->aml; - acpi_native_uint length; + u32 package_length; ACPI_FUNCTION_TRACE("ps_get_next_package_end"); - /* Function below changes parser_state->Aml */ + /* Function below updates parser_state->Aml */ - length = - (acpi_native_uint) acpi_ps_get_next_package_length(parser_state); + package_length = acpi_ps_get_next_package_length(parser_state); - return_PTR(start + length); /* end of package */ + return_PTR(start + package_length); /* end of package */ } /******************************************************************************* @@ -169,17 +158,15 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) ACPI_FUNCTION_TRACE("ps_get_next_namestring"); - /* Handle multiple prefix characters */ - - while (acpi_ps_is_prefix_char(ACPI_GET8(end))) { - /* Include prefix '\\' or '^' */ + /* Point past any namestring prefix characters (backslash or carat) */ + while (acpi_ps_is_prefix_char(*end)) { end++; } - /* Decode the path */ + /* Decode the path prefix character */ - switch (ACPI_GET8(end)) { + switch (*end) { case 0: /* null_name */ @@ -199,9 +186,9 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) case AML_MULTI_NAME_PREFIX_OP: - /* Multiple name segments, 4 chars each */ + /* Multiple name segments, 4 chars each, count in next byte */ - end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE); + end += 2 + (*(end + 1) * ACPI_NAME_SIZE); break; default: @@ -212,7 +199,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) break; } - parser_state->aml = (u8 *) end; + parser_state->aml = end; return_PTR((char *)start); } @@ -342,7 +329,6 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, ("search_node %p start_node %p return_node %p\n", scope_info.scope.node, parser_state->start_node, node); - } else { /* * We got a NOT_FOUND during table load or we encountered @@ -382,59 +368,63 @@ void acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, u32 arg_type, union acpi_parse_object *arg) { + u32 length; + u16 opcode; + u8 *aml = parser_state->aml; ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); switch (arg_type) { case ARGP_BYTEDATA: - acpi_ps_init_op(arg, AML_BYTE_OP); - arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml); - parser_state->aml++; + /* Get 1 byte from the AML stream */ + + opcode = AML_BYTE_OP; + arg->common.value.integer = (acpi_integer) * aml; + length = 1; break; case ARGP_WORDDATA: - acpi_ps_init_op(arg, AML_WORD_OP); - /* Get 2 bytes from the AML stream */ - ACPI_MOVE_16_TO_32(&arg->common.value.integer, - parser_state->aml); - parser_state->aml += 2; + opcode = AML_WORD_OP; + ACPI_MOVE_16_TO_64(&arg->common.value.integer, aml); + length = 2; break; case ARGP_DWORDDATA: - acpi_ps_init_op(arg, AML_DWORD_OP); - /* Get 4 bytes from the AML stream */ - ACPI_MOVE_32_TO_32(&arg->common.value.integer, - parser_state->aml); - parser_state->aml += 4; + opcode = AML_DWORD_OP; + ACPI_MOVE_32_TO_64(&arg->common.value.integer, aml); + length = 4; break; case ARGP_QWORDDATA: - acpi_ps_init_op(arg, AML_QWORD_OP); - /* Get 8 bytes from the AML stream */ - ACPI_MOVE_64_TO_64(&arg->common.value.integer, - parser_state->aml); - parser_state->aml += 8; + opcode = AML_QWORD_OP; + ACPI_MOVE_64_TO_64(&arg->common.value.integer, aml); + length = 8; break; case ARGP_CHARLIST: - acpi_ps_init_op(arg, AML_STRING_OP); - arg->common.value.string = (char *)parser_state->aml; + /* Get a pointer to the string, point past the string */ + + opcode = AML_STRING_OP; + arg->common.value.string = ACPI_CAST_PTR(char, aml); - while (ACPI_GET8(parser_state->aml) != '\0') { - parser_state->aml++; + /* Find the null terminator */ + + length = 0; + while (aml[length]) { + length++; } - parser_state->aml++; + length++; break; case ARGP_NAME: @@ -443,14 +433,16 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); arg->common.value.name = acpi_ps_get_next_namestring(parser_state); - break; + return_VOID; default: ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); - break; + return_VOID; } + acpi_ps_init_op(arg, opcode); + parser_state->aml += length; return_VOID; } @@ -540,7 +532,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state * access_type is first operand, access_attribute is second */ field->common.value.integer = - (ACPI_GET8(parser_state->aml) << 8); + (((u32) ACPI_GET8(parser_state->aml) << 8)); parser_state->aml++; field->common.value.integer |= ACPI_GET8(parser_state->aml); parser_state->aml++; diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 76d4d640d83..7cfa7eb0dfc 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -503,22 +503,23 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } else if (status == AE_CTRL_TERMINATE) { status = AE_OK; } else if ((status != AE_OK) && (walk_state->method_desc)) { - ACPI_REPORT_METHOD_ERROR("Method execution failed", - walk_state->method_node, NULL, - status); + /* Either the method parse or actual execution failed */ - /* Ensure proper cleanup */ - - walk_state->parse_flags |= ACPI_PARSE_EXECUTE; + ACPI_REPORT_METHOD_ERROR + ("Method parse/execution failed", + walk_state->method_node, NULL, status); /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && (!walk_state->method_desc->method.semaphore)) { /* - * This method is marked not_serialized, but it tried to create + * Method tried to create an object twice. The probable cause is + * that the method cannot handle reentrancy. + * + * The method is marked not_serialized, but it tried to create * a named object, causing the second thread entrance to fail. - * We will workaround this by marking the method permanently + * Workaround this problem by marking the method permanently * as Serialized. */ walk_state->method_desc->method.method_flags |= @@ -536,15 +537,22 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) acpi_ds_scope_stack_clear(walk_state); /* - * If we just returned from the execution of a control method, - * there's lots of cleanup to do + * If we just returned from the execution of a control method or if we + * encountered an error during the method parse phase, there's lots of + * cleanup to do */ - if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) { + if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { if (walk_state->method_desc) { /* Decrement the thread count on the method parse tree */ - walk_state->method_desc->method.thread_count--; + if (walk_state->method_desc->method. + thread_count) { + walk_state->method_desc->method. + thread_count--; + } else { + ACPI_REPORT_ERROR(("Invalid zero thread count in method\n")); + } } acpi_ds_terminate_control_method(walk_state); @@ -553,7 +561,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) /* Delete this walk state and all linked control states */ acpi_ps_cleanup_scope(&walk_state->parser_state); - previous_walk_state = walk_state; ACPI_DEBUG_PRINT((ACPI_DB_PARSE, diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 4c426f4c6af..14d544d6086 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -87,7 +87,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) /* TBDs: Validate name, allow full path or just nameseg */ - acpi_gbl_trace_method_name = *(u32 *) name; + acpi_gbl_trace_method_name = *ACPI_CAST_PTR(u32, name); acpi_gbl_trace_flags = flags; if (debug_level) { diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index eca7439ee9d..c2c4d9079c6 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -300,7 +300,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) /* Point to the next object */ resource = - ACPI_PTR_ADD(struct acpi_resource, resource, + ACPI_ADD_PTR(struct acpi_resource, resource, resource->length); } @@ -374,8 +374,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, * Get the number of bits set in the 16-bit IRQ mask */ ACPI_MOVE_16_TO_16(&temp16, buffer); - extra_struct_bytes = - acpi_rs_count_set_bits(temp16) * sizeof(u32); + extra_struct_bytes = acpi_rs_count_set_bits(temp16); break; case ACPI_RESOURCE_NAME_DMA: @@ -383,8 +382,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, * DMA Resource: * Get the number of bits set in the 8-bit DMA mask */ - extra_struct_bytes = - acpi_rs_count_set_bits(*buffer) * sizeof(u32); + extra_struct_bytes = acpi_rs_count_set_bits(*buffer); break; case ACPI_RESOURCE_NAME_VENDOR_SMALL: @@ -399,9 +397,9 @@ acpi_rs_get_list_length(u8 * aml_buffer, case ACPI_RESOURCE_NAME_END_TAG: /* - * End Tag: This is the normal exit + * End Tag: This is the normal exit, add size of end_tag */ - *size_needed = buffer_size; + *size_needed = buffer_size + ACPI_RS_SIZE_MIN; return_ACPI_STATUS(AE_OK); case ACPI_RESOURCE_NAME_VENDOR_LARGE: @@ -466,7 +464,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + extra_struct_bytes); - buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); + buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); /* * Point to the next resource within the stream diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index f617ca80c5a..cebd890d3db 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -383,7 +383,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) while (count) { previous_target = target; - target = ((u8 *) resource) + table->offset; + target = ACPI_ADD_PTR(u8, resource, table->offset); name = table->name; switch (table->opcode) { @@ -410,22 +410,19 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) /* Data items, 8/16/32/64 bit */ case ACPI_RSD_UINT8: - acpi_rs_out_integer8(name, *ACPI_CAST_PTR(u8, target)); + acpi_rs_out_integer8(name, ACPI_GET8(target)); break; case ACPI_RSD_UINT16: - acpi_rs_out_integer16(name, - *ACPI_CAST_PTR(u16, target)); + acpi_rs_out_integer16(name, ACPI_GET16(target)); break; case ACPI_RSD_UINT32: - acpi_rs_out_integer32(name, - *ACPI_CAST_PTR(u32, target)); + acpi_rs_out_integer32(name, ACPI_GET32(target)); break; case ACPI_RSD_UINT64: - acpi_rs_out_integer64(name, - *ACPI_CAST_PTR(u64, target)); + acpi_rs_out_integer64(name, ACPI_GET64(target)); break; /* Flags: 1-bit and 2-bit flags supported */ @@ -462,8 +459,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) * Note: The list length is obtained from the previous table entry */ if (previous_target) { - acpi_rs_dump_byte_list(*ACPI_CAST_PTR - (u16, previous_target), + acpi_rs_dump_byte_list(ACPI_GET16 + (previous_target), target); } break; @@ -634,7 +631,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Point to the next resource structure */ resource_list = - ACPI_PTR_ADD(struct acpi_resource, resource_list, + ACPI_ADD_PTR(struct acpi_resource, resource_list, resource_list->length); /* Exit when END_TAG descriptor is reached */ @@ -675,9 +672,8 @@ void acpi_rs_dump_irq_list(u8 * route_table) count); acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); - prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, - ((u8 *) prt_element) + - prt_element->length); + prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table, + prt_element, prt_element->length); } } diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index b83996233c1..573c0670564 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -112,7 +112,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) /* Point to the next structure in the output buffer */ resource = - ACPI_PTR_ADD(struct acpi_resource, resource, + ACPI_ADD_PTR(struct acpi_resource, resource, resource->length); } @@ -201,7 +201,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Point to the next input resource descriptor */ resource = - ACPI_PTR_ADD(struct acpi_resource, resource, + ACPI_ADD_PTR(struct acpi_resource, resource, resource->length); } diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 16ad3bfbee2..e1b5aa2af9a 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -104,8 +104,9 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, * Source is the external AML byte stream buffer, * destination is the internal resource descriptor */ - source = ((u8 *) aml) + info->aml_offset; - destination = ((u8 *) resource) + info->resource_offset; + source = ACPI_ADD_PTR(void, aml, info->aml_offset); + destination = + ACPI_ADD_PTR(void, resource, info->resource_offset); switch (info->opcode) { case ACPI_RSC_INITGET: @@ -129,22 +130,22 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, /* * Mask and shift the flag bit */ - *((u8 *) destination) = (u8) - ((*((u8 *) source) >> info->value) & 0x01); + ACPI_SET8(destination) = (u8) + ((ACPI_GET8(source) >> info->value) & 0x01); break; case ACPI_RSC_2BITFLAG: /* * Mask and shift the flag bits */ - *((u8 *) destination) = (u8) - ((*((u8 *) source) >> info->value) & 0x03); + ACPI_SET8(destination) = (u8) + ((ACPI_GET8(source) >> info->value) & 0x03); break; case ACPI_RSC_COUNT: - item_count = *((u8 *) source); - *((u8 *) destination) = (u8) item_count; + item_count = ACPI_GET8(source); + ACPI_SET8(destination) = (u8) item_count; resource->length = resource->length + (info->value * (item_count - 1)); @@ -153,7 +154,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, case ACPI_RSC_COUNT16: item_count = aml_resource_length; - *((u16 *) destination) = item_count; + ACPI_SET16(destination) = item_count; resource->length = resource->length + (info->value * (item_count - 1)); @@ -186,9 +187,8 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, case ACPI_RSC_DATA8: - target = ((char *)resource) + info->value; - ACPI_MEMCPY(destination, source, - *(ACPI_CAST_PTR(u16, target))); + target = ACPI_ADD_PTR(char, resource, info->value); + ACPI_MEMCPY(destination, source, ACPI_GET16(target)); break; case ACPI_RSC_ADDRESS: @@ -217,8 +217,8 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, * complicated case used by the Interrupt() macro */ target = - ((char *)resource) + info->aml_offset + - (item_count * 4); + ACPI_ADD_PTR(char, resource, + info->aml_offset + (item_count * 4)); resource->length += acpi_rs_get_resource_source(aml_resource_length, @@ -230,15 +230,14 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, * 8-bit encoded bitmask (DMA macro) */ item_count = - acpi_rs_decode_bitmask(*((u8 *) source), + acpi_rs_decode_bitmask(ACPI_GET8(source), destination); if (item_count) { - resource->length += - resource->length + (item_count - 1); + resource->length += (item_count - 1); } - target = ((char *)resource) + info->value; - *((u8 *) target) = (u8) item_count; + target = ACPI_ADD_PTR(char, resource, info->value); + ACPI_SET8(target) = (u8) item_count; break; case ACPI_RSC_BITMASK16: @@ -250,12 +249,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, item_count = acpi_rs_decode_bitmask(temp16, destination); if (item_count) { - resource->length = - resource->length + (item_count - 1); + resource->length += (item_count - 1); } - target = ((char *)resource) + info->value; - *((u8 *) target) = (u8) item_count; + target = ACPI_ADD_PTR(char, resource, info->value); + ACPI_SET8(target) = (u8) item_count; break; case ACPI_RSC_EXIT_NE: @@ -270,7 +268,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, break; case ACPI_RSC_COMPARE_VALUE: - if (*((u8 *) source) != info->value) { + if (ACPI_GET8(source) != info->value) { goto exit; } break; @@ -349,8 +347,8 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, * Source is the internal resource descriptor, * destination is the external AML byte stream buffer */ - source = ((u8 *) resource) + info->resource_offset; - destination = ((u8 *) aml) + info->aml_offset; + source = ACPI_ADD_PTR(void, resource, info->resource_offset); + destination = ACPI_ADD_PTR(void, aml, info->aml_offset); switch (info->opcode) { case ACPI_RSC_INITSET: @@ -368,37 +366,38 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, /* * Clear the flag byte */ - *((u8 *) destination) = 0; + ACPI_SET8(destination) = 0; break; case ACPI_RSC_1BITFLAG: /* * Mask and shift the flag bit */ - *((u8 *) destination) |= (u8) - ((*((u8 *) source) & 0x01) << info->value); + ACPI_SET8(destination) |= (u8) + ((ACPI_GET8(source) & 0x01) << info->value); break; case ACPI_RSC_2BITFLAG: /* * Mask and shift the flag bits */ - *((u8 *) destination) |= (u8) - ((*((u8 *) source) & 0x03) << info->value); + ACPI_SET8(destination) |= (u8) + ((ACPI_GET8(source) & 0x03) << info->value); break; case ACPI_RSC_COUNT: - item_count = *((u8 *) source); - *((u8 *) destination) = (u8) item_count; + item_count = ACPI_GET8(source); + ACPI_SET8(destination) = (u8) item_count; - aml_length = (u16) (aml_length + - (info->value * (item_count - 1))); + aml_length = + (u16) (aml_length + + (info->value * (item_count - 1))); break; case ACPI_RSC_COUNT16: - item_count = *((u16 *) source); + item_count = ACPI_GET16(source); aml_length = (u16) (aml_length + item_count); acpi_rs_set_resource_length(aml_length, aml); break; @@ -453,20 +452,21 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, /* * 8-bit encoded bitmask (DMA macro) */ - *((u8 *) destination) = (u8) + ACPI_SET8(destination) = (u8) acpi_rs_encode_bitmask(source, - *(((u8 *) resource) + - info->value)); + *ACPI_ADD_PTR(u8, resource, + info->value)); break; case ACPI_RSC_BITMASK16: /* * 16-bit encoded bitmask (IRQ macro) */ - temp16 = - acpi_rs_encode_bitmask(source, - *(((u8 *) resource) + - info->value)); + temp16 = acpi_rs_encode_bitmask(source, + *ACPI_ADD_PTR(u8, + resource, + info-> + value)); ACPI_MOVE_16_TO_16(destination, &temp16); break; @@ -485,9 +485,9 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, */ switch (COMPARE_OPCODE(info)) { case ACPI_RSC_COMPARE_VALUE: - if (* - ((u8 *) (((u8 *) resource) + - COMPARE_TARGET(info))) != + + if (*ACPI_ADD_PTR(u8, resource, + COMPARE_TARGET(info)) != COMPARE_VALUE(info)) { goto exit; } diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index a1eac0f1df5..2236a0c90da 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -152,18 +152,18 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) * misaligned memory transfers */ case ACPI_RSC_MOVE16: - ACPI_MOVE_16_TO_16(&((u16 *) destination)[i], - &((u16 *) source)[i]); + ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], + &ACPI_CAST_PTR(u16, source)[i]); break; case ACPI_RSC_MOVE32: - ACPI_MOVE_32_TO_32(&((u32 *) destination)[i], - &((u32 *) source)[i]); + ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i], + &ACPI_CAST_PTR(u32, source)[i]); break; case ACPI_RSC_MOVE64: - ACPI_MOVE_64_TO_64(&((u64 *) destination)[i], - &((u64 *) source)[i]); + ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i], + &ACPI_CAST_PTR(u64, source)[i]); break; default: @@ -318,7 +318,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, total_length = resource_length + sizeof(struct aml_resource_large_header); - aml_resource_source = ((u8 *) aml) + minimum_length; + aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); /* * resource_source is present if the length of the descriptor is longer than @@ -338,9 +338,9 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, * String destination pointer is not specified; Set the String * pointer to the end of the current resource_source structure. */ - resource_source->string_ptr = (char *) - ((u8 *) resource_source) + - sizeof(struct acpi_resource_source); + resource_source->string_ptr = + ACPI_ADD_PTR(char, resource_source, + sizeof(struct acpi_resource_source)); } /* @@ -407,7 +407,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, if (resource_source->string_length) { /* Point to the end of the AML descriptor */ - aml_resource_source = ((u8 *) aml) + minimum_length; + aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); /* Copy the resource_source_index */ diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 09d250ab987..50a956b705b 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -64,6 +64,10 @@ ACPI_MODULE_NAME("rsxface") ACPI_COPY_FIELD(out, in, translation_offset); \ ACPI_COPY_FIELD(out, in, address_length); \ ACPI_COPY_FIELD(out, in, resource_source); +/* Local prototypes */ +static acpi_status +acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); + /******************************************************************************* * * FUNCTION: acpi_get_irq_routing_table @@ -86,6 +90,7 @@ ACPI_MODULE_NAME("rsxface") * the object indicated by the passed device_handle. * ******************************************************************************/ + acpi_status acpi_get_irq_routing_table(acpi_handle device_handle, struct acpi_buffer *ret_buffer) @@ -222,12 +227,12 @@ EXPORT_SYMBOL(acpi_get_possible_resources); * * FUNCTION: acpi_walk_resources * - * PARAMETERS: device_handle - a handle to the device object for the + * PARAMETERS: device_handle - Handle to the device object for the * device we are querying - * Path - method name of the resources we want + * Name - Method name of the resources we want * (METHOD_NAME__CRS or METHOD_NAME__PRS) - * user_function - called for each resource - * Context - passed to user_function + * user_function - Called for each resource + * Context - Passed to user_function * * RETURN: Status * @@ -239,79 +244,74 @@ EXPORT_SYMBOL(acpi_get_possible_resources); acpi_status acpi_walk_resources(acpi_handle device_handle, - char *path, + char *name, ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) { acpi_status status; - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer buffer; struct acpi_resource *resource; - struct acpi_resource *buffer_end; + struct acpi_resource *resource_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)))) { + /* Parameter validation */ + + if (!device_handle || !user_function || !name || + (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && + ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_rs_get_method_data(device_handle, path, &buffer); + /* Get the _CRS or _PRS resource list */ + + buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; + status = acpi_rs_get_method_data(device_handle, name, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Setup pointers */ + /* Buffer now contains the resource list */ - resource = (struct acpi_resource *)buffer.pointer; - buffer_end = ACPI_CAST_PTR(struct acpi_resource, - ((u8 *) buffer.pointer + buffer.length)); + resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); + resource_end = + ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); - /* Walk the resource list */ + /* Walk the resource list until the end_tag is found (or buffer end) */ - for (;;) { - if (!resource || resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + while (resource < resource_end) { + /* Sanity check the resource */ + + if (resource->type > ACPI_RESOURCE_TYPE_MAX) { + status = AE_AML_INVALID_RESOURCE_TYPE; break; } - status = user_function(resource, context); - - switch (status) { - case AE_OK: - case AE_CTRL_DEPTH: + /* Invoke the user function, abort on any error returned */ - /* Just keep going */ + status = user_function(resource, context); + if (ACPI_FAILURE(status)) { + if (status == AE_CTRL_TERMINATE) { + /* This is an OK termination by the user function */ - status = AE_OK; + status = AE_OK; + } break; + } - case AE_CTRL_TERMINATE: - - /* Exit now, with OK stats */ - - status = AE_OK; - goto cleanup; - - default: - - /* All others are valid exceptions */ + /* end_tag indicates end-of-list */ - goto cleanup; + if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + break; } /* Get the next resource descriptor */ - resource = ACPI_NEXT_RESOURCE(resource); - - /* Check for end-of-buffer */ - - if (resource >= buffer_end) { - goto cleanup; - } + resource = + ACPI_ADD_PTR(struct acpi_resource, resource, + resource->length); } - cleanup: - - acpi_os_free(buffer.pointer); + ACPI_MEM_FREE(buffer.pointer); return_ACPI_STATUS(status); } @@ -381,6 +381,12 @@ acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address16 *address16; struct acpi_resource_address32 *address32; + if (!resource || !out) { + return (AE_BAD_PARAMETER); + } + + /* Convert 16 or 32 address descriptor to 64 */ + switch (resource->type) { case ACPI_RESOURCE_TYPE_ADDRESS16: @@ -410,3 +416,113 @@ acpi_resource_to_address64(struct acpi_resource *resource, } EXPORT_SYMBOL(acpi_resource_to_address64); + +/******************************************************************************* + * + * FUNCTION: acpi_get_vendor_resource + * + * PARAMETERS: device_handle - Handle for the parent device object + * Name - Method name for the parent resource + * (METHOD_NAME__CRS or METHOD_NAME__PRS) + * Uuid - Pointer to the UUID to be matched. + * includes both subtype and 16-byte UUID + * ret_buffer - Where the vendor resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Walk a resource template for the specified evice to find a + * vendor-defined resource that matches the supplied UUID and + * UUID subtype. Returns a struct acpi_resource of type Vendor. + * + ******************************************************************************/ + +acpi_status +acpi_get_vendor_resource(acpi_handle device_handle, + char *name, + struct acpi_vendor_uuid * uuid, + struct acpi_buffer * ret_buffer) +{ + struct acpi_vendor_walk_info info; + acpi_status status; + + /* Other parameters are validated by acpi_walk_resources */ + + if (!uuid || !ret_buffer) { + return (AE_BAD_PARAMETER); + } + + info.uuid = uuid; + info.buffer = ret_buffer; + info.status = AE_NOT_EXIST; + + /* Walk the _CRS or _PRS resource list for this device */ + + status = + acpi_walk_resources(device_handle, name, + acpi_rs_match_vendor_resource, &info); + if (ACPI_FAILURE(status)) { + return (status); + } + + return (info.status); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_match_vendor_resource + * + * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID + * + ******************************************************************************/ + +static acpi_status +acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) +{ + struct acpi_vendor_walk_info *info = context; + struct acpi_resource_vendor_typed *vendor; + struct acpi_buffer *buffer; + acpi_status status; + + /* Ignore all descriptors except Vendor */ + + if (resource->type != ACPI_RESOURCE_TYPE_VENDOR) { + return (AE_OK); + } + + vendor = &resource->data.vendor_typed; + + /* + * For a valid match, these conditions must hold: + * + * 1) Length of descriptor data must be at least as long as a UUID struct + * 2) The UUID subtypes must match + * 3) The UUID data must match + */ + if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) || + (vendor->uuid_subtype != info->uuid->subtype) || + (ACPI_MEMCMP(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) { + return (AE_OK); + } + + /* Validate/Allocate/Clear caller buffer */ + + buffer = info->buffer; + status = acpi_ut_initialize_buffer(buffer, resource->length); + if (ACPI_FAILURE(status)) { + return (status); + } + + /* Found the correct resource, copy and return it */ + + ACPI_MEMCPY(buffer->pointer, resource, resource->length); + buffer->length = resource->length; + + /* Found the desired descriptor, terminate resource walk */ + + info->status = AE_OK; + return (AE_CTRL_TERMINATE); +} diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 31218e1d2a1..e332306ae2b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -844,7 +844,7 @@ static void acpi_device_set_id(struct acpi_device *device, * ---- * Fix for the system root bus device -- the only root-level device. */ - if ((parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { + if (((acpi_handle)parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { hid = ACPI_BUS_HID; strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); strcpy(device->pnp.device_class, ACPI_BUS_CLASS); diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index a03939399fa..cd33397d923 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -554,7 +554,9 @@ acpi_status acpi_tb_convert_table_fadt(void) ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Hex dump of common internal FADT, size %d (%X)\n", acpi_gbl_FADT->length, acpi_gbl_FADT->length)); - ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); + + ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_FADT), + acpi_gbl_FADT->length); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 8d72343537e..33c9ed8a6f9 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c @@ -292,7 +292,9 @@ acpi_status acpi_tb_get_required_tables(void) "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width)); - ACPI_DUMP_BUFFER((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); + + ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_DSDT), + acpi_gbl_DSDT->length); /* Always delete the RSDP mapping, we are done with it */ diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index e6dfe688b76..9d0bf536d67 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -240,16 +240,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) u8 acpi_tb_generate_checksum(void *buffer, u32 length) { - const u8 *limit; - const u8 *rover; + u8 *end_buffer; + u8 *rover; u8 sum = 0; if (buffer && length) { /* Buffer and Length are valid */ - limit = (u8 *) buffer + length; + end_buffer = ACPI_ADD_PTR(u8, buffer, length); - for (rover = buffer; rover < limit; rover++) { + for (rover = buffer; rover < end_buffer; rover++) { sum = (u8) (sum + *rover); } } diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 5442b32de61..568df9e42f8 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -398,14 +398,17 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, * Build a simple object (no nested objects) */ status = acpi_ut_copy_isimple_to_esimple(internal_object, - (union acpi_object *) - ret_buffer->pointer, - ((u8 *) ret_buffer-> - pointer + - ACPI_ROUND_UP_TO_NATIVE_WORD - (sizeof - (union - acpi_object))), + ACPI_CAST_PTR(union + acpi_object, + ret_buffer-> + pointer), + ACPI_ADD_PTR(u8, + ret_buffer-> + pointer, + ACPI_ROUND_UP_TO_NATIVE_WORD + (sizeof + (union + acpi_object))), &ret_buffer->length); /* * build simple does not include the object size in the length diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 413e1dd8ae3..d6813d88a10 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -638,7 +638,7 @@ char *acpi_ut_get_node_name(void *object) /* Name must be a valid ACPI name */ - if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { + if (!acpi_ut_valid_acpi_name(node->name.integer)) { return ("????"); } @@ -831,6 +831,7 @@ void acpi_ut_init_globals(void) acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_owner_id_mask = 0; + acpi_gbl_last_owner_id = 0; acpi_gbl_trace_method_name = 0; acpi_gbl_trace_dbg_level = 0; acpi_gbl_trace_dbg_layer = 0; @@ -845,7 +846,6 @@ void acpi_ut_init_globals(void) /* Namespace */ acpi_gbl_root_node = NULL; - acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 2a9110c0639..89efba7bf44 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -63,6 +63,7 @@ ACPI_MODULE_NAME("utmisc") acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) { acpi_native_uint i; + acpi_native_uint j; acpi_status status; ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); @@ -82,29 +83,46 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) return_ACPI_STATUS(status); } - /* Find a free owner ID */ + /* + * Find a free owner ID, cycle through all possible IDs on repeated + * allocations. Note: Index for next possible ID is equal to the value + * of the last allocated ID. + */ + for (i = 0, j = acpi_gbl_last_owner_id; i < 32; i++, j++) { + if (j >= 32) { + j = 0; /* Wraparound to ID start */ + } + + if (!(acpi_gbl_owner_id_mask & (1 << j))) { + /* + * Found a free ID. The actual ID is the bit index plus one, + * making zero an invalid Owner ID. Save this as the last ID + * allocated and update the global ID mask. + */ + acpi_gbl_last_owner_id = (acpi_owner_id) (j + 1); + *owner_id = acpi_gbl_last_owner_id; - for (i = 0; i < 32; i++) { - if (!(acpi_gbl_owner_id_mask & (1 << i))) { ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "Current owner_id mask: %8.8X New ID: %2.2X\n", acpi_gbl_owner_id_mask, - (unsigned int)(i + 1))); + (unsigned int) + acpi_gbl_last_owner_id)); - acpi_gbl_owner_id_mask |= (1 << i); - *owner_id = (acpi_owner_id) (i + 1); + acpi_gbl_owner_id_mask |= (1 << j); goto exit; } } /* - * If we are here, all owner_ids have been allocated. This probably should + * All owner_ids have been allocated. This typically should * not happen since the IDs are reused after deallocation. The IDs are * allocated upon table load (one per table) and method execution, and * they are released when a table is unloaded or a method completes * execution. + * + * If this error happens, there may be very deep nesting of invoked control + * methods, or there may be a bug where the IDs are not released. */ - *owner_id = 0; status = AE_OWNER_ID_LIMIT; ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 07a314c710d..6c0ce7b1219 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -157,7 +157,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) /* * 1) Validate the resource_type field (Byte 0) */ - resource_type = *((u8 *) aml); + resource_type = ACPI_GET8(aml); /* * Byte 0 contains the descriptor name (Resource Type) @@ -266,14 +266,14 @@ u8 acpi_ut_get_resource_type(void *aml) * Byte 0 contains the descriptor name (Resource Type) * Examine the large/small bit in the resource header */ - if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { /* Large Resource Type -- bits 6:0 contain the name */ - return (*((u8 *) aml)); + return (ACPI_GET8(aml)); } else { /* Small Resource Type -- bits 6:3 contain the name */ - return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); + return ((u8) (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); } } @@ -301,15 +301,15 @@ u16 acpi_ut_get_resource_length(void *aml) * Byte 0 contains the descriptor name (Resource Type) * Examine the large/small bit in the resource header */ - if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); + ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); } else { /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - resource_length = (u16) (*((u8 *) aml) & + resource_length = (u16) (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); } @@ -334,7 +334,7 @@ u8 acpi_ut_get_resource_header_length(void *aml) /* Examine the large/small bit in the resource header */ - if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { return (sizeof(struct aml_resource_large_header)); } else { return (sizeof(struct aml_resource_small_header)); @@ -372,8 +372,9 @@ u32 acpi_ut_get_descriptor_length(void *aml) * FUNCTION: acpi_ut_get_resource_end_tag * * PARAMETERS: obj_desc - The resource template buffer object + * end_tag - Where the pointer to the end_tag is returned * - * RETURN: Pointer to the end tag + * RETURN: Status, pointer to the end tag * * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template * diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index d371ec6b981..08eafece3ee 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20051102 +#define ACPI_CA_VERSION 0x20051117 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -98,11 +98,6 @@ #define ACPI_CA_SUPPORT_LEVEL 3 -/* String size constants */ - -#define ACPI_MAX_STRING_LENGTH 512 -#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ - /* Maximum count for a semaphore object */ #define ACPI_MAX_SEMAPHORE_COUNT 256 @@ -134,14 +129,11 @@ #define ACPI_METHOD_NUM_ARGS 7 #define ACPI_METHOD_MAX_ARG 6 -/* Maximum length of resulting string when converting from a buffer */ - -#define ACPI_MAX_STRING_CONVERSION 200 - -/* Length of _HID, _UID, and _CID values */ +/* Length of _HID, _UID, _CID, and UUID values */ #define ACPI_DEVICE_ID_LENGTH 0x09 #define ACPI_MAX_CID_LENGTH 48 +#define ACPI_UUID_LENGTH 16 /* * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index cef51b1ddf9..bd344e51313 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -223,6 +223,7 @@ ACPI_EXTERN u32 acpi_gbl_ps_find_count; ACPI_EXTERN u32 acpi_gbl_owner_id_mask; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; ACPI_EXTERN u16 acpi_gbl_global_lock_handle; +ACPI_EXTERN u8 acpi_gbl_last_owner_id; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; ACPI_EXTERN u8 acpi_gbl_step_to_next_call; diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index dca0d40ea39..0cb61a72d97 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -573,6 +573,8 @@ struct acpi_parse_obj_named { /* The parse node is the fundamental element of the parse tree */ +#define ACPI_MAX_PARSEOP_NAME 20 + struct acpi_parse_obj_asl { ACPI_PARSE_COMMON union acpi_parse_object *child; union acpi_parse_object *parent_method; @@ -597,7 +599,7 @@ struct acpi_parse_obj_asl { u8 aml_opcode_length; u8 aml_pkg_len_bytes; u8 extra; - char parse_op_name[12]; + char parse_op_name[ACPI_MAX_PARSEOP_NAME]; }; union acpi_parse_object { diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index e42222c3d34..5b78ff4091b 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -107,23 +107,29 @@ * Extract a byte of data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below */ -#define ACPI_GET8(addr) (*(u8*)(addr)) +#define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) +#define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) +#define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr) +#define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr) +#define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr) +#define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr) +#define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) +#define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) -/* Pointer arithmetic */ +/* Pointer manipulation */ -#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (acpi_native_uint)(b)) +#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) +#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_native_uint)(b))) #define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b)) /* Pointer/Integer type conversions */ -#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i) +#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_native_uint)i) #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) -#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) -#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) - #if ACPI_MACHINE_WIDTH == 16 #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) @@ -365,6 +371,13 @@ #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) +/* Generate a UUID */ + +#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ + (b) & 0xFF, ((b) >> 8) & 0xFF, \ + (c) & 0xFF, ((c) >> 8) & 0xFF, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) + /* * An struct acpi_namespace_node * can appear in some contexts, * where a pointer to an union acpi_operand_object can also diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 02f00a8fee0..2a88429bc4e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -271,6 +271,12 @@ typedef acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, void *context); +acpi_status +acpi_get_vendor_resource(acpi_handle device_handle, + char *name, + struct acpi_vendor_uuid *uuid, + struct acpi_buffer *ret_buffer); + acpi_status acpi_get_current_resources(acpi_handle device_handle, struct acpi_buffer *ret_buffer); @@ -283,7 +289,7 @@ acpi_get_possible_resources(acpi_handle device_handle, acpi_status acpi_walk_resources(acpi_handle device_handle, - char *path, + char *name, ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); acpi_status diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index 2bf53940f25..ba281f7740a 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -137,9 +137,14 @@ extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; /* Resource tables indexed by raw AML resource descriptor type */ +extern const u8 acpi_gbl_resource_struct_sizes[]; extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; -extern const u8 acpi_gbl_resource_struct_sizes[]; +struct acpi_vendor_walk_info { + struct acpi_vendor_uuid *uuid; + struct acpi_buffer *buffer; + acpi_status status; +}; /* * rscreate diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 29b887017b1..11847592ed1 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -326,7 +326,7 @@ typedef u64 acpi_integer; /* * Constants with special meanings */ -#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) +#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) /* * Initialization sequence @@ -986,6 +986,17 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 #pragma pack(1) #endif +/* UUID data structures for use in vendor-defined resource descriptors */ + +struct acpi_uuid { + u8 data[ACPI_UUID_LENGTH]; +}; + +struct acpi_vendor_uuid { + u8 subtype; + u8 data[ACPI_UUID_LENGTH]; +}; + /* * Structures used to describe device resources */ @@ -1033,6 +1044,15 @@ struct acpi_resource_vendor { u8 byte_data[1]; }; +/* Vendor resource with UUID info (introduced in ACPI 3.0) */ + +struct acpi_resource_vendor_typed { + u16 byte_length; + u8 uuid_subtype; + u8 uuid[ACPI_UUID_LENGTH]; + u8 byte_data[1]; +}; + struct acpi_resource_end_tag { u8 checksum; }; @@ -1184,6 +1204,7 @@ union acpi_resource_data { struct acpi_resource_io io; struct acpi_resource_fixed_io fixed_io; struct acpi_resource_vendor vendor; + struct acpi_resource_vendor_typed vendor_typed; struct acpi_resource_end_tag end_tag; struct acpi_resource_memory24 memory24; struct acpi_resource_memory32 memory32; diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index c93e6562f0e..1b9cbf05b79 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -71,6 +71,10 @@ #define acpi_cache_t kmem_cache_t #endif +/* Full namespace pathname length limit - arbitrary */ + +#define ACPI_PATHNAME_MAX 256 + #else /* !__KERNEL__ */ #include -- cgit v1.2.3 From 28f55ebce5bd2fceec8adc7c8860953d3e4532a8 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 2 Dec 2005 18:27:00 -0500 Subject: [ACPI] ACPICA 20051202 Modified the parsing of control methods to no longer create namespace objects during the first pass of the parse. Objects are now created only during the execute phase, at the moment the namespace creation operator is encountered in the AML (Name, OperationRegion, CreateByteField, etc.) This should eliminate ALREADY_EXISTS exceptions seen on some machines where reentrant control methods are protected by an AML mutex. The mutex will now correctly block multiple threads from attempting to create the same object more than once. Increased the number of available Owner Ids for namespace object tracking from 32 to 255. This should eliminate the OWNER_ID_LIMIT exceptions seen on some machines with a large number of ACPI tables (either static or dynamic). Enhanced the namespace dump routine to output the owner ID for each namespace object. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsmethod.c | 337 ++++++++++++++++++++----------------- drivers/acpi/dispatcher/dswload.c | 132 +++++++++++---- drivers/acpi/namespace/nsdump.c | 4 +- drivers/acpi/utilities/utglobal.c | 9 +- drivers/acpi/utilities/utmisc.c | 79 ++++++--- include/acpi/acconfig.h | 6 +- include/acpi/acglobal.h | 5 +- include/acpi/acmacros.h | 4 + 8 files changed, 350 insertions(+), 226 deletions(-) diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 36c1ca0b9ad..58ad00b31ee 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -51,133 +51,6 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmethod") -/******************************************************************************* - * - * FUNCTION: acpi_ds_parse_method - * - * PARAMETERS: Node - Method node - * - * RETURN: Status - * - * DESCRIPTION: Parse the AML that is associated with the method. - * - * MUTEX: Assumes parser is locked - * - ******************************************************************************/ -acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) -{ - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); - - /* Parameter Validation */ - - if (!node) { - return_ACPI_STATUS(AE_NULL_ENTRY); - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** Parsing [%4.4s] **** named_obj=%p\n", - acpi_ut_get_node_name(node), node)); - - /* Extract the method object from the method Node */ - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - return_ACPI_STATUS(AE_NULL_OBJECT); - } - - /* Create a mutex for the method if there is a concurrency limit */ - - if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && - (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore(obj_desc->method.concurrency, - obj_desc->method.concurrency, - &obj_desc->method.semaphore); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - - /* - * Allocate a new parser op to be the root of the parsed - * method tree - */ - op = acpi_ps_alloc_op(AML_METHOD_OP); - if (!op) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - /* Init new op with the method name and pointer back to the Node */ - - acpi_ps_set_name(op, node->name.integer); - op->common.node = node; - - /* - * Get a new owner_id for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - goto cleanup; - } - - /* Create and initialize a new walk state */ - - walk_state = - acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, - NULL); - if (!walk_state) { - status = AE_NO_MEMORY; - goto cleanup2; - } - - status = acpi_ds_init_aml_walk(walk_state, op, node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 1); - if (ACPI_FAILURE(status)) { - acpi_ds_delete_walk_state(walk_state); - goto cleanup2; - } - - /* - * Parse the method, first pass - * - * The first pass load is where newly declared named objects are added into - * the namespace. Actual evaluation of the named objects (what would be - * called a "second pass") happens during the actual execution of the - * method so that operands to the named objects can take on dynamic - * run-time values. - */ - status = acpi_ps_parse_aml(walk_state); - if (ACPI_FAILURE(status)) { - goto cleanup2; - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", - acpi_ut_get_node_name(node), node, op)); - - /* - * Delete the parse tree. We simply re-parse the method for every - * execution since there isn't much overhead (compared to keeping lots - * of parse trees around) - */ - acpi_ns_delete_namespace_subtree(node); - acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); - - cleanup2: - acpi_ut_release_owner_id(&obj_desc->method.owner_id); - - cleanup: - acpi_ps_delete_parse_tree(op); - return_ACPI_STATUS(status); -} - /******************************************************************************* * * FUNCTION: acpi_ds_begin_method_execution @@ -193,7 +66,6 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) * for clearance to execute. * ******************************************************************************/ - acpi_status acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, union acpi_operand_object *obj_desc, @@ -545,16 +417,54 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) } } + /* + * There are no more threads executing this method. Perform + * additional cleanup. + * + * The method Node is stored in the walk state + */ + method_node = walk_state->method_node; + + /* Lock namespace for possible update */ + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* + * Delete any namespace entries created immediately underneath + * the method + */ + if (method_node->child) { + acpi_ns_delete_namespace_subtree(method_node); + } + + /* + * Delete any namespace entries created anywhere else within + * the namespace by the execution of this method + */ + acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. + owner_id); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + + /* Are there any other threads currently executing this method? */ + if (walk_state->method_desc->method.thread_count) { + /* + * Additional threads. Do not release the owner_id in this case, + * we immediately reuse it for the next thread executing this method + */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "*** Not deleting method namespace, there are still %d threads\n", + "*** Completed execution of one thread, %d threads remaining\n", walk_state->method_desc->method. thread_count)); - } else { /* This is the last executing thread */ + } else { + /* This is the only executing thread for this method */ /* * Support to dynamically change a method from not_serialized to - * Serialized if it appears that the method is written foolishly and + * Serialized if it appears that the method is incorrectly written and * does not support multiple thread execution. The best example of this * is if such a method creates namespace objects and blocks. A second * thread will fail with an AE_ALREADY_EXISTS exception @@ -570,34 +480,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) semaphore); } - /* - * There are no more threads executing this method. Perform - * additional cleanup. - * - * The method Node is stored in the walk state - */ - method_node = walk_state->method_node; - - /* - * Delete any namespace entries created immediately underneath - * the method - */ - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - goto exit; - } - - if (method_node->child) { - acpi_ns_delete_namespace_subtree(method_node); - } + /* No more threads, we can free the owner_id */ - /* - * Delete any namespace entries created anywhere else within - * the namespace - */ - acpi_ns_delete_namespace_by_owner(walk_state->method_desc-> - method.owner_id); - status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); acpi_ut_release_owner_id(&walk_state->method_desc->method. owner_id); } @@ -606,3 +490,140 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); return_VOID; } + +#ifdef ACPI_INIT_PARSE_METHODS + /* + * Note 11/2005: Removed this code to parse all methods during table + * load because it causes problems if there are any errors during the + * parse. Also, it seems like overkill and we probably don't want to + * abort a table load because of an issue with a single method. + */ + +/******************************************************************************* + * + * FUNCTION: acpi_ds_parse_method + * + * PARAMETERS: Node - Method node + * + * RETURN: Status + * + * DESCRIPTION: Parse the AML that is associated with the method. + * + * MUTEX: Assumes parser is locked + * + ******************************************************************************/ + +acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) +{ + acpi_status status; + union acpi_operand_object *obj_desc; + union acpi_parse_object *op; + struct acpi_walk_state *walk_state; + + ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); + + /* Parameter Validation */ + + if (!node) { + return_ACPI_STATUS(AE_NULL_ENTRY); + } + + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** Parsing [%4.4s] **** named_obj=%p\n", + acpi_ut_get_node_name(node), node)); + + /* Extract the method object from the method Node */ + + obj_desc = acpi_ns_get_attached_object(node); + if (!obj_desc) { + return_ACPI_STATUS(AE_NULL_OBJECT); + } + + /* Create a mutex for the method if there is a concurrency limit */ + + if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && + (!obj_desc->method.semaphore)) { + status = acpi_os_create_semaphore(obj_desc->method.concurrency, + obj_desc->method.concurrency, + &obj_desc->method.semaphore); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } + + /* + * Allocate a new parser op to be the root of the parsed + * method tree + */ + op = acpi_ps_alloc_op(AML_METHOD_OP); + if (!op) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + /* Init new op with the method name and pointer back to the Node */ + + acpi_ps_set_name(op, node->name.integer); + op->common.node = node; + + /* + * Get a new owner_id for objects created by this method. Namespace + * objects (such as Operation Regions) can be created during the + * first pass parse. + */ + status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + + /* Create and initialize a new walk state */ + + walk_state = + acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, + NULL); + if (!walk_state) { + status = AE_NO_MEMORY; + goto cleanup2; + } + + status = acpi_ds_init_aml_walk(walk_state, op, node, + obj_desc->method.aml_start, + obj_desc->method.aml_length, NULL, 1); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(walk_state); + goto cleanup2; + } + + /* + * Parse the method, first pass + * + * The first pass load is where newly declared named objects are added into + * the namespace. Actual evaluation of the named objects (what would be + * called a "second pass") happens during the actual execution of the + * method so that operands to the named objects can take on dynamic + * run-time values. + */ + status = acpi_ps_parse_aml(walk_state); + if (ACPI_FAILURE(status)) { + goto cleanup2; + } + + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", + acpi_ut_get_node_name(node), node, op)); + + /* + * Delete the parse tree. We simply re-parse the method for every + * execution since there isn't much overhead (compared to keeping lots + * of parse trees around) + */ + acpi_ns_delete_namespace_subtree(node); + acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); + + cleanup2: + acpi_ut_release_owner_id(&obj_desc->method.owner_id); + + cleanup: + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(status); +} +#endif diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 89d318cbc8a..44d4f4bb2f9 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, char *path; u32 flags; - ACPI_FUNCTION_NAME("ds_load1_begin_op"); + ACPI_FUNCTION_TRACE("ds_load1_begin_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -138,14 +138,14 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, if (op) { if (!(walk_state->op_info->flags & AML_NAMED)) { *out_op = op; - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Check if this object has already been installed in the namespace */ if (op->common.node) { *out_op = op; - return (AE_OK); + return_ACPI_STATUS(AE_OK); } } @@ -188,7 +188,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, #endif if (ACPI_FAILURE(status)) { ACPI_REPORT_NSERROR(path, status); - return (status); + return_ACPI_STATUS(status); } /* @@ -235,7 +235,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); - return (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } break; @@ -257,6 +257,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * buffer_field, or Package), the name of the object is already * in the namespace. */ + if (walk_state->deferred_node) { /* This name is already in the namespace, get the node */ @@ -265,6 +266,16 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, break; } + /* + * If we are executing a method, do not create any namespace objects + * during the load phase, only during execution. + */ + if (walk_state->method_node) { + node = NULL; + status = AE_OK; + break; + } + flags = ACPI_NS_NO_UPSEARCH; if ((walk_state->opcode != AML_SCOPE_OP) && (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { @@ -290,7 +301,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, &(node)); if (ACPI_FAILURE(status)) { ACPI_REPORT_NSERROR(path, status); - return (status); + return_ACPI_STATUS(status); } break; } @@ -302,28 +313,29 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, op = acpi_ps_alloc_op(walk_state->opcode); if (!op) { - return (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } } - /* Initialize */ - - op->named.name = node->name.integer; + /* Initialize the op */ #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) op->named.path = ACPI_CAST_PTR(u8, path); #endif - /* - * Put the Node in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - op->common.node = node; + if (node) { + /* + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed + */ + op->common.node = node; + op->named.name = node->name.integer; + } + acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), op); - *out_op = op; - return (status); + return_ACPI_STATUS(status); } /******************************************************************************* @@ -339,13 +351,13 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * ******************************************************************************/ -acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) +acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) { union acpi_parse_object *op; acpi_object_type object_type; acpi_status status = AE_OK; - ACPI_FUNCTION_NAME("ds_load1_end_op"); + ACPI_FUNCTION_TRACE("ds_load1_end_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -354,7 +366,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) /* We are only interested in opcodes that have an associated name */ if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Get the object type to determine if we should pop the scope */ @@ -363,21 +375,37 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) #ifndef ACPI_NO_METHOD_EXECUTION if (walk_state->op_info->flags & AML_FIELD) { - if (walk_state->opcode == AML_FIELD_OP || - walk_state->opcode == AML_BANK_FIELD_OP || - walk_state->opcode == AML_INDEX_FIELD_OP) { - status = acpi_ds_init_field_objects(op, walk_state); + /* + * If we are executing a method, do not create any namespace objects + * during the load phase, only during execution. + */ + if (!walk_state->method_node) { + if (walk_state->opcode == AML_FIELD_OP || + walk_state->opcode == AML_BANK_FIELD_OP || + walk_state->opcode == AML_INDEX_FIELD_OP) { + status = + acpi_ds_init_field_objects(op, walk_state); + } } - return (status); + return_ACPI_STATUS(status); } - if (op->common.aml_opcode == AML_REGION_OP) { - status = acpi_ex_create_region(op->named.data, op->named.length, - (acpi_adr_space_type) - ((op->common.value.arg)->common. - value.integer), walk_state); - if (ACPI_FAILURE(status)) { - return (status); + /* + * If we are executing a method, do not create any namespace objects + * during the load phase, only during execution. + */ + if (!walk_state->method_node) { + if (op->common.aml_opcode == AML_REGION_OP) { + status = + acpi_ex_create_region(op->named.data, + op->named.length, + (acpi_adr_space_type) + ((op->common.value.arg)-> + common.value.integer), + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } } } #endif @@ -391,7 +419,12 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) common. aml_opcode))-> object_type; - op->common.node->type = (u8) object_type; + + /* Set node type if we have a namespace node */ + + if (op->common.node) { + op->common.node->type = (u8) object_type; + } } } @@ -424,7 +457,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) walk_state->num_operands = 0; if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } } } @@ -439,7 +472,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) status = acpi_ds_scope_stack_pop(walk_state); } - return (status); + return_ACPI_STATUS(status); } /******************************************************************************* @@ -456,8 +489,8 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) ******************************************************************************/ acpi_status -acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, - union acpi_parse_object ** out_op) +acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op) { union acpi_parse_object *op; struct acpi_namespace_node *node; @@ -840,6 +873,13 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_NAMED_FIELD: + /* + * If we are executing a method, initialize the field + */ + if (walk_state->method_node) { + status = acpi_ds_init_field_objects(op, walk_state); + } + switch (op->common.aml_opcode) { case AML_INDEX_FIELD_OP: @@ -929,6 +969,24 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) switch (op->common.aml_opcode) { #ifndef ACPI_NO_METHOD_EXECUTION case AML_REGION_OP: + + /* + * If we are executing a method, initialize the region + */ + if (walk_state->method_node) { + status = + acpi_ex_create_region(op->named.data, + op->named.length, + (acpi_adr_space_type) + ((op->common.value. + arg)->common.value. + integer), + walk_state); + if (ACPI_FAILURE(status)) { + return (status); + } + } + /* * The op_region is not fully parsed at this time. Only valid * argument is the space_id. (We must save the address of the diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 9faf1d5c86e..864c642759f 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -212,7 +212,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, /* * Now we can print out the pertinent information */ - acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node); + acpi_os_printf(" %-12s %p %2.2X ", + acpi_ut_get_type_name(type), this_node, + this_node->owner_id); dbg_level = acpi_dbg_level; acpi_dbg_level = 0; diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index d6813d88a10..6828c7aefa8 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -793,6 +793,11 @@ void acpi_ut_init_globals(void) acpi_gbl_mutex_info[i].use_count = 0; } + for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { + acpi_gbl_owner_id_mask[i] = 0; + } + acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ + /* GPE support */ acpi_gbl_gpe_xrupt_list_head = NULL; @@ -830,8 +835,8 @@ void acpi_ut_init_globals(void) acpi_gbl_ns_lookup_count = 0; acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; - acpi_gbl_owner_id_mask = 0; - acpi_gbl_last_owner_id = 0; + acpi_gbl_last_owner_id_index = 0; + acpi_gbl_next_owner_id_offset = 0; acpi_gbl_trace_method_name = 0; acpi_gbl_trace_dbg_level = 0; acpi_gbl_trace_dbg_layer = 0; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 89efba7bf44..64dd64b1aa1 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -64,6 +64,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) { acpi_native_uint i; acpi_native_uint j; + acpi_native_uint k; acpi_status status; ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); @@ -85,32 +86,50 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) /* * Find a free owner ID, cycle through all possible IDs on repeated - * allocations. Note: Index for next possible ID is equal to the value - * of the last allocated ID. + * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have + * to be scanned twice. */ - for (i = 0, j = acpi_gbl_last_owner_id; i < 32; i++, j++) { - if (j >= 32) { - j = 0; /* Wraparound to ID start */ + for (i = 0, j = acpi_gbl_last_owner_id_index; + i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { + if (j >= ACPI_NUM_OWNERID_MASKS) { + j = 0; /* Wraparound to start of mask array */ } - if (!(acpi_gbl_owner_id_mask & (1 << j))) { - /* - * Found a free ID. The actual ID is the bit index plus one, - * making zero an invalid Owner ID. Save this as the last ID - * allocated and update the global ID mask. - */ - acpi_gbl_last_owner_id = (acpi_owner_id) (j + 1); - *owner_id = acpi_gbl_last_owner_id; + for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { + if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { + /* There are no free IDs in this mask */ - ACPI_DEBUG_PRINT((ACPI_DB_VALUES, - "Current owner_id mask: %8.8X New ID: %2.2X\n", - acpi_gbl_owner_id_mask, - (unsigned int) - acpi_gbl_last_owner_id)); + break; + } - acpi_gbl_owner_id_mask |= (1 << j); - goto exit; + if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) { + /* + * Found a free ID. The actual ID is the bit index plus one, + * making zero an invalid Owner ID. Save this as the last ID + * allocated and update the global ID mask. + */ + acpi_gbl_owner_id_mask[j] |= (1 << k); + + acpi_gbl_last_owner_id_index = (u8) j; + acpi_gbl_next_owner_id_offset = (u8) (k + 1); + + /* + * Construct encoded ID from the index and bit position + * + * Note: Last [j].k (bit 255) is never used and is marked + * permanently allocated (prevents +1 overflow) + */ + *owner_id = + (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); + + ACPI_DEBUG_PRINT((ACPI_DB_VALUES, + "Allocated owner_id: %2.2X\n", + (unsigned int)*owner_id)); + goto exit; + } } + + acpi_gbl_next_owner_id_offset = 0; } /* @@ -124,7 +143,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) * methods, or there may be a bug where the IDs are not released. */ status = AE_OWNER_ID_LIMIT; - ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); + ACPI_REPORT_ERROR(("Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT\n")); exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -141,7 +160,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) * control method or unloading a table. Either way, we would * ignore any error anyway. * - * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32 + * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 * ******************************************************************************/ @@ -149,6 +168,8 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) { acpi_owner_id owner_id = *owner_id_ptr; acpi_status status; + acpi_native_uint index; + u32 bit; ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); @@ -158,7 +179,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Zero is not a valid owner_iD */ - if ((owner_id == 0) || (owner_id > 32)) { + if ((owner_id == 0) || (owner_id > 255)) { ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); return_VOID; } @@ -174,10 +195,18 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) owner_id--; + /* Decode ID to index/offset pair */ + + index = ACPI_DIV_32(owner_id); + bit = 1 << ACPI_MOD_32(owner_id); + /* Free the owner ID only if it is valid */ - if (acpi_gbl_owner_id_mask & (1 << owner_id)) { - acpi_gbl_owner_id_mask ^= (1 << owner_id); + if (acpi_gbl_owner_id_mask[index] & bit) { + acpi_gbl_owner_id_mask[index] ^= bit; + } else { + ACPI_REPORT_ERROR(("Release of non-allocated owner_id: %2.2X\n", + owner_id + 1)); } (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 08eafece3ee..f48b9ee9a87 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20051117 +#define ACPI_CA_VERSION 0x20051202 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -110,6 +110,10 @@ #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 +/* owner_id tracking. 8 entries allows for 255 owner_ids */ + +#define ACPI_NUM_OWNERID_MASKS 8 + /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index bd344e51313..3f37560c26a 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -220,10 +220,11 @@ ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; ACPI_EXTERN u32 acpi_gbl_ps_find_count; -ACPI_EXTERN u32 acpi_gbl_owner_id_mask; +ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; ACPI_EXTERN u16 acpi_gbl_global_lock_handle; -ACPI_EXTERN u8 acpi_gbl_last_owner_id; +ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; +ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; ACPI_EXTERN u8 acpi_gbl_step_to_next_call; diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 5b78ff4091b..65a1a5c1a68 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -332,6 +332,10 @@ #define ACPI_MUL_16(a) _ACPI_MUL(a,4) #define ACPI_MOD_16(a) _ACPI_MOD(a,16) +#define ACPI_DIV_32(a) _ACPI_DIV(a,5) +#define ACPI_MUL_32(a) _ACPI_MUL(a,5) +#define ACPI_MOD_32(a) _ACPI_MOD(a,32) + /* * Rounding macros (Power of two boundaries only) */ -- cgit v1.2.3 From 729b4d4ce1982c52040bbf22d6711cdf8db07ad8 Mon Sep 17 00:00:00 2001 From: Alexey Starikovskiy Date: Thu, 1 Dec 2005 04:29:00 -0500 Subject: [ACPI] fix reboot upon suspend-to-disk http://bugzilla.kernel.org/show_bug.cgi?id=4320 Signed-off-by: Alexey Starikovskiy Acked-by: Pavel Machek Signed-off-by: Len Brown --- drivers/acpi/sleep/poweroff.c | 15 +++++++++------ drivers/acpi/sleep/sleep.h | 2 +- drivers/acpi/sleep/wakeup.c | 6 +++--- include/linux/kernel.h | 1 + include/linux/reboot.h | 3 +-- kernel/power/disk.c | 9 +-------- kernel/sys.c | 25 ++++++++++--------------- 7 files changed, 26 insertions(+), 35 deletions(-) diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index af7935a95bc..47fb4b394ee 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c @@ -33,9 +33,7 @@ int acpi_sleep_prepare(u32 acpi_state) ACPI_FLUSH_CPU_CACHE(); acpi_enable_wakeup_device_prep(acpi_state); #endif - if (acpi_state == ACPI_STATE_S5) { - acpi_wakeup_gpe_poweroff_prepare(); - } + acpi_gpe_sleep_prepare(acpi_state); acpi_enter_sleep_state_prep(acpi_state); return 0; } @@ -53,11 +51,16 @@ void acpi_power_off(void) static int acpi_shutdown(struct sys_device *x) { - if (system_state == SYSTEM_POWER_OFF) { - /* Prepare if we are going to power off the system */ + switch (system_state) { + case SYSTEM_POWER_OFF: + /* Prepare to power off the system */ return acpi_sleep_prepare(ACPI_STATE_S5); + case SYSTEM_SUSPEND_DISK: + /* Prepare to suspend the system to disk */ + return acpi_sleep_prepare(ACPI_STATE_S4); + default: + return 0; } - return 0; } static struct sysdev_class acpi_sysclass = { diff --git a/drivers/acpi/sleep/sleep.h b/drivers/acpi/sleep/sleep.h index efd0001c6f0..f3e70397a7d 100644 --- a/drivers/acpi/sleep/sleep.h +++ b/drivers/acpi/sleep/sleep.h @@ -5,4 +5,4 @@ extern int acpi_suspend (u32 state); extern void acpi_enable_wakeup_device_prep(u8 sleep_state); extern void acpi_enable_wakeup_device(u8 sleep_state); extern void acpi_disable_wakeup_device(u8 sleep_state); -extern void acpi_wakeup_gpe_poweroff_prepare(void); +extern void acpi_gpe_sleep_prepare(u32 sleep_state); diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 4134ed43d02..85df0ceda2a 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c @@ -192,7 +192,7 @@ late_initcall(acpi_wakeup_device_init); * RUNTIME GPEs, we simply mark all GPES that * are not enabled for wakeup from S5 as RUNTIME. */ -void acpi_wakeup_gpe_poweroff_prepare(void) +void acpi_gpe_sleep_prepare(u32 sleep_state) { struct list_head *node, *next; @@ -201,8 +201,8 @@ void acpi_wakeup_gpe_poweroff_prepare(void) struct acpi_device, wakeup_list); - /* The GPE can wakeup system from S5, don't touch it */ - if ((u32) dev->wakeup.sleep_state == ACPI_STATE_S5) + /* The GPE can wakeup system from this state, don't touch it */ + if ((u32) dev->wakeup.sleep_state >= sleep_state) continue; /* acpi_set_gpe_type will automatically disable GPE */ acpi_set_gpe_type(dev->wakeup.gpe_device, diff --git a/include/linux/kernel.h b/include/linux/kernel.h index b1e407a4fbd..73aa55a7333 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -181,6 +181,7 @@ extern enum system_states { SYSTEM_HALT, SYSTEM_POWER_OFF, SYSTEM_RESTART, + SYSTEM_SUSPEND_DISK, } system_state; #define TAINT_PROPRIETARY_MODULE (1<<0) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 7ab2cdb83ef..015297ff73f 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -60,8 +60,7 @@ extern void machine_crash_shutdown(struct pt_regs *); */ extern void kernel_restart_prepare(char *cmd); -extern void kernel_halt_prepare(void); -extern void kernel_power_off_prepare(void); +extern void kernel_shutdown_prepare(enum system_states state); extern void kernel_restart(char *cmd); extern void kernel_halt(void); diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 027322a564f..f2cd279d07c 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c @@ -52,7 +52,7 @@ static void power_down(suspend_disk_method_t mode) switch(mode) { case PM_DISK_PLATFORM: - kernel_power_off_prepare(); + kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); error = pm_ops->enter(PM_SUSPEND_DISK); break; case PM_DISK_SHUTDOWN: @@ -119,13 +119,6 @@ static int prepare_processes(void) goto thaw; } - if (pm_disk_mode == PM_DISK_PLATFORM) { - if (pm_ops && pm_ops->prepare) { - if ((error = pm_ops->prepare(PM_SUSPEND_DISK))) - goto thaw; - } - } - /* Free memory before shutting down devices. */ free_some_memory(); return 0; diff --git a/kernel/sys.c b/kernel/sys.c index eecf84526af..c3b1874661f 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -427,23 +427,25 @@ void kernel_kexec(void) } EXPORT_SYMBOL_GPL(kernel_kexec); +void kernel_shutdown_prepare(enum system_states state) +{ + notifier_call_chain(&reboot_notifier_list, + (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL); + system_state = state; + device_shutdown(); +} /** * kernel_halt - halt the system * * Shutdown everything and perform a clean system halt. */ -void kernel_halt_prepare(void) -{ - notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); - system_state = SYSTEM_HALT; - device_shutdown(); -} void kernel_halt(void) { - kernel_halt_prepare(); + kernel_shutdown_prepare(SYSTEM_HALT); printk(KERN_EMERG "System halted.\n"); machine_halt(); } + EXPORT_SYMBOL_GPL(kernel_halt); /** @@ -451,20 +453,13 @@ EXPORT_SYMBOL_GPL(kernel_halt); * * Shutdown everything and perform a clean system power_off. */ -void kernel_power_off_prepare(void) -{ - notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); - system_state = SYSTEM_POWER_OFF; - device_shutdown(); -} void kernel_power_off(void) { - kernel_power_off_prepare(); + kernel_shutdown_prepare(SYSTEM_POWER_OFF); printk(KERN_EMERG "Power down.\n"); machine_power_off(); } EXPORT_SYMBOL_GPL(kernel_power_off); - /* * Reboot system call: for obvious reasons only root may call it, * and even root needs to set up some magic numbers in the registers -- cgit v1.2.3 From 63c94b68ec30847a6e2b36651703f41066f91480 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Mon, 5 Dec 2005 20:51:00 -0500 Subject: [ACPI] build EC driver on IA64 Signed-off-by: Kenji Kaneshige Signed-off-by: Len Brown --- drivers/acpi/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index fe1e8126fba..0c6abf49528 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -270,7 +270,6 @@ config ACPI_DEBUG config ACPI_EC bool - depends on X86 default y help This driver is required on some systems for the proper operation of -- cgit v1.2.3 From cb654695f6b912cef7cb3271665b6ee0d416124c Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 28 Dec 2005 02:43:51 -0500 Subject: [ACPI] acpi_register_gsi() fix needed for ACPICA 20051021 Use the #define for ACPI_LEVEL_SENSITIVE instead of assuming non-zero, because ACPICA 20051021 changes its value to zero. Also, use uniform variable names: edge_level -> triggering active_high_low -> polarity Signed-off-by: Len Brown --- arch/i386/kernel/acpi/boot.c | 6 +++--- arch/i386/kernel/mpparse.c | 8 ++++---- arch/ia64/kernel/acpi.c | 6 +++--- arch/x86_64/kernel/mpparse.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 447fa9e33ff..1f378df14f3 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -464,7 +464,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) * success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) +int acpi_register_gsi(u32 gsi, int triggering, int polarity) { unsigned int irq; unsigned int plat_gsi = gsi; @@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { extern void eisa_set_level_irq(unsigned int irq); - if (edge_level == ACPI_LEVEL_SENSITIVE) + if (triggering == ACPI_LEVEL_SENSITIVE) eisa_set_level_irq(gsi); } #endif #ifdef CONFIG_X86_IO_APIC if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { - plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low); + plat_gsi = mp_register_gsi(gsi, triggering, polarity); } #endif acpi_gsi_to_irq(plat_gsi, &irq); diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index 1ca5269b1e8..d7cede83ba2 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -1070,7 +1070,7 @@ void __init mp_config_acpi_legacy_irqs (void) #define MAX_GSI_NUM 4096 -int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) +int mp_register_gsi (u32 gsi, int triggering, int polarity) { int ioapic = -1; int ioapic_pin = 0; @@ -1119,7 +1119,7 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<=0) * failure: return < 0 */ -int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) +int acpi_register_gsi(u32 gsi, int triggering, int polarity) { if (has_8259 && gsi < 16) return isa_irq_to_vector(gsi); return iosapic_register_intr(gsi, - (active_high_low == + (polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, - (edge_level == + (triggering == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); } diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index ba817e7454b..dc49bfb6db0 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c @@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1< Date: Fri, 16 Dec 2005 17:05:00 -0500 Subject: [ACPI] ACPICA 20051216 Implemented optional support to allow unresolved names within ASL Package objects. A null object is inserted in the package when a named reference cannot be located in the current namespace. Enabled via the interpreter slack flag which Linux has enabled by default (acpi=strict to disable slack). This should eliminate AE_NOT_FOUND exceptions seen on machines that contain such code. Implemented an optimization to the initialization sequence that can improve boot time. During ACPI device initialization, the _STA method is now run if and only if the _INI method exists. The _STA method is used to determine if the device is present; An _INI can only be run if _STA returns present, but it is a waste of time to run the _STA method if the _INI does not exist. (Prototype and assistance from Dong Wei) Implemented use of the C99 uintptr_t for the pointer casting macros if it is available in the current compiler. Otherwise, the default (void *) cast is used as before. Fixed some possible memory leaks found within the execution path of the Break, Continue, If, and CreateField operators. (Valery Podrezov) Fixed a problem introduced in the 20051202 release where an exception is generated during method execution if a control method attempts to declare another method. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsmethod.c | 65 +++++++- drivers/acpi/dispatcher/dsobject.c | 81 ++++++---- drivers/acpi/dispatcher/dswexec.c | 33 +--- drivers/acpi/dispatcher/dswload.c | 110 ++++++++++---- drivers/acpi/executer/exoparg3.c | 4 +- drivers/acpi/hardware/hwregs.c | 3 +- drivers/acpi/namespace/nsinit.c | 85 ++++++----- drivers/acpi/namespace/nssearch.c | 17 ++- drivers/acpi/namespace/nsxfeval.c | 4 +- drivers/acpi/parser/psargs.c | 198 +++++++++++++----------- drivers/acpi/parser/psloop.c | 9 ++ drivers/acpi/parser/psparse.c | 17 ++- drivers/acpi/resources/rsdump.c | 1 - drivers/acpi/utilities/utalloc.c | 4 +- drivers/acpi/utilities/uteval.c | 20 +-- drivers/acpi/utilities/utglobal.c | 9 +- drivers/acpi/utilities/utmisc.c | 2 +- drivers/acpi/utilities/utresrc.c | 109 +++++++++++++ include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 22 +-- include/acpi/acdispat.h | 3 + include/acpi/acglobal.h | 8 +- include/acpi/aclocal.h | 31 ++++ include/acpi/acmacros.h | 24 +-- include/acpi/actbl.h | 6 + include/acpi/actypes.h | 303 ++++++++++++++++++++----------------- include/acpi/acutils.h | 24 +++ 27 files changed, 775 insertions(+), 419 deletions(-) diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 58ad00b31ee..e7ce86b8d95 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -47,10 +47,68 @@ #include #include #include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmethod") +/******************************************************************************* + * + * FUNCTION: acpi_ds_method_error + * + * PARAMETERS: Status - Execution status + * walk_state - Current state + * + * RETURN: Status + * + * DESCRIPTION: Called on method error. Invoke the global exception handler if + * present, dump the method data if the disassembler is configured + * + * Note: Allows the exception handler to change the status code + * + ******************************************************************************/ +acpi_status +acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) +{ + ACPI_FUNCTION_ENTRY(); + + /* Ignore AE_OK and control exception codes */ + + if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) { + return (status); + } + + /* Invoke the global exception handler */ + + if (acpi_gbl_exception_handler) { + /* Exit the interpreter, allow handler to execute methods */ + + acpi_ex_exit_interpreter(); + + /* + * Handler can map the exception code to anything it wants, including + * AE_OK, in which case the executing method will not be aborted. + */ + status = acpi_gbl_exception_handler(status, + walk_state->method_node ? + walk_state->method_node-> + name.integer : 0, + walk_state->opcode, + walk_state->aml_offset, + NULL); + (void)acpi_ex_enter_interpreter(); + } +#ifdef ACPI_DISASSEMBLER + if (ACPI_FAILURE(status)) { + /* Display method locals/args if disassembler is present */ + + acpi_dm_dump_method_info(status, walk_state, walk_state->op); + } +#endif + + return (status); +} + /******************************************************************************* * * FUNCTION: acpi_ds_begin_method_execution @@ -66,10 +124,11 @@ ACPI_MODULE_NAME("dsmethod") * for clearance to execute. * ******************************************************************************/ + acpi_status -acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, - union acpi_operand_object *obj_desc, - struct acpi_namespace_node *calling_method_node) +acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, + union acpi_operand_object * obj_desc, + struct acpi_namespace_node * calling_method_node) { acpi_status status = AE_OK; diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8ac0cd93adb..905a84e4b14 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -51,6 +51,7 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsobject") +/* Local prototypes */ static acpi_status acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, union acpi_parse_object *op, @@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, *obj_desc_ptr = NULL; if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { /* - * This is an named object reference. If this name was + * This is a named object reference. If this name was * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ @@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - (struct acpi_namespace_node **) - &(op->common.node)); - + ACPI_CAST_INDIRECT_PTR(struct + acpi_namespace_node, + &(op-> + common. + node))); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(op->common.value.string, - status); + /* Check if we are resolving a named reference within a package */ + + if ((status == AE_NOT_FOUND) + && (acpi_gbl_enable_interpreter_slack) + && + ((op->common.parent->common.aml_opcode == + AML_PACKAGE_OP) + || (op->common.parent->common.aml_opcode == + AML_VAR_PACKAGE_OP))) { + /* + * We didn't find the target and we are populating elements + * of a package - ignore if slack enabled. Some ASL code + * contains dangling invalid references in packages and + * expects that no exception will be issued. Leave the + * element as a null element. It cannot be used, but it + * can be overwritten by subsequent ASL code - this is + * typically the case. + */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Ignoring unresolved reference in package [%4.4s]\n", + walk_state-> + scope_info->scope. + node->name.ascii)); + + return_ACPI_STATUS(AE_OK); + } else { + ACPI_REPORT_NSERROR(op->common.value. + string, status); + } + return_ACPI_STATUS(status); } } } - /* Create and init the internal ACPI object */ + /* Create and init a new internal ACPI object */ obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info (op->common.aml_opcode))-> @@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); + /* + * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". + * The buffer object already exists (from the NS node), otherwise it must + * be created. + */ obj_desc = *obj_desc_ptr; - if (obj_desc) { - /* - * We are evaluating a Named buffer object "Name (xxxx, Buffer)". - * The buffer object already exists (from the NS node) - */ - } else { + if (!obj_desc) { /* Create a new buffer object */ obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); @@ -259,7 +290,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, union acpi_operand_object *obj_desc = NULL; u32 package_list_length; acpi_status status = AE_OK; - u32 i; + acpi_native_uint i; ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); @@ -271,13 +302,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, parent = parent->common.parent; } + /* + * If we are evaluating a Named package object "Name (xxxx, Package)", + * the package object already exists, otherwise it must be created. + */ obj_desc = *obj_desc_ptr; - if (obj_desc) { - /* - * We are evaluating a Named package object "Name (xxxx, Package)". - * Get the existing package object from the NS node - */ - } else { + if (!obj_desc) { obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); *obj_desc_ptr = obj_desc; if (!obj_desc) { @@ -291,11 +321,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, /* Count the number of items in the package list */ - package_list_length = 0; arg = op->common.value.arg; arg = arg->common.next; - while (arg) { - package_list_length++; + for (package_list_length = 0; arg; package_list_length++) { arg = arg->common.next; } @@ -322,12 +350,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, } /* - * Now init the elements of the package + * Initialize all elements of the package */ - i = 0; arg = op->common.value.arg; arg = arg->common.next; - while (arg) { + for (i = 0; arg; i++) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { /* Object (package or buffer) is already built */ @@ -340,8 +367,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, package. elements[i]); } - - i++; arg = arg->common.next; } diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index e522763bb69..74f6996db2d 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -314,12 +314,13 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: - /* * Most operators with arguments. * Start a new result/operand state */ - status = acpi_ds_result_stack_push(walk_state); + if (walk_state->opcode != AML_CREATE_FIELD_OP) { + status = acpi_ds_result_stack_push(walk_state); + } break; default: @@ -723,20 +724,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) cleanup: - /* Invoke exception handler on error */ - - if (ACPI_FAILURE(status) && - acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { - acpi_ex_exit_interpreter(); - status = acpi_gbl_exception_handler(status, - walk_state->method_node-> - name.integer, - walk_state->opcode, - walk_state->aml_offset, - NULL); - (void)acpi_ex_enter_interpreter(); - } - if (walk_state->result_obj) { /* Break to debugger to display result */ @@ -758,18 +745,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) } #endif - /* Always clear the object stack */ - - walk_state->num_operands = 0; - -#ifdef ACPI_DISASSEMBLER - - /* On error, display method locals/args */ + /* Invoke exception handler on error */ if (ACPI_FAILURE(status)) { - acpi_dm_dump_method_info(status, walk_state, op); + status = acpi_ds_method_error(status, walk_state); } -#endif + /* Always clear the object stack */ + + walk_state->num_operands = 0; return_ACPI_STATUS(status); } diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 44d4f4bb2f9..441931cab08 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -428,43 +428,54 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) } } - if (op->common.aml_opcode == AML_METHOD_OP) { - /* - * method_op pkg_length name_string method_flags term_list - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p named_obj=%p\n", - walk_state, op, op->named.node)); + /* + * If we are executing a method, do not create any namespace objects + * during the load phase, only during execution. + */ + if (!walk_state->method_node) { + if (op->common.aml_opcode == AML_METHOD_OP) { + /* + * method_op pkg_length name_string method_flags term_list + * + * Note: We must create the method node/object pair as soon as we + * see the method declaration. This allows later pass1 parsing + * of invocations of the method (need to know the number of + * arguments.) + */ + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p named_obj=%p\n", + walk_state, op, op->named.node)); - if (!acpi_ns_get_attached_object(op->named.node)) { - walk_state->operands[0] = (void *)op->named.node; - walk_state->num_operands = 1; + if (!acpi_ns_get_attached_object(op->named.node)) { + walk_state->operands[0] = + ACPI_CAST_PTR(void, op->named.node); + walk_state->num_operands = 1; - status = - acpi_ds_create_operands(walk_state, - op->common.value.arg); - if (ACPI_SUCCESS(status)) { - status = acpi_ex_create_method(op->named.data, - op->named.length, - walk_state); - } - walk_state->operands[0] = NULL; - walk_state->num_operands = 0; + status = + acpi_ds_create_operands(walk_state, + op->common.value. + arg); + if (ACPI_SUCCESS(status)) { + status = + acpi_ex_create_method(op->named. + data, + op->named. + length, + walk_state); + } + walk_state->operands[0] = NULL; + walk_state->num_operands = 0; - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } } } } - /* Pop the scope stack */ + /* Pop the scope stack (only if loading a table) */ - if (acpi_ns_opens_scope(object_type)) { + if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", acpi_ut_get_type_name(object_type), op)); @@ -1015,11 +1026,50 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_create_node(walk_state, node, op); break; + + case AML_METHOD_OP: + /* + * method_op pkg_length name_string method_flags term_list + * + * Note: We must create the method node/object pair as soon as we + * see the method declaration. This allows later pass1 parsing + * of invocations of the method (need to know the number of + * arguments.) + */ + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p named_obj=%p\n", + walk_state, op, op->named.node)); + + if (!acpi_ns_get_attached_object(op->named.node)) { + walk_state->operands[0] = + ACPI_CAST_PTR(void, op->named.node); + walk_state->num_operands = 1; + + status = + acpi_ds_create_operands(walk_state, + op->common.value. + arg); + if (ACPI_SUCCESS(status)) { + status = + acpi_ex_create_method(op->named. + data, + op->named. + length, + walk_state); + } + walk_state->operands[0] = NULL; + walk_state->num_operands = 0; + + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } + break; + #endif /* ACPI_NO_METHOD_EXECUTION */ default: /* All NAMED_COMPLEX opcodes must be handled above */ - /* Note: Method objects were already created in Pass 1 */ break; } break; diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 48336577767..2ea1c322970 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c @@ -223,8 +223,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) goto cleanup; } - if (length > 0) { - /* Copy the portion requested */ + if (buffer) { + /* We have a buffer, copy the portion requested */ ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, length); diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 536a7aea80c..b243f20708b 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -144,7 +144,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) info.parameters = NULL; info.return_object = NULL; - sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; + sleep_state_name = + ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); status = acpi_ns_evaluate_by_name(sleep_state_name, &info); if (ACPI_FAILURE(status)) { diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 0a08d2f04a0..efa3f423373 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -336,23 +336,22 @@ acpi_ns_init_one_device(acpi_handle obj_handle, struct acpi_parameter_info pinfo; u32 flags; acpi_status status; + struct acpi_namespace_node *ini_node; + struct acpi_namespace_node *device_node; ACPI_FUNCTION_TRACE("ns_init_one_device"); - pinfo.parameters = NULL; - pinfo.parameter_type = ACPI_PARAM_ARGS; - - pinfo.node = acpi_ns_map_handle_to_node(obj_handle); - if (!pinfo.node) { + device_node = acpi_ns_map_handle_to_node(obj_handle); + if (!device_node) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * We will run _STA/_INI on Devices, Processors and thermal_zones only */ - if ((pinfo.node->type != ACPI_TYPE_DEVICE) && - (pinfo.node->type != ACPI_TYPE_PROCESSOR) && - (pinfo.node->type != ACPI_TYPE_THERMAL)) { + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_THERMAL)) { return_ACPI_STATUS(AE_OK); } @@ -364,57 +363,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle, info->device_count++; /* - * Run _STA to determine if we can run _INI on the device. + * Check if the _INI method exists for this device - + * if _INI does not exist, there is no need to run _STA + * No _INI means device requires no initialization + */ + status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), + device_node, ACPI_TYPE_METHOD, &ini_node); + if (ACPI_FAILURE(status)) { + /* No _INI method found - move on to next device */ + + return_ACPI_STATUS(AE_OK); + } + + /* + * Run _STA to determine if we can run _INI on the device - + * the device must be present before _INI can be run. + * However, _STA is not required - assume device present if no _STA */ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, - pinfo.node, + device_node, METHOD_NAME__STA)); - status = acpi_ut_execute_STA(pinfo.node, &flags); + pinfo.node = device_node; + pinfo.parameters = NULL; + pinfo.parameter_type = ACPI_PARAM_ARGS; + + status = acpi_ut_execute_STA(pinfo.node, &flags); if (ACPI_FAILURE(status)) { - if (pinfo.node->type == ACPI_TYPE_DEVICE) { - /* Ignore error and move on to next device */ + /* Ignore error and move on to next device */ - return_ACPI_STATUS(AE_OK); - } + return_ACPI_STATUS(AE_OK); + } - /* _STA is not required for Processor or thermal_zone objects */ - } else { + if (flags != ACPI_UINT32_MAX) { info->num_STA++; + } - if (!(flags & 0x01)) { - /* Don't look at children of a not present device */ + if (!(flags & ACPI_STA_DEVICE_PRESENT)) { + /* Don't look at children of a not present device */ - return_ACPI_STATUS(AE_CTRL_DEPTH); - } + return_ACPI_STATUS(AE_CTRL_DEPTH); } /* - * The device is present. Run _INI. + * The device is present and _INI exists. Run the _INI method. + * (We already have the _INI node from above) */ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, pinfo.node, METHOD_NAME__INI)); - status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); - if (ACPI_FAILURE(status)) { - /* No _INI (AE_NOT_FOUND) means device requires no initialization */ - if (status != AE_NOT_FOUND) { - /* Ignore error and move on to next device */ + pinfo.node = ini_node; + status = acpi_ns_evaluate_by_handle(&pinfo); + if (ACPI_FAILURE(status)) { + /* Ignore error and move on to next device */ #ifdef ACPI_DEBUG_OUTPUT - char *scope_name = - acpi_ns_get_external_pathname(pinfo.node); + char *scope_name = acpi_ns_get_external_pathname(ini_node); - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", - scope_name, - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", + scope_name, acpi_format_exception(status))); - ACPI_MEM_FREE(scope_name); + ACPI_MEM_FREE(scope_name); #endif - } - - status = AE_OK; } else { /* Delete any return object (especially if implicit_return is enabled) */ @@ -434,5 +445,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle, acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); } - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 50a3ca5470e..c1b1943d467 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name, if (scope_name) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", - scope_name, node, - (char *)&target_name, + scope_name, node, ACPI_CAST_PTR(char, + &target_name), acpi_ut_get_type_name(type))); ACPI_MEM_FREE(scope_name); @@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name, */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", - (char *)&target_name, + ACPI_CAST_PTR(char, &target_name), acpi_ut_get_type_name(next_node-> type), next_node, @@ -160,7 +160,8 @@ acpi_ns_search_node(u32 target_name, ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", - (char *)&target_name, acpi_ut_get_type_name(type), + ACPI_CAST_PTR(char, &target_name), + acpi_ut_get_type_name(type), acpi_ut_get_node_name(node), node, node->child)); return_ACPI_STATUS(AE_NOT_FOUND); @@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name, */ if (!parent_node) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", - (char *)&target_name)); + ACPI_CAST_PTR(char, &target_name))); return_ACPI_STATUS(AE_NOT_FOUND); } if (acpi_ns_local(type)) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] type [%s] must be local to this scope (no parent search)\n", - (char *)&target_name, + ACPI_CAST_PTR(char, &target_name), acpi_ut_get_type_name(type))); return_ACPI_STATUS(AE_NOT_FOUND); } @@ -227,7 +228,7 @@ acpi_ns_search_parent_tree(u32 target_name, ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching parent [%4.4s] for [%4.4s]\n", acpi_ut_get_node_name(parent_node), - (char *)&target_name)); + ACPI_CAST_PTR(char, &target_name))); /* * Search parents until target is found or we have backed up to the root @@ -360,7 +361,7 @@ acpi_ns_search_and_enter(u32 target_name, if (interpreter_mode == ACPI_IMODE_EXECUTE) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n", - (char *)&target_name, node)); + ACPI_CAST_PTR(char, &target_name), node)); return_ACPI_STATUS(AE_NOT_FOUND); } diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 8167af1fa57..75b137a6a3c 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -473,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, return (AE_CTRL_DEPTH); } - if (!(flags & 0x01)) { - /* Don't return at the device or children of the device if not there */ + if (!(flags & ACPI_STA_DEVICE_PRESENT)) { + /* Don't examine children of the device if not present */ return (AE_CTRL_DEPTH); } diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 6eae35febcc..e6d4cb9fd30 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -45,6 +45,7 @@ #include #include #include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psargs") @@ -211,7 +212,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) * Arg - Where the namepath will be stored * arg_count - If the namepath points to a control method * the method's argument is returned here. - * method_call - Whether the namepath can possibly be the + * possible_method_call - Whether the namepath can possibly be the * start of a method call * * RETURN: Status @@ -227,11 +228,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) acpi_status acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, struct acpi_parse_state *parser_state, - union acpi_parse_object *arg, u8 method_call) + union acpi_parse_object *arg, u8 possible_method_call) { char *path; union acpi_parse_object *name_op; - acpi_status status = AE_OK; + acpi_status status; union acpi_operand_object *method_desc; struct acpi_namespace_node *node; union acpi_generic_state scope_info; @@ -239,114 +240,127 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, ACPI_FUNCTION_TRACE("ps_get_next_namepath"); path = acpi_ps_get_next_namestring(parser_state); + acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); - /* Null path case is allowed */ + /* Null path case is allowed, just exit */ - if (path) { - /* - * Lookup the name in the internal namespace - */ - scope_info.scope.node = NULL; - node = parser_state->start_node; - if (node) { - scope_info.scope.node = node; - } + if (!path) { + arg->common.value.name = path; + return_ACPI_STATUS(AE_OK); + } - /* - * Lookup object. We don't want to add anything new to the namespace - * here, however. So we use MODE_EXECUTE. Allow searching of the - * parent tree, but don't open a new scope -- we just want to lookup the - * object (MUST BE mode EXECUTE to perform upsearch) - */ - status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | - ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); - if (ACPI_SUCCESS(status) && method_call) { - if (node->type == ACPI_TYPE_METHOD) { - /* This name is actually a control method invocation */ - - method_desc = acpi_ns_get_attached_object(node); - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Control Method - %p Desc %p Path=%p\n", - node, method_desc, path)); - - name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); - if (!name_op) { - return_ACPI_STATUS(AE_NO_MEMORY); - } + /* Setup search scope info */ + + scope_info.scope.node = NULL; + node = parser_state->start_node; + if (node) { + scope_info.scope.node = node; + } - /* Change arg into a METHOD CALL and attach name to it */ + /* + * Lookup the name in the internal namespace. We don't want to add + * anything new to the namespace here, however, so we use MODE_EXECUTE. + * Allow searching of the parent tree, but don't open a new scope - + * we just want to lookup the object (must be mode EXECUTE to perform + * the upsearch) + */ + status = + acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &node); - acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); - name_op->common.value.name = path; + /* + * If this name is a control method invocation, we must + * setup the method call + */ + if (ACPI_SUCCESS(status) && + possible_method_call && (node->type == ACPI_TYPE_METHOD)) { + /* This name is actually a control method invocation */ - /* Point METHODCALL/NAME to the METHOD Node */ + method_desc = acpi_ns_get_attached_object(node); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Control Method - %p Desc %p Path=%p\n", node, + method_desc, path)); - name_op->common.node = node; - acpi_ps_append_arg(arg, name_op); + name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); + if (!name_op) { + return_ACPI_STATUS(AE_NO_MEMORY); + } - if (!method_desc) { - ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); - return_ACPI_STATUS(AE_AML_INTERNAL); - } + /* Change Arg into a METHOD CALL and attach name to it */ - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Control Method - %p Args %X\n", - node, - method_desc->method. - param_count)); + acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); + name_op->common.value.name = path; - /* Get the number of arguments to expect */ + /* Point METHODCALL/NAME to the METHOD Node */ - walk_state->arg_count = - method_desc->method.param_count; - return_ACPI_STATUS(AE_OK); - } + name_op->common.node = node; + acpi_ps_append_arg(arg, name_op); - /* - * Else this is normal named object reference. - * Just init the NAMEPATH object with the pathname. - * (See code below) - */ + if (!method_desc) { + ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); + return_ACPI_STATUS(AE_AML_INTERNAL); } - if (ACPI_FAILURE(status)) { - /* - * 1) Any error other than NOT_FOUND is always severe - * 2) NOT_FOUND is only important if we are executing a method. - * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. - */ - if ((((walk_state-> - parse_flags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND) - && (walk_state->op->common.aml_opcode != - AML_COND_REF_OF_OP)) - || (status != AE_NOT_FOUND)) { - ACPI_REPORT_NSERROR(path, status); - - acpi_os_printf - ("search_node %p start_node %p return_node %p\n", - scope_info.scope.node, - parser_state->start_node, node); - } else { - /* - * We got a NOT_FOUND during table load or we encountered - * a cond_ref_of(x) where the target does not exist. - * Either case is ok - */ - status = AE_OK; - } - } + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Control Method - %p Args %X\n", + node, method_desc->method.param_count)); + + /* Get the number of arguments to expect */ + + walk_state->arg_count = method_desc->method.param_count; + return_ACPI_STATUS(AE_OK); } /* - * Regardless of success/failure above, - * Just initialize the Op with the pathname. + * Special handling if the name was not found during the lookup - + * some not_found cases are allowed */ - acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); - arg->common.value.name = path; + if (status == AE_NOT_FOUND) { + /* 1) not_found is ok during load pass 1/2 (allow forward references) */ + + if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != + ACPI_PARSE_EXECUTE) { + status = AE_OK; + } + + /* 2) not_found during a cond_ref_of(x) is ok by definition */ + + else if (walk_state->op->common.aml_opcode == + AML_COND_REF_OF_OP) { + status = AE_OK; + } + + /* + * 3) not_found while building a Package is ok at this point, we + * may flag as an error later if slack mode is not enabled. + * (Some ASL code depends on allowing this behavior) + */ + else if ((arg->common.parent) && + ((arg->common.parent->common.aml_opcode == + AML_PACKAGE_OP) + || (arg->common.parent->common.aml_opcode == + AML_VAR_PACKAGE_OP))) { + status = AE_OK; + } + } + + /* Final exception check (may have been changed from code above) */ + + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(path, status); + + if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) { + /* Report a control method execution error */ + status = acpi_ds_method_error(status, walk_state); + } + } + + /* Save the namepath */ + + arg->common.value.name = path; return_ACPI_STATUS(status); } diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 088d33999d9..e81e51b8b3a 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -704,6 +704,15 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); + + if (op->common.aml_opcode != AML_WHILE_OP) { + status2 = + acpi_ds_result_stack_pop + (walk_state); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); + } + } } /* Close this iteration of the While loop */ diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 7cfa7eb0dfc..f0979b2956f 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -333,7 +333,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, switch (callback_status) { case AE_CTRL_TERMINATE: - /* * A control method was terminated via a RETURN statement. * The walk of this method is complete. @@ -346,13 +345,19 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, parser_state->aml = walk_state->aml_last_while; walk_state->control_state->common.value = FALSE; - status = AE_CTRL_BREAK; + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_BREAK; + } break; case AE_CTRL_CONTINUE: parser_state->aml = walk_state->aml_last_while; - status = AE_CTRL_CONTINUE; + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_CONTINUE; + } break; case AE_CTRL_PENDING: @@ -369,16 +374,18 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, #endif case AE_CTRL_TRUE: - /* * Predicate of an IF was true, and we are at the matching ELSE. * Just close out this package */ parser_state->aml = acpi_ps_get_next_package_end(parser_state); + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_PENDING; + } break; case AE_CTRL_FALSE: - /* * Either an IF/WHILE Predicate was false or we encountered a BREAK * opcode. In both cases, we do not execute the rest of the diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index cebd890d3db..c24e3eb658c 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -43,7 +43,6 @@ #include #include -#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsdump") diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index e04b6119a4d..b11b7ed788c 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -47,7 +47,7 @@ ACPI_MODULE_NAME("utalloc") /* Local prototypes */ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS +#ifdef ACPI_DBG_TRACK_ALLOCATIONS static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); static acpi_status @@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address, static acpi_status acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, u32 component, char *module, u32 line); -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS static acpi_status acpi_ut_create_list(char *list_name, u16 object_size, struct acpi_memory_list **return_cache); diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 7b81d5ef3c3..cd63a2d93fe 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -95,7 +95,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { if (!ACPI_STRCMP(string_desc->string.pointer, - (char *)acpi_gbl_valid_osi_strings[i])) { + ACPI_CAST_PTR(char, + acpi_gbl_valid_osi_strings[i]))) + { /* This string is supported */ return_desc->integer.value = 0xFFFFFFFF; @@ -592,7 +594,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) "_STA on %4.4s was not found, assuming device is present\n", acpi_ut_get_node_name(device_node))); - *flags = 0x0F; + *flags = ACPI_UINT32_MAX; status = AE_OK; } @@ -637,17 +639,17 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) for (i = 0; i < 4; i++) { highest[i] = 0xFF; status = acpi_ut_evaluate_object(device_node, - (char *) - acpi_gbl_highest_dstate_names - [i], ACPI_BTYPE_INTEGER, - &obj_desc); + ACPI_CAST_PTR(char, + acpi_gbl_highest_dstate_names + [i]), + ACPI_BTYPE_INTEGER, &obj_desc); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s on Device %4.4s, %s\n", - (char *) - acpi_gbl_highest_dstate_names - [i], + ACPI_CAST_PTR(char, + acpi_gbl_highest_dstate_names + [i]), acpi_ut_get_node_name (device_node), acpi_format_exception diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 6828c7aefa8..7c59c2b0d95 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -485,7 +485,7 @@ char *acpi_ut_get_region_name(u8 space_id) return ("invalid_space_id"); } - return ((char *)acpi_gbl_region_types[space_id]); + return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); } /******************************************************************************* @@ -690,11 +690,12 @@ char *acpi_ut_get_descriptor_name(void *object) } if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { - return ((char *)acpi_gbl_bad_type); + return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); } - return ((char *) - acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); + return (ACPI_CAST_PTR(char, + acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE + (object)])); } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 64dd64b1aa1..48d511d5c04 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -179,7 +179,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Zero is not a valid owner_iD */ - if ((owner_id == 0) || (owner_id > 255)) { + if (owner_id == 0) { ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); return_VOID; } diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 6c0ce7b1219..eaf0edec6ef 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -47,6 +47,115 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") +#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) +/* + * Strings used to decode resource descriptors. + * Used by both the disasssembler and the debugger resource dump routines + */ +const char *acpi_gbl_BMdecode[2] = { + "not_bus_master", + "bus_master" +}; + +const char *acpi_gbl_config_decode[4] = { + "0 - Good Configuration", + "1 - Acceptable Configuration", + "2 - Suboptimal Configuration", + "3 - ***Invalid Configuration***", +}; + +const char *acpi_gbl_consume_decode[2] = { + "resource_producer", + "resource_consumer" +}; + +const char *acpi_gbl_DECdecode[2] = { + "pos_decode", + "sub_decode" +}; + +const char *acpi_gbl_HEdecode[2] = { + "Level", + "Edge" +}; + +const char *acpi_gbl_io_decode[2] = { + "Decode10", + "Decode16" +}; + +const char *acpi_gbl_LLdecode[2] = { + "active_high", + "active_low" +}; + +const char *acpi_gbl_max_decode[2] = { + "max_not_fixed", + "max_fixed" +}; + +const char *acpi_gbl_MEMdecode[4] = { + "non_cacheable", + "Cacheable", + "write_combining", + "Prefetchable" +}; + +const char *acpi_gbl_min_decode[2] = { + "min_not_fixed", + "min_fixed" +}; + +const char *acpi_gbl_MTPdecode[4] = { + "address_range_memory", + "address_range_reserved", + "address_range_aCPI", + "address_range_nVS" +}; + +const char *acpi_gbl_RNGdecode[4] = { + "invalid_ranges", + "non_iSAonly_ranges", + "ISAonly_ranges", + "entire_range" +}; + +const char *acpi_gbl_RWdecode[2] = { + "read_only", + "read_write" +}; + +const char *acpi_gbl_SHRdecode[2] = { + "Exclusive", + "Shared" +}; + +const char *acpi_gbl_SIZdecode[4] = { + "Transfer8", + "Transfer8_16", + "Transfer16", + "invalid_size" +}; + +const char *acpi_gbl_TRSdecode[2] = { + "dense_translation", + "sparse_translation" +}; + +const char *acpi_gbl_TTPdecode[2] = { + "type_static", + "type_translation" +}; + +const char *acpi_gbl_TYPdecode[4] = { + "Compatibility", + "type_a", + "type_b", + "type_f" +}; + +#endif + /* * Base sizes of the raw AML resource descriptors, indexed by resource type. * Zero indicates a reserved (and therefore invalid) resource type. diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index f48b9ee9a87..1f2477eb95f 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20051202 +#define ACPI_CA_VERSION 0x20051216 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 99250ee1b9d..0a8f49f5d2f 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -57,27 +57,11 @@ struct acpi_external_list { }; extern struct acpi_external_list *acpi_gbl_external_list; -extern const char *acpi_gbl_io_decode[2]; + +/* Strings used for decoding flags to ASL keywords */ + extern const char *acpi_gbl_word_decode[4]; -extern const char *acpi_gbl_consume_decode[2]; -extern const char *acpi_gbl_config_decode[4]; -extern const char *acpi_gbl_min_decode[2]; -extern const char *acpi_gbl_max_decode[2]; -extern const char *acpi_gbl_DECdecode[2]; -extern const char *acpi_gbl_RNGdecode[4]; -extern const char *acpi_gbl_MEMdecode[4]; -extern const char *acpi_gbl_RWdecode[2]; extern const char *acpi_gbl_irq_decode[2]; -extern const char *acpi_gbl_HEdecode[2]; -extern const char *acpi_gbl_LLdecode[2]; -extern const char *acpi_gbl_SHRdecode[2]; -extern const char *acpi_gbl_TYPdecode[4]; -extern const char *acpi_gbl_BMdecode[2]; -extern const char *acpi_gbl_SIZdecode[4]; -extern const char *acpi_gbl_TTPdecode[2]; -extern const char *acpi_gbl_MTPdecode[4]; -extern const char *acpi_gbl_TRSdecode[2]; - extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 065f24a77cf..cc6407eef70 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -201,6 +201,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, union acpi_operand_object *obj_desc, struct acpi_namespace_node *calling_method_node); +acpi_status +acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); + /* * dsinit */ diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 3f37560c26a..dfb3b2493ae 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -98,11 +98,15 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; /* * Enable "slack" in the AML interpreter? Default is FALSE, and the * interpreter strictly follows the ACPI specification. Setting to TRUE - * allows the interpreter to forgive certain bad AML constructs. Currently: + * allows the interpreter to ignore certain errors and/or bad AML constructs. + * + * Currently, these features are enabled by this flag: + * * 1) Allow "implicit return" of last value in a control method - * 2) Allow access beyond end of operation region + * 2) Allow access beyond the end of an operation region * 3) Allow access to uninitialized locals/args (auto-init to integer 0) * 4) Allow ANY object type to be a source operand for the Store() operator + * 5) Allow unresolved references (invalid target name) in package objects */ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 0cb61a72d97..da7f1cb96f5 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -276,6 +276,37 @@ struct acpi_create_field_info { u8 field_type; }; +/* + * Bitmapped ACPI types. Used internally only + */ +#define ACPI_BTYPE_ANY 0x00000000 +#define ACPI_BTYPE_INTEGER 0x00000001 +#define ACPI_BTYPE_STRING 0x00000002 +#define ACPI_BTYPE_BUFFER 0x00000004 +#define ACPI_BTYPE_PACKAGE 0x00000008 +#define ACPI_BTYPE_FIELD_UNIT 0x00000010 +#define ACPI_BTYPE_DEVICE 0x00000020 +#define ACPI_BTYPE_EVENT 0x00000040 +#define ACPI_BTYPE_METHOD 0x00000080 +#define ACPI_BTYPE_MUTEX 0x00000100 +#define ACPI_BTYPE_REGION 0x00000200 +#define ACPI_BTYPE_POWER 0x00000400 +#define ACPI_BTYPE_PROCESSOR 0x00000800 +#define ACPI_BTYPE_THERMAL 0x00001000 +#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 +#define ACPI_BTYPE_DDB_HANDLE 0x00004000 +#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 +#define ACPI_BTYPE_REFERENCE 0x00010000 +#define ACPI_BTYPE_RESOURCE 0x00020000 + +#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) + +#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) +#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) +#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ +#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF + /***************************************************************************** * * Event typedefs and structs diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 65a1a5c1a68..0fa8f72dbac 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -60,7 +60,7 @@ /* * For 16-bit addresses, we have to assume that the upper 32 bits - * are zero. + * (out of 64) are zero. */ #define ACPI_LODWORD(l) ((u32)(l)) #define ACPI_HIDWORD(l) ((u32)(0)) @@ -104,8 +104,9 @@ #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) /* - * Extract a byte of data using a pointer. Any more than a byte and we - * get into potential aligment issues -- see the STORE macros below + * Extract data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below. + * Use with care. */ #define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) #define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) @@ -116,16 +117,17 @@ #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) -/* Pointer manipulation */ - -#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) -#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) -#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_native_uint)(b))) -#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b)) +/* + * Pointer manipulation + */ +#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) +#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_native_uint)(b))) +#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) /* Pointer/Integer type conversions */ -#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_native_uint)i) +#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) @@ -133,7 +135,7 @@ #if ACPI_MACHINE_WIDTH == 16 #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) -#define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i) +#define ACPI_PTR_TO_PHYSADDR(i) (u32) ACPI_CAST_PTR (u8,(i)) #else #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index a46f406e1c9..ef2ddcadfe6 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -44,6 +44,12 @@ #ifndef __ACTBL_H__ #define __ACTBL_H__ +/* + * Note about bitfields: The u8 type is used for bitfields in ACPI tables. + * This is the only type that is even remotely portable. Anything else is not + * portable, so do not use any other bitfield types. + */ + /* * Values for description table header signatures */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 11847592ed1..18e1338c5c7 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -44,7 +44,15 @@ #ifndef __ACTYPES_H__ #define __ACTYPES_H__ -/*! [Begin] no source code translation (keep the typedefs) */ +/* + * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header + * and must be either 16, 32, or 64 + */ +#ifndef ACPI_MACHINE_WIDTH +#error ACPI_MACHINE_WIDTH not defined +#endif + +/*! [Begin] no source code translation */ /* * Data type ranges @@ -58,154 +66,210 @@ #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ #define ACPI_ASCII_MAX 0x7F -#ifdef DEFINE_ALTERNATE_TYPES /* - * Types used only in translated source, defined here to enable - * cross-platform compilation only. + * Architecture-specific ACPICA Subsystem Data Types + * + * The goal of these types is to provide source code portability across + * 16-bit, 32-bit, and 64-bit targets. + * + * 1) The following types are of fixed size for all targets (16/32/64): + * + * BOOLEAN Logical boolean + * + * UINT8 8-bit (1 byte) unsigned value + * UINT16 16-bit (2 byte) unsigned value + * UINT32 32-bit (4 byte) unsigned value + * UINT64 64-bit (8 byte) unsigned value + * + * INT16 16-bit (2 byte) signed value + * INT32 32-bit (4 byte) signed value + * INT64 64-bit (8 byte) signed value + * + * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the + * compiler-dependent header(s) and were introduced because there is no common + * 64-bit integer type across the various compilation models, as shown in + * the table below. + * + * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit + * char 8 8 8 8 8 8 + * short 16 16 16 16 16 16 + * _int32 32 + * int 32 64 32 32 16 16 + * long 64 64 32 32 32 32 + * long long 64 64 + * pointer 64 64 64 32 32 32 + * + * Note: ILP64 and LP32 are currently not supported. + * + * + * 2) These types represent the native word size of the target mode of the + * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are + * usually used for memory allocation, efficient loop counters, and array + * indexes. The types are similar to the size_t type in the C library and are + * required because there is no C type that consistently represents the native + * data width. + * + * ACPI_SIZE 16/32/64-bit unsigned value + * ACPI_NATIVE_UINT 16/32/64-bit unsigned value + * ACPI_NATIVE_INT 16/32/64-bit signed value + * */ -typedef int s32; -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef COMPILER_DEPENDENT_UINT64 u64; -#endif - -/* - * Data types - Fixed across all compilation models (16/32/64) +/******************************************************************************* * - * BOOLEAN Logical Boolean. - * INT8 8-bit (1 byte) signed value - * UINT8 8-bit (1 byte) unsigned value - * INT16 16-bit (2 byte) signed value - * UINT16 16-bit (2 byte) unsigned value - * INT32 32-bit (4 byte) signed value - * UINT32 32-bit (4 byte) unsigned value - * INT64 64-bit (8 byte) signed value - * UINT64 64-bit (8 byte) unsigned value - * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value - */ + * Common types for all compilers, all targets + * + ******************************************************************************/ + +typedef unsigned char BOOLEAN; +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef COMPILER_DEPENDENT_INT64 INT64; -typedef unsigned long acpi_native_uint; +/*! [End] no source code translation !*/ -#ifndef ACPI_MACHINE_WIDTH -#error ACPI_MACHINE_WIDTH not defined -#endif +/******************************************************************************* + * + * Types specific to 64-bit targets + * + ******************************************************************************/ #if ACPI_MACHINE_WIDTH == 64 -/*! [Begin] no source code translation (keep the typedefs) */ +/*! [Begin] no source code translation (keep the typedefs as-is) */ -/* - * 64-bit type definitions - */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned short UINT16; -typedef int INT32; typedef unsigned int UINT32; -typedef COMPILER_DEPENDENT_INT64 INT64; -typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef int INT32; /*! [End] no source code translation !*/ +typedef u64 acpi_native_uint; +typedef s64 acpi_native_int; + typedef u64 acpi_table_ptr; typedef u64 acpi_io_address; typedef u64 acpi_physical_address; -typedef u64 acpi_size; -#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ -#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 +#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ + /* * In the case of the Itanium Processor Family (IPF), the hardware does not * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag * to indicate that special precautions must be taken to avoid alignment faults. * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) * - * Note: Em64_t and other X86-64 processors do support misaligned transfers, + * Note: Em64_t and other X86-64 processors support misaligned transfers, * so there is no need to define this flag. */ #if defined (__IA64__) || defined (__ia64__) #define ACPI_MISALIGNMENT_NOT_SUPPORTED #endif +/******************************************************************************* + * + * Types specific to 32-bit targets + * + ******************************************************************************/ + +#elif ACPI_MACHINE_WIDTH == 32 + +/*! [Begin] no source code translation (keep the typedefs as-is) */ + +typedef unsigned int UINT32; +typedef int INT32; + +/*! [End] no source code translation !*/ + +typedef u32 acpi_native_uint; +typedef s32 acpi_native_int; + +typedef u64 acpi_table_ptr; +typedef u32 acpi_io_address; +typedef u64 acpi_physical_address; + +#define ACPI_MAX_PTR ACPI_UINT32_MAX +#define ACPI_SIZE_MAX ACPI_UINT32_MAX + +#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 + +/******************************************************************************* + * + * Types specific to 16-bit targets + * + ******************************************************************************/ + #elif ACPI_MACHINE_WIDTH == 16 /*! [Begin] no source code translation (keep the typedefs as-is) */ -/* - * 16-bit type definitions - */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned int UINT16; -typedef long INT32; -typedef int INT16; typedef unsigned long UINT32; - -struct { - UINT32 Lo; - UINT32 Hi; -}; +typedef short INT16; +typedef long INT32; /*! [End] no source code translation !*/ +typedef u16 acpi_native_uint; +typedef s16 acpi_native_int; + typedef u32 acpi_table_ptr; typedef u32 acpi_io_address; typedef char *acpi_physical_address; -typedef u16 acpi_size; -#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 -#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX -/* - * (16-bit only) internal integers must be 32-bits, so - * 64-bit integers cannot be supported - */ -#define ACPI_NO_INTEGER64_SUPPORT +#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 +#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ -#elif ACPI_MACHINE_WIDTH == 32 +/* 64-bit integers cannot be supported */ -/*! [Begin] no source code translation (keep the typedefs) */ +#define ACPI_NO_INTEGER64_SUPPORT -/* - * 32-bit type definitions (default) - */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; -typedef COMPILER_DEPENDENT_INT64 INT64; -typedef COMPILER_DEPENDENT_UINT64 UINT64; +#else -/*! [End] no source code translation !*/ +/* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ -typedef u64 acpi_table_ptr; -typedef u32 acpi_io_address; -typedef u64 acpi_physical_address; -typedef u32 acpi_size; +#error unknown ACPI_MACHINE_WIDTH +#endif -#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 -#define ACPI_MAX_PTR ACPI_UINT32_MAX -#define ACPI_SIZE_MAX ACPI_UINT32_MAX +/******************************************************************************* + * + * OS- or compiler-dependent types + * + ******************************************************************************/ -#else -#error unknown ACPI_MACHINE_WIDTH +/* + * If acpi_uintptr_t was not defined in the OS- or compiler-dependent header, + * define it now (use C99 uintptr_t for pointer casting if available, + * "void *" otherwise) + */ +#ifndef acpi_uintptr_t +#define acpi_uintptr_t void * #endif /* - * This type is used for bitfields in ACPI tables. The only type that is - * even remotely portable is u8. Anything else is not portable, so - * do not add any more bitfield types. + * If acpi_cache_t was not defined in the OS-dependent header, + * define it now. This is typically the case where the local cache + * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) */ -typedef u8 UINT8_BIT; -typedef acpi_native_uint ACPI_PTRDIFF; +#ifndef acpi_cache_t +#define acpi_cache_t struct acpi_memory_list +#endif + +/* Variable-width type, used instead of clib size_t */ + +typedef acpi_native_uint acpi_size; + +/******************************************************************************* + * + * Independent types + * + ******************************************************************************/ /* * Pointer overlays to avoid lots of typecasting for @@ -237,18 +301,8 @@ struct acpi_pointer { #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER -/* - * If acpi_cache_t was not defined in the OS-dependent header, - * define it now. This is typically the case where the local cache - * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) - */ -#ifndef acpi_cache_t -#define acpi_cache_t struct acpi_memory_list -#endif +/* Logical defines and NULL */ -/* - * Useful defines - */ #ifdef FALSE #undef FALSE #endif @@ -264,12 +318,12 @@ struct acpi_pointer { #endif /* - * Local datatypes + * Mescellaneous types */ typedef u32 acpi_status; /* All ACPI Exceptions */ typedef u32 acpi_name; /* 4-byte ACPI name */ typedef char *acpi_string; /* Null terminated ASCII string */ -typedef void *acpi_handle; /* Actually a ptr to an Node */ +typedef void *acpi_handle; /* Actually a ptr to a NS Node */ struct uint64_struct { u32 lo; @@ -472,37 +526,6 @@ typedef u32 acpi_object_type; #define ACPI_TYPE_INVALID 0x1E #define ACPI_TYPE_NOT_FOUND 0xFF -/* - * Bitmapped ACPI types. Used internally only - */ -#define ACPI_BTYPE_ANY 0x00000000 -#define ACPI_BTYPE_INTEGER 0x00000001 -#define ACPI_BTYPE_STRING 0x00000002 -#define ACPI_BTYPE_BUFFER 0x00000004 -#define ACPI_BTYPE_PACKAGE 0x00000008 -#define ACPI_BTYPE_FIELD_UNIT 0x00000010 -#define ACPI_BTYPE_DEVICE 0x00000020 -#define ACPI_BTYPE_EVENT 0x00000040 -#define ACPI_BTYPE_METHOD 0x00000080 -#define ACPI_BTYPE_MUTEX 0x00000100 -#define ACPI_BTYPE_REGION 0x00000200 -#define ACPI_BTYPE_POWER 0x00000400 -#define ACPI_BTYPE_PROCESSOR 0x00000800 -#define ACPI_BTYPE_THERMAL 0x00001000 -#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 -#define ACPI_BTYPE_DDB_HANDLE 0x00004000 -#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 -#define ACPI_BTYPE_REFERENCE 0x00010000 -#define ACPI_BTYPE_RESOURCE 0x00020000 - -#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) - -#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) -#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) -#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) -#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ -#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF - /* * All I/O */ @@ -856,6 +879,14 @@ struct acpi_compatible_id_list { #define ACPI_VALID_CID 0x0010 #define ACPI_VALID_SXDS 0x0020 +/* Flags for _STA method */ + +#define ACPI_STA_DEVICE_PRESENT 0x01 +#define ACPI_STA_DEVICE_ENABLED 0x02 +#define ACPI_STA_DEVICE_UI 0x04 +#define ACPI_STA_DEVICE_OK 0x08 +#define ACPI_STA_BATTERY_PRESENT 0x10 + #define ACPI_COMMON_OBJ_INFO \ acpi_object_type type; /* ACPI object type */ \ acpi_name name /* ACPI object Name */ @@ -921,7 +952,9 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 #define ACPI_ISA_ONLY_RANGES (u8) 0x02 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) -#define ACPI_SPARSE_TRANSLATION (u8) 0x03 +/* Type of translation - 1=Sparse, 0=Dense */ + +#define ACPI_SPARSE_TRANSLATION (u8) 0x01 /* * IO Port Descriptor Decode diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 4ff963323de..5fa21e03a62 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -46,6 +46,30 @@ extern const u8 acpi_gbl_resource_aml_sizes[]; +/* Strings used by the disassembler and debugger resource dump routines */ + +#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) + +extern const char *acpi_gbl_BMdecode[2]; +extern const char *acpi_gbl_config_decode[4]; +extern const char *acpi_gbl_consume_decode[2]; +extern const char *acpi_gbl_DECdecode[2]; +extern const char *acpi_gbl_HEdecode[2]; +extern const char *acpi_gbl_io_decode[2]; +extern const char *acpi_gbl_LLdecode[2]; +extern const char *acpi_gbl_max_decode[2]; +extern const char *acpi_gbl_MEMdecode[4]; +extern const char *acpi_gbl_min_decode[2]; +extern const char *acpi_gbl_MTPdecode[4]; +extern const char *acpi_gbl_RNGdecode[4]; +extern const char *acpi_gbl_RWdecode[2]; +extern const char *acpi_gbl_SHRdecode[2]; +extern const char *acpi_gbl_SIZdecode[4]; +extern const char *acpi_gbl_TRSdecode[2]; +extern const char *acpi_gbl_TTPdecode[2]; +extern const char *acpi_gbl_TYPdecode[4]; +#endif + /* Types for Resource descriptor entries */ #define ACPI_INVALID_RESOURCE 0 -- cgit v1.2.3 From 3173cdfe02995f6c6841a28b5148f94cefd8ab77 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 28 Dec 2005 03:20:03 -0500 Subject: [ACPI] fix osl.c build warning typecheck complains on i386 that u32 != unsigned long Signed-off-by: Len Brown --- drivers/acpi/osl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 4ece850b2af..58e7c47354e 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1073,7 +1073,7 @@ acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) { - spin_unlock_irqrestore((spinlock_t *) handle, flags); + spin_unlock_irqrestore((spinlock_t *) handle, (unsigned long) flags); } #ifndef ACPI_USE_LOCAL_CACHE -- cgit v1.2.3 From b697b5372ecfe0c57ee26e0c3787fc2306109228 Mon Sep 17 00:00:00 2001 From: Karol Kozimor Date: Thu, 22 Dec 2005 12:42:00 -0500 Subject: [ASUS_ACPI] work around Samsung P30s oops The code used to rely on a certain method to return a NULL buffer, which is now hardly possible with the implicit return code on by default. This sort of fixes bugs #5067 and #5092 for now. Note: this patch makes the driver unusable on said machines (and on said machines only) iff acpi=strict is specified, but it seems noone really uses that. Signed-off-by: Karol Kozimor Signed-off-by: Len Brown --- drivers/acpi/asus_acpi.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index fec895af6ae..582995ef9f3 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -987,9 +987,21 @@ static int __init asus_hotk_get_info(void) printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", bsts_result); - /* Samsung P30 has a device with a valid _HID whose INIT does not - * return anything. Catch this one and any similar here */ - if (buffer.pointer == NULL) { + /* This is unlikely with implicit return */ + if (buffer.pointer == NULL) + return -EINVAL; + + model = (union acpi_object *) buffer.pointer; + /* + * Samsung P30 has a device with a valid _HID whose INIT does not + * return anything. It used to be possible to catch this exception, + * but the implicit return code will now happily confuse the + * driver. We assume that every ACPI_TYPE_STRING is a valid model + * identifier but it's still possible to get completely bogus data. + */ + if (model->type == ACPI_TYPE_STRING) { + printk(KERN_NOTICE " %s model detected, ", model->string.pointer); + } else { if (asus_info && /* Samsung P30 */ strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { hotk->model = P30; @@ -1002,13 +1014,10 @@ static int __init asus_hotk_get_info(void) "the developers with your DSDT\n"); } hotk->methods = &model_conf[hotk->model]; - return AE_OK; - } + + acpi_os_free(model); - model = (union acpi_object *)buffer.pointer; - if (model->type == ACPI_TYPE_STRING) { - printk(KERN_NOTICE " %s model detected, ", - model->string.pointer); + return AE_OK; } hotk->model = END_MODEL; -- cgit v1.2.3 From dacd9b80355525be0e3c519687868410e304ad1c Mon Sep 17 00:00:00 2001 From: Yu Luming Date: Sat, 31 Dec 2005 01:45:00 -0500 Subject: [ACPI] fix acpi_os_wait_sempahore() finite timeout case (AE_TIME warning) Before this fix, the finite timeout case behaved like the no-timeout (trylock) case. http://bugzilla.kernel.org/show_bug.cgi?id=4588 Signed-off-by: Luming Yu Signed-off-by: Len Brown --- drivers/acpi/osl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index e3cd0b16031..8653dac01a7 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -836,7 +836,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) static const int quantum_ms = 1000 / HZ; ret = down_trylock(sem); - for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { + for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) { schedule_timeout_interruptible(1); ret = down_trylock(sem); } -- cgit v1.2.3 From bb84db937a875045de9e6d08d177ad3223ae0ae3 Mon Sep 17 00:00:00 2001 From: Karol Kozimor Date: Tue, 3 Jan 2006 23:03:00 -0500 Subject: [ACPI_ASUS] M6R display reading This patch corrects the node to read display settings on M6R laptops. Signed-off-by: Karol Kozimor Signed-off-by: Len Brown --- drivers/acpi/asus_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 582995ef9f3..d4e1e95934f 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -302,7 +302,7 @@ static struct model_data model_conf[END_MODEL] = { .brightness_set = "SPLV", .brightness_get = "GPLV", .display_set = "SDSP", - .display_get = "\\SSTE"}, + .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"}, { .name = "M6R", .mt_mled = "MLED", -- cgit v1.2.3 From aea19aa0780d4b006372fedab8434226e1cc7686 Mon Sep 17 00:00:00 2001 From: Karol Kozimor Date: Tue, 3 Jan 2006 23:05:00 -0500 Subject: [ACPI_ASUS] fix asus module param description Signed-off-by: Karol Kozimor Signed-off-by: Len Brown --- drivers/acpi/asus_acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index d4e1e95934f..f4c87750dbf 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -78,9 +78,9 @@ MODULE_LICENSE("GPL"); static uid_t asus_uid; static gid_t asus_gid; module_param(asus_uid, uint, 0); -MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n"); +MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus.\n"); module_param(asus_gid, uint, 0); -MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); +MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus.\n"); /* For each model, all features implemented, * those marked with R are relative to HOTK, A for absolute */ @@ -851,6 +851,8 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) mode = S_IFREG | S_IRUGO | S_IWUGO; } else { mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; + printk(KERN_WARNING " asus_uid and asus_gid parameters are " + "deprecated, use chown and chmod instead!\n"); } acpi_device_dir(device) = asus_proc_dir; -- cgit v1.2.3 From ed349a8a0a780ed27e2a765f16cee54d9b63bfee Mon Sep 17 00:00:00 2001 From: Len Brown Date: Thu, 5 Jan 2006 02:40:11 -0500 Subject: [ACPI] fix pnpacpi regression resulting from ACPICA 20051117 In ACPICA 20051117, acpi_walk_resources() started sending ACPI_RESOURCE_TYPE_END_TAG to the callback routine which wasn't prepared for it, causing _CRS to fail and PnPACPI to not recognize any devices: pnp: ACPI device : hid PNP0C02 pnp: PnPACPI: unknown resource type 7 pnp: PnPACPI: METHOD_NAME__CRS failure for PNP0c02 Signed-off-by: Len Brown --- drivers/acpi/resources/rsxface.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 50a956b705b..5408e5d10cc 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -286,6 +286,12 @@ acpi_walk_resources(acpi_handle device_handle, break; } + /* end_tag indicates end-of-list */ + + if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + break; + } + /* Invoke the user function, abort on any error returned */ status = user_function(resource, context); @@ -298,12 +304,6 @@ acpi_walk_resources(acpi_handle device_handle, break; } - /* end_tag indicates end-of-list */ - - if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { - break; - } - /* Get the next resource descriptor */ resource = -- cgit v1.2.3 From 6f957eaf79356a32e838f5f262ee9a60544b1d5b Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 20 Sep 2005 15:26:00 -0400 Subject: [ACPI] enable PNPACPI support for resource types used by HP serial ports PNPACPI complained about and ignored devices with ADDRESS16, ADDRESS32, or ADDRESS64 descriptors in _PRS. HP firmware uses them for built-in serial ports, so this patch adds support for parsing these descriptors from _PRS. Note that this does not add the corresponding support for encoding them in preparation for _SRS, because I don't have any machine that supports _SRS on these descriptors, so I couldn't test that support. Attempts to encode them will cause a warning and an -EINVAL return. http://sourceforge.net/mailarchive/forum.php?thread_id=8250154&forum_id=6102 Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/pnp/pnpacpi/rsparser.c | 48 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 416d30debe6..2424bd3620d 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -453,6 +453,45 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, return; } +static void +pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) +{ + struct acpi_resource_address64 addr, *p = &addr; + acpi_status status; + struct pnp_mem * mem; + struct pnp_port * port; + + status = acpi_resource_to_address64(r, p); + if (!ACPI_SUCCESS(status)) { + pnp_warn("PnPACPI: failed to convert resource type %d", r->id); + return; + } + + if (p->address_length == 0) + return; + + if (p->resource_type == ACPI_MEMORY_RANGE) { + mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); + if (!mem) + return; + mem->min = mem->max = p->min_address_range; + mem->size = p->address_length; + mem->align = 0; + mem->flags = (p->attribute.memory.read_write_attribute == + ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; + pnp_register_mem_resource(option,mem); + } else if (p->resource_type == ACPI_IO_RANGE) { + port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); + if (!port) + return; + port->min = port->max = p->min_address_range; + port->size = p->address_length; + port->align = 0; + port->flags = PNP_PORT_FLAG_FIXED; + pnp_register_port_resource(option,port); + } +} + struct acpipnp_parse_option_s { struct pnp_option *option; struct pnp_option *option_independent; @@ -495,6 +534,11 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, pnpacpi_parse_fixed_mem32_option(option, &res->data.fixed_memory32); break; + case ACPI_RSTYPE_ADDRESS16: + case ACPI_RSTYPE_ADDRESS32: + case ACPI_RSTYPE_ADDRESS64: + pnpacpi_parse_address_option(option, res); + break; case ACPI_RSTYPE_START_DPF: switch (res->data.start_dpf.compatibility_priority) { case ACPI_GOOD_CONFIGURATION: @@ -568,11 +612,9 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, case ACPI_RSTYPE_MEM24: case ACPI_RSTYPE_MEM32: case ACPI_RSTYPE_FIXED_MEM32: -#if 0 case ACPI_RSTYPE_ADDRESS16: case ACPI_RSTYPE_ADDRESS32: case ACPI_RSTYPE_ADDRESS64: -#endif (*res_cnt) ++; default: return AE_OK; @@ -593,11 +635,9 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, case ACPI_RSTYPE_MEM24: case ACPI_RSTYPE_MEM32: case ACPI_RSTYPE_FIXED_MEM32: -#if 0 case ACPI_RSTYPE_ADDRESS16: case ACPI_RSTYPE_ADDRESS32: case ACPI_RSTYPE_ADDRESS64: -#endif (*resource)->id = res->id; (*resource)++; default: -- cgit v1.2.3 From d479e908457f4972205fcafa054f8030e91781ef Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Fri, 6 Jan 2006 16:47:00 -0500 Subject: [ACPI] move some run-time structure inits to compile time acpi_processor_limit_fops.write was written at run time, but can be initiailized at compile-time instead. Similar for acpi_video_bus_POST_fops.write and friends, but keep doing those at runtime to avoid prototype-hell. Signed-off-by: Arjan van de Ven Signed-off-by: Len Brown --- drivers/acpi/processor_core.c | 2 -- drivers/acpi/processor_perflib.c | 2 +- drivers/acpi/processor_thermal.c | 1 + drivers/acpi/processor_throttling.c | 1 + drivers/acpi/video.c | 8 ++++---- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 1278aca96fe..60e550f1f95 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -357,7 +357,6 @@ static int acpi_processor_add_fs(struct acpi_device *device) ACPI_PROCESSOR_FILE_THROTTLING)); else { entry->proc_fops = &acpi_processor_throttling_fops; - entry->proc_fops->write = acpi_processor_write_throttling; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } @@ -372,7 +371,6 @@ static int acpi_processor_add_fs(struct acpi_device *device) ACPI_PROCESSOR_FILE_LIMIT)); else { entry->proc_fops = &acpi_processor_limit_fops; - entry->proc_fops->write = acpi_processor_write_limit; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 22c7bb66c20..0c0234e1826 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -520,8 +520,8 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) "Unable to create '%s' fs entry\n", ACPI_PROCESSOR_FILE_PERFORMANCE)); else { + acpi_processor_perf_fops.write = acpi_processor_write_performance; entry->proc_fops = &acpi_processor_perf_fops; - entry->proc_fops->write = acpi_processor_write_performance; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index dc9817cfb88..22fc9e28a58 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -394,6 +394,7 @@ ssize_t acpi_processor_write_limit(struct file * file, struct file_operations acpi_processor_limit_fops = { .open = acpi_processor_limit_open_fs, .read = seq_read, + .write = acpi_processor_write_limit, .llseek = seq_lseek, .release = single_release, }; diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 74a52d4e79a..5cd056abfcf 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -337,6 +337,7 @@ ssize_t acpi_processor_write_throttling(struct file * file, struct file_operations acpi_processor_throttling_fops = { .open = acpi_processor_throttling_open_fs, .read = seq_read, + .write = acpi_processor_write_throttling, .llseek = seq_lseek, .release = single_release, }; diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index d10668f1469..bd488751837 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -920,8 +920,8 @@ static int acpi_video_device_add_fs(struct acpi_device *device) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'state' fs entry\n")); else { + acpi_video_device_state_fops.write = acpi_video_device_write_state; entry->proc_fops = &acpi_video_device_state_fops; - entry->proc_fops->write = acpi_video_device_write_state; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } @@ -934,8 +934,8 @@ static int acpi_video_device_add_fs(struct acpi_device *device) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'brightness' fs entry\n")); else { + acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; entry->proc_fops = &acpi_video_device_brightness_fops; - entry->proc_fops->write = acpi_video_device_write_brightness; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } @@ -1239,8 +1239,8 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST' fs entry\n")); else { + acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; entry->proc_fops = &acpi_video_bus_POST_fops; - entry->proc_fops->write = acpi_video_bus_write_POST; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } @@ -1253,8 +1253,8 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'DOS' fs entry\n")); else { + acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; entry->proc_fops = &acpi_video_bus_DOS_fops; - entry->proc_fops->write = acpi_video_bus_write_DOS; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } -- cgit v1.2.3 From 3963f00831bc01f509c7dc38d050505fca64f67d Mon Sep 17 00:00:00 2001 From: KAMEZAWA Hiroyuki Date: Fri, 6 Jan 2006 01:31:00 -0500 Subject: [ACPI] acpi_memhotplug.c build fix drivers/acpi/acpi_memhotplug.c: In function `acpi_memory_get_device_resources': drivers/acpi/acpi_memhotplug.c:101: error: structure has no member named `attribute' drivers/acpi/acpi_memhotplug.c:103: error: structure has no member named `attribute' drivers/acpi/acpi_memhotplug.c: In function `acpi_memory_disable_device': drivers/acpi/acpi_memhotplug.c:253: warning: unused variable `attr' Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/acpi_memhotplug.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index b12946ccd13..d882bf87fa9 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -71,8 +71,8 @@ static struct acpi_driver acpi_memory_device_driver = { struct acpi_memory_device { acpi_handle handle; unsigned int state; /* State of the memory device */ - unsigned short cache_attribute; /* memory cache attribute */ - unsigned short read_write_attribute; /* memory read/write attribute */ + unsigned short caching; /* memory cache attribute */ + unsigned short write_protect; /* memory read/write attribute */ u64 start_addr; /* Memory Range start physical addr */ u64 end_addr; /* Memory Range end physical addr */ }; @@ -97,10 +97,10 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) if (ACPI_SUCCESS(status)) { if (address64.resource_type == ACPI_MEMORY_RANGE) { /* Populate the structure */ - mem_device->cache_attribute = - address64.attribute.memory.cache_attribute; - mem_device->read_write_attribute = - address64.attribute.memory.read_write_attribute; + mem_device->caching = + address64.info.mem.caching; + mem_device->write_protect = + address64.info.mem.write_protect; mem_device->start_addr = address64.minimum; mem_device->end_addr = address64.maximum; } @@ -250,7 +250,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) int result; u64 start = mem_device->start_addr; u64 len = mem_device->end_addr - start + 1; - unsigned long attr = mem_device->read_write_attribute; ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); -- cgit v1.2.3 From 35f652b5ef4ef145ac5514f6302b3f4cebfbbad4 Mon Sep 17 00:00:00 2001 From: Benoit Boissinot Date: Fri, 6 Jan 2006 01:31:00 -0500 Subject: [ACPI] fix acpi_cpufreq.c build warrning Signed-off-by: Benoit Boissinot Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 31ce890865d..8a5e159d818 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -306,10 +306,6 @@ acpi_cpufreq_cpu_init ( struct cpufreq_acpi_io *data; unsigned int result = 0; - union acpi_object arg0 = {ACPI_TYPE_BUFFER}; - u32 arg0_buf[3]; - struct acpi_object_list arg_list = {1, &arg0}; - dprintk("acpi_cpufreq_cpu_init\n"); data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); -- cgit v1.2.3 From 876c184b31dc73cc3f38c5b86dee55d091a56769 Mon Sep 17 00:00:00 2001 From: Thomas Rosner Date: Fri, 6 Jan 2006 01:31:00 -0500 Subject: [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops This adds all known BIOS versions of IBM R40e Laptops to the C2/C3 processor state blacklist and thus prevents them from crashing. workaround for http://bugzilla.kernel.org/show_bug.cgi?id=3549 Signed-off-by: Thomas Rosner Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/processor_idle.c | 67 ++++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 807b0df308f..552420e1f89 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -95,22 +95,57 @@ static int set_max_cstate(struct dmi_system_id *id) } static struct dmi_system_id __initdata processor_power_dmi_table[] = { - {set_max_cstate, "IBM ThinkPad R40e", { - DMI_MATCH(DMI_BIOS_VENDOR, - "IBM"), - DMI_MATCH(DMI_BIOS_VERSION, - "1SET60WW")}, - (void *)1}, - {set_max_cstate, "Medion 41700", { - DMI_MATCH(DMI_BIOS_VENDOR, - "Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION, - "R01-A1J")}, (void *)1}, - {set_max_cstate, "Clevo 5600D", { - DMI_MATCH(DMI_BIOS_VENDOR, - "Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION, - "SHE845M0.86C.0013.D.0302131307")}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET43WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET45WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET47WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET50WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET52WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET55WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET56WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET59WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET61WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET62WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET64WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET65WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET68WW") }, (void*)1}, + { set_max_cstate, "Medion 41700", { + DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J")}, (void *)1}, + { set_max_cstate, "Clevo 5600D", { + DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")}, (void *)2}, {}, }; -- cgit v1.2.3 From 07b0120d53a3e7cbc88458a64a4d668fc416100f Mon Sep 17 00:00:00 2001 From: matthieu castet Date: Fri, 6 Jan 2006 01:31:00 -0500 Subject: [PNPACPI] Ignore devices that have no resources Ignore devices that don't have a _CRS method. They are useless for the PNP layer as they don't provide any resources. Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/pnp/pnpacpi/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 816479ad217..e77d1feb759 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -131,7 +131,8 @@ static int __init pnpacpi_add_device(struct acpi_device *device) struct pnp_id *dev_id; struct pnp_dev *dev; - if (!ispnpidacpi(acpi_device_hid(device)) || + status = acpi_get_handle(device->handle, "_CRS", &temp); + if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || is_exclusive_device(device)) return 0; -- cgit v1.2.3 From c4bb6f5ad968540d7f9619565bacd18d7419b85f Mon Sep 17 00:00:00 2001 From: matthieu castet Date: Fri, 6 Jan 2006 01:31:00 -0500 Subject: [PNPACPI] clean excluded_id_list[] Clean the blacklist. Battery, Button, Fan have no _CRS and can be removed. PCI root is in pnpbios and is harmless. Cc: Adam Belay Cc: "Li, Shaohua" Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/pnp/pnpacpi/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index e77d1feb759..f104577f73e 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -27,12 +27,15 @@ static int num = 0; +/* We need only to blacklist devices that have already an acpi driver that + * can't use pnp layer. We don't need to blacklist device that are directly + * used by the kernel (PCI root, ...), as it is harmless and there were + * already present in pnpbios. But there is an exception for devices that + * have irqs (PIC, Timer) because we call acpi_register_gsi. + * Finaly only devices that have a CRS method need to be in this list. + */ static char __initdata excluded_id_list[] = - "PNP0C0A," /* Battery */ - "PNP0C0C,PNP0C0E,PNP0C0D," /* Button */ "PNP0C09," /* EC */ - "PNP0C0B," /* Fan */ - "PNP0A03," /* PCI root */ "PNP0C0F," /* Link device */ "PNP0000," /* PIC */ "PNP0100," /* Timer */ -- cgit v1.2.3 From 757b18661ea0a0d890e8ce7b1a391e5b7d417d78 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 7 Jan 2006 13:19:00 -0500 Subject: [ACPI] make two processor functions static acpi_processor_write_throttling() acpi_processor_write_limit() Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/processor_thermal.c | 6 +++--- drivers/acpi/processor_throttling.c | 6 +++--- include/acpi/processor.h | 6 ------ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 22fc9e28a58..f99ad05cd6a 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -348,9 +348,9 @@ static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) PDE(inode)->data); } -ssize_t acpi_processor_write_limit(struct file * file, - const char __user * buffer, - size_t count, loff_t * data) +static ssize_t acpi_processor_write_limit(struct file * file, + const char __user * buffer, + size_t count, loff_t * data) { int result = 0; struct seq_file *m = (struct seq_file *)file->private_data; diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 5cd056abfcf..b966549ec00 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -306,9 +306,9 @@ static int acpi_processor_throttling_open_fs(struct inode *inode, PDE(inode)->data); } -ssize_t acpi_processor_write_throttling(struct file * file, - const char __user * buffer, - size_t count, loff_t * data) +static ssize_t acpi_processor_write_throttling(struct file * file, + const char __user * buffer, + size_t count, loff_t * data) { int result = 0; struct seq_file *m = (struct seq_file *)file->private_data; diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 7a00d5089de..edb5a8919cb 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -235,9 +235,6 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) /* in processor_throttling.c */ int acpi_processor_get_throttling_info(struct acpi_processor *pr); int acpi_processor_set_throttling(struct acpi_processor *pr, int state); -ssize_t acpi_processor_write_throttling(struct file *file, - const char __user * buffer, - size_t count, loff_t * data); extern struct file_operations acpi_processor_throttling_fops; /* in processor_idle.c */ @@ -249,9 +246,6 @@ int acpi_processor_power_exit(struct acpi_processor *pr, /* in processor_thermal.c */ int acpi_processor_get_limit_info(struct acpi_processor *pr); -ssize_t acpi_processor_write_limit(struct file *file, - const char __user * buffer, - size_t count, loff_t * data); extern struct file_operations acpi_processor_limit_fops; #ifdef CONFIG_CPU_FREQ -- cgit v1.2.3 From 2ae4117435b30c7f9c12c89bcb323ce48b08c16a Mon Sep 17 00:00:00 2001 From: Len Brown Date: Mon, 16 Jan 2006 15:22:45 -0500 Subject: Revert "[ACPI] fix pnpacpi regression resulting from ACPICA 20051117" This reverts ed349a8a0a780ed27e2a765f16cee54d9b63bfee commit. --- drivers/acpi/resources/rsxface.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 5408e5d10cc..50a956b705b 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -286,12 +286,6 @@ acpi_walk_resources(acpi_handle device_handle, break; } - /* end_tag indicates end-of-list */ - - if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { - break; - } - /* Invoke the user function, abort on any error returned */ status = user_function(resource, context); @@ -304,6 +298,12 @@ acpi_walk_resources(acpi_handle device_handle, break; } + /* end_tag indicates end-of-list */ + + if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + break; + } + /* Get the next resource descriptor */ resource = -- cgit v1.2.3 From 0af5853bccd263161df80c259d61fc71211c5ac3 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 20 Jan 2006 01:11:37 -0500 Subject: [ACPI] better fix for pnpacpi regression resulting from ACPICA 20051117 Rather than tweaking acpi_walk_resource() again not return end tags, modify the pnpacpi code to ignore them. The pnpacpi resource type switch statements now include all known types in the order that they're defined -- so it is easy to see what is not implemented. The code will squawk only if it sees a truly undefined type. Signed-off-by: Len Brown --- drivers/pnp/pnpacpi/rsparser.c | 145 +++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 43 deletions(-) diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index c6db14d30ed..407b4eaddcb 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -177,29 +177,34 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, } break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { - pnpacpi_parse_allocated_irqresource(res_table, - res->data.extended_irq.interrupts[i], - res->data.extended_irq.triggering, - res->data.extended_irq.polarity); - } - break; case ACPI_RESOURCE_TYPE_DMA: if (res->data.dma.channel_count > 0) pnpacpi_parse_allocated_dmaresource(res_table, res->data.dma.channels[0]); break; + case ACPI_RESOURCE_TYPE_IO: pnpacpi_parse_allocated_ioresource(res_table, res->data.io.minimum, res->data.io.address_length); break; + + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: + break; + case ACPI_RESOURCE_TYPE_FIXED_IO: pnpacpi_parse_allocated_ioresource(res_table, res->data.fixed_io.address, res->data.fixed_io.address_length); break; + + case ACPI_RESOURCE_TYPE_VENDOR: + break; + + case ACPI_RESOURCE_TYPE_END_TAG: + break; + case ACPI_RESOURCE_TYPE_MEMORY24: pnpacpi_parse_allocated_memresource(res_table, res->data.memory24.minimum, @@ -230,8 +235,22 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, res->data.address64.minimum, res->data.address64.address_length); break; - case ACPI_RESOURCE_TYPE_VENDOR: + + case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: + break; + + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { + pnpacpi_parse_allocated_irqresource(res_table, + res->data.extended_irq.interrupts[i], + res->data.extended_irq.triggering, + res->data.extended_irq.polarity); + } + break; + + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: break; + default: pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; @@ -510,35 +529,11 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, case ACPI_RESOURCE_TYPE_IRQ: pnpacpi_parse_irq_option(option, &res->data.irq); break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - pnpacpi_parse_ext_irq_option(option, - &res->data.extended_irq); - break; + case ACPI_RESOURCE_TYPE_DMA: pnpacpi_parse_dma_option(option, &res->data.dma); break; - case ACPI_RESOURCE_TYPE_IO: - pnpacpi_parse_port_option(option, &res->data.io); - break; - case ACPI_RESOURCE_TYPE_FIXED_IO: - pnpacpi_parse_fixed_port_option(option, - &res->data.fixed_io); - break; - case ACPI_RESOURCE_TYPE_MEMORY24: - pnpacpi_parse_mem24_option(option, &res->data.memory24); - break; - case ACPI_RESOURCE_TYPE_MEMORY32: - pnpacpi_parse_mem32_option(option, &res->data.memory32); - break; - case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: - pnpacpi_parse_fixed_mem32_option(option, - &res->data.fixed_memory32); - break; - case ACPI_RESOURCE_TYPE_ADDRESS16: - case ACPI_RESOURCE_TYPE_ADDRESS32: - case ACPI_RESOURCE_TYPE_ADDRESS64: - pnpacpi_parse_address_option(option, res); - break; + case ACPI_RESOURCE_TYPE_START_DEPENDENT: switch (res->data.start_dpf.compatibility_priority) { case ACPI_GOOD_CONFIGURATION: @@ -562,6 +557,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, return AE_ERROR; parse_data->option = option; break; + case ACPI_RESOURCE_TYPE_END_DEPENDENT: /*only one EndDependentFn is allowed*/ if (!parse_data->option_independent) { @@ -571,6 +567,50 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, parse_data->option = parse_data->option_independent; parse_data->option_independent = NULL; break; + + case ACPI_RESOURCE_TYPE_IO: + pnpacpi_parse_port_option(option, &res->data.io); + break; + + case ACPI_RESOURCE_TYPE_FIXED_IO: + pnpacpi_parse_fixed_port_option(option, + &res->data.fixed_io); + break; + + case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RESOURCE_TYPE_END_TAG: + break; + + case ACPI_RESOURCE_TYPE_MEMORY24: + pnpacpi_parse_mem24_option(option, &res->data.memory24); + break; + + case ACPI_RESOURCE_TYPE_MEMORY32: + pnpacpi_parse_mem32_option(option, &res->data.memory32); + break; + + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + pnpacpi_parse_fixed_mem32_option(option, + &res->data.fixed_memory32); + break; + + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: + pnpacpi_parse_address_option(option, res); + break; + + case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: + break; + + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + pnpacpi_parse_ext_irq_option(option, + &res->data.extended_irq); + break; + + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: + break; + default: pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; @@ -605,7 +645,6 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, int *res_cnt = (int *)data; switch (res->type) { case ACPI_RESOURCE_TYPE_IRQ: - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_DMA: case ACPI_RESOURCE_TYPE_IO: case ACPI_RESOURCE_TYPE_FIXED_IO: @@ -615,7 +654,13 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, case ACPI_RESOURCE_TYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: (*res_cnt) ++; + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: default: return AE_OK; } @@ -628,7 +673,6 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, struct acpi_resource **resource = (struct acpi_resource **)data; switch (res->type) { case ACPI_RESOURCE_TYPE_IRQ: - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_DMA: case ACPI_RESOURCE_TYPE_IO: case ACPI_RESOURCE_TYPE_FIXED_IO: @@ -638,8 +682,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, case ACPI_RESOURCE_TYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: (*resource)->type = res->type; (*resource)++; + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: default: return AE_OK; } @@ -828,12 +878,6 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, irq++; break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - pnp_dbg("Encode ext irq"); - pnpacpi_encode_ext_irq(resource, - &res_table->irq_resource[irq]); - irq++; - break; case ACPI_RESOURCE_TYPE_DMA: pnp_dbg("Encode dma"); pnpacpi_encode_dma(resource, @@ -870,6 +914,21 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, &res_table->mem_resource[mem]); mem ++; break; + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + pnp_dbg("Encode ext irq"); + pnpacpi_encode_ext_irq(resource, + &res_table->irq_resource[irq]); + irq++; + break; + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: default: /* other type */ pnp_warn("unknown resource type %d", resource->type); return -EINVAL; -- cgit v1.2.3 From 3c5c363826e435cf4d54d917202567e5b57cae5f Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 20 Jan 2006 01:17:42 -0500 Subject: [ACPI] delete message "**** SET: Misaligned resource pointer:" This check, added in ACPICA 20051021, was overly paranoid. Signed-off-by: Len Brown --- drivers/acpi/resources/rsmisc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index e1b5aa2af9a..4a758bd4a5c 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -328,14 +328,6 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); - /* Validate the Resource pointer, must be 32-bit aligned */ - - if (((acpi_native_uint) resource) & 0x3) { - acpi_os_printf - ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n", - resource, resource->type, resource->length); - } - /* * First table entry must be ACPI_RSC_INITxxx and must contain the * table length (# of table entries) -- cgit v1.2.3 From 4a90c7e86202f46fa9af011bdbcdf36e355d1721 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 13 Jan 2006 16:22:00 -0500 Subject: [ACPI] ACPICA 20060113 Added 2006 copyright. At SuSE's suggestion, enabled all error messages without enabling function tracing, ie with CONFIG_ACPI_DEBUG=n Replaced all instances of the ACPI_DEBUG_PRINT macro invoked at the ACPI_DB_ERROR and ACPI_DB_WARN debug levels with the ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros, respectively. This preserves all error and warning messages in the non-debug version of the ACPICA code (this has been referred to as the "debug lite" option.) Over 200 cases were converted to create a total of over 380 error/warning messages across the ACPICA code. This increases the code and data size of the default non-debug version by about 13K. Added ACPI_NO_ERROR_MESSAGES flag to enable deleting all messages. The size of the debug version remains about the same. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsfield.c | 9 ++-- drivers/acpi/dispatcher/dsinit.c | 20 +++---- drivers/acpi/dispatcher/dsmethod.c | 2 +- drivers/acpi/dispatcher/dsmthdat.c | 28 ++++------ drivers/acpi/dispatcher/dsobject.c | 21 +++----- drivers/acpi/dispatcher/dsopcode.c | 41 ++++++-------- drivers/acpi/dispatcher/dsutils.c | 18 +++---- drivers/acpi/dispatcher/dswexec.c | 36 ++++--------- drivers/acpi/dispatcher/dswload.c | 2 +- drivers/acpi/dispatcher/dswscope.c | 6 +-- drivers/acpi/dispatcher/dswstate.c | 106 +++++++++++++------------------------ drivers/acpi/events/evevent.c | 4 +- drivers/acpi/events/evgpe.c | 20 ++++--- drivers/acpi/events/evgpeblk.c | 20 +++---- drivers/acpi/events/evmisc.c | 12 ++--- drivers/acpi/events/evregion.c | 45 +++++----------- drivers/acpi/events/evrgnini.c | 2 +- drivers/acpi/events/evsci.c | 2 +- drivers/acpi/events/evxface.c | 13 +++-- drivers/acpi/events/evxfevnt.c | 23 ++++---- drivers/acpi/events/evxfregn.c | 2 +- drivers/acpi/executer/exconfig.c | 6 +-- drivers/acpi/executer/exconvrt.c | 15 ++---- drivers/acpi/executer/excreate.c | 2 +- drivers/acpi/executer/exdump.c | 2 +- drivers/acpi/executer/exfield.c | 2 +- drivers/acpi/executer/exfldio.c | 60 ++++++--------------- drivers/acpi/executer/exmisc.c | 12 +++-- drivers/acpi/executer/exmutex.c | 2 +- drivers/acpi/executer/exnames.c | 16 +++--- drivers/acpi/executer/exoparg1.c | 59 ++++++++------------- drivers/acpi/executer/exoparg2.c | 28 +++++----- drivers/acpi/executer/exoparg3.c | 8 +-- drivers/acpi/executer/exoparg6.c | 13 ++--- drivers/acpi/executer/exprep.c | 11 ++-- drivers/acpi/executer/exregion.c | 12 ++--- drivers/acpi/executer/exresnte.c | 50 +++++++---------- drivers/acpi/executer/exresolv.c | 28 +++++----- drivers/acpi/executer/exresop.c | 89 +++++++++---------------------- drivers/acpi/executer/exstore.c | 19 +++---- drivers/acpi/executer/exstoren.c | 13 ++--- drivers/acpi/executer/exstorob.c | 2 +- drivers/acpi/executer/exsystem.c | 4 +- drivers/acpi/executer/exutils.c | 6 +-- drivers/acpi/hardware/hwacpi.c | 7 ++- drivers/acpi/hardware/hwgpe.c | 2 +- drivers/acpi/hardware/hwregs.c | 29 ++++------ drivers/acpi/hardware/hwsleep.c | 2 +- drivers/acpi/hardware/hwtimer.c | 2 +- drivers/acpi/namespace/nsaccess.c | 18 +++---- drivers/acpi/namespace/nsalloc.c | 7 ++- drivers/acpi/namespace/nsdump.c | 5 +- drivers/acpi/namespace/nsdumpdv.c | 2 +- drivers/acpi/namespace/nseval.c | 5 +- drivers/acpi/namespace/nsinit.c | 22 ++++---- drivers/acpi/namespace/nsload.c | 6 +-- drivers/acpi/namespace/nsnames.c | 10 ++-- drivers/acpi/namespace/nsobject.c | 10 ++-- drivers/acpi/namespace/nsparse.c | 2 +- drivers/acpi/namespace/nssearch.c | 11 ++-- drivers/acpi/namespace/nsutils.c | 29 ++++------ drivers/acpi/namespace/nswalk.c | 2 +- drivers/acpi/namespace/nsxfeval.c | 21 ++++---- drivers/acpi/namespace/nsxfname.c | 2 +- drivers/acpi/namespace/nsxfobj.c | 2 +- drivers/acpi/parser/psargs.c | 4 +- drivers/acpi/parser/psloop.c | 23 ++------ drivers/acpi/parser/psopcode.c | 4 +- drivers/acpi/parser/psparse.c | 8 +-- drivers/acpi/parser/psscope.c | 2 +- drivers/acpi/parser/pstree.c | 5 +- drivers/acpi/parser/psutils.c | 2 +- drivers/acpi/parser/pswalk.c | 2 +- drivers/acpi/parser/psxface.c | 2 +- drivers/acpi/resources/rsaddr.c | 2 +- drivers/acpi/resources/rscalc.c | 2 +- drivers/acpi/resources/rscreate.c | 42 +++------------ drivers/acpi/resources/rsdump.c | 2 +- drivers/acpi/resources/rsinfo.c | 2 +- drivers/acpi/resources/rsio.c | 2 +- drivers/acpi/resources/rsirq.c | 2 +- drivers/acpi/resources/rslist.c | 6 +-- drivers/acpi/resources/rsmemory.c | 2 +- drivers/acpi/resources/rsmisc.c | 9 ++-- drivers/acpi/resources/rsutils.c | 2 +- drivers/acpi/resources/rsxface.c | 2 +- drivers/acpi/tables/tbconvrt.c | 2 +- drivers/acpi/tables/tbget.c | 6 +-- drivers/acpi/tables/tbgetall.c | 2 +- drivers/acpi/tables/tbinstal.c | 2 +- drivers/acpi/tables/tbrsdt.c | 18 +++---- drivers/acpi/tables/tbutils.c | 22 +++----- drivers/acpi/tables/tbxface.c | 17 +++--- drivers/acpi/tables/tbxfroot.c | 22 +++----- drivers/acpi/utilities/utalloc.c | 32 ++++++----- drivers/acpi/utilities/utcache.c | 2 +- drivers/acpi/utilities/utcopy.c | 7 ++- drivers/acpi/utilities/utdebug.c | 2 +- drivers/acpi/utilities/utdelete.c | 9 ++-- drivers/acpi/utilities/uteval.c | 24 ++++----- drivers/acpi/utilities/utglobal.c | 21 ++++---- drivers/acpi/utilities/utinit.c | 7 ++- drivers/acpi/utilities/utmath.c | 10 ++-- drivers/acpi/utilities/utmisc.c | 18 +++---- drivers/acpi/utilities/utmutex.c | 37 +++---------- drivers/acpi/utilities/utobject.c | 28 +++++----- drivers/acpi/utilities/utresrc.c | 2 +- drivers/acpi/utilities/utstate.c | 2 +- drivers/acpi/utilities/utxface.c | 7 ++- include/acpi/acconfig.h | 4 +- include/acpi/acdebug.h | 2 +- include/acpi/acdisasm.h | 2 +- include/acpi/acdispat.h | 2 +- include/acpi/acevents.h | 2 +- include/acpi/acexcep.h | 2 +- include/acpi/acglobal.h | 2 +- include/acpi/achware.h | 2 +- include/acpi/acinterp.h | 2 +- include/acpi/aclocal.h | 2 +- include/acpi/acmacros.h | 83 ++++++++++++++++------------- include/acpi/acnames.h | 2 +- include/acpi/acnamesp.h | 4 +- include/acpi/acobject.h | 2 +- include/acpi/acopcode.h | 2 +- include/acpi/acoutput.h | 12 +++-- include/acpi/acparser.h | 2 +- include/acpi/acpi.h | 2 +- include/acpi/acpiosxf.h | 2 +- include/acpi/acpixf.h | 2 +- include/acpi/acresrc.h | 2 +- include/acpi/acstruct.h | 2 +- include/acpi/actables.h | 2 +- include/acpi/actbl.h | 2 +- include/acpi/actbl1.h | 2 +- include/acpi/actbl2.h | 2 +- include/acpi/actypes.h | 2 +- include/acpi/acutils.h | 9 ++-- include/acpi/amlcode.h | 2 +- include/acpi/amlresrc.h | 2 +- include/acpi/platform/acenv.h | 2 +- include/acpi/platform/acgcc.h | 2 +- include/acpi/platform/aclinux.h | 2 +- 142 files changed, 658 insertions(+), 1023 deletions(-) diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 2022aeaecfb..f3a008ff1ea 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -293,7 +293,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, + (acpi_integer) arg->common.value.size; if (position > ACPI_UINT32_MAX) { - ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name)); + ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", ACPI_CAST_PTR(char, &info->field_node->name))); return_ACPI_STATUS(AE_SUPPORT); } @@ -302,9 +302,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid opcode in field list: %X\n", - arg->common.aml_opcode)); + ACPI_REPORT_ERROR(("Invalid opcode in field list: %X\n", + arg->common.aml_opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index 4fa80abfe6c..258fbdfaa69 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,7 +84,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, acpi_object_type type; acpi_status status; - ACPI_FUNCTION_NAME("ds_init_one_object"); + ACPI_FUNCTION_ENTRY(); /* * We are only interested in NS nodes owned by the table that @@ -105,11 +105,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, status = acpi_ds_initialize_region(obj_handle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Region %p [%4.4s] - Init failure, %s\n", - obj_handle, - acpi_ut_get_node_name(obj_handle), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Region %p [%4.4s] - Init failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status))); } info->op_region_count++; @@ -148,11 +144,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, */ status = acpi_ds_parse_method(obj_handle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\n+Method %p [%4.4s] - parse failure, %s\n", - obj_handle, - acpi_ut_get_node_name(obj_handle), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("\n+Method %p [%4.4s] - parse failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status))); /* This parse failed, but we will continue parsing more methods */ } @@ -214,8 +206,8 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, acpi_ds_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("walk_namespace failed, %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index e7ce86b8d95..d861add3fc1 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index 4095ce70982..ce33c34f87c 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -260,9 +260,7 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_LOCAL_OP: if (index > ACPI_METHOD_MAX_LOCAL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Local index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_LOCAL)); + ACPI_REPORT_ERROR(("Local index %d is invalid (max %d)\n", index, ACPI_METHOD_MAX_LOCAL)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -274,9 +272,8 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_ARG_OP: if (index > ACPI_METHOD_MAX_ARG) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Arg index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_ARG)); + ACPI_REPORT_ERROR(("Arg index %d is invalid (max %d)\n", + index, ACPI_METHOD_MAX_ARG)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -286,8 +283,7 @@ acpi_ds_method_data_get_node(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", - opcode)); + ACPI_REPORT_ERROR(("Opcode %d is invalid\n", opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } @@ -378,8 +374,7 @@ acpi_ds_method_data_get_value(u16 opcode, /* Validate the object descriptor */ if (!dest_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null object descriptor pointer\n")); + ACPI_REPORT_ERROR(("Null object descriptor pointer\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -424,23 +419,18 @@ acpi_ds_method_data_get_value(u16 opcode, switch (opcode) { case AML_ARG_OP: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Uninitialized Arg[%d] at node %p\n", - index, node)); + ACPI_REPORT_ERROR(("Uninitialized Arg[%d] at node %p\n", index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); case AML_LOCAL_OP: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Uninitialized Local[%d] at node %p\n", - index, node)); + ACPI_REPORT_ERROR(("Uninitialized Local[%d] at node %p\n", index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); default: - ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", - opcode)); + ACPI_REPORT_ERROR(("Not a Arg/Local opcode: %X\n", opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 905a84e4b14..dc116d679a5 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,10 +214,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, byte_list = arg->named.next; if (byte_list) { if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting bytelist, got AML opcode %X in op %p\n", - byte_list->common.aml_opcode, - byte_list)); + ACPI_REPORT_ERROR(("Expecting bytelist, got AML opcode %X in op %p\n", byte_list->common.aml_opcode, byte_list)); acpi_ut_remove_reference(obj_desc); return (AE_TYPE); @@ -543,9 +540,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown constant opcode %X\n", - opcode)); + ACPI_REPORT_ERROR(("Unknown constant opcode %X\n", opcode)); status = AE_AML_OPERAND_TYPE; break; } @@ -560,9 +555,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown Integer type %X\n", - op_info->type)); + ACPI_REPORT_ERROR(("Unknown Integer type %X\n", + op_info->type)); status = AE_AML_OPERAND_TYPE; break; } @@ -640,9 +634,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unimplemented data type: %X\n", - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Unimplemented data type: %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; break; diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 939d167bf87..60414ee84b0 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -413,9 +413,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Host object must be a Buffer */ if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Target of Create Field is not a Buffer object - %s\n", - acpi_ut_get_object_type_name(buffer_desc))); + ACPI_REPORT_ERROR(("Target of Create Field is not a Buffer object - %s\n", acpi_ut_get_object_type_name(buffer_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -427,10 +425,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode, * after resolution in acpi_ex_resolve_operands(). */ if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(%s) destination not a NS Node [%s]\n", - acpi_ps_get_opcode_name(aml_opcode), - acpi_ut_get_descriptor_name(result_desc))); + ACPI_REPORT_ERROR(("(%s) destination not a NS Node [%s]\n", + acpi_ps_get_opcode_name(aml_opcode), + acpi_ut_get_descriptor_name(result_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -453,8 +450,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Must have a valid (>0) bit count */ if (bit_count == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Attempt to create_field of length 0\n")); + ACPI_REPORT_ERROR(("Attempt to create_field of length 0\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -507,9 +503,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown field creation opcode %02x\n", - aml_opcode)); + ACPI_REPORT_ERROR(("Unknown field creation opcode %02x\n", + aml_opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -517,13 +512,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Entire field must fit within the current length of the buffer */ if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", - acpi_ut_get_node_name(result_desc), - bit_offset + bit_count, - acpi_ut_get_node_name(buffer_desc->buffer. - node), - 8 * (u32) buffer_desc->buffer.length)); + ACPI_REPORT_ERROR(("Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", acpi_ut_get_node_name(result_desc), bit_offset + bit_count, acpi_ut_get_node_name(buffer_desc->buffer.node), 8 * (u32) buffer_desc->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -629,9 +618,10 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, "after acpi_ex_resolve_operands"); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", - acpi_ps_get_opcode_name(op->common. - aml_opcode), status)); + ACPI_REPORT_ERROR(("(%s) bad operand(s) (%X)\n", + acpi_ps_get_opcode_name(op->common. + aml_opcode), + status)); return_ACPI_STATUS(status); } @@ -1155,9 +1145,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown control opcode=%X Op=%p\n", - op->common.aml_opcode, op)); + ACPI_REPORT_ERROR(("Unknown control opcode=%X Op=%p\n", + op->common.aml_opcode, op)); status = AE_AML_BAD_OPCODE; break; diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 2cc53da5c0b..cd9aa7faa57 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -176,7 +176,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, /* Must have both an Op and a Result Object */ if (!op) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); + ACPI_REPORT_ERROR(("Null Op\n")); return_UINT8(TRUE); } @@ -216,8 +216,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, parent_info = acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); if (parent_info->class == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown parent opcode. Op=%p\n", op)); + ACPI_REPORT_ERROR(("Unknown parent opcode Op=%p\n", op)); return_UINT8(FALSE); } @@ -344,7 +343,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); if (!op) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); + ACPI_REPORT_ERROR(("Null Op\n")); return_VOID; } @@ -635,10 +634,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, * Only error is underflow, and this indicates * a missing or null operand! */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Missing or null operand, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("Missing or null operand, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } } else { @@ -730,7 +726,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, */ (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", - (arg_count + 1), acpi_format_exception(status))); + ACPI_REPORT_ERROR(("While creating Arg %d - %s\n", + (arg_count + 1), acpi_format_exception(status))); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 74f6996db2d..5a9b91fe93d 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,9 +100,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, if (result_obj) { status = acpi_ds_result_pop(&obj_desc, walk_state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not get result from predicate evaluation, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not get result from predicate evaluation, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -123,9 +121,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (!obj_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No predicate obj_desc=%p State=%p\n", - obj_desc, walk_state)); + ACPI_REPORT_ERROR(("No predicate obj_desc=%p State=%p\n", + obj_desc, walk_state)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -140,10 +137,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", - obj_desc, walk_state, - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", obj_desc, walk_state, ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -362,8 +356,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) op_class = walk_state->op_info->class; if (op_class == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", - op->common.aml_opcode)); + ACPI_REPORT_ERROR(("Unknown opcode %X\n", + op->common.aml_opcode)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -453,12 +447,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) walk_state->operands[1]->reference.offset)) { status = AE_OK; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "[%s]: Could not resolve operands, %s\n", - acpi_ps_get_opcode_name - (walk_state->opcode), - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("[%s]: Could not resolve operands, %s\n", acpi_ps_get_opcode_name(walk_state->opcode), acpi_format_exception(status))); } } @@ -677,8 +666,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_UNDEFINED: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Undefined opcode type Op=%p\n", op)); + ACPI_REPORT_ERROR(("Undefined opcode type Op=%p\n", + op)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); case AML_TYPE_BOGUS: @@ -690,10 +679,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", - op_class, op_type, - op->common.aml_opcode, op)); + ACPI_REPORT_ERROR(("Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", op_class, op_type, op->common.aml_opcode, op)); status = AE_NOT_IMPLEMENTED; break; diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 441931cab08..4cad6afa82f 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index defe956ef75..e7fc88ca47b 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,14 +107,14 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, if (!node) { /* Invalid scope */ - ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); + ACPI_REPORT_ERROR(("Null scope parameter\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Make sure object type is valid */ if (!acpi_ut_valid_object_type(type)) { - ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); + ACPI_REPORT_WARNING(("Invalid object type: 0x%X\n", type)); } /* Allocate a new scope object */ diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 7d68a5aaf3c..61aae2dcc5e 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,26 +92,23 @@ acpi_ds_result_remove(union acpi_operand_object **object, state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result object pushed! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_MAX_OPERAND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index out of range: %X State=%p Num=%X\n", - index, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Index out of range: %X State=%p Num=%X\n", + index, walk_state, + state->results.num_results)); } /* Check for a valid result object */ if (!state->results.obj_desc[index]) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X, Index=%X\n", - walk_state, state->results.num_results, - index)); + ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X, Index=%X\n", + walk_state, state->results.num_results, + index)); return (AE_AML_NO_RETURN_VALUE); } @@ -163,9 +160,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } if (!state->results.num_results) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Result stack is empty! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("Result stack is empty! State=%p\n", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -192,8 +188,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result objects! State=%p\n", walk_state)); + ACPI_REPORT_ERROR(("No result objects! State=%p\n", walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -222,15 +217,14 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Warning: No result object pushed! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (!state->results.num_results) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result objects! State=%p\n", walk_state)); + ACPI_REPORT_ERROR(("No result objects! State=%p\n", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -250,10 +244,9 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, /* Check for a valid result object */ if (!*object) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X Index=%X\n", - walk_state, state->results.num_results, - (u32) index)); + ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X Index=%X\n", + walk_state, state->results.num_results, + (u32) index)); return (AE_AML_NO_RETURN_VALUE); } @@ -293,18 +286,14 @@ acpi_ds_result_push(union acpi_operand_object * object, } if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Result stack overflow: Obj=%p State=%p Num=%X\n", - object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Result stack overflow: Obj=%p State=%p Num=%X\n", object, walk_state, state->results.num_results)); return (AE_STACK_OVERFLOW); } if (!object) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null Object! Obj=%p State=%p Num=%X\n", - object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Null Object! Obj=%p State=%p Num=%X\n", + object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -413,10 +402,7 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) /* Check for stack overflow */ if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "overflow! Obj=%p State=%p #Ops=%X\n", - object, walk_state, - walk_state->num_operands)); + ACPI_REPORT_ERROR(("Object stack overflow! Obj=%p State=%p #Ops=%X\n", object, walk_state, walk_state->num_operands)); return (AE_STACK_OVERFLOW); } @@ -460,10 +446,7 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Underflow! Count=%X State=%p #Ops=%X\n", - pop_count, walk_state, - walk_state->num_operands)); + ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -506,10 +489,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Underflow! Count=%X State=%p #Ops=%X\n", - pop_count, walk_state, - walk_state->num_operands)); + ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -826,16 +806,14 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) } if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%p is not a valid walk state\n", - walk_state)); + ACPI_REPORT_ERROR(("%p is not a valid walk state\n", + walk_state)); return; } if (walk_state->parser_state.scope) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%p walk still has a scope list\n", - walk_state)); + ACPI_REPORT_ERROR(("%p walk still has a scope list\n", + walk_state)); } /* Always must free any linked control states */ @@ -894,25 +872,18 @@ acpi_ds_result_insert(void *object, state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result object pushed! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index out of range: %X Obj=%p State=%p Num=%X\n", - index, object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Index out of range: %X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); return (AE_BAD_PARAMETER); } if (!object) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null Object! Index=%X Obj=%p State=%p Num=%X\n", - index, object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Null Object! Index=%X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -986,9 +957,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Missing operand/stack empty! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_REPORT_ERROR(("Missing operand/stack empty! State=%p #Ops=%X\n", walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } @@ -1000,9 +969,8 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for a valid operand */ if (!walk_state->operands[walk_state->num_operands]) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X\n", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 9522c643b88..b380ae1044b 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,7 +73,7 @@ acpi_status acpi_ev_initialize_events(void) /* Make sure we have ACPI tables */ if (!acpi_gbl_DSDT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n")); + ACPI_REPORT_WARNING(("No ACPI tables present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index bdd86537738..353b907edbf 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -599,7 +599,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ACPI_GPE_EDGE_TRIGGERED) { status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("%s, Unable to clear GPE[%2X]\n", + acpi_format_exception(status), + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -637,7 +639,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ACPI_GPE_LEVEL_TRIGGERED) { status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("%s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -651,7 +653,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) */ status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("%s, Unable to disable GPE[%2X]\n", + acpi_format_exception(status), + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } @@ -663,7 +667,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) acpi_ev_asynch_execute_gpe_method, gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("%s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); } break; @@ -671,7 +675,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) /* No handler or method to run! */ - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); + ACPI_REPORT_ERROR(("No handler or method for GPE[%2X], disabling event\n", gpe_number)); /* * Disable the GPE. The GPE will remain disabled until the ACPI @@ -679,7 +683,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) */ status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("%s, Unable to disable GPE[%2X]\n", + acpi_format_exception(status), + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } break; diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 8efca2eac27..3b9bbdda551 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -279,9 +279,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, default: /* Unknown method type, just ignore it! */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", - name)); + ACPI_REPORT_ERROR(("Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", name)); return_ACPI_STATUS(AE_OK); } @@ -291,9 +289,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", - name)); + ACPI_REPORT_ERROR(("Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", name)); return_ACPI_STATUS(AE_OK); } @@ -527,9 +523,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 acpi_ev_gpe_xrupt_handler, gpe_xrupt); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not install GPE interrupt handler at level 0x%X\n", - interrupt_number)); + ACPI_REPORT_ERROR(("Could not install GPE interrupt handler at level 0x%X\n", interrupt_number)); return_PTR(NULL); } } @@ -745,8 +739,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) sizeof(struct acpi_gpe_register_info)); if (!gpe_register_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not allocate the gpe_register_info table\n")); + ACPI_REPORT_ERROR(("Could not allocate the gpe_register_info table\n")); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -759,8 +752,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ACPI_GPE_REGISTER_WIDTH) * sizeof(struct acpi_gpe_event_info)); if (!gpe_event_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not allocate the gpe_event_info table\n")); + ACPI_REPORT_ERROR(("Could not allocate the gpe_event_info table\n")); status = AE_NO_MEMORY; goto error_exit; } diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 7e57b8470f5..78883239784 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -542,9 +542,7 @@ void acpi_ev_terminate(void) for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { status = acpi_disable_event((u32) i, 0); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not disable fixed event %d\n", - (u32) i)); + ACPI_REPORT_ERROR(("Could not disable fixed event %d\n", (u32) i)); } } @@ -556,8 +554,7 @@ void acpi_ev_terminate(void) status = acpi_ev_remove_sci_handler(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not remove SCI handler\n")); + ACPI_REPORT_ERROR(("Could not remove SCI handler\n")); } } @@ -570,8 +567,7 @@ void acpi_ev_terminate(void) if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { status = acpi_disable(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "acpi_disable failed\n")); + ACPI_REPORT_WARNING(("acpi_disable failed\n")); } } return_VOID; diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 84fad082d80..900e5b32e59 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -295,12 +295,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, handler_desc = region_obj->region.handler; if (!handler_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No handler for Region [%4.4s] (%p) [%s]\n", - acpi_ut_get_node_name(region_obj->region. - node), region_obj, - acpi_ut_get_region_name(region_obj->region. - space_id))); + ACPI_REPORT_ERROR(("No handler for Region [%4.4s] (%p) [%s]\n", + acpi_ut_get_node_name(region_obj->region. + node), region_obj, + acpi_ut_get_region_name(region_obj->region. + space_id))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -317,12 +316,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, if (!region_setup) { /* No initialization routine, exit with error */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No init routine for region(%p) [%s]\n", - region_obj, - acpi_ut_get_region_name(region_obj-> - region. - space_id))); + ACPI_REPORT_ERROR(("No init routine for region(%p) [%s]\n", region_obj, acpi_ut_get_region_name(region_obj->region.space_id))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -347,12 +341,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, /* Check for failure of the Region Setup */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Region Init: %s [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name(region_obj-> - region. - space_id))); + ACPI_REPORT_ERROR(("Region Initialization: %s [%s]\n", + acpi_format_exception(status), + acpi_ut_get_region_name(region_obj-> + region. + space_id))); return_ACPI_STATUS(status); } @@ -501,12 +494,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, status = acpi_ev_execute_reg_method(region_obj, 0); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s from region _REG, [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name - (region_obj->region. - space_id))); + ACPI_REPORT_ERROR(("%s from region _REG, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); } if (acpi_ns_is_locked) { @@ -528,12 +516,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s from region init, [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name - (region_obj->region. - space_id))); + ACPI_REPORT_ERROR(("%s from region init, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); } region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index a1bd2da27c4..de1a38e9ce2 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index e2c0b48a7e9..9a622169008 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 57d73299298..b2f69b1ac4b 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,8 +143,8 @@ acpi_install_fixed_event_handler(u32 event, if (ACPI_SUCCESS(status)) status = acpi_enable_event(event, 0); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Could not enable fixed event.\n")); + ACPI_REPORT_WARNING(("Could not enable fixed event %X\n", + event)); /* Remove the handler */ @@ -204,10 +204,9 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) acpi_gbl_fixed_event_handlers[event].context = NULL; if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Could not write to fixed event enable register.\n")); + ACPI_REPORT_WARNING(("Could not write to fixed event enable register %X\n", event)); } else { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n", event)); } @@ -434,7 +433,7 @@ acpi_remove_notify_handler(acpi_handle device, if (device == ACPI_ROOT_OBJECT) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Removing notify handler for ROOT object.\n")); + "Removing notify handler for namespace root object\n")); if (((handler_type & ACPI_SYSTEM_NOTIFY) && !acpi_gbl_system_notify.handler) || diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index c1b89892825..90eb7939e98 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,8 +70,7 @@ acpi_status acpi_enable(void) /* Make sure we have the FADT */ if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "No FADT information present!\n")); + ACPI_REPORT_WARNING(("No FADT information present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -83,7 +82,7 @@ acpi_status acpi_enable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n")); + ACPI_REPORT_ERROR(("Could not transition to ACPI mode\n")); return_ACPI_STATUS(status); } @@ -113,8 +112,7 @@ acpi_status acpi_disable(void) ACPI_FUNCTION_TRACE("acpi_disable"); if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "No FADT information present!\n")); + ACPI_REPORT_WARNING(("No FADT information present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -127,8 +125,7 @@ acpi_status acpi_disable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not exit ACPI mode to legacy mode")); + ACPI_REPORT_ERROR(("Could not exit ACPI mode to legacy mode")); return_ACPI_STATUS(status); } @@ -185,9 +182,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags) } if (value != 1) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not enable %s event\n", - acpi_ut_get_event_name(event))); + ACPI_REPORT_ERROR(("Could not enable %s event\n", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } @@ -384,9 +380,8 @@ acpi_status acpi_disable_event(u32 event, u32 flags) } if (value != 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not disable %s events\n", - acpi_ut_get_event_name(event))); + ACPI_REPORT_ERROR(("Could not disable %s events\n", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index 6f28ea2db5b..abf5caca9ae 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 1ce365d651d..109d0255a5b 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -413,9 +413,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, (!ACPI_STRNCMP(table_ptr->signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", - table_ptr->signature)); + ACPI_REPORT_ERROR(("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", table_ptr->signature)); status = AE_BAD_SIGNATURE; goto cleanup; } diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index fa9e75d4ec6..e6f55cf8ad3 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -654,17 +654,8 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown Target type ID 0x%X Op %s dest_type %s\n", - GET_CURRENT_ARG_TYPE(walk_state->op_info-> - runtime_args), - walk_state->op_info->name, - acpi_ut_get_type_name(destination_type))); - - ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n", - GET_CURRENT_ARG_TYPE(walk_state->op_info-> - runtime_args))) - status = AE_AML_INTERNAL; + ACPI_REPORT_ERROR(("Unknown Target type ID 0x%X aml_opcode %X dest_type %s\n", GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args), walk_state->opcode, acpi_ut_get_type_name(destination_type))); + status = AE_AML_INTERNAL; } /* diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 91c49188fb0..da313dad576 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 17c79cd91b3..a7cca8d4f85 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index ab1ba399aa2..78a76f91a1c 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index ba6e08843c2..9fe27fd04a2 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,10 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, /* We must have a valid region */ if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed Region, found type %X (%s)\n", - ACPI_GET_OBJECT_TYPE(rgn_desc), - acpi_ut_get_object_type_name(rgn_desc))); + ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", + ACPI_GET_OBJECT_TYPE(rgn_desc), + acpi_ut_get_object_type_name(rgn_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -162,31 +161,14 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * than the region itself. For example, a region of length one * byte, and a field with Dword access specified. */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", - acpi_ut_get_node_name(obj_desc-> - common_field. - node), - obj_desc->common_field. - access_byte_width, - acpi_ut_get_node_name(rgn_desc-> - region.node), - rgn_desc->region.length)); + ACPI_REPORT_ERROR(("Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.access_byte_width, acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length)); } /* * Offset rounded up to next multiple of field width * exceeds region length, indicate an error */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", - acpi_ut_get_node_name(obj_desc->common_field. - node), - obj_desc->common_field.base_byte_offset, - field_datum_byte_offset, - obj_desc->common_field.access_byte_width, - acpi_ut_get_node_name(rgn_desc->region.node), - rgn_desc->region.length)); + ACPI_REPORT_ERROR(("Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.base_byte_offset, field_datum_byte_offset, obj_desc->common_field.access_byte_width, acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length)); return_ACPI_STATUS(AE_AML_REGION_LIMIT); } @@ -270,12 +252,11 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, if (ACPI_FAILURE(status)) { if (status == AE_NOT_IMPLEMENTED) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Region %s(%X) not implemented\n", - acpi_ut_get_region_name(rgn_desc-> - region. - space_id), - rgn_desc->region.space_id)); + ACPI_REPORT_ERROR(("Region %s(%X) not implemented\n", + acpi_ut_get_region_name(rgn_desc-> + region. + space_id), + rgn_desc->region.space_id)); } else if (status == AE_NOT_EXIST) { ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", acpi_ut_get_region_name(rgn_desc-> @@ -618,11 +599,10 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "write_with_update_rule: Unknown update_rule setting: %X\n", - (obj_desc->common_field. - field_flags & - AML_FIELD_UPDATE_RULE_MASK))); + ACPI_REPORT_ERROR(("Unknown update_rule value: %X\n", + (obj_desc->common_field. + field_flags & + AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } } @@ -677,10 +657,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field size %X (bits) is too large for buffer (%X)\n", - obj_desc->common_field.bit_length, - buffer_length)); + ACPI_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_length)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } @@ -792,10 +769,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field size %X (bits) is too large for buffer (%X)\n", - obj_desc->common_field.bit_length, - buffer_length)); + ACPI_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_length)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 0778bff632b..5ad34566738 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,7 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } break; @@ -113,7 +114,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Invalid descriptor type %X\n", + ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); return_ACPI_STATUS(AE_TYPE); } @@ -266,7 +268,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, break; default: - ACPI_REPORT_ERROR(("Concatanate - invalid object type: %X\n", + ACPI_REPORT_ERROR(("Invalid object type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; } @@ -368,7 +370,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Invalid object type, should not happen here */ - ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", + ACPI_REPORT_ERROR(("Invalid object type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; goto cleanup; diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index ab47f6d8b5c..89b8ab79410 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 7bb5e17b568..de3216b6a4f 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,7 +99,8 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) */ name_string = ACPI_MEM_ALLOCATE(size_needed); if (!name_string) { - ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); + ACPI_REPORT_ERROR(("Could not allocate size %d\n", + size_needed)); return_PTR(NULL); } @@ -167,8 +168,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) char_buf[0] = *aml_address; if ('0' <= char_buf[0] && char_buf[0] <= '9') { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n", - char_buf[0])); + ACPI_REPORT_ERROR(("Invalid leading digit: %c\n", char_buf[0])); return_ACPI_STATUS(AE_CTRL_PENDING); } @@ -211,9 +211,8 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) * the required 4 */ status = AE_AML_BAD_NAME; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bad character %02x in name, at %p\n", - *aml_address, aml_address)); + ACPI_REPORT_ERROR(("Bad character %02x in name, at %p\n", + *aml_address, aml_address)); } *in_aml_address = ACPI_CAST_PTR(u8, aml_address); @@ -412,8 +411,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, if (AE_CTRL_PENDING == status && has_prefix) { /* Ran out of segments after processing a prefix */ - ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n", - name_string)); + ACPI_REPORT_ERROR(("Malformed Name at %p\n", name_string)); status = AE_AML_BAD_NAME; } diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 97e34542f5e..bc8837ecb71 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,7 +111,8 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -188,7 +189,8 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -227,7 +229,8 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -346,9 +349,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Check the range of the digit */ if (temp32 > 9) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "BCD digit too large (not decimal): 0x%X\n", - temp32)); + ACPI_REPORT_ERROR(("BCD digit too large (not decimal): 0x%X\n", temp32)); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; @@ -393,12 +394,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Overflow if there is any data left in Digit */ if (digit > 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Integer too large to convert to BCD: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(operand - [0]-> - integer. - value))); + ACPI_REPORT_ERROR(("Integer too large to convert to BCD: %8.8X%8.8X\n", ACPI_FORMAT_UINT64(operand[0]->integer.value))); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } @@ -525,15 +521,16 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* These are two obsolete opcodes */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s is obsolete and not implemented\n", - acpi_ps_get_opcode_name(walk_state->opcode))); + ACPI_REPORT_ERROR(("%s is obsolete and not implemented\n", + acpi_ps_get_opcode_name(walk_state-> + opcode))); status = AE_SUPPORT; goto cleanup; default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -639,11 +636,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, walk_state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s: bad operand(s) %s\n", - acpi_ps_get_opcode_name(walk_state-> - opcode), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("%s: bad operand(s) %s\n", + acpi_ps_get_opcode_name(walk_state-> + opcode), + acpi_format_exception(status))); goto cleanup; } @@ -742,9 +738,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", - acpi_ut_get_type_name(type))); + ACPI_REPORT_ERROR(("Operand is not Buf/Int/Str/Pkg - found type %s\n", acpi_ut_get_type_name(type))); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -941,11 +935,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown Index target_type %X in obj %p\n", - operand[0]->reference. - target_type, - operand[0])); + ACPI_REPORT_ERROR(("Unknown Index target_type %X in obj %p\n", operand[0]->reference.target_type, operand[0])); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -971,11 +961,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown opcode in ref(%p) - %X\n", - operand[0], - operand[0]->reference. - opcode)); + ACPI_REPORT_ERROR(("Unknown opcode in ref(%p) - %X\n", operand[0], operand[0]->reference.opcode)); status = AE_TYPE; goto cleanup; @@ -985,7 +971,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index d8472842c1f..7c59dda4094 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,9 +111,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) /* Are notifies allowed on this object? */ if (!acpi_ev_is_notify_object(node)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unexpected notify object type [%s]\n", - acpi_ut_get_type_name(node->type))); + ACPI_REPORT_ERROR(("Unexpected notify object type [%s]\n", acpi_ut_get_type_name(node->type))); status = AE_AML_OPERAND_TYPE; break; @@ -157,7 +155,8 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; } @@ -221,7 +220,8 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -389,10 +389,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* Object to be indexed is a Package */ if (index >= operand[0]->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index value (%X%8.8X) beyond package end (%X)\n", - ACPI_FORMAT_UINT64(index), - operand[0]->package.count)); + ACPI_REPORT_ERROR(("Index value (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -405,10 +402,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* Object to be indexed is a Buffer/String */ if (index >= operand[0]->buffer.length) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index value (%X%8.8X) beyond end of buffer (%X)\n", - ACPI_FORMAT_UINT64(index), - operand[0]->buffer.length)); + ACPI_REPORT_ERROR(("Index value (%X%8.8X) beyond end of buffer (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -440,7 +434,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -544,7 +539,8 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 2ea1c322970..a979b338a49 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,7 +119,8 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -242,7 +243,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index 5dee7713957..05e7f9b67f2 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -234,8 +234,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Match operator out of range\n")); + ACPI_REPORT_ERROR(("Match operator out of range\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -244,10 +243,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) index = operand[5]->integer.value; if (index >= operand[0]->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index (%X%8.8X) beyond package end (%X)\n", - ACPI_FORMAT_UINT64(index), - operand[0]->package.count)); + ACPI_REPORT_ERROR(("Index (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -316,7 +312,8 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 88ccbf3b29d..3bde780c94c 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -274,8 +274,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, default: /* Invalid field access type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown field access type %X\n", access)); + ACPI_REPORT_ERROR(("Unknown field access type %X\n", access)); return_UINT32(0); } @@ -422,15 +421,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { if (!info->region_node) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n")); + ACPI_REPORT_ERROR(("Null region_node\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } type = acpi_ns_get_type(info->region_node); if (type != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed Region, found type %X (%s)\n", - type, acpi_ut_get_type_name(type))); + ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", type, acpi_ut_get_type_name(type))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 80118be3f54..82983575cca 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -103,9 +103,8 @@ acpi_ex_system_memory_space_handler(u32 function, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid system_memory width %d\n", - bit_width)); + ACPI_REPORT_ERROR(("Invalid system_memory width %d\n", + bit_width)); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } @@ -159,10 +158,7 @@ acpi_ex_system_memory_space_handler(u32 function, (void **)&mem_info-> mapped_logical_address); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X%8.8X, size %X\n", - ACPI_FORMAT_UINT64(address), - (u32) window_size)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X, size %X\n", ACPI_FORMAT_UINT64(address), (u32) window_size)); mem_info->mapped_length = 0; return_ACPI_STATUS(status); } diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index ff5d8f97e8e..a5cca7eda21 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,8 +122,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, } if (!source_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No object attached to node %p\n", node)); + ACPI_REPORT_ERROR(("No object attached to node %p\n", node)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -135,10 +134,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_PACKAGE: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a Package, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a Package, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -154,10 +152,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_BUFFER: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a Buffer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a Buffer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -173,10 +170,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_STRING: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a String, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a String, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -189,10 +185,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_INTEGER: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a Integer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a Integer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -236,9 +231,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_ANY: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Untyped entry %p, no attached object!\n", - node)); + ACPI_REPORT_ERROR(("Untyped entry %p, no attached object!\n", + node)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ @@ -257,12 +251,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, default: /* No named references are allowed here */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported Reference opcode %X (%s)\n", - source_desc->reference.opcode, - acpi_ps_get_opcode_name(source_desc-> - reference. - opcode))); + ACPI_REPORT_ERROR(("Unsupported Reference opcode %X (%s)\n", source_desc->reference.opcode, acpi_ps_get_opcode_name(source_desc->reference.opcode))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -272,9 +261,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* Default case is for unknown types */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Node %p - Unknown object type %X\n", - node, entry_type)); + ACPI_REPORT_ERROR(("Node %p - Unknown object type %X\n", + node, entry_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 97eecbd3242..ae2d2da0084 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,7 +81,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); if (!stack_ptr || !*stack_ptr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n")); + ACPI_REPORT_ERROR(("Internal - null pointer\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -97,8 +97,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, } if (!*stack_ptr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Internal - null pointer\n")); + ACPI_REPORT_ERROR(("Internal - null pointer\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } } @@ -228,9 +227,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, * A NULL object descriptor means an unitialized element of * the package, can't dereference it */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Attempt to deref an Index to NULL pkg element Idx=%p\n", - stack_desc)); + ACPI_REPORT_ERROR(("Attempt to deref an Index to NULL pkg element Idx=%p\n", stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } break; @@ -239,7 +236,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, /* Invalid reference object */ - ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); + ACPI_REPORT_ERROR(("Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; break; } @@ -264,7 +261,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, default: - ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); + ACPI_REPORT_ERROR(("Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); status = AE_AML_INTERNAL; break; } @@ -386,7 +383,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); + ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", + node, + acpi_ut_get_descriptor_name + (node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -442,7 +442,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); + ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", + node, + acpi_ut_get_descriptor_name + (node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -511,7 +514,8 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("Unknown Reference subtype %X\n", + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index b04e4a3707a..804faebf825 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,7 +73,7 @@ static acpi_status acpi_ex_check_object_type(acpi_object_type type_needed, acpi_object_type this_type, void *object) { - ACPI_FUNCTION_NAME("ex_check_object_type"); + ACPI_FUNCTION_ENTRY(); if (type_needed == ACPI_TYPE_ANY) { /* All types OK, so we don't perform any typechecks */ @@ -95,10 +95,9 @@ acpi_ex_check_object_type(acpi_object_type type_needed, } if (type_needed != this_type) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [%s], found [%s] %p\n", - acpi_ut_get_type_name(type_needed), - acpi_ut_get_type_name(this_type), object)); + ACPI_REPORT_ERROR(("Needed type [%s], found [%s] %p\n", + acpi_ut_get_type_name(type_needed), + acpi_ut_get_type_name(this_type), object)); return (AE_AML_OPERAND_TYPE); } @@ -151,7 +150,7 @@ acpi_ex_resolve_operands(u16 opcode, arg_types = op_info->runtime_args; if (arg_types == ARGI_INVALID_OPCODE) { - ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -169,7 +168,8 @@ acpi_ex_resolve_operands(u16 opcode, */ while (GET_CURRENT_ARG_TYPE(arg_types)) { if (!stack_ptr || !*stack_ptr) { - ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); + ACPI_REPORT_ERROR(("Null stack entry at %p\n", + stack_ptr)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -198,9 +198,7 @@ acpi_ex_resolve_operands(u16 opcode, /* Check for bad acpi_object_type */ if (!acpi_ut_valid_object_type(object_type)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bad operand object type [%X]\n", - object_type)); + ACPI_REPORT_ERROR(("Bad operand object type [%X]\n", object_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -238,13 +236,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", - obj_desc->reference. - opcode, - (acpi_ps_get_opcode_info - (obj_desc->reference. - opcode))->name)); + ACPI_REPORT_ERROR(("Operand is a Reference, Unknown Reference Opcode: %X\n", obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -255,11 +247,10 @@ acpi_ex_resolve_operands(u16 opcode, /* Invalid descriptor */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid descriptor %p [%s]\n", - obj_desc, - acpi_ut_get_descriptor_name - (obj_desc))); + ACPI_REPORT_ERROR(("Invalid descriptor %p [%s]\n", + obj_desc, + acpi_ut_get_descriptor_name + (obj_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -417,11 +408,7 @@ acpi_ex_resolve_operands(u16 opcode, acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), - obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -444,11 +431,7 @@ acpi_ex_resolve_operands(u16 opcode, status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), - obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -472,11 +455,7 @@ acpi_ex_resolve_operands(u16 opcode, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), - obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -502,10 +481,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -539,10 +515,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -566,10 +539,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Buffer/String/Package/Reference], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Buffer/String/Package/Reference], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -588,10 +558,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Buffer/String/Package], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Buffer/String/Package], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -611,10 +578,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Region/region_field], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Region/region_field], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -656,10 +620,7 @@ acpi_ex_resolve_operands(u16 opcode, break; } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -669,9 +630,7 @@ acpi_ex_resolve_operands(u16 opcode, /* Unknown type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Internal - Unknown ARGI (required operand) type %X\n", - this_arg_type)); + ACPI_REPORT_ERROR(("Internal - Unknown ARGI (required operand) type %X\n", this_arg_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index a7d8eea305c..202ebe1eb95 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -250,7 +250,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Validate parameters */ if (!source_desc || !dest_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n")); + ACPI_REPORT_ERROR(("Null parameter\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -290,10 +290,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Destination is not a Reference object */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Target is not a Reference or Constant object - %s [%p]\n", - acpi_ut_get_object_type_name(dest_desc), - dest_desc)); + ACPI_REPORT_ERROR(("Target is not a Reference or Constant object - %s [%p]\n", acpi_ut_get_object_type_name(dest_desc), dest_desc)); ACPI_DUMP_STACK_ENTRY(source_desc); ACPI_DUMP_STACK_ENTRY(dest_desc); @@ -360,7 +357,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, default: - ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n", + ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", ref_desc->reference.opcode)); ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); @@ -490,10 +487,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, /* All other types are invalid */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Source must be Integer/Buffer/String type, not %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Source must be Integer/Buffer/String type, not %s\n", acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -503,8 +497,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Target is not a Package or buffer_field\n")); + ACPI_REPORT_ERROR(("Target is not a Package or buffer_field\n")); status = AE_AML_OPERAND_TYPE; break; } diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 382f63c14ea..25bbc1d7854 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -123,11 +123,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, && (source_desc->reference.opcode == AML_LOAD_OP))) { /* Conversion successful but still not a valid type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", - acpi_ut_get_object_type_name - (source_desc), - acpi_ut_get_type_name(target_type))); + ACPI_REPORT_ERROR(("Cannot assign type %s to %s (must be type Int/Str/Buf)\n", acpi_ut_get_object_type_name(source_desc), acpi_ut_get_type_name(target_type))); status = AE_AML_OPERAND_TYPE; } break; @@ -280,9 +276,8 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, /* * All other types come here. */ - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Store into type %s not implemented\n", - acpi_ut_get_object_type_name(dest_desc))); + ACPI_REPORT_WARNING(("Store into type %s not implemented\n", + acpi_ut_get_object_type_name(dest_desc))); status = AE_NOT_IMPLEMENTED; break; diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 855db713075..6ab70708775 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 8a88b841237..9a3684d3cf8 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -129,7 +129,7 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n", + ACPI_REPORT_ERROR(("Time parameter is too large (%d)\n", how_long)); status = AE_AML_OPERAND_VALUE; } else { diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 9f4e547d773..990c40e0c04 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,9 +200,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) if (ACPI_SUCCESS(status)) { locked = TRUE; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not acquire Global Lock, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not acquire Global Lock, %s\n", acpi_format_exception(status))); } } diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 20a335cc9be..5c068cc4f67 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,8 +68,7 @@ acpi_status acpi_hw_initialize(void) /* We must have the ACPI tables by the time we get here */ if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n")); - + ACPI_REPORT_ERROR(("No FADT is present\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -108,7 +107,7 @@ acpi_status acpi_hw_set_mode(u32 mode) * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n")); + ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed\n")); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 5c8e5dfd024..d84942d22dd 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index b243f20708b..b4b50a3d170 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -7,7 +7,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -202,12 +202,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", - acpi_format_exception(status), - sleep_state_name, info.return_object, - acpi_ut_get_object_type_name(info. - return_object))); + ACPI_REPORT_ERROR(("%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", acpi_format_exception(status), sleep_state_name, info.return_object, acpi_ut_get_object_type_name(info.return_object))); } acpi_ut_remove_reference(info.return_object); @@ -230,12 +225,11 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { - ACPI_FUNCTION_NAME("hw_get_bit_register_info"); + ACPI_FUNCTION_ENTRY(); if (register_id > ACPI_BITREG_MAX) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid bit_register ID: %X\n", - register_id)); + ACPI_REPORT_ERROR(("Invalid bit_register ID: %X\n", + register_id)); return (NULL); } @@ -570,8 +564,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n", - register_id)); + ACPI_REPORT_ERROR(("Unknown Register ID: %X\n", register_id)); status = AE_BAD_PARAMETER; break; } @@ -766,9 +759,8 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_REPORT_ERROR(("Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } @@ -837,9 +829,8 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_REPORT_ERROR(("Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 34519069050..992128d7111 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index aff6dc14178..fc10b7cb456 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 6923059ba3c..c2db93e25b7 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -110,10 +110,7 @@ acpi_status acpi_ns_root_initialize(void) ACPI_NS_NO_UPSEARCH, NULL, &new_node); if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not create predefined name %s, %s\n", - init_val->name, - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not create predefined name %s, %s\n", init_val->name, acpi_format_exception(status))); } /* @@ -124,9 +121,7 @@ acpi_status acpi_ns_root_initialize(void) if (init_val->val) { status = acpi_os_predefined_override(init_val, &val); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not override predefined %s\n", - init_val->name)); + ACPI_REPORT_ERROR(("Could not override predefined %s\n", init_val->name)); } if (!val) { @@ -339,7 +334,10 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, prefix_node = scope_info->scope.node; if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node))); + ACPI_REPORT_ERROR(("%p is not a namespace node [%s]\n", + prefix_node, + acpi_ut_get_descriptor_name + (prefix_node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -600,7 +598,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, (this_node->type != type_to_check_for)) { /* Complain about a type mismatch */ - ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); + ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", ACPI_CAST_PTR(char, &simple_name), acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); } /* diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index cc7a85f8cfe..3db950f5d5a 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -272,9 +272,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) /* Grandchildren should have all been deleted already */ if (child_node->child) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Found a grandchild! P=%p C=%p\n", - parent_node, child_node)); + ACPI_REPORT_ERROR(("Found a grandchild! P=%p C=%p\n", + parent_node, child_node)); } /* Now we can free this child object */ diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 864c642759f..2f0b70e3e88 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -198,7 +198,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, /* Check the node type and name */ if (type > ACPI_TYPE_LOCAL_MAX) { - ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type)); + ACPI_REPORT_WARNING(("Invalid ACPI Object Type %08X\n", + type)); } if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index 55de883943d..aff899a935e 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 0191c7d9282..e3c667072e2 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -373,8 +373,7 @@ acpi_ns_execute_control_method(struct acpi_parameter_info *info) info->obj_desc = acpi_ns_get_attached_object(info->node); if (!info->obj_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No attached method object\n")); + ACPI_REPORT_ERROR(("No attached method object\n")); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(AE_NULL_OBJECT); diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index efa3f423373..6c117893f30 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,8 +93,8 @@ acpi_status acpi_ns_initialize_objects(void) ACPI_UINT32_MAX, acpi_ns_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("walk_namespace failed! %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -159,8 +159,8 @@ acpi_status acpi_ns_initialize_devices(void) (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("walk_namespace failed! %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -289,12 +289,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n")); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not execute arguments for [%4.4s] (%s), %s\n", - acpi_ut_get_node_name(node), - acpi_ut_get_type_name(type), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("\nCould not execute arguments for [%4.4s] (%s), %s\n", acpi_ut_get_node_name(node), acpi_ut_get_type_name(type), acpi_format_exception(status))); } /* @@ -421,8 +416,9 @@ acpi_ns_init_one_device(acpi_handle obj_handle, #ifdef ACPI_DEBUG_OUTPUT char *scope_name = acpi_ns_get_external_pathname(ini_node); - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", - scope_name, acpi_format_exception(status))); + ACPI_REPORT_WARNING(("%s._INI failed: %s\n", + scope_name, + acpi_format_exception(status))); ACPI_MEM_FREE(scope_name); #endif diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index c28849de465..0b4a866ef5a 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,7 +92,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, /* Check validity of the AML start and length */ if (!table_desc->aml_start) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n")); + ACPI_REPORT_ERROR(("Null AML pointer\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -263,7 +263,7 @@ acpi_status acpi_ns_load_namespace(void) /* There must be at least a DSDT installed */ if (acpi_gbl_DSDT == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n")); + ACPI_REPORT_ERROR(("DSDT is not in memory\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 5400728eb79..411e1f8b11d 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, acpi_size index; struct acpi_namespace_node *parent_node; - ACPI_FUNCTION_NAME("ns_build_external_path"); + ACPI_FUNCTION_ENTRY(); /* Special case for root */ @@ -110,9 +110,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, name_buffer[index] = AML_ROOT_PREFIX; if (index != 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not construct pathname; index=%X, size=%X, Path=%s\n", - (u32) index, (u32) size, &name_buffer[size])); + ACPI_REPORT_ERROR(("Could not construct pathname; index=%X, size=%X, Path=%s\n", (u32) index, (u32) size, &name_buffer[size])); } return; @@ -148,7 +146,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) name_buffer = ACPI_MEM_CALLOCATE(size); if (!name_buffer) { - ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n")); + ACPI_REPORT_ERROR(("Allocation failure\n")); return_PTR(NULL); } diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index fc9be946ebe..86113093f7b 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,21 +84,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, if (!node) { /* Invalid handle */ - ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n")); + ACPI_REPORT_ERROR(("Null named_obj handle\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!object && (ACPI_TYPE_ANY != type)) { /* Null object */ - ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); + ACPI_REPORT_ERROR(("Null object, but type not ACPI_TYPE_ANY\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { /* Not a name handle */ - ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n", + ACPI_REPORT_ERROR(("Invalid handle %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -254,7 +254,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); if (!node) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n")); + ACPI_REPORT_WARNING(("Null Node ptr\n")); return_PTR(NULL); } diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 433442a9ec7..232be430365 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index c1b1943d467..f094a2eb851 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -298,18 +298,15 @@ acpi_ns_search_and_enter(u32 target_name, /* Parameter validation */ if (!node || !target_name || !return_node) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null param: Node %p Name %X return_node %p\n", - node, target_name, return_node)); - - ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n")); + ACPI_REPORT_ERROR(("Null param: Node %p Name %X return_node %p\n", node, target_name, return_node)); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Name must consist of printable characters */ if (!acpi_ut_valid_acpi_name(target_name)) { - ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name)); + ACPI_REPORT_ERROR(("Bad character in ACPI Name: %X\n", + target_name)); return_ACPI_STATUS(AE_BAD_CHARACTER); } diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 549075fb9f8..bc779fdd3ca 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,6 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * internal_name - Name or path of the namespace node * lookup_status - Exception code from NS lookup * @@ -76,14 +75,12 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); void acpi_ns_report_error(char *module_name, u32 line_number, - u32 component_id, char *internal_name, acpi_status lookup_status) { acpi_status status; char *name = NULL; - acpi_os_printf("%8s-%04d: *** Error: Looking up ", - module_name, line_number); + acpi_ut_report_error(module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ @@ -109,7 +106,7 @@ acpi_ns_report_error(char *module_name, } } - acpi_os_printf(" in namespace, %s\n", + acpi_os_printf("Namespace lookup failure, %s\n", acpi_format_exception(lookup_status)); } @@ -119,10 +116,9 @@ acpi_ns_report_error(char *module_name, * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * Message - Error message to use on failure * prefix_node - Prefix relative to the path - * Path - Path to the node + * Path - Path to the node (optional) * method_status - Execution status * * RETURN: None @@ -134,7 +130,6 @@ acpi_ns_report_error(char *module_name, void acpi_ns_report_method_error(char *module_name, u32 line_number, - u32 component_id, char *message, struct acpi_namespace_node *prefix_node, char *path, acpi_status method_status) @@ -142,17 +137,16 @@ acpi_ns_report_method_error(char *module_name, acpi_status status; struct acpi_namespace_node *node = prefix_node; + acpi_ut_report_error(module_name, line_number); + if (path) { status = acpi_ns_get_node_by_path(path, prefix_node, ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE(status)) { - acpi_os_printf - ("report_method_error: Could not get node\n"); - return; + acpi_os_printf("[Could not get node by pathname]"); } } - acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); acpi_ns_print_node_pathname(node, message); acpi_os_printf(", %s\n", acpi_format_exception(method_status)); } @@ -248,7 +242,7 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) ACPI_FUNCTION_TRACE("ns_get_type"); if (!node) { - ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); + ACPI_REPORT_WARNING(("Null Node parameter\n")); return_UINT32(ACPI_TYPE_ANY); } @@ -275,7 +269,7 @@ u32 acpi_ns_local(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* Type code out of range */ - ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); + ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); return_UINT32(ACPI_NS_NORMAL); } @@ -627,7 +621,7 @@ acpi_ns_externalize_name(u32 internal_name_length, * with internal_name (invalid format). */ if (required_length > internal_name_length) { - ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n")); + ACPI_REPORT_ERROR(("Invalid internal name\n")); return_ACPI_STATUS(AE_BAD_PATHNAME); } @@ -803,8 +797,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* type code out of range */ - ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", - type)); + ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); return_UINT32(ACPI_NS_NORMAL); } diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 5f164c0df33..fcab1e784b8 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 75b137a6a3c..de13add43ef 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,8 +112,7 @@ acpi_evaluate_object_typed(acpi_handle handle, if (return_buffer->length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n")); - + ACPI_REPORT_ERROR(("No return value\n")); return_ACPI_STATUS(AE_NULL_OBJECT); } @@ -125,11 +124,11 @@ acpi_evaluate_object_typed(acpi_handle handle, /* Return object type does not match requested type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Incorrect return type [%s] requested [%s]\n", - acpi_ut_get_type_name(((union acpi_object *) - return_buffer->pointer)->type), - acpi_ut_get_type_name(return_type))); + ACPI_REPORT_ERROR(("Incorrect return type [%s] requested [%s]\n", + acpi_ut_get_type_name(((union acpi_object *) + return_buffer->pointer)-> + type), + acpi_ut_get_type_name(return_type))); if (must_free) { /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ @@ -236,11 +235,9 @@ acpi_evaluate_object(acpi_handle handle, * qualified names above, this is an error */ if (!pathname) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Both Handle and Pathname are NULL\n")); + ACPI_REPORT_ERROR(("Both Handle and Pathname are NULL\n")); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Handle is NULL and Pathname is relative\n")); + ACPI_REPORT_ERROR(("Handle is NULL and Pathname is relative\n")); } status = AE_BAD_PARAMETER; diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 6b5f8d4481d..853e6d170c9 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 0856d42e690..a0332595677 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index e6d4cb9fd30..3c37cd0ecd8 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -298,7 +298,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, acpi_ps_append_arg(arg, name_op); if (!method_desc) { - ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); + ACPI_REPORT_ERROR(("Control Method %p has no attached object\n", node)); return_ACPI_STATUS(AE_AML_INTERNAL); } diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index e81e51b8b3a..c66029b890b 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -123,16 +123,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) && ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { if (status == AE_AML_NO_RETURN_VALUE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invoked method did not return a value, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("Invoked method did not return a value, %s\n", acpi_format_exception(status))); } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "get_predicate Failed, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("get_predicate Failed, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -190,11 +184,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* The opcode is unrecognized. Just skip unknown opcodes */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Found unknown opcode %X at AML address %p offset %X, ignoring\n", - walk_state->opcode, - parser_state->aml, - walk_state->aml_offset)); + ACPI_REPORT_ERROR(("Found unknown opcode %X at AML address %p offset %X, ignoring\n", walk_state->opcode, parser_state->aml, walk_state->aml_offset)); ACPI_DUMP_BUFFER(parser_state->aml, 128); @@ -281,10 +271,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->descending_callback(walk_state, &op); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "During name lookup/catalog, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("During name lookup/catalog, %s\n", acpi_format_exception(status))); goto close_this_op; } diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 229ae86afe8..11d6351ab8b 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -747,7 +747,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) /* Unknown AML opcode */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Unknown AML opcode [%4.4X]\n", opcode)); return (&acpi_gbl_aml_op_info[_UNK]); diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index f0979b2956f..3b540fe17a0 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -512,9 +512,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } else if ((status != AE_OK) && (walk_state->method_desc)) { /* Either the method parse or actual execution failed */ - ACPI_REPORT_METHOD_ERROR - ("Method parse/execution failed", - walk_state->method_node, NULL, status); + ACPI_REPORT_MTERROR("Method parse/execution failed", + walk_state->method_node, NULL, + status); /* Check for possible multi-thread reentrancy problem */ diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index 1c953b6f1af..bc6047caccd 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index f0e755884ee..d387e2b01db 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,7 +132,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) if (op_info->class == AML_CLASS_UNKNOWN) { /* Invalid opcode */ - ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode)); + ACPI_REPORT_ERROR(("Invalid AML Opcode: 0x%2.2X\n", + op->common.aml_opcode)); return; } diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 2075efbb432..3e07cb9cb74 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 08f2321b6de..06f05bfd761 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 14d544d6086..2dd48cbb7c0 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 4ac942badbc..8fa3213ce00 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index c2c4d9079c6..1dfa6906d45 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 6c7c6c56063..7f46ca0bf33 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,21 +207,14 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* 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))); + ACPI_REPORT_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)); + ACPI_REPORT_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); } @@ -238,11 +231,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 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))); + ACPI_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -252,11 +241,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 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))); + ACPI_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -267,10 +252,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 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)); + ACPI_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -316,11 +298,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 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))); + ACPI_REPORT_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); } @@ -335,11 +313,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 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))); + ACPI_REPORT_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); } diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index c24e3eb658c..98356e2482c 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 623b0668933..d9ae64b77bd 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index ef24ba110c6..ea567167c4f 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 79e71257b69..1fa63bc2e36 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 573c0670564..e4778a51c17 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,9 +156,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid descriptor type (%X) in resource list\n", - resource->type)); + ACPI_REPORT_ERROR(("Invalid descriptor type (%X) in resource list\n", resource->type)); return_ACPI_STATUS(AE_BAD_DATA); } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 418a3fb6407..a5131936d69 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 4a758bd4a5c..83bfe0dd3eb 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -523,9 +523,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { * polarity/trigger interrupts 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", - aml->irq.flags)); + ACPI_REPORT_ERROR(("Invalid interrupt polarity/trigger in resource list, %X\n", aml->irq.flags)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -537,8 +535,7 @@ if (temp8 < 1) { } if (resource->data.dma.transfer == 0x03) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid DMA.Transfer preference (3)\n")); + ACPI_REPORT_ERROR(("Invalid DMA.Transfer preference (3)\n")); return_ACPI_STATUS(AE_BAD_DATA); } #endif diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 2236a0c90da..25b5aedd661 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 50a956b705b..88b67077aee 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index cd33397d923..48290b7e6ba 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 6acd5aeb093..0fedf4b27ea 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -362,8 +362,8 @@ acpi_tb_get_this_table(struct acpi_pointer *address, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid address flags %X\n", - address->pointer_type)); + ACPI_REPORT_ERROR(("Invalid address flags %X\n", + address->pointer_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 33c9ed8a6f9..496f336b3e3 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 10db8484e46..e1c9faa3982 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 3cee0cee4cc..17830902685 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -176,7 +176,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) { int no_match; - ACPI_FUNCTION_NAME("tb_validate_rsdt"); + ACPI_FUNCTION_ENTRY(); /* * Search for appropriate signature, RSDT or XSDT @@ -192,15 +192,11 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) if (no_match) { /* Invalid RSDT or XSDT signature */ - ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); + ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located. RSDP:\n")); ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); - ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, - "RSDT/XSDT signature at %X (%p) is invalid\n", - acpi_gbl_RSDP->rsdt_physical_address, - (void *)(acpi_native_uint) acpi_gbl_RSDP-> - rsdt_physical_address)); + ACPI_REPORT_ERROR(("RSDT/XSDT signature at %X (%p) is invalid\n", acpi_gbl_RSDP->rsdt_physical_address, (void *)(acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ACPI_REPORT_ERROR(("Looking for RSDT\n")) @@ -209,7 +205,6 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) } ACPI_DUMP_BUFFER((char *)table_ptr, 48); - return (AE_BAD_SIGNATURE); } @@ -243,9 +238,8 @@ acpi_status acpi_tb_get_table_rsdt(void) table_info.type = ACPI_TABLE_XSDT; status = acpi_tb_get_table(&address, &table_info); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not get the RSDT/XSDT, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not get the RSDT/XSDT, %s\n", + acpi_format_exception(status))); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 9d0bf536d67..38c6749e43d 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -144,14 +144,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) { acpi_name signature; - ACPI_FUNCTION_NAME("tb_validate_table_header"); + ACPI_FUNCTION_ENTRY(); /* Verify that this is a valid address */ if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cannot read table header at %p\n", - table_header)); + ACPI_REPORT_ERROR(("Cannot read table header at %p\n", + table_header)); return (AE_BAD_ADDRESS); } @@ -160,12 +159,10 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) ACPI_MOVE_32_TO_32(&signature, table_header->signature); if (!acpi_ut_valid_acpi_name(signature)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Table signature at %p [%p] has invalid characters\n", - table_header, &signature)); + ACPI_REPORT_ERROR(("Table signature at %p [%p] has invalid characters\n", table_header, &signature)); ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", - (char *)&signature)); + ACPI_CAST_PTR(char, &signature))); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -175,9 +172,7 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) /* Validate the table length */ if (table_header->length < sizeof(struct acpi_table_header)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid length in table header %p name %4.4s\n", - table_header, (char *)&signature)); + ACPI_REPORT_ERROR(("Invalid length in table header %p name %4.4s\n", table_header, (char *)&signature)); ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); @@ -291,8 +286,7 @@ acpi_tb_handle_to_object(u16 table_id, } } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n", - table_id)); + ACPI_REPORT_ERROR(("table_id=%X does not exist\n", table_id)); return (AE_BAD_PARAMETER); } #endif diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 3f96a4909aa..83a9ca8cb98 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ acpi_status acpi_load_tables(void) status = acpi_os_get_root_pointer(ACPI_LOGICAL_ADDRESSING, &rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Could not get RSDP, %s\n", + ACPI_REPORT_ERROR(("Could not get RSDP, %s\n", acpi_format_exception(status))); goto error_exit; } @@ -86,7 +86,8 @@ acpi_status acpi_load_tables(void) status = acpi_tb_verify_rsdp(&rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: RSDP Failed validation: %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("RSDP Failed validation: %s\n", + acpi_format_exception(status))); goto error_exit; } @@ -94,7 +95,8 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_table_rsdt(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Could not load RSDT: %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not load RSDT: %s\n", + acpi_format_exception(status))); goto error_exit; } @@ -102,7 +104,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_required_tables(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not get all required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); goto error_exit; } @@ -112,14 +114,15 @@ acpi_status acpi_load_tables(void) status = acpi_ns_load_namespace(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Could not load namespace: %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not load namespace: %s\n", + acpi_format_exception(status))); goto error_exit; } return_ACPI_STATUS(AE_OK); error_exit: - ACPI_REPORT_ERROR(("acpi_load_tables: Could not load tables: %s\n", + ACPI_REPORT_ERROR(("Could not load tables: %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index b01a4b2ae7d..6538ed818f5 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -396,9 +396,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) status = acpi_tb_find_rsdp(&table_info, flags); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "RSDP structure not found, %s Flags=%X\n", - acpi_format_exception(status), flags)); + ACPI_REPORT_ERROR(("RSDP structure not found, %s Flags=%X\n", + acpi_format_exception(status), flags)); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -503,10 +502,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_PTR_LENGTH, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - ACPI_EBDA_PTR_LOCATION, - ACPI_EBDA_PTR_LENGTH)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS(status); } @@ -530,10 +526,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_WINDOW_SIZE, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - physical_address, - ACPI_EBDA_WINDOW_SIZE)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", physical_address, ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS(status); } @@ -563,10 +556,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - ACPI_HI_RSDP_WINDOW_BASE, - ACPI_HI_RSDP_WINDOW_SIZE)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index b11b7ed788c..0efcbdf7e62 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -301,7 +301,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); size = 1; } @@ -310,7 +310,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_allocate: Could not allocate size %X\n", (u32) size)); @@ -344,7 +344,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); size = 1; } @@ -353,7 +353,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_callocate: Could not allocate size %X\n", (u32) size)); return_PTR(NULL); @@ -480,7 +480,7 @@ void *acpi_ut_callocate_and_track(acpi_size size, if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_callocate: Could not allocate size %X\n", (u32) size)); return (NULL); @@ -524,7 +524,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); if (NULL == allocation) { - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("acpi_ut_free: Attempt to delete a NULL address\n")); return_VOID; @@ -540,8 +540,8 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) status = acpi_ut_remove_allocation(debug_block, component, module, line); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not free memory, %s\n", + acpi_format_exception(status))); } acpi_os_free(debug_block); @@ -626,8 +626,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, if (element) { ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", - element, allocation)); + ACPI_REPORT_ERROR(("Element %p Address %p\n", + element, allocation)); goto unlock_and_exit; } @@ -687,7 +687,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, if (NULL == mem_list->list_head) { /* No allocations! */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); return_ACPI_STATUS(AE_OK); @@ -863,12 +863,10 @@ void acpi_ut_dump_allocations(u32 component, char *module) /* Print summary */ if (!num_outstanding) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No outstanding allocations\n")); + ACPI_REPORT_INFO(("No outstanding allocations\n")); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%d(%X) Outstanding allocations\n", - num_outstanding, num_outstanding)); + ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n", + num_outstanding, num_outstanding)); } return_VOID; diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 93d48681d27..2177cb1ef2c 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 568df9e42f8..1a4da006822 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -606,8 +606,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, /* * Packages as external input to control methods are not supported, */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Packages as parameters not implemented!\n")); + ACPI_REPORT_ERROR(("Packages as parameters not implemented!\n")); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -870,7 +869,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, count + 1) * sizeof(void *)); if (!dest_obj->package.elements) { - ACPI_REPORT_ERROR(("aml_build_copy_internal_package_object: Package allocation failure\n")); + ACPI_REPORT_ERROR(("Package allocation failure\n")); return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index d80e9263993..35f3d581e03 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 2bc878f7a12..1079a1a1f19 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -363,8 +363,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n", - action)); + ACPI_REPORT_ERROR(("Unknown action (%X)\n", action)); break; } @@ -374,9 +373,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) */ if (count > ACPI_MAX_REFERENCE_COUNT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "**** Warning **** Large Reference Count (%X) in object %p\n\n", - count, object)); + ACPI_REPORT_WARNING(("Large Reference Count (%X) in object %p\n\n", count, object)); } return; diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index cd63a2d93fe..f4dc374a0ee 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,8 +154,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_ut_get_node_name(prefix_node), path)); } else { - ACPI_REPORT_METHOD_ERROR("Method execution failed", - prefix_node, path, status); + ACPI_REPORT_MTERROR("Method execution failed", + prefix_node, path, status); } return_ACPI_STATUS(status); @@ -165,9 +165,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, if (!info.return_object) { if (expected_return_btypes) { - ACPI_REPORT_METHOD_ERROR("No object was returned from", - prefix_node, path, - AE_NOT_EXIST); + ACPI_REPORT_MTERROR("No object was returned from", + prefix_node, path, AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -212,15 +211,10 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, /* Is the return object one of the expected types? */ if (!(expected_return_btypes & return_btype)) { - ACPI_REPORT_METHOD_ERROR("Return object type is incorrect", - prefix_node, path, AE_TYPE); - - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Type returned from %s was incorrect: %s, expected Btypes: %X\n", - path, - acpi_ut_get_object_type_name(info. - return_object), - expected_return_btypes)); + ACPI_REPORT_MTERROR("Return object type is incorrect", + prefix_node, path, AE_TYPE); + + ACPI_REPORT_ERROR(("Type returned from %s was incorrect: %s, expected Btypes: %X\n", path, acpi_ut_get_object_type_name(info.return_object), expected_return_btypes)); /* On error exit, we must delete the return object */ diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 7c59c2b0d95..87ca9a0a8b7 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,8 +67,11 @@ const char *acpi_format_exception(acpi_status status) acpi_status sub_status; const char *exception = NULL; - ACPI_FUNCTION_NAME("format_exception"); + ACPI_FUNCTION_ENTRY(); + /* + * Status is composed of two parts, a "type" and an actual code + */ sub_status = (status & ~AE_CODE_MASK); switch (status & AE_CODE_MASK) { @@ -118,13 +121,13 @@ const char *acpi_format_exception(acpi_status status) if (!exception) { /* Exception code was not recognized */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown exception code: 0x%8.8X\n", status)); + ACPI_REPORT_ERROR(("Unknown exception code: 0x%8.8X\n", + status)); - return ((const char *)"UNKNOWN_STATUS_CODE"); + exception = "UNKNOWN_STATUS_CODE"; } - return ((const char *)exception); + return (ACPI_CAST_PTR(const char, exception)); } /******************************************************************************* @@ -519,7 +522,7 @@ char *acpi_ut_get_event_name(u32 event_id) return ("invalid_event_iD"); } - return ((char *)acpi_gbl_event_types[event_id]); + return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); } /******************************************************************************* @@ -586,10 +589,10 @@ char *acpi_ut_get_type_name(acpi_object_type type) { if (type > ACPI_TYPE_INVALID) { - return ((char *)acpi_gbl_bad_type); + return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); } - return ((char *)acpi_gbl_ns_type_names[type]); + return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); } char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 9dde82b0bea..7565ba6f90d 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,15 +221,14 @@ void acpi_ut_subsystem_shutdown(void) /* Just exit if subsystem is already shutdown */ if (acpi_gbl_shutdown) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "ACPI Subsystem is already terminated\n")); + ACPI_REPORT_ERROR(("ACPI Subsystem is already terminated\n")); return_VOID; } /* Subsystem appears active, go ahead and shut it down */ acpi_gbl_shutdown = TRUE; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); /* Close the acpi_event Handling */ diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 68a0a6f9412..06214201329 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,7 +82,7 @@ acpi_ut_short_divide(acpi_integer dividend, /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -144,7 +144,7 @@ acpi_ut_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -266,7 +266,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -292,7 +292,7 @@ acpi_ut_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 48d511d5c04..a77ffcd5570 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -841,7 +841,6 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * * RETURN: None * @@ -849,10 +848,10 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * ******************************************************************************/ -void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) +void acpi_ut_report_error(char *module_name, u32 line_number) { - acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); + acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); } /******************************************************************************* @@ -861,7 +860,6 @@ void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * * RETURN: None * @@ -869,11 +867,10 @@ void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) * ******************************************************************************/ -void -acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) +void acpi_ut_report_warning(char *module_name, u32 line_number) { - acpi_os_printf("%8s-%04d: *** Warning: ", module_name, line_number); + acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); } /******************************************************************************* @@ -882,7 +879,6 @@ acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * * RETURN: None * @@ -890,8 +886,8 @@ acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) * ******************************************************************************/ -void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id) +void acpi_ut_report_info(char *module_name, u32 line_number) { - acpi_os_printf("%8s-%04d: *** Info: ", module_name, line_number); + acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); } diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index e158b1b6313..ffaff55270b 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -216,21 +216,12 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) for (i = mutex_id; i < MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Mutex [%s] already acquired by this thread [%X]\n", - acpi_ut_get_mutex_name - (mutex_id), - this_thread_id)); + ACPI_REPORT_ERROR(("Mutex [%s] already acquired by this thread [%X]\n", acpi_ut_get_mutex_name(mutex_id), this_thread_id)); return (AE_ALREADY_ACQUIRED); } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", - this_thread_id, - acpi_ut_get_mutex_name(i), - acpi_ut_get_mutex_name - (mutex_id))); + ACPI_REPORT_ERROR(("Invalid acquire order: Thread %X owns [%s], wants [%s]\n", this_thread_id, acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); return (AE_ACQUIRE_DEADLOCK); } @@ -253,11 +244,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Thread %X could not acquire Mutex [%s] %s\n", - this_thread_id, - acpi_ut_get_mutex_name(mutex_id), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Thread %X could not acquire Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); } return (status); @@ -295,9 +282,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * Mutex must be acquired in order to release it! */ if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Mutex [%s] is not acquired, cannot release\n", - acpi_ut_get_mutex_name(mutex_id))); + ACPI_REPORT_ERROR(("Mutex [%X] is not acquired, cannot release\n", mutex_id)); return (AE_NOT_ACQUIRED); } @@ -318,11 +303,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) continue; } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid release order: owns [%s], releasing [%s]\n", - acpi_ut_get_mutex_name(i), - acpi_ut_get_mutex_name - (mutex_id))); + ACPI_REPORT_ERROR(("Invalid release order: owns [%s], releasing [%s]\n", acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); return (AE_RELEASE_DEADLOCK); } @@ -338,11 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Thread %X could not release Mutex [%s] %s\n", - this_thread_id, - acpi_ut_get_mutex_name(mutex_id), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Thread %X could not release Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 3015e154005..1b6b2157780 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -177,7 +177,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) buffer = ACPI_MEM_CALLOCATE(buffer_size); if (!buffer) { - ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size)); + ACPI_REPORT_ERROR(("Could not allocate size %X\n", + (u32) buffer_size)); acpi_ut_remove_reference(buffer_desc); return_PTR(NULL); } @@ -228,7 +229,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) */ string = ACPI_MEM_CALLOCATE(string_size + 1); if (!string) { - ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size)); + ACPI_REPORT_ERROR(("Could not allocate size %X\n", + (u32) string_size)); acpi_ut_remove_reference(string_desc); return_PTR(NULL); } @@ -310,7 +312,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, object = acpi_os_acquire_object(acpi_gbl_operand_cache); if (!object) { - _ACPI_REPORT_ERROR(module_name, line_number, component_id, + _ACPI_REPORT_ERROR(module_name, line_number, ("Could not allocate an object descriptor\n")); return_PTR(NULL); @@ -345,9 +347,9 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object) /* Object must be an union acpi_operand_object */ if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%p is not an ACPI Operand object [%s]\n", - object, acpi_ut_get_descriptor_name(object))); + ACPI_REPORT_ERROR(("%p is not an ACPI Operand object [%s]\n", + object, + acpi_ut_get_descriptor_name(object))); return_VOID; } @@ -449,10 +451,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, * Notably, Locals and Args are not supported, but this may be * required eventually. */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported Reference opcode=%X in object %p\n", - internal_object->reference.opcode, - internal_object)); + ACPI_REPORT_ERROR(("Unsupported Reference opcode=%X in object %p\n", internal_object->reference.opcode, internal_object)); status = AE_TYPE; break; } @@ -460,10 +459,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported type=%X in object %p\n", - ACPI_GET_OBJECT_TYPE(internal_object), - internal_object)); + ACPI_REPORT_ERROR(("Unsupported type=%X in object %p\n", + ACPI_GET_OBJECT_TYPE(internal_object), + internal_object)); status = AE_TYPE; break; } diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index eaf0edec6ef..36bf9e4bf52 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 6ff1d707334..4b134a72290 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 57adc5bc02f..b4bc9488320 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ acpi_status acpi_initialize_subsystem(void) status = acpi_os_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n", + ACPI_REPORT_ERROR(("OSL failed to initialize, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -154,8 +154,7 @@ acpi_status acpi_enable_subsystem(u32 flags) status = acpi_enable(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "acpi_enable failed.\n")); + ACPI_REPORT_WARNING(("acpi_enable failed\n")); return_ACPI_STATUS(status); } } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 1f2477eb95f..675a32f7832 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20051216 +#define ACPI_CA_VERSION 0x20060113 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index 70ce3b4d006..d8167095caf 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 0a8f49f5d2f..11a8fe39cb0 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index cc6407eef70..c41a926ff31 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index b40062c3ba7..f2717be4fe0 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 4f005eb6592..dc768aa580e 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index dfb3b2493ae..734cc77bf2c 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/achware.h b/include/acpi/achware.h index 3644d7248e7..29b60a8c059 100644 --- a/include/acpi/achware.h +++ b/include/acpi/achware.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 87e5e44572c..9f22cfcb624 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index da7f1cb96f5..97f8e4185e4 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 0fa8f72dbac..49ba151766d 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -443,56 +443,66 @@ #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) /* - * Reporting macros that are never compiled out + * Module name is include in both debug and non-debug versions primarily for + * error messages. The __FILE__ macro is not very useful for this, because it + * often includes the entire pathname to the module */ -#define ACPI_PARAM_LIST(pl) pl +#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) + +#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; +#else +#define ACPI_MODULE_NAME(name) +#endif /* - * Error reporting. These versions add callers module and line#. - * - * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT - * isn't defined, only use it in debug mode. + * Ascii error messages can be configured out */ -#ifdef ACPI_DEBUG_OUTPUT +#ifndef ACPI_NO_ERROR_MESSAGES + +#define ACPI_PARAM_LIST(pl) pl +#define ACPI_LOCATION_INFO _acpi_module_name, __LINE__ -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e); +/* + * Error reporting. Callers module and line number are inserted automatically + * These macros are used for both the debug and non-debug versions of the code + */ +#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info (ACPI_LOCATION_INFO); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error (ACPI_LOCATION_INFO); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning (ACPI_LOCATION_INFO); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error (ACPI_LOCATION_INFO, \ + s, e); +#define ACPI_REPORT_MTERROR(s,n,p,e) acpi_ns_report_method_error (ACPI_LOCATION_INFO, \ + s, n, p, e); -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e); +/* Error reporting. These versions pass thru the module and lineno */ +#define _ACPI_REPORT_INFO(a,b,fp) {acpi_ut_report_info (a,b); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define _ACPI_REPORT_ERROR(a,b,fp) {acpi_ut_report_error (a,b); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define _ACPI_REPORT_WARNING(a,b,fp) {acpi_ut_report_warning (a,b); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} #else -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e); - -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e); +/* No error messages */ +#define ACPI_REPORT_INFO(fp) +#define ACPI_REPORT_ERROR(fp) +#define ACPI_REPORT_WARNING(fp) +#define ACPI_REPORT_NSERROR(s,e) +#define ACPI_REPORT_MTERROR(s,n,p,e) +#define _ACPI_REPORT_INFO(a,b,c,fp) +#define _ACPI_REPORT_ERROR(a,b,c,fp) +#define _ACPI_REPORT_WARNING(a,b,c,fp) #endif -/* Error reporting. These versions pass thru the module and line# */ - -#define _ACPI_REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define _ACPI_REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define _ACPI_REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} - /* * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT -#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; /* * Common parameters used for debug output functions: @@ -649,9 +659,6 @@ * This is the non-debug case -- make everything go away, * leaving no executable debug code! */ -#define ACPI_MODULE_NAME(name) -#define _acpi_module_name "" - #define ACPI_DEBUG_EXEC(a) #define ACPI_NORMAL_EXEC(a) a; diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 4f9063f3e95..b67da363689 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index dd3501f7e5d..b667a804fc8 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -263,13 +263,11 @@ u32 acpi_ns_local(acpi_object_type type); void acpi_ns_report_error(char *module_name, u32 line_number, - u32 component_id, char *internal_name, acpi_status lookup_status); void acpi_ns_report_method_error(char *module_name, u32 line_number, - u32 component_id, char *message, struct acpi_namespace_node *node, char *path, acpi_status lookup_status); diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index 4a326ba6d48..1bd411962c7 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index 64da4299219..e6d78bd9e90 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 68d7edf0f69..7785d481dc3 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -137,13 +137,19 @@ /* Exception level -- used in the global "debug_level" */ -#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) -#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) +/* + * These two levels are essentially obsolete, all instances in the + * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING + * (Kept here because some drivers may still use them) + */ +#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) +#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) + /* Trace level -- also used in the global "debug_level" */ #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index d352d40de1f..5a1ff484af3 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index ccf34f9dac6..b9a39d1009b 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 58473f60755..768f63f391c 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -8,7 +8,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2a88429bc4e..66cf2ecef57 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ba281f7740a..fa02e808338 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index 99d23533980..d8c1c2cdac0 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actables.h b/include/acpi/actables.h index f92c1858b80..30a47542e1c 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index ef2ddcadfe6..ed53f842dad 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 67312c3a915..cd428d57add 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 50305ce2681..dfc7ac1094b 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 18e1338c5c7..74819e9b469 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 5fa21e03a62..10f6625f639 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -275,12 +275,11 @@ acpi_ut_ptr_exit(u32 line_number, const char *function_name, char *module_name, u32 component_id, u8 * ptr); -void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id); +void acpi_ut_report_error(char *module_name, u32 line_number); -void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id); +void acpi_ut_report_info(char *module_name, u32 line_number); -void -acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id); +void acpi_ut_report_warning(char *module_name, u32 line_number); void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 7fdf5299f50..37964a59aef 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 2e3382c1e5e..fb4735315ad 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 53aa997f05f..31b0f18342f 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 4c0e0ba09ba..ea2a6322f64 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 1b9cbf05b79..c21c27fe7e1 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without -- cgit v1.2.3 From 6c1080c1ea0ecdd541dac25e6550449390935db6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Jan 2006 12:15:07 +0100 Subject: [ALSA] via82xx - Add dxs_support for ASUS mobo Modules: VIA82xx driver Add a dxs_support entry for ASUS mobo. Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index ed26a155c34..9188a9f2315 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2340,6 +2340,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ { .subvendor = 0x1043, .subdevice = 0x810d, .action = VIA_DXS_SRC }, /* ASUS */ { .subvendor = 0x1043, .subdevice = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */ + { .subvendor = 0x1043, .subdevice = 0x8174, .action = VIA_DXS_SRC }, /* ASUS */ { .subvendor = 0x1071, .subdevice = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */ { .subvendor = 0x1071, .subdevice = 0x8399, .action = VIA_DXS_NO_VRA }, /* Umax AB 595T (VIA K8N800A - VT8237) */ { .subvendor = 0x10cf, .subdevice = 0x118e, .action = VIA_DXS_ENABLE }, /* FSC laptop */ -- cgit v1.2.3 From d82ed2ffc2839413c20b41a271a4d8db12b0683c Mon Sep 17 00:00:00 2001 From: Ulrich Mueller Date: Wed, 4 Jan 2006 12:21:11 +0100 Subject: [ALSA] intel8x0 - Fix duplicate ac97_quirks entry Modules: Intel8x0 driver in recent -mm kernels additional quirks for ac97 hardware in HP laptops have been added. However, now the list in intel8x0.c contains a duplicate, since the HP nx6110 and nc6120 have identical subdevice ids. This was introduced in -mm1 by the following patch: add-new-quirk-for-devices-with-mute-leds-and-separate-headphone-volume.patch Since the HP nx6110 and nc6120 are almost identical, both entries should really be combined, as in the following patch. I have checked that AC97_TUNE_HP_MUTE_LED is the right thing to do. Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5466b1fa0cd..2fe2a8ae82c 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1845,12 +1845,6 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "HP nx8220", .type = AC97_TUNE_MUTE_LED }, - { - .subvendor = 0x103c, - .subdevice = 0x099c, - .name = "HP nx6110", /* AD1981B */ - .type = AC97_TUNE_HP_ONLY - }, { .subvendor = 0x103c, .subdevice = 0x129d, @@ -1866,7 +1860,7 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { { .subvendor = 0x103c, .subdevice = 0x099c, - .name = "HP nc6120", + .name = "HP nx6110/nc6120", .type = AC97_TUNE_HP_MUTE_LED }, { -- cgit v1.2.3 From 59b1b34f47e6c8ac8f00660db2cd34216819b400 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Jan 2006 15:06:44 +0100 Subject: [ALSA] Fix compilation without CONFIG_PNP Fix compilation of some ISA drivers without CONFIG_PNP. Signed-off-by: Takashi Iwai --- sound/isa/cmi8330.c | 6 ++++++ sound/isa/cs423x/cs4236.c | 7 +++++++ sound/isa/es18xx.c | 6 +++++- sound/isa/opl3sa2.c | 6 ++++++ sound/isa/sscape.c | 6 +++++- sound/isa/wavefront/wavefront.c | 7 +++++-- 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index bd8e2381846..fd9bb2575de 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -109,7 +109,9 @@ module_param_array(wssdma, int, NULL, 0444); MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); static struct platform_device *platform_devices[SNDRV_CARDS]; +#ifdef CONFIG_PNP static int pnp_registered; +#endif #define CMI8330_RMUX3D 16 #define CMI8330_MUTEMUX 17 @@ -672,8 +674,10 @@ static void __init_or_module snd_cmi8330_unregister_all(void) { int i; +#ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&cmi8330_pnpc_driver); +#endif for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) platform_device_unregister(platform_devices[i]); platform_driver_unregister(&snd_cmi8330_driver); @@ -700,11 +704,13 @@ static int __init alsa_card_cmi8330_init(void) cards++; } +#ifdef CONFIG_PNP err = pnp_register_card_driver(&cmi8330_pnpc_driver); if (err >= 0) { pnp_registered = 1; cards += err; } +#endif if (!cards) { #ifdef MODULE diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index e1683337e6c..2bfa68b01fe 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -125,10 +125,12 @@ module_param_array(dma2, int, NULL, 0444); MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); static struct platform_device *platform_devices[SNDRV_CARDS]; +#ifdef CONFIG_PNP static int pnpc_registered; #ifdef CS4232 static int pnp_registered; #endif +#endif /* CONFIG_PNP */ struct snd_card_cs4236 { struct snd_cs4231 *chip; @@ -747,12 +749,14 @@ static void __init_or_module snd_cs423x_unregister_all(void) { int i; +#ifdef CONFIG_PNP if (pnpc_registered) pnp_unregister_card_driver(&cs423x_pnpc_driver); #ifdef CS4232 if (pnp_registered) pnp_unregister_driver(&cs4232_pnp_driver); #endif +#endif /* CONFIG_PNP */ for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) platform_device_unregister(platform_devices[i]); platform_driver_unregister(&cs423x_nonpnp_driver); @@ -778,6 +782,7 @@ static int __init alsa_card_cs423x_init(void) platform_devices[i] = device; cards++; } +#ifdef CONFIG_PNP #ifdef CS4232 i = pnp_register_driver(&cs4232_pnp_driver); if (i >= 0) { @@ -790,6 +795,8 @@ static int __init alsa_card_cs423x_init(void) pnpc_registered = 1; cards += i; } +#endif /* CONFIG_PNP */ + if (!cards) { #ifdef MODULE printk(KERN_ERR IDENT " soundcard not found or device busy\n"); diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index bf5de0782eb..08f032b5110 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1878,9 +1878,9 @@ module_param_array(dma2, int, NULL, 0444); MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); static struct platform_device *platform_devices[SNDRV_CARDS]; -static int pnp_registered; #ifdef CONFIG_PNP +static int pnp_registered; static struct pnp_card_device_id snd_audiodrive_pnpids[] = { /* ESS 1868 (integrated on Compaq dual P-Pro motherboard and Genius 18PnP 3D) */ @@ -2209,8 +2209,10 @@ static void __init_or_module snd_es18xx_unregister_all(void) { int i; +#ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&es18xx_pnpc_driver); +#endif for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) platform_device_unregister(platform_devices[i]); platform_driver_unregister(&snd_es18xx_nonpnp_driver); @@ -2237,11 +2239,13 @@ static int __init alsa_card_es18xx_init(void) cards++; } +#ifdef CONFIG_PNP i = pnp_register_card_driver(&es18xx_pnpc_driver); if (i >= 0) { pnp_registered = 1; cards += i; } +#endif if(!cards) { #ifdef MODULE diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index ca359e0c674..84ffa8f0f26 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -91,8 +91,10 @@ module_param_array(opl3sa3_ymode, int, NULL, 0444); MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); static struct platform_device *platform_devices[SNDRV_CARDS]; +#ifdef CONFIG_PNP static int pnp_registered; static int pnpc_registered; +#endif /* control ports */ #define OPL3SA2_PM_CTRL 0x01 @@ -929,10 +931,12 @@ static void __init_or_module snd_opl3sa2_unregister_all(void) { int i; +#ifdef CONFIG_PNP if (pnpc_registered) pnp_unregister_card_driver(&opl3sa2_pnpc_driver); if (pnp_registered) pnp_unregister_driver(&opl3sa2_pnp_driver); +#endif for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) platform_device_unregister(platform_devices[i]); platform_driver_unregister(&snd_opl3sa2_nonpnp_driver); @@ -961,6 +965,7 @@ static int __init alsa_card_opl3sa2_init(void) cards++; } +#ifdef CONFIG_PNP err = pnp_register_driver(&opl3sa2_pnp_driver); if (err >= 0) { pnp_registered = 1; @@ -971,6 +976,7 @@ static int __init alsa_card_opl3sa2_init(void) pnpc_registered = 1; cards += err; } +#endif if (!cards) { #ifdef MODULE diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 5fb981c0a28..29bba8cc3ef 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -69,9 +69,9 @@ module_param_array(dma, int, NULL, 0444); MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); static struct platform_device *platform_devices[SNDRV_CARDS]; -static int pnp_registered; #ifdef CONFIG_PNP +static int pnp_registered; static struct pnp_card_device_id sscape_pnpids[] = { { .id = "ENS3081", .devs = { { "ENS0000" } } }, { .id = "" } /* end */ @@ -1391,8 +1391,10 @@ static void __init_or_module sscape_unregister_all(void) { int i; +#ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&sscape_pnpc_driver); +#endif for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) platform_device_unregister(platform_devices[i]); platform_driver_unregister(&snd_sscape_driver); @@ -1466,8 +1468,10 @@ static int __init sscape_init(void) ret = sscape_manual_probe(); if (ret < 0) return ret; +#ifdef CONFIG_PNP if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0) pnp_registered = 1; +#endif return 0; } diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index a6dcb2f970c..fa3ab960de1 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -84,10 +84,9 @@ module_param_array(use_cs4232_midi, bool, NULL, 0444); MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); static struct platform_device *platform_devices[SNDRV_CARDS]; -static int pnp_registered; - #ifdef CONFIG_PNP +static int pnp_registered; static struct pnp_card_device_id snd_wavefront_pnpids[] = { /* Tropez */ @@ -695,8 +694,10 @@ static void __init_or_module snd_wavefront_unregister_all(void) { int i; +#ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&wavefront_pnpc_driver); +#endif for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) platform_device_unregister(platform_devices[i]); platform_driver_unregister(&snd_wavefront_driver); @@ -725,11 +726,13 @@ static int __init alsa_card_wavefront_init(void) cards++; } +#ifdef CONFIG_PNP i = pnp_register_card_driver(&wavefront_pnpc_driver); if (i >= 0) { pnp_registered = 1; cards += i; } +#endif if (!cards) { #ifdef MODULE -- cgit v1.2.3 From 4d7d7596287588a953f450a3f18c5d4587f763d0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Jan 2006 16:00:48 +0100 Subject: [ALSA] emu10k1 - Fix silence problems after suspend Modules: EMU10K1/EMU10K2 driver Fix silence problems on some boards after suspend/resume (bug#1674). Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emumixer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 2e86a901a0a..8c912b1bee3 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -829,9 +829,9 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, } if (emu->audigy) { /* set master volume to 0 dB */ - snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000); + snd_ac97_write_cache(emu->ac97, AC97_MASTER, 0x0000); /* set capture source to mic */ - snd_ac97_write(emu->ac97, AC97_REC_SEL, 0x0000); + snd_ac97_write_cache(emu->ac97, AC97_REC_SEL, 0x0000); c = audigy_remove_ctls; } else { /* @@ -844,8 +844,8 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT); } /* remove unused AC97 controls */ - snd_ac97_write(emu->ac97, AC97_SURROUND_MASTER, 0x0202); - snd_ac97_write(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202); + snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202); + snd_ac97_write_cache(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202); c = emu10k1_remove_ctls; } for (; *c; c++) -- cgit v1.2.3 From 6421776a6f8b8503a88e07b205162842d3f7d702 Mon Sep 17 00:00:00 2001 From: Martin Drab Date: Thu, 5 Jan 2006 18:33:56 +0100 Subject: [ALSA] bt87x - Fix the unability of snd-bt87x to recognize AVerMedia Studio Modules: BT87x driver The patch siply adds the PCI IDs of AVerMedia Studio No. 103, 203, and possibly even other versions with the same PCI IDs to the snd-bt87x driver and sets its default sampling rate to 48 kHz. Signed-off-by: Martin Drab Signed-off-by: Takashi Iwai --- sound/pci/bt87x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index dc9cd3079b1..aaaa2e0d45c 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -781,6 +781,8 @@ static struct pci_device_id snd_bt87x_ids[] = { BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, 0x0070, 0x13eb, 32000), /* Viewcast Osprey 200 */ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff01, 44100), + /* AVerMedia Studio No. 103, 203, ...? */ + BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1461, 0x0003, 48000), { } }; MODULE_DEVICE_TABLE(pci, snd_bt87x_ids); -- cgit v1.2.3 From 7eae36fbd5ea9db3d3fe0d671199121be782a5b3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Jan 2006 18:40:56 +0100 Subject: [ALSA] emu10k1 - Fix the confliction of 'Front' control Modules: EMU10K1/EMU10K2 driver Fix the confliction of 'Front' controls on models with STAC9758 codec. Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emumixer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 8c912b1bee3..2a9d12d1068 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -759,6 +759,8 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, "Master Mono Playback Volume", "PCM Out Path & Mute", "Mono Output Select", + "Front Playback Switch", + "Front Playback Volume", "Surround Playback Switch", "Surround Playback Volume", "Center Playback Switch", -- cgit v1.2.3 From d0bd41e289768ff851066f1e952ae4c802c4dca7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Jan 2006 12:36:53 +0100 Subject: [ALSA] via82xx - Add dxs_support entry Modules: VIA82xx driver Added a dxs_support entry for Jetway K8M8MS. Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 9188a9f2315..8664bc478b1 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2372,6 +2372,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) { .subvendor = 0x161f, .subdevice = 0x2032, .action = VIA_DXS_48K }, /* m680x machines */ { .subvendor = 0x1631, .subdevice = 0xe004, .action = VIA_DXS_ENABLE }, /* Easy Note 3174, Packard Bell */ { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */ + { .subvendor = 0x16f3, .subdevice = 0x6405, .action = VIA_DXS_SRC }, /* Jetway K8M8MS */ { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */ { .subvendor = 0x1849, .subdevice = 0x9761, .action = VIA_DXS_SRC }, /* ASRock mobo(?) */ { .subvendor = 0x1919, .subdevice = 0x200a, .action = VIA_DXS_NO_VRA }, /* Soltek SL-K8Tpro-939 */ -- cgit v1.2.3 From d99e98891ccde745c6c25b7a11a139123e74db4c Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 9 Jan 2006 16:44:46 +0100 Subject: [ALSA] Remove BKL from sound/core/info.c Modules: ALSA Core Remove BKL from sound/core/info.c Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/core/info.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/sound/core/info.c b/sound/core/info.c index ae885392146..af123e3bdb2 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -444,8 +444,8 @@ static unsigned int snd_info_entry_poll(struct file *file, poll_table * wait) return mask; } -static inline int _snd_info_entry_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static long snd_info_entry_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { struct snd_info_private_data *data; struct snd_info_entry *entry; @@ -465,17 +465,6 @@ static inline int _snd_info_entry_ioctl(struct inode *inode, struct file *file, return -ENOTTY; } -/* FIXME: need to unlock BKL to allow preemption */ -static int snd_info_entry_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) -{ - int err; - unlock_kernel(); - err = _snd_info_entry_ioctl(inode, file, cmd, arg); - lock_kernel(); - return err; -} - static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) { struct inode *inode = file->f_dentry->d_inode; @@ -499,15 +488,15 @@ static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) static struct file_operations snd_info_entry_operations = { - .owner = THIS_MODULE, - .llseek = snd_info_entry_llseek, - .read = snd_info_entry_read, - .write = snd_info_entry_write, - .poll = snd_info_entry_poll, - .ioctl = snd_info_entry_ioctl, - .mmap = snd_info_entry_mmap, - .open = snd_info_entry_open, - .release = snd_info_entry_release, + .owner = THIS_MODULE, + .llseek = snd_info_entry_llseek, + .read = snd_info_entry_read, + .write = snd_info_entry_write, + .poll = snd_info_entry_poll, + .unlocked_ioctl = snd_info_entry_ioctl, + .mmap = snd_info_entry_mmap, + .open = snd_info_entry_open, + .release = snd_info_entry_release, }; /** -- cgit v1.2.3 From be3cd57aa65c366e479d6a21a5d49a08117b5d77 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Mon, 9 Jan 2006 21:20:56 +0100 Subject: [ALSA] snd-ca0106: Fixed ALSA bug#1600 Modules: CA0106 driver Description: Shuttle XPC SD11G5 which has an onboard Creative Labs Sound Blaster Live! 24-bit EAX high-definition 7.1 audio processor'. Fixes ALSA bug#1600 Signed-off-by: James Courtier-Dutton --- sound/pci/ca0106/ca0106_main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 6ed7c0bfa09..9477838a9c8 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -199,7 +199,8 @@ static struct snd_ca0106_details ca0106_chip_details[] = { .name = "MSI K8N Diamond MB [SB0438]", .gpio_type = 1, .i2c_adc = 1 } , - /* Shuttle XPC SD31P which has an onboard Creative Labs Sound Blaster Live! 24-bit EAX + /* Shuttle XPC SD31P which has an onboard Creative Labs + * Sound Blaster Live! 24-bit EAX * high-definition 7.1 audio processor". * Added using info from andrewvegan in alsa bug #1298 */ @@ -207,6 +208,15 @@ static struct snd_ca0106_details ca0106_chip_details[] = { .name = "Shuttle XPC SD31P [SD31P]", .gpio_type = 1, .i2c_adc = 1 } , + /* Shuttle XPC SD11G5 which has an onboard Creative Labs + * Sound Blaster Live! 24-bit EAX + * high-definition 7.1 audio processor". + * Fixes ALSA bug#1600 + */ + { .serial = 0x30411297, + .name = "Shuttle XPC SD11G5 [SD11G5]", + .gpio_type = 1, + .i2c_adc = 1 } , { .serial = 0, .name = "AudigyLS [Unknown]" } }; -- cgit v1.2.3 From d2981393615f9a7adb8223a2ab1e0d7423d5c9dd Mon Sep 17 00:00:00 2001 From: Jason Gaston Date: Tue, 10 Jan 2006 11:07:37 +0100 Subject: [ALSA] hda-intel - patch for Intel ICH8 Modules: HDA Intel driver This patch adds the Intel ICH8 HD Audio DID to the hda_intel.c audio driver. Signed-off-by: Jason Gaston Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index a983deba402..fd12b6991fe 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -75,6 +75,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," "{Intel, ICH6M}," "{Intel, ICH7}," "{Intel, ESB2}," + "{Intel, ICH8}," "{ATI, SB450}," "{VIA, VT8251}," "{VIA, VT8237A}," @@ -1586,6 +1587,7 @@ static struct pci_device_id azx_ids[] = { { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */ { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */ { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */ + { 0x8086, 0x284b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH8 */ { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ -- cgit v1.2.3 From 8937fd88558d5a741d6ed29d5f8c327646a4f1db Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Jan 2006 11:14:49 +0100 Subject: [ALSA] pcxhr - Fix the sample rate changes Modules: Digigram PCXHR driver Fix the hardware set up when the sample rate is changed multiple times. Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index b8c0853a827..57fe9538f5a 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -744,13 +744,14 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs) /* only the first stream can choose the sample rate */ /* the further opened streams will be limited to its frequency (see open) */ /* set the clock only once (first stream) */ - if (mgr->sample_rate == 0) { + if (mgr->sample_rate != subs->runtime->rate) { err = pcxhr_set_clock(mgr, subs->runtime->rate); if (err) break; + if (mgr->sample_rate == 0) + /* start the DSP-timer */ + err = pcxhr_hardware_timer(mgr, 1); mgr->sample_rate = subs->runtime->rate; - - err = pcxhr_hardware_timer(mgr, 1); /* start the DSP-timer */ } } while(0); /* do only once (so we can use break instead of goto) */ -- cgit v1.2.3 From b14e77e613a104c78ab455c0109b566dab430de6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Jan 2006 18:10:50 +0100 Subject: [ALSA] hda-codec - Add model entry for Sony VAIO Modules: HDA Codec driver Added an ALC260 model entry (basic) for Sony VAIO. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ad9e501a981..543980d89b8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2945,6 +2945,8 @@ static int alc260_auto_init(struct hda_codec *codec) */ static struct hda_board_config alc260_cfg_tbl[] = { { .modelname = "basic", .config = ALC260_BASIC }, + { .pci_subvendor = 0x104d, .pci_subdevice = 0x81bb, + .config = ALC260_BASIC }, /* Sony VAIO */ { .modelname = "hp", .config = ALC260_HP }, { .pci_subvendor = 0x103c, .pci_subdevice = 0x3010, .config = ALC260_HP }, { .pci_subvendor = 0x103c, .pci_subdevice = 0x3011, .config = ALC260_HP }, -- cgit v1.2.3 From 128a46a55da81e563116e99e08e295fda41a145b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Jan 2006 18:15:43 +0100 Subject: [ALSA] ac97 - Suppress jack sense controls for Thinkpads Modules: AC97 Codec Added a blacklist to suppress to create jack sense controls. These controls must be always off on some devices (e.g. Thinkpad). Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_patch.c | 49 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 4aa5fdc5688..bccce44421e 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -1621,8 +1621,27 @@ static const struct snd_kcontrol_new snd_ac97_ad1981x_jack_sense[] = { AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0), }; +/* black list to avoid HP/Line jack-sense controls + * (SS vendor << 16 | device) + */ +static unsigned int ad1981_jacks_blacklist[] = { + 0x10140554, /* Thinkpad T42p/R50p */ + 0 /* end */ +}; + +static int check_list(struct snd_ac97 *ac97, const unsigned int *list) +{ + u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; + for (; *list; list++) + if (*list == subid) + return 1; + return 0; +} + static int patch_ad1981a_specific(struct snd_ac97 * ac97) { + if (check_list(ac97, ad1981_jacks_blacklist)) + return 0; return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); } @@ -1635,22 +1654,26 @@ static struct snd_ac97_build_ops patch_ad1981a_build_ops = { #endif }; +/* white list to enable HP jack-sense bits + * (SS vendor << 16 | device) + */ +static unsigned int ad1981_jacks_whitelist[] = { + 0x0e11005a, /* HP nc4000/4010 */ + 0x103c0890, /* HP nc6000 */ + 0x103c0938, /* HP nc4220 */ + 0x103c099c, /* HP nx6110 */ + 0x103c0944, /* HP nc6220 */ + 0x103c0934, /* HP nc8220 */ + 0x103c006d, /* HP nx9105 */ + 0x17340088, /* FSC Scenic-W */ + 0 /* end */ +}; + static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97) { - u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; - switch (subid) { - case 0x0e11005a: /* HP nc4000/4010 */ - case 0x103c0890: /* HP nc6000 */ - case 0x103c0938: /* HP nc4220 */ - case 0x103c099c: /* HP nx6110 */ - case 0x103c0944: /* HP nc6220 */ - case 0x103c0934: /* HP nc8220 */ - case 0x103c006d: /* HP nx9105 */ - case 0x17340088: /* FSC Scenic-W */ + if (check_list(ac97, ad1981_jacks_whitelist)) /* enable headphone jack sense */ snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11); - break; - } } int patch_ad1981a(struct snd_ac97 *ac97) @@ -1672,6 +1695,8 @@ static int patch_ad1981b_specific(struct snd_ac97 *ac97) if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) return err; + if (check_list(ac97, ad1981_jacks_blacklist)) + return 0; return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); } -- cgit v1.2.3 From 54c63cfc153c6909a5d5dbe6072e8704b091f30e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 12 Jan 2006 07:56:40 +0100 Subject: [ALSA] bt87x - fix detection of unknown card Modules: BT87x driver Signed-off-by: Jaroslav Kysela --- sound/pci/bt87x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index aaaa2e0d45c..c840a4c08e9 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -810,7 +810,7 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev *pci) const struct pci_device_id *supported; supported = pci_match_device(&driver, pci); - if (supported) + if (supported && supported->driver_data > 0) return supported->driver_data; for (i = 0; i < ARRAY_SIZE(blacklist); ++i) -- cgit v1.2.3 From 4b2849283461a64c6d8cc6c7e72c62d7b4d91b43 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 12 Jan 2006 08:17:49 +0100 Subject: [ALSA] usb-audio: don't use empty packets at start of playback Modules: USB generic driver Some widespread USB interface chips with adaptive iso endpoints hang after receiving a series of empty packets when they expect data (ALSA bug#1585). To avoid this, we have to send packets containing silence (zero samples) instead. Signed-off-by: Clemens Ladisch --- sound/usb/usbaudio.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index a1bd8040dea..95729730bcd 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -478,22 +478,38 @@ static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs, /* * Prepare urb for streaming before playback starts. * - * We don't care about (or have) any data, so we just send a transfer delimiter. + * We don't yet have data, so we send a frame of silence. */ static int prepare_startup_playback_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb) { - unsigned int i; + unsigned int i, offs, counts; struct snd_urb_ctx *ctx = urb->context; + int stride = runtime->frame_bits >> 3; + offs = 0; urb->dev = ctx->subs->dev; urb->number_of_packets = subs->packs_per_ms; for (i = 0; i < subs->packs_per_ms; ++i) { - urb->iso_frame_desc[i].offset = 0; - urb->iso_frame_desc[i].length = 0; + /* calculate the size of a packet */ + if (subs->fill_max) + counts = subs->maxframesize; /* fixed */ + else { + subs->phase = (subs->phase & 0xffff) + + (subs->freqm << subs->datainterval); + counts = subs->phase >> 16; + if (counts > subs->maxframesize) + counts = subs->maxframesize; + } + urb->iso_frame_desc[i].offset = offs * stride; + urb->iso_frame_desc[i].length = counts * stride; + offs += counts; } - urb->transfer_buffer_length = 0; + urb->transfer_buffer_length = offs * stride; + memset(urb->transfer_buffer, + subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0, + offs * stride); return 0; } -- cgit v1.2.3 From 363fa1d615d93fe047659c16ff3277d78302b2eb Mon Sep 17 00:00:00 2001 From: Rene Rebe Date: Thu, 12 Jan 2006 11:42:47 +0100 Subject: [ALSA] AMD cs5536 ID for cs5535audio Modules: CS5535 driver Added AMD CS5536 to the cs5535audio driver. Signed-off-by: Rene Rebe Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/cs5535audio/cs5535audio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index f36ede82747..02e3721030b 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c @@ -46,8 +46,10 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static struct pci_device_id snd_cs5535audio_ids[] = { - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0, }, + { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, + { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, {} }; -- cgit v1.2.3 From da79e44df4fff22c7f815687ea210b2324b3507c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 12 Jan 2006 11:45:51 +0100 Subject: [ALSA] ac97 - Fix CLFE channel setting of ALC850 Modules: AC97 Codec Fix CLFE channel setting of ALC850 (ALSA bug#1731). Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_patch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index bccce44421e..a444a78c7c9 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -2235,9 +2235,9 @@ static void alc850_update_jacks(struct snd_ac97 *ac97) /* Vref disable (bit12), 1kOhm (bit13) */ snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13), shared ? (1<<12) : (1<<13)); - /* MIC-IN = 1, CENTER-LFE = 2 */ + /* MIC-IN = 1, CENTER-LFE = 5 */ snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, - shared ? (2<<4) : (1<<4)); + shared ? (5<<4) : (1<<4)); } static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = { -- cgit v1.2.3 From fc80a2027afc31e8447a0691ea1279166ce5d69f Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 13 Jan 2006 07:41:45 +0100 Subject: [ALSA] ymfpci: fix SPDIF sample rate information Modules: YMFPCI driver Set the (read only) sample rate field in the IEC958 mixer controls to 48 kHz (instead of 44.1 kHz) because that is the rate actually supported by the hardware. Signed-off-by: Clemens Ladisch --- sound/pci/ymfpci/ymfpci_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 1dfc7233c6a..a1aa74b79b3 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -1229,6 +1229,7 @@ static int snd_ymfpci_spdif_default_get(struct snd_kcontrol *kcontrol, spin_lock_irq(&chip->reg_lock); ucontrol->value.iec958.status[0] = (chip->spdif_bits >> 0) & 0xff; ucontrol->value.iec958.status[1] = (chip->spdif_bits >> 8) & 0xff; + ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS_48000; spin_unlock_irq(&chip->reg_lock); return 0; } @@ -1303,6 +1304,7 @@ static int snd_ymfpci_spdif_stream_get(struct snd_kcontrol *kcontrol, spin_lock_irq(&chip->reg_lock); ucontrol->value.iec958.status[0] = (chip->spdif_pcm_bits >> 0) & 0xff; ucontrol->value.iec958.status[1] = (chip->spdif_pcm_bits >> 8) & 0xff; + ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS_48000; spin_unlock_irq(&chip->reg_lock); return 0; } -- cgit v1.2.3 From 33159378254b67d0080a8d63197e95654b672cf7 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 13 Jan 2006 08:11:22 +0100 Subject: [ALSA] usb-audio: fix non-48k sample rates with SB Audigy 2 ZS Modules: USB generic driver On the Audigy 2 ZS, disable all sample rate that are not a multiple of 48 kHz because the others work only with the digital output which is not yet supported. Signed-off-by: Clemens Ladisch --- sound/usb/usbaudio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 95729730bcd..d5013383fad 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -2493,12 +2493,13 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp if (err < 0) return err; #if 1 - /* FIXME: temporary hack for extigy/audigy 2 nx */ + /* FIXME: temporary hack for extigy/audigy 2 nx/zs */ /* extigy apparently supports sample rates other than 48k * but not in ordinary way. so we enable only 48k atm. */ if (chip->usb_id == USB_ID(0x041e, 0x3000) || - chip->usb_id == USB_ID(0x041e, 0x3020)) { + chip->usb_id == USB_ID(0x041e, 0x3020) || + chip->usb_id == USB_ID(0x041e, 0x3061)) { if (fmt[3] == USB_FORMAT_TYPE_I && fp->rates != SNDRV_PCM_RATE_48000 && fp->rates != SNDRV_PCM_RATE_96000) -- cgit v1.2.3 From e3183ec9cd98db7800d078768b1c9edc2fd0425f Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Fri, 13 Jan 2006 13:14:53 +0100 Subject: [ALSA] Prevent ALSA trident driver from grabbing pcnet32 hardware Modules: Trident driver Some pcnet32 hardware erroneously has the Vendor ID for Trident. The pcnet32 driver looks for the PCI ethernet class before grabbing the hardware, but the current trident driver does not check against the PCI audio class. This allows the trident driver to claim the pcnet32 hardware. This patch prevents that. Per Jiri Slaby's request, I changed the trident driver to use PCI_DEVICE macro and PCI ID #defines. This patch is untested on Trident 4DWAVE_DX hardware, but has been tested on pcnet32 hardware. Signed-off-by: Jon Mason Signed-off-by: Takashi Iwai --- sound/pci/trident/trident.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 2b21df16ad6..b4538045049 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c @@ -64,9 +64,11 @@ module_param_array(wavetable_size, int, NULL, 0444); MODULE_PARM_DESC(wavetable_size, "Maximum memory size in kB for wavetable synth."); static struct pci_device_id snd_trident_ids[] = { - { 0x1023, 0x2000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Trident 4DWave DX PCI Audio */ - { 0x1023, 0x2001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Trident 4DWave NX PCI Audio */ - { 0x1039, 0x7018, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* SiS SI7018 PCI Audio */ + {PCI_DEVICE(PCI_VENDOR_ID_TRIDENT, PCI_DEVICE_ID_TRIDENT_4DWAVE_DX), + PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, + {PCI_DEVICE(PCI_VENDOR_ID_TRIDENT, PCI_DEVICE_ID_TRIDENT_4DWAVE_NX), + 0, 0, 0}, + {PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7018), 0, 0, 0}, { 0, } }; -- cgit v1.2.3 From ec6c8c3b2588261669c1b101338ab4fe43b1b9c0 Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Fri, 13 Jan 2006 13:17:43 +0100 Subject: [ALSA] ali5451: Add PCI_DEVICE and #defines in snd_ali_ids Modules: ALI5451 driver This patch uses #defines for the Vendor ID and Device ID and uses the new PCI_DEVICE macro. Signed-off-by: Jon Mason Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/ali5451/ali5451.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index bc4d1ef08ef..e264136e8fb 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -279,7 +279,7 @@ struct snd_ali { }; static struct pci_device_id snd_ali_ids[] = { - {0x10b9, 0x5451, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, + {PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5451), 0, 0, 0}, {0, } }; MODULE_DEVICE_TABLE(pci, snd_ali_ids); -- cgit v1.2.3 From c9fe51c492fbb0de789a16828749595dc1985610 Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Fri, 13 Jan 2006 13:26:42 +0100 Subject: [ALSA] intel8x0: Add quirk for Optiplex GX270 Modules: Intel8x0 driver This patch adds a quirk entry for the Dell Optiplex GX270, on which the volume is set by the headphone control, not the master control. Signed-off-by: Chris Ball Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 2fe2a8ae82c..b345894659b 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1803,6 +1803,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "Dell", /* which model? AD1981B*/ .type = AC97_TUNE_HP_ONLY }, + { + .subvendor = 0x1028, + .subdevice = 0x0151, + .name = "Dell Optiplex GX270", /* AD1981B */ + .type = AC97_TUNE_HP_ONLY + }, { .subvendor = 0x1028, .subdevice = 0x0163, -- cgit v1.2.3 From 0fd1708a199bf55ebf21d611225866955babc1ba Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Jan 2006 18:46:21 +0100 Subject: [ALSA] hda-codec - Fix capture on Sigmatel STAC92xx codecs Modules: HDA Codec driver Added the missing 'Capture Switch' control for Sigmatel STAC92xx codecs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 61903848cd4..4f78b58416a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -183,6 +183,7 @@ static struct snd_kcontrol_new stac922x_mixer[] = { .put = stac92xx_mux_enum_put, }, HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT), { } /* end */ }; -- cgit v1.2.3 From cacd3347ce5b5ee4fce90c2627d80bf0ac15dec0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Jan 2006 13:00:50 +0100 Subject: [ALSA] via82xx - Add dxs_support entry for EpoX 9HEAI Modules: VIA82xx driver Added the dxs_support entry for EpoX 9HEAI. Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 8664bc478b1..d59fe3e83f1 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2372,6 +2372,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) { .subvendor = 0x161f, .subdevice = 0x2032, .action = VIA_DXS_48K }, /* m680x machines */ { .subvendor = 0x1631, .subdevice = 0xe004, .action = VIA_DXS_ENABLE }, /* Easy Note 3174, Packard Bell */ { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */ + { .subvendor = 0x1695, .subdevice = 0x300e, .action = VIA_DXS_SRC }, /* EPoX 9HEAI */ { .subvendor = 0x16f3, .subdevice = 0x6405, .action = VIA_DXS_SRC }, /* Jetway K8M8MS */ { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */ { .subvendor = 0x1849, .subdevice = 0x9761, .action = VIA_DXS_SRC }, /* ASRock mobo(?) */ -- cgit v1.2.3 From 7113d680d4824dfd4db43bc9880cdc98bcc309b9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Jan 2006 13:55:48 +0100 Subject: [ALSA] au88x0 - Fix a compile warning Modules: au88x0 driver Fixed an uninitialized variable. Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_eq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c index 13bc8ed301c..c8280f82eb5 100644 --- a/sound/pci/au88x0/au88x0_eq.c +++ b/sound/pci/au88x0/au88x0_eq.c @@ -849,7 +849,7 @@ static int snd_vortex_peaks_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { vortex_t *vortex = snd_kcontrol_chip(kcontrol); - int i, count; + int i, count = 0; u16 peaks[20]; vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count); -- cgit v1.2.3 From 2f25b7feab257bae406f1edb44438a347a1cc727 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 17 Jan 2006 18:31:42 +0100 Subject: [ALSA] Fix a typo in snd_assert() Modules: CS46xx driver Reported by in http://bugzilla.kernel.org/show_bug.cgi?id=5903 Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/cs46xx/dsp_spos_scb_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index 509aa2b6333..d4e0fb39bd0 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -675,7 +675,7 @@ cs46xx_dsp_create_src_task_scb(struct snd_cs46xx * chip, char * scb_name, if (pass_through) { /* wont work with any other rate than the native DSP rate */ - snd_assert (rate = 48000); + snd_assert (rate == 48000); scb = cs46xx_dsp_create_generic_scb(chip,scb_name,(u32 *)&src_task_scb, dest,"DMAREADER",parent_scb, -- cgit v1.2.3 From 62af9905a1f809094f5209ae15d2ce69599a8123 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Jan 2006 14:03:06 +0100 Subject: [ALSA] opl3sa2 - Fix conflict of driver name on sysfs Modules: OPL3SA2 driver Fix the conflict of driver name 'opl3sa2' on sysfs with OSS driver. Signed-off-by: Takashi Iwai --- sound/isa/opl3sa2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 84ffa8f0f26..9dc6b20e9a5 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -781,7 +781,7 @@ static int snd_opl3sa2_pnp_resume(struct pnp_dev *pdev) #endif static struct pnp_driver opl3sa2_pnp_driver = { - .name = "opl3sa2-pnpbios", + .name = "snd-opl3sa2-pnpbios", .id_table = snd_opl3sa2_pnpbiosids, .probe = snd_opl3sa2_pnp_detect, .remove = __devexit_p(snd_opl3sa2_pnp_remove), @@ -848,7 +848,7 @@ static int snd_opl3sa2_pnp_cresume(struct pnp_card_link *pcard) static struct pnp_card_driver opl3sa2_pnpc_driver = { .flags = PNP_DRIVER_RES_DISABLE, - .name = "opl3sa2", + .name = "snd-opl3sa2-cpnp", .id_table = snd_opl3sa2_pnpids, .probe = snd_opl3sa2_pnp_cdetect, .remove = __devexit_p(snd_opl3sa2_pnp_cremove), -- cgit v1.2.3 From 80faf041cd731bde220523166f016377e1765acd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Jan 2006 14:03:39 +0100 Subject: [ALSA] sb16 - Fix duplicated PnP entry Modules: SB16/AWE driver Fix the duplicated PnP entry between sb16 and sbawe drivers. Signed-off-by: Takashi Iwai --- sound/isa/sb/sb16.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index c0be7a5a342..0667bd14ad6 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -179,6 +179,8 @@ static struct pnp_card_device_id snd_sb16_pnpids[] = { { .id = "CTL0086", .devs = { { "CTL0041" } } }, /* Sound Blaster Vibra16X */ { .id = "CTL00f0", .devs = { { "CTL0043" } } }, + /* Sound Blaster 16 (Virtual PC 2004) */ + { .id = "tBA03b0", .devs = { {.id="PNPb003" } } }, #else /* SNDRV_SBAWE defined */ /* Sound Blaster AWE 32 PnP */ { .id = "CTL0035", .devs = { { "CTL0031" }, { "CTL0021" } } }, @@ -235,8 +237,6 @@ static struct pnp_card_device_id snd_sb16_pnpids[] = { { .id = "CTLXXXX" , .devs = { { "CTL0044" }, { "CTL0023" } } }, { .id = "CTLXXXX" , .devs = { { "CTL0045" }, { "CTL0022" } } }, #endif /* SNDRV_SBAWE */ - /* Sound Blaster 16 PnP (Virtual PC 2004)*/ - { .id = "tBA03b0", .devs = { { "PNPb003" } } }, { .id = "", } }; -- cgit v1.2.3 From e2eba3e7d911b26525c17f0b7e2bc45aad8e2629 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 20 Jan 2006 14:07:13 +0100 Subject: [ALSA] hdsp - Fix printk warnings Modules: RME9652 driver sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_preallocate_memory': sound/pci/rme9652/hdspm.c:3327: warning: int format, different type arg (arg 4) sound/pci/rme9652/hdspm.c:3331: warning: int format, different type arg (arg 4) sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_create': sound/pci/rme9652/hdspm.c:3513: warning: int format, different type arg (arg 4) Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 3dec616bad6..103b4d715ff 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -3324,11 +3324,11 @@ static int __devinit snd_hdspm_preallocate_memory(struct hdspm * hdspm) snd_dma_pci_data(hdspm->pci), wanted, wanted)) < 0) { - snd_printdd("Could not preallocate %d Bytes\n", wanted); + snd_printdd("Could not preallocate %zd Bytes\n", wanted); return err; } else - snd_printdd(" Preallocated %d Bytes\n", wanted); + snd_printdd(" Preallocated %zd Bytes\n", wanted); return 0; } @@ -3510,7 +3510,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card, struct hdspm * hdsp hdspm->monitor_outs = enable_monitor; - snd_printdd("kmalloc Mixer memory of %d Bytes\n", + snd_printdd("kmalloc Mixer memory of %zd Bytes\n", sizeof(struct hdspm_mixer)); if ((hdspm->mixer = kmalloc(sizeof(struct hdspm_mixer), GFP_KERNEL)) == NULL) { -- cgit v1.2.3 From 20cd22620ad3a8a57a942fa1f301d47a1e15d67e Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 20 Jan 2006 14:07:47 +0100 Subject: [ALSA] pcxhr - Fix printk warning Modules: Digigram PCXHR driver sound/pci/pcxhr/pcxhr.c: In function 'pcxhr_update_r_buffer': sound/pci/pcxhr/pcxhr.c:460: warning: unsigned int format, different type arg (arg 7) Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 57fe9538f5a..b2cba75b6b1 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -454,7 +454,7 @@ static int pcxhr_update_r_buffer(struct pcxhr_stream *stream) is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE); stream_num = is_capture ? 0 : subs->number; - snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%x) subs(%d)\n", + snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%zx) subs(%d)\n", is_capture ? 'c' : 'p', chip->chip_idx, (void*)subs->runtime->dma_addr, subs->runtime->dma_bytes, subs->number); -- cgit v1.2.3 From 168a95f170070ddda1ba7505c2ce9ae8b50f21f6 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Fri, 20 Jan 2006 14:44:41 +0100 Subject: [ALSA] sound/ppc/pmac.c typo Modules: PPC PMAC driver In 2.6.16-rc1 there is a small typo introduced by the 'Remove device_node addrs/n_addr' changes which prevents my Powerbook G4 sound from working: Advanced Linux Sound Architecture Driver Version 1.0.11rc2 (Wed Jan 04 08:57:20 2006 UTC). snd: can't request rsrc 0 (Sound Control: 0x80000000:80004fff) ALSA device list: No soundcards found. The patch below fixes it. Of course, the patch fixing the i2c issues ('i2c_smbus_write_i2c_block_data' patch) needs to be applied to in order for the sound to completly work. Signed-off-by: Stelian Pop Signed-off-by: Takashi Iwai --- sound/ppc/pmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index a642e4cfcf4..4988f873a7b 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -1216,7 +1216,7 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) goto __error; } for (i = 0; i < 3; i ++) { - if (of_address_to_resource(np->parent, i, + if (of_address_to_resource(np, i, &chip->rsrc[i])) { printk(KERN_ERR "snd: can't translate rsrc " " %d (%s)\n", i, rnames[i]); -- cgit v1.2.3 From ec80859ed292a55334df68fc2492f1303cf3a0ac Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 22 Jan 2006 09:28:15 +0100 Subject: [ALSA] cs4232/cs4236 - moved CS423X_DRIVER define outside CONFIG_PNP Modules: CS4236+ driver Signed-off-by: Jaroslav Kysela --- sound/isa/cs423x/cs4236.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 2bfa68b01fe..edf9279bf9d 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -75,8 +75,10 @@ MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4235}," #ifdef CS4232 #define IDENT "CS4232" +#define CS423X_DRIVER "snd_cs4232" #else #define IDENT "CS4236+" +#define CS423X_DRIVER "snd_cs4236" #endif static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ @@ -160,7 +162,6 @@ MODULE_DEVICE_TABLE(pnp, snd_cs4232_pnpbiosids); #endif /* CS4232 */ #ifdef CS4232 -#define CS423X_DRIVER "snd_cs4232" #define CS423X_ISAPNP_DRIVER "cs4232_isapnp" static struct pnp_card_device_id snd_cs423x_pnpids[] = { /* Philips PCA70PS */ @@ -181,7 +182,6 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = { { .id = "" } /* end */ }; #else /* CS4236 */ -#define CS423X_DRIVER "snd_cs4236" #define CS423X_ISAPNP_DRIVER "cs4236_isapnp" static struct pnp_card_device_id snd_cs423x_pnpids[] = { /* Intel Marlin Spike Motherboard - CS4235 */ -- cgit v1.2.3 From d1d051b28e9d3c3bed0bd15a2b49df3d04f7768f Mon Sep 17 00:00:00 2001 From: Adam Belay Date: Fri, 20 Jan 2006 09:29:27 +0100 Subject: [ALSA] check return code in pnp_register_card_driver() Signed-off-by: Adam Belay Signed-off-by: Takashi Iwai --- drivers/pnp/card.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 0ecbe4edbec..aaa568a3806 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -363,7 +363,7 @@ static int card_resume(struct pnp_dev *dev) int pnp_register_card_driver(struct pnp_card_driver * drv) { - int count = 0; + int count; struct list_head *pos, *temp; drv->link.name = drv->name; @@ -374,10 +374,15 @@ int pnp_register_card_driver(struct pnp_card_driver * drv) drv->link.suspend = drv->suspend ? card_suspend : NULL; drv->link.resume = drv->resume ? card_resume : NULL; + count = pnp_register_driver(&drv->link); + if (count < 0) + return count; + spin_lock(&pnp_lock); list_add_tail(&drv->global_list, &pnp_card_drivers); spin_unlock(&pnp_lock); - pnp_register_driver(&drv->link); + + count = 0; list_for_each_safe(pos,temp,&pnp_cards){ struct pnp_card *card = list_entry(pos, struct pnp_card, global_list); -- cgit v1.2.3 From 0820e15a35b3cf37caadf550ddb7c75a7a77afd0 Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 23 Jan 2006 12:50:04 -0800 Subject: [CIFS] Do not zero non-existent iovec in SendReceive response processing. Could cause memory leak in some readpaths depending on what junk followed it in the stack. Signed-off-by: Steve French --- fs/cifs/transport.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 7b98792150e..b12cb8a7da7 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -498,7 +498,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, else *pRespBufType = CIFS_SMALL_BUFFER; iov[0].iov_len = receive_len + 4; - iov[1].iov_len = 0; dump_smb(midQ->resp_buf, 80); /* convert the length into a more usable form */ -- cgit v1.2.3 From d59cc22f7ce48bf5454f12eec8603bff81c34cdb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jan 2006 14:31:45 +1100 Subject: drm: Fix sparce warning in radeon driver From: Luiz Fernando Capitulino drivers/char/drm/radeon_cp.c:1643:31: warning: Using plain integer as NULL pointer Signed-off-by: Luiz Capitulino Signed-off-by: Andrew Morton Signed-off-by: Dave Airlie --- drivers/char/drm/radeon_cp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 915665c7fe7..9bb8ae0c1c2 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c @@ -1640,7 +1640,7 @@ static int radeon_do_cleanup_cp(drm_device_t * dev) if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) { drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev); - dev_priv->gart_info.addr = 0; + dev_priv->gart_info.addr = NULL; } } /* only clear to the start of flags */ -- cgit v1.2.3 From 5457f38e01ae2d296ff49db42254679018f13fa9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jan 2006 14:34:33 +1100 Subject: drm: add i945GM PCI ID From: Charles F. Johnson Signed-off-by: Dave Airlie --- drivers/char/drm/drm_pciids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 5b1d3a04458..27de81dad41 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h @@ -242,5 +242,6 @@ {0x8086, 0x2582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ + {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0, 0, 0} -- cgit v1.2.3 From 2fed3bd7436e8988980989493c16b4983be1a800 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jan 2006 14:52:43 +1100 Subject: drm: add X600 PCI IDs From: Brice Goglin Now that Xorg 6.9/7.0 has been released, DRI is supported on more Radeon cards without ATI proprietary drivers. I got my X300 to work without problem. But, another Radeon X600 required to add its PCI ids to the Radeon driver. Patch is attached. I can't be sure about the "CHIP_RV350", I copied it from the X300 entry (from http://dri.freedesktop.org/wiki/ATIRadeon, X600 is a rv380 chip while X300 is a rv370). But, at least it works now. Signed-off-by: Brice Goglin Signed-off-by: Andrew Morton Signed-off-by: Dave Airlie --- drivers/char/drm/drm_pciids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 27de81dad41..8fd6357a48d 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h @@ -3,6 +3,7 @@ Please contact dri-devel@lists.sf.net to add new cards to this list */ #define radeon_PCI_IDS \ + {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350},\ {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|CHIP_IS_IGP}, \ {0x1002, 0x4137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP}, \ {0x1002, 0x4144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ -- cgit v1.2.3 From f1e5c03d34c39394781ae13543cd3355976e4812 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jan 2006 14:54:15 +1100 Subject: drm: use NULL instead of 0 From: Randy Dunlap Use NULL instead of 0 (sparse warnings): drivers/char/drm/ati_pcigart.c:64:10: warning: Using plain integer as NULL pointer drivers/char/drm/ati_pcigart.c:130:21: warning: Using plain integer as NULL pointer drivers/char/drm/ati_pcigart.c:171:14: warning: Using plain integer as NULL pointer Signed-off-by: Randy Dunlap Signed-off-by: Dave Airlie --- drivers/char/drm/ati_pcigart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index 5485382cade..7d2a885b5db 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c @@ -61,7 +61,7 @@ static void *drm_ati_alloc_pcigart_table(void) address = __get_free_pages(GFP_KERNEL, ATI_PCIGART_TABLE_ORDER); if (address == 0UL) { - return 0; + return NULL; } page = virt_to_page(address); @@ -127,7 +127,7 @@ int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && gart_info->addr) { drm_ati_free_pcigart_table(gart_info->addr); - gart_info->addr = 0; + gart_info->addr = NULL; } return 1; @@ -168,7 +168,7 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) if (bus_address == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_free_pcigart_table(address); - address = 0; + address = NULL; goto done; } } else { -- cgit v1.2.3 From 507d256bae9eef7acd5049af6e3f67c24904a1e4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jan 2006 14:58:58 +1100 Subject: drm: ati_pcigart: simplify page_count manipulations From: Nick Piggin Allocate a compound page for the user mapping instead of tweaking the page refcounts. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Dave Airlie --- drivers/char/drm/ati_pcigart.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index 7d2a885b5db..bd7be09ea53 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c @@ -59,17 +59,16 @@ static void *drm_ati_alloc_pcigart_table(void) int i; DRM_DEBUG("%s\n", __FUNCTION__); - address = __get_free_pages(GFP_KERNEL, ATI_PCIGART_TABLE_ORDER); + address = __get_free_pages(GFP_KERNEL | __GFP_COMP, + ATI_PCIGART_TABLE_ORDER); if (address == 0UL) { return NULL; } page = virt_to_page(address); - for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { - get_page(page); + for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) SetPageReserved(page); - } DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); return (void *)address; @@ -83,10 +82,8 @@ static void drm_ati_free_pcigart_table(void *address) page = virt_to_page((unsigned long)address); - for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { - __put_page(page); + for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) ClearPageReserved(page); - } free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); } -- cgit v1.2.3 From 17cbbafe8e82bde4258e407ce043b61f4f9a350f Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 24 Jan 2006 20:26:48 -0800 Subject: [CIFS] Make cifs default wsize match what we actually want to send (52K typically - header + 13 pages). Forgetting to set wsize on the mount command costs more than 10% on large write (can be much more) so this makes a saner default. We still shrink this default smaller if server can not support it. Signed-off-by: Steve French --- fs/cifs/connect.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 88f60aa5205..eae306fa24b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1785,7 +1785,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, } else if(volume_info.wsize) cifs_sb->wsize = volume_info.wsize; else - cifs_sb->wsize = CIFSMaxBufSize; /* default */ + cifs_sb->wsize = + min(PAGEVEC_SIZE * PAGE_CACHE_SIZE, 127*1024); + /* old default of CIFSMaxBufSize was too small now + that SMB Write2 can send multiple pages in kvec. + RFC1001 does not describe what happens when frame + bigger than 128K is sent so use that as max in + conjunction with 52K kvec constraint on arch with 4K + page size */ + if(cifs_sb->rsize < PAGE_CACHE_SIZE) { cifs_sb->rsize = PAGE_CACHE_SIZE; /* Windows ME does this */ -- cgit v1.2.3 From de227f5f32775d86e5c780a7cffdd2e08574f7fb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jan 2006 15:31:43 +1100 Subject: drm: i915 patches from Tungsten Graphics Fix CMDBUFFER path, add heap destroy and flesh out sarea for rotation (Tungsten Graphics) From: Alan Hourihane Signed-off-by: Dave Airlie --- drivers/char/drm/i915_dma.c | 42 ++++++++++++++++++++++++++++++------------ drivers/char/drm/i915_drm.h | 33 +++++++++++++++++++++++++++++++++ drivers/char/drm/i915_drv.h | 6 ++++-- drivers/char/drm/i915_mem.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 14 deletions(-) diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 9140703da1b..1ff4c7ca0bf 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c @@ -344,18 +344,20 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) int i; RING_LOCALS; + if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8) + return DRM_ERR(EINVAL); + + BEGIN_LP_RING(((dwords+1)&~1)); + for (i = 0; i < dwords;) { int cmd, sz; if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) return DRM_ERR(EINVAL); -/* printk("%d/%d ", i, dwords); */ - if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) return DRM_ERR(EINVAL); - BEGIN_LP_RING(sz); OUT_RING(cmd); while (++i, --sz) { @@ -365,9 +367,13 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) } OUT_RING(cmd); } - ADVANCE_LP_RING(); } + if (dwords & 1) + OUT_RING(0); + + ADVANCE_LP_RING(); + return 0; } @@ -401,6 +407,21 @@ static int i915_emit_box(drm_device_t * dev, return 0; } +static void i915_emit_breadcrumb(drm_device_t *dev) +{ + drm_i915_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; + + BEGIN_LP_RING(4); + OUT_RING(CMD_STORE_DWORD_IDX); + OUT_RING(20); + OUT_RING(dev_priv->counter); + OUT_RING(0); + ADVANCE_LP_RING(); +} + static int i915_dispatch_cmdbuffer(drm_device_t * dev, drm_i915_cmdbuffer_t * cmd) { @@ -429,6 +450,7 @@ static int i915_dispatch_cmdbuffer(drm_device_t * dev, return ret; } + i915_emit_breadcrumb(dev); return 0; } @@ -475,12 +497,7 @@ static int i915_dispatch_batchbuffer(drm_device_t * dev, dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; - BEGIN_LP_RING(4); - OUT_RING(CMD_STORE_DWORD_IDX); - OUT_RING(20); - OUT_RING(dev_priv->counter); - OUT_RING(0); - ADVANCE_LP_RING(); + i915_emit_breadcrumb(dev); return 0; } @@ -657,7 +674,7 @@ static int i915_getparam(DRM_IOCTL_ARGS) value = READ_BREADCRUMB(dev_priv); break; default: - DRM_ERROR("Unkown parameter %d\n", param.param); + DRM_ERROR("Unknown parameter %d\n", param.param); return DRM_ERR(EINVAL); } @@ -742,7 +759,8 @@ drm_ioctl_desc_t i915_ioctls[] = { [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, DRM_AUTH}, [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH}, [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, - [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH} + [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH}, + [DRM_IOCTL_NR(DRM_I915_DESTROY_HEAP)] = { i915_mem_destroy_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY } }; int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h index 77412ddac00..4cb3da57833 100644 --- a/drivers/char/drm/i915_drm.h +++ b/drivers/char/drm/i915_drm.h @@ -74,6 +74,30 @@ typedef struct _drm_i915_sarea { int pf_active; int pf_current_page; /* which buffer is being displayed? */ int perf_boxes; /* performance boxes to be displayed */ + int width, height; /* screen size in pixels */ + + drm_handle_t front_handle; + int front_offset; + int front_size; + + drm_handle_t back_handle; + int back_offset; + int back_size; + + drm_handle_t depth_handle; + int depth_offset; + int depth_size; + + drm_handle_t tex_handle; + int tex_offset; + int tex_size; + int log_tex_granularity; + int pitch; + int rotation; /* 0, 90, 180 or 270 */ + int rotated_offset; + int rotated_size; + int rotated_pitch; + int virtualX, virtualY; } drm_i915_sarea_t; /* Flags for perf_boxes @@ -99,6 +123,7 @@ typedef struct _drm_i915_sarea { #define DRM_I915_FREE 0x09 #define DRM_I915_INIT_HEAP 0x0a #define DRM_I915_CMDBUFFER 0x0b +#define DRM_I915_DESTROY_HEAP 0x0c #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) @@ -112,6 +137,7 @@ typedef struct _drm_i915_sarea { #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) +#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) /* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware. @@ -191,4 +217,11 @@ typedef struct drm_i915_mem_init_heap { int start; } drm_i915_mem_init_heap_t; +/* Allow memory manager to be torn down and re-initialized (eg on + * rotate): + */ +typedef struct drm_i915_mem_destroy_heap { + int region; +} drm_i915_mem_destroy_heap_t; + #endif /* _I915_DRM_H_ */ diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index c6c71b45f10..7a65666899e 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h @@ -37,16 +37,17 @@ #define DRIVER_NAME "i915" #define DRIVER_DESC "Intel Graphics" -#define DRIVER_DATE "20051209" +#define DRIVER_DATE "20060119" /* Interface history: * * 1.1: Original. * 1.2: Add Power Management * 1.3: Add vblank support + * 1.4: Fix cmdbuffer path, add heap destroy */ #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 3 +#define DRIVER_MINOR 4 #define DRIVER_PATCHLEVEL 0 typedef struct _drm_i915_ring_buffer { @@ -123,6 +124,7 @@ extern void i915_driver_irq_uninstall(drm_device_t * dev); extern int i915_mem_alloc(DRM_IOCTL_ARGS); extern int i915_mem_free(DRM_IOCTL_ARGS); extern int i915_mem_init_heap(DRM_IOCTL_ARGS); +extern int i915_mem_destroy_heap(DRM_IOCTL_ARGS); extern void i915_mem_takedown(struct mem_block **heap); extern void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap); diff --git a/drivers/char/drm/i915_mem.c b/drivers/char/drm/i915_mem.c index ba87ff17ff6..52c67324df5 100644 --- a/drivers/char/drm/i915_mem.c +++ b/drivers/char/drm/i915_mem.c @@ -365,3 +365,34 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS) return init_heap(heap, initheap.start, initheap.size); } + +int i915_mem_destroy_heap( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_i915_private_t *dev_priv = dev->dev_private; + drm_i915_mem_destroy_heap_t destroyheap; + struct mem_block **heap; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( destroyheap, (drm_i915_mem_destroy_heap_t *)data, + sizeof(destroyheap) ); + + heap = get_heap( dev_priv, destroyheap.region ); + if (!heap) { + DRM_ERROR("get_heap failed"); + return DRM_ERR(EFAULT); + } + + if (!*heap) { + DRM_ERROR("heap not initialized?"); + return DRM_ERR(EFAULT); + } + + i915_mem_takedown( heap ); + return 0; +} + -- cgit v1.2.3 From 339363c4c6fe01043c51e7d6e9fbeb8feee00841 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 26 Jan 2006 08:32:14 +1100 Subject: drm: Fixes sparse warnings in via_dmablit.c Fixes the following sparse warnings: drivers/char/drm/via_dmablit.c:111:35: warning: Using plain integer as NULL pointer drivers/char/drm/via_dmablit.c:584:23: warning: Using plain integer as NULL pointer Signed-off-by: Luiz Capitulino Signed-off-by: Dave Airlie --- drivers/char/drm/via_dmablit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index 9d5e027dae0..a28eece6281 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c @@ -108,7 +108,7 @@ via_map_blit_for_device(struct pci_dev *pdev, int num_desc = 0; int cur_line; dma_addr_t next = 0 | VIA_DMA_DPR_EC; - drm_via_descriptor_t *desc_ptr = 0; + drm_via_descriptor_t *desc_ptr = NULL; if (mode == 1) desc_ptr = vsg->desc_pages[cur_descriptor_page]; @@ -581,7 +581,7 @@ via_build_sg_info(drm_device_t *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t * int ret = 0; vsg->direction = (draw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; - vsg->bounce_buffer = 0; + vsg->bounce_buffer = NULL; vsg->state = dr_via_sg_init; -- cgit v1.2.3 From d4ec6c7cc9a15a7a529719bc3b84f46812f9842e Mon Sep 17 00:00:00 2001 From: Len Brown Date: Thu, 26 Jan 2006 17:23:38 -0500 Subject: [ACPI] remove "Resource isn't an IRQ" warning In the case where a (broken) BIOS gives us a blank _CRS for a PCI Interrupt Link Device, the acpi_walk_resources() will not terminate, but will then give the callback the resource end tag. Ignore the end tag. Signed-off-by: Len Brown --- drivers/acpi/pci_link.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 1ffc7711536..07bc6dfe662 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -233,8 +233,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) *irq = p->interrupts[0]; break; } + break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); + case ACPI_RESOURCE_TYPE_END_TAG: return_ACPI_STATUS(AE_OK); } return_ACPI_STATUS(AE_CTRL_TERMINATE); -- cgit v1.2.3 From eb9bdaa3f3b9d30d09bcad47037216aa39639b8e Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 27 Jan 2006 15:11:47 -0800 Subject: Signed-off-by: Steve French --- fs/cifs/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 77c990f0cb9..d17c97d07c8 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1190,7 +1190,6 @@ retry: /* BB what if continued retry is requested via mount flags? */ set_bit(AS_EIO, &mapping->flags); - SetPageError(page); } else { cifs_stats_bytes_written(cifs_sb->tcon, bytes_written); @@ -1198,6 +1197,13 @@ retry: } for (i = 0; i < n_iov; i++) { page = pvec.pages[first + i]; + /* Should we also set page error on + success rc but too little data written? */ + /* BB investigate retry logic on temporary + server crash cases and how recovery works + when page marked as error */ + if(rc) + SetPageError(page); kunmap(page); unlock_page(page); page_cache_release(page); -- cgit v1.2.3 From 1877c9ea66a29563987f22d0a86c66f438a87ce2 Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 27 Jan 2006 18:36:11 -0800 Subject: [CIFS] Remove compiler warning Signed-off-by: Steve French --- fs/cifs/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index eae306fa24b..e488603fb1e 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1786,7 +1786,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, cifs_sb->wsize = volume_info.wsize; else cifs_sb->wsize = - min(PAGEVEC_SIZE * PAGE_CACHE_SIZE, 127*1024); + min_t(const int, PAGEVEC_SIZE * PAGE_CACHE_SIZE, + 127*1024); /* old default of CIFSMaxBufSize was too small now that SMB Write2 can send multiple pages in kvec. RFC1001 does not describe what happens when frame -- cgit v1.2.3 From b8e4d89357fc434618a59c1047cac72641191805 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 27 Jan 2006 16:43:00 -0500 Subject: [ACPI] ACPICA 20060127 Implemented support in the Resource Manager to allow unresolved namestring references within resource package objects for the _PRT method. This support is in addition to the previously implemented unresolved reference support within the AML parser. If the interpreter slack mode is enabled (true on Linux unless acpi=strict), these unresolved references will be passed through to the caller as a NULL package entry. http://bugzilla.kernel.org/show_bug.cgi?id=5741 Implemented and deployed new macros and functions for error and warning messages across the subsystem. These macros are simpler and generate less code than their predecessors. The new macros ACPI_ERROR, ACPI_EXCEPTION, ACPI_WARNING, and ACPI_INFO replace the ACPI_REPORT_* macros. Implemented the acpi_cpu_flags type to simplify host OS integration of the Acquire/Release Lock OSL interfaces. Suggested by Steven Rostedt and Andrew Morton. Fixed a problem where Alias ASL operators are sometimes not correctly resolved. causing AE_AML_INTERNAL http://bugzilla.kernel.org/show_bug.cgi?id=5189 http://bugzilla.kernel.org/show_bug.cgi?id=5674 Fixed several problems with the implementation of the ConcatenateResTemplate ASL operator. As per the ACPI specification, zero length buffers are now treated as a single EndTag. One-length buffers always cause a fatal exception. Non-zero length buffers that do not end with a full 2-byte EndTag cause a fatal exception. Fixed a possible structure overwrite in the AcpiGetObjectInfo external interface. (With assistance from Thomas Renninger) Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsfield.c | 34 +++++---- drivers/acpi/dispatcher/dsinit.c | 14 ++-- drivers/acpi/dispatcher/dsmethod.c | 6 +- drivers/acpi/dispatcher/dsmthdat.c | 25 ++++--- drivers/acpi/dispatcher/dsobject.c | 20 +++--- drivers/acpi/dispatcher/dsopcode.c | 45 +++++++----- drivers/acpi/dispatcher/dsutils.c | 15 ++-- drivers/acpi/dispatcher/dswexec.c | 31 +++++--- drivers/acpi/dispatcher/dswload.c | 26 ++++--- drivers/acpi/dispatcher/dswscope.c | 4 +- drivers/acpi/dispatcher/dswstate.c | 94 ++++++++++++++---------- drivers/acpi/events/evevent.c | 19 +++-- drivers/acpi/events/evgpe.c | 42 +++++++---- drivers/acpi/events/evgpeblk.c | 50 ++++++++----- drivers/acpi/events/evmisc.c | 20 ++++-- drivers/acpi/events/evregion.c | 44 +++++++----- drivers/acpi/events/evrgnini.c | 6 +- drivers/acpi/events/evxface.c | 12 ++-- drivers/acpi/events/evxfevnt.c | 20 +++--- drivers/acpi/executer/exconfig.c | 4 +- drivers/acpi/executer/exconvrt.c | 11 ++- drivers/acpi/executer/excreate.c | 4 +- drivers/acpi/executer/exfield.c | 9 ++- drivers/acpi/executer/exfldio.c | 65 +++++++++++------ drivers/acpi/executer/exmisc.c | 43 ++++++----- drivers/acpi/executer/exmutex.c | 26 +++++-- drivers/acpi/executer/exnames.c | 13 ++-- drivers/acpi/executer/exoparg1.c | 57 +++++++++------ drivers/acpi/executer/exoparg2.c | 30 +++++--- drivers/acpi/executer/exoparg3.c | 8 +-- drivers/acpi/executer/exoparg6.c | 11 +-- drivers/acpi/executer/exprep.c | 25 +++++-- drivers/acpi/executer/exregion.c | 9 ++- drivers/acpi/executer/exresnte.c | 37 +++++----- drivers/acpi/executer/exresolv.c | 37 ++++++---- drivers/acpi/executer/exresop.c | 96 +++++++++++++++++++------ drivers/acpi/executer/exstore.c | 18 +++-- drivers/acpi/executer/exstoren.c | 17 +++-- drivers/acpi/executer/exsystem.c | 4 +- drivers/acpi/executer/exutils.c | 10 +-- drivers/acpi/hardware/hwacpi.c | 14 ++-- drivers/acpi/hardware/hwregs.c | 43 +++++++---- drivers/acpi/hardware/hwsleep.c | 21 +++--- drivers/acpi/namespace/nsaccess.c | 29 +++++--- drivers/acpi/namespace/nsalloc.c | 8 ++- drivers/acpi/namespace/nsdump.c | 8 +-- drivers/acpi/namespace/nseval.c | 2 +- drivers/acpi/namespace/nsinit.c | 18 ++--- drivers/acpi/namespace/nsload.c | 8 +-- drivers/acpi/namespace/nsnames.c | 6 +- drivers/acpi/namespace/nsobject.c | 11 +-- drivers/acpi/namespace/nssearch.c | 8 ++- drivers/acpi/namespace/nsutils.c | 12 ++-- drivers/acpi/namespace/nsxfeval.c | 18 ++--- drivers/acpi/namespace/nsxfname.c | 3 +- drivers/acpi/osl.c | 8 +-- drivers/acpi/parser/psargs.c | 10 +-- drivers/acpi/parser/psloop.c | 15 ++-- drivers/acpi/parser/psparse.c | 9 +-- drivers/acpi/parser/pstree.c | 4 +- drivers/acpi/resources/rscalc.c | 14 ++-- drivers/acpi/resources/rscreate.c | 144 ++++++++++++++++++++++--------------- drivers/acpi/resources/rsdump.c | 6 +- drivers/acpi/resources/rslist.c | 12 +++- drivers/acpi/resources/rsmisc.c | 28 +++++--- drivers/acpi/tables/tbconvrt.c | 17 +++-- drivers/acpi/tables/tbget.c | 37 +++++----- drivers/acpi/tables/tbgetall.c | 21 ++++-- drivers/acpi/tables/tbinstal.c | 10 +-- drivers/acpi/tables/tbrsdt.c | 18 +++-- drivers/acpi/tables/tbutils.c | 27 ++++--- drivers/acpi/tables/tbxface.c | 19 ++--- drivers/acpi/tables/tbxfroot.c | 21 ++++-- drivers/acpi/utilities/utalloc.c | 51 +++++++------ drivers/acpi/utilities/utcopy.c | 5 +- drivers/acpi/utilities/utdelete.c | 10 +-- drivers/acpi/utilities/uteval.c | 20 +++--- drivers/acpi/utilities/utglobal.c | 4 +- drivers/acpi/utilities/utinit.c | 8 +-- drivers/acpi/utilities/utmath.c | 8 +-- drivers/acpi/utilities/utmisc.c | 90 ++++++++++++++++------- drivers/acpi/utilities/utmutex.c | 29 ++++++-- drivers/acpi/utilities/utobject.c | 29 ++++---- drivers/acpi/utilities/utresrc.c | 16 +++++ drivers/acpi/utilities/utxface.c | 14 ++-- include/acpi/acconfig.h | 4 +- include/acpi/aclocal.h | 9 ++- include/acpi/acmacros.h | 87 +++++++++------------- include/acpi/acobject.h | 2 +- include/acpi/acpiosxf.h | 4 +- include/acpi/actypes.h | 41 +++++++++-- include/acpi/acutils.h | 25 ++++++- include/acpi/platform/acenv.h | 10 +-- include/acpi/platform/acgcc.h | 8 ++- include/acpi/platform/aclinux.h | 2 + 95 files changed, 1345 insertions(+), 821 deletions(-) diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index f3a008ff1ea..76bc0463f6d 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c @@ -128,7 +128,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(arg->common.value.string, status); + ACPI_ERROR_NAMESPACE(arg->common.value.string, status); return_ACPI_STATUS(status); } } @@ -232,7 +232,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, + (acpi_integer) arg->common.value.size; if (position > ACPI_UINT32_MAX) { - ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n")); + ACPI_ERROR((AE_INFO, + "Bit offset within field too large (> 0xFFFFFFFF)")); return_ACPI_STATUS(AE_SUPPORT); } @@ -268,8 +269,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, ACPI_NS_DONT_OPEN_SCOPE, walk_state, &info->field_node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR((char *)&arg->named.name, - status); + ACPI_ERROR_NAMESPACE((char *)&arg->named.name, + status); if (status != AE_ALREADY_EXISTS) { return_ACPI_STATUS(status); } @@ -293,7 +294,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, + (acpi_integer) arg->common.value.size; if (position > ACPI_UINT32_MAX) { - ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", ACPI_CAST_PTR(char, &info->field_node->name))); + ACPI_ERROR((AE_INFO, + "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)", + ACPI_CAST_PTR(char, + &info->field_node-> + name))); return_ACPI_STATUS(AE_SUPPORT); } @@ -302,8 +307,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, default: - ACPI_REPORT_ERROR(("Invalid opcode in field list: %X\n", - arg->common.aml_opcode)); + ACPI_ERROR((AE_INFO, + "Invalid opcode in field list: %X", + arg->common.aml_opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } @@ -348,7 +354,7 @@ acpi_ds_create_field(union acpi_parse_object *op, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(arg->common.value.name, status); + ACPI_ERROR_NAMESPACE(arg->common.value.name, status); return_ACPI_STATUS(status); } } @@ -430,8 +436,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, ACPI_NS_ERROR_IF_FOUND, walk_state, &node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR((char *)&arg->named.name, - status); + ACPI_ERROR_NAMESPACE((char *)&arg->named.name, + status); if (status != AE_ALREADY_EXISTS) { return_ACPI_STATUS(status); } @@ -487,7 +493,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(arg->common.value.name, status); + ACPI_ERROR_NAMESPACE(arg->common.value.name, status); return_ACPI_STATUS(status); } } @@ -501,7 +507,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(arg->common.value.string, status); + ACPI_ERROR_NAMESPACE(arg->common.value.string, status); return_ACPI_STATUS(status); } @@ -559,7 +565,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(arg->common.value.string, status); + ACPI_ERROR_NAMESPACE(arg->common.value.string, status); return_ACPI_STATUS(status); } @@ -572,7 +578,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(arg->common.value.string, status); + ACPI_ERROR_NAMESPACE(arg->common.value.string, status); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index 258fbdfaa69..e65a07ad242 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -105,7 +105,10 @@ acpi_ds_init_one_object(acpi_handle obj_handle, status = acpi_ds_initialize_region(obj_handle); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Region %p [%4.4s] - Init failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "During Region initialization %p [%4.4s]", + obj_handle, + acpi_ut_get_node_name(obj_handle))); } info->op_region_count++; @@ -144,7 +147,11 @@ acpi_ds_init_one_object(acpi_handle obj_handle, */ status = acpi_ds_parse_method(obj_handle); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("\n+Method %p [%4.4s] - parse failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status))); + ACPI_ERROR((AE_INFO, + "Method %p [%4.4s] - parse failure, %s", + obj_handle, + acpi_ut_get_node_name(obj_handle), + acpi_format_exception(status))); /* This parse failed, but we will continue parsing more methods */ } @@ -206,8 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, acpi_ds_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("walk_namespace failed, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index d861add3fc1..c475546535b 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -141,7 +141,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, /* Prevent wraparound of thread count */ if (obj_desc->method.thread_count == ACPI_UINT8_MAX) { - ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n")); + ACPI_ERROR((AE_INFO, + "Method reached maximum reentrancy limit (255)")); return_ACPI_STATUS(AE_AML_METHOD_LIMIT); } @@ -470,7 +471,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) acpi_os_signal_semaphore(walk_state->method_desc->method. semaphore, 1); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); + ACPI_ERROR((AE_INFO, + "Could not signal method semaphore")); /* Ignore error and continue cleanup */ } diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index ce33c34f87c..c025674f938 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -260,7 +260,9 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_LOCAL_OP: if (index > ACPI_METHOD_MAX_LOCAL) { - ACPI_REPORT_ERROR(("Local index %d is invalid (max %d)\n", index, ACPI_METHOD_MAX_LOCAL)); + ACPI_ERROR((AE_INFO, + "Local index %d is invalid (max %d)", + index, ACPI_METHOD_MAX_LOCAL)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -272,8 +274,9 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_ARG_OP: if (index > ACPI_METHOD_MAX_ARG) { - ACPI_REPORT_ERROR(("Arg index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_ARG)); + ACPI_ERROR((AE_INFO, + "Arg index %d is invalid (max %d)", + index, ACPI_METHOD_MAX_ARG)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -283,7 +286,7 @@ acpi_ds_method_data_get_node(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Opcode %d is invalid\n", opcode)); + ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } @@ -374,7 +377,7 @@ acpi_ds_method_data_get_value(u16 opcode, /* Validate the object descriptor */ if (!dest_desc) { - ACPI_REPORT_ERROR(("Null object descriptor pointer\n")); + ACPI_ERROR((AE_INFO, "Null object descriptor pointer")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -419,18 +422,24 @@ acpi_ds_method_data_get_value(u16 opcode, switch (opcode) { case AML_ARG_OP: - ACPI_REPORT_ERROR(("Uninitialized Arg[%d] at node %p\n", index, node)); + ACPI_ERROR((AE_INFO, + "Uninitialized Arg[%d] at node %p", + index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); case AML_LOCAL_OP: - ACPI_REPORT_ERROR(("Uninitialized Local[%d] at node %p\n", index, node)); + ACPI_ERROR((AE_INFO, + "Uninitialized Local[%d] at node %p", + index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); default: - ACPI_REPORT_ERROR(("Not a Arg/Local opcode: %X\n", opcode)); + ACPI_ERROR((AE_INFO, + "Not a Arg/Local opcode: %X", + opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index dc116d679a5..8b21f0f9e51 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -129,8 +129,8 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, return_ACPI_STATUS(AE_OK); } else { - ACPI_REPORT_NSERROR(op->common.value. - string, status); + ACPI_ERROR_NAMESPACE(op->common.value. + string, status); } return_ACPI_STATUS(status); @@ -214,7 +214,9 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, byte_list = arg->named.next; if (byte_list) { if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { - ACPI_REPORT_ERROR(("Expecting bytelist, got AML opcode %X in op %p\n", byte_list->common.aml_opcode, byte_list)); + ACPI_ERROR((AE_INFO, + "Expecting bytelist, got AML opcode %X in op %p", + byte_list->common.aml_opcode, byte_list)); acpi_ut_remove_reference(obj_desc); return (AE_TYPE); @@ -540,7 +542,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Unknown constant opcode %X\n", opcode)); + ACPI_ERROR((AE_INFO, + "Unknown constant opcode %X", + opcode)); status = AE_AML_OPERAND_TYPE; break; } @@ -555,8 +559,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, break; default: - ACPI_REPORT_ERROR(("Unknown Integer type %X\n", - op_info->type)); + ACPI_ERROR((AE_INFO, "Unknown Integer type %X", + op_info->type)); status = AE_AML_OPERAND_TYPE; break; } @@ -634,8 +638,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Unimplemented data type: %X\n", - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_ERROR((AE_INFO, "Unimplemented data type: %X", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; break; diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 60414ee84b0..6229c10674e 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c @@ -245,7 +245,9 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) node = obj_desc->buffer.node; if (!node) { - ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc)); + ACPI_ERROR((AE_INFO, + "No pointer back to NS node in buffer obj %p", + obj_desc)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -287,8 +289,9 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) node = obj_desc->package.node; if (!node) { - ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n", - obj_desc)); + ACPI_ERROR((AE_INFO, + "No pointer back to NS node in package %p", + obj_desc)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -413,7 +416,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Host object must be a Buffer */ if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { - ACPI_REPORT_ERROR(("Target of Create Field is not a Buffer object - %s\n", acpi_ut_get_object_type_name(buffer_desc))); + ACPI_ERROR((AE_INFO, + "Target of Create Field is not a Buffer object - %s", + acpi_ut_get_object_type_name(buffer_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -425,9 +430,10 @@ acpi_ds_init_buffer_field(u16 aml_opcode, * after resolution in acpi_ex_resolve_operands(). */ if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("(%s) destination not a NS Node [%s]\n", - acpi_ps_get_opcode_name(aml_opcode), - acpi_ut_get_descriptor_name(result_desc))); + ACPI_ERROR((AE_INFO, + "(%s) destination not a NS Node [%s]", + acpi_ps_get_opcode_name(aml_opcode), + acpi_ut_get_descriptor_name(result_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -450,7 +456,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Must have a valid (>0) bit count */ if (bit_count == 0) { - ACPI_REPORT_ERROR(("Attempt to create_field of length 0\n")); + ACPI_ERROR((AE_INFO, + "Attempt to create_field of length zero")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -503,8 +510,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode, default: - ACPI_REPORT_ERROR(("Unknown field creation opcode %02x\n", - aml_opcode)); + ACPI_ERROR((AE_INFO, + "Unknown field creation opcode %02x", aml_opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -512,7 +519,12 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Entire field must fit within the current length of the buffer */ if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { - ACPI_REPORT_ERROR(("Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", acpi_ut_get_node_name(result_desc), bit_offset + bit_count, acpi_ut_get_node_name(buffer_desc->buffer.node), 8 * (u32) buffer_desc->buffer.length)); + ACPI_ERROR((AE_INFO, + "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)", + acpi_ut_get_node_name(result_desc), + bit_offset + bit_count, + acpi_ut_get_node_name(buffer_desc->buffer.node), + 8 * (u32) buffer_desc->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -618,10 +630,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, "after acpi_ex_resolve_operands"); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("(%s) bad operand(s) (%X)\n", - acpi_ps_get_opcode_name(op->common. - aml_opcode), - status)); + ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", + acpi_ps_get_opcode_name(op->common.aml_opcode), + status)); return_ACPI_STATUS(status); } @@ -1145,8 +1156,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, default: - ACPI_REPORT_ERROR(("Unknown control opcode=%X Op=%p\n", - op->common.aml_opcode, op)); + ACPI_ERROR((AE_INFO, "Unknown control opcode=%X Op=%p", + op->common.aml_opcode, op)); status = AE_AML_BAD_OPCODE; break; diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index cd9aa7faa57..53356a591ac 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -176,7 +176,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, /* Must have both an Op and a Result Object */ if (!op) { - ACPI_REPORT_ERROR(("Null Op\n")); + ACPI_ERROR((AE_INFO, "Null Op")); return_UINT8(TRUE); } @@ -216,7 +216,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, parent_info = acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); if (parent_info->class == AML_CLASS_UNKNOWN) { - ACPI_REPORT_ERROR(("Unknown parent opcode Op=%p\n", op)); + ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op)); return_UINT8(FALSE); } @@ -343,7 +343,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); if (!op) { - ACPI_REPORT_ERROR(("Null Op\n")); + ACPI_ERROR((AE_INFO, "Null Op")); return_VOID; } @@ -566,7 +566,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, } if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(name_string, status); + ACPI_ERROR_NAMESPACE(name_string, status); } } @@ -634,7 +634,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, * Only error is underflow, and this indicates * a missing or null operand! */ - ACPI_REPORT_ERROR(("Missing or null operand, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Missing or null operand")); return_ACPI_STATUS(status); } } else { @@ -726,7 +727,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, */ (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); - ACPI_REPORT_ERROR(("While creating Arg %d - %s\n", - (arg_count + 1), acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", + (arg_count + 1))); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 5a9b91fe93d..f1af655ff11 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -100,7 +100,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, if (result_obj) { status = acpi_ds_result_pop(&obj_desc, walk_state); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get result from predicate evaluation, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not get result from predicate evaluation")); return_ACPI_STATUS(status); } @@ -121,8 +122,9 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (!obj_desc) { - ACPI_REPORT_ERROR(("No predicate obj_desc=%p State=%p\n", - obj_desc, walk_state)); + ACPI_ERROR((AE_INFO, + "No predicate obj_desc=%p State=%p", + obj_desc, walk_state)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -137,7 +139,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { - ACPI_REPORT_ERROR(("Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", obj_desc, walk_state, ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_ERROR((AE_INFO, + "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X", + obj_desc, walk_state, + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -356,8 +361,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) op_class = walk_state->op_info->class; if (op_class == AML_CLASS_UNKNOWN) { - ACPI_REPORT_ERROR(("Unknown opcode %X\n", - op->common.aml_opcode)); + ACPI_ERROR((AE_INFO, "Unknown opcode %X", + op->common.aml_opcode)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -447,7 +452,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) walk_state->operands[1]->reference.offset)) { status = AE_OK; } else { - ACPI_REPORT_ERROR(("[%s]: Could not resolve operands, %s\n", acpi_ps_get_opcode_name(walk_state->opcode), acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "While resolving operands for [%s]", + acpi_ps_get_opcode_name + (walk_state->opcode))); } } @@ -666,8 +674,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_UNDEFINED: - ACPI_REPORT_ERROR(("Undefined opcode type Op=%p\n", - op)); + ACPI_ERROR((AE_INFO, + "Undefined opcode type Op=%p", op)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); case AML_TYPE_BOGUS: @@ -679,7 +687,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", op_class, op_type, op->common.aml_opcode, op)); + ACPI_ERROR((AE_INFO, + "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p", + op_class, op_type, op->common.aml_opcode, + op)); status = AE_NOT_IMPLEMENTED; break; diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 4cad6afa82f..d3d24da31c8 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -187,7 +187,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, } #endif if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(path, status); + ACPI_ERROR_NAMESPACE(path, status); return_ACPI_STATUS(status); } @@ -233,7 +233,9 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, /* All other types are an error */ - ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); + ACPI_ERROR((AE_INFO, + "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)", + acpi_ut_get_type_name(node->type), path)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -300,7 +302,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(path, status); + ACPI_ERROR_NAMESPACE(path, status); return_ACPI_STATUS(status); } break; @@ -618,10 +620,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, if (status == AE_NOT_FOUND) { status = AE_OK; } else { - ACPI_REPORT_NSERROR(buffer_ptr, status); + ACPI_ERROR_NAMESPACE(buffer_ptr, status); } #else - ACPI_REPORT_NSERROR(buffer_ptr, status); + ACPI_ERROR_NAMESPACE(buffer_ptr, status); #endif return_ACPI_STATUS(status); } @@ -651,7 +653,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, * Scope (DEB) { ... } */ - ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type))); + ACPI_WARNING((AE_INFO, + "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)", + buffer_ptr, + acpi_ut_get_type_name(node->type))); node->type = ACPI_TYPE_ANY; walk_state->scope_info->common.value = ACPI_TYPE_ANY; @@ -661,7 +666,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, /* All other types are an error */ - ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr)); + ACPI_ERROR((AE_INFO, + "Invalid type (%s) for target of Scope operator [%4.4s]", + acpi_ut_get_type_name(node->type), + buffer_ptr)); return (AE_AML_OPERAND_TYPE); } @@ -714,7 +722,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, } if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(buffer_ptr, status); + ACPI_ERROR_NAMESPACE(buffer_ptr, status); return_ACPI_STATUS(status); } @@ -1112,7 +1120,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) */ op->common.node = new_node; } else { - ACPI_REPORT_NSERROR(arg->common.value.string, status); + ACPI_ERROR_NAMESPACE(arg->common.value.string, status); } break; diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index e7fc88ca47b..ada21ef4a17 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c @@ -107,14 +107,14 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, if (!node) { /* Invalid scope */ - ACPI_REPORT_ERROR(("Null scope parameter\n")); + ACPI_ERROR((AE_INFO, "Null scope parameter")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Make sure object type is valid */ if (!acpi_ut_valid_object_type(type)) { - ACPI_REPORT_WARNING(("Invalid object type: 0x%X\n", type)); + ACPI_WARNING((AE_INFO, "Invalid object type: 0x%X", type)); } /* Allocate a new scope object */ diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 61aae2dcc5e..fa78cb74ee3 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -92,23 +92,23 @@ acpi_ds_result_remove(union acpi_operand_object **object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", - walk_state)); + ACPI_ERROR((AE_INFO, "No result object pushed! State=%p", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_MAX_OPERAND) { - ACPI_REPORT_ERROR(("Index out of range: %X State=%p Num=%X\n", - index, walk_state, - state->results.num_results)); + ACPI_ERROR((AE_INFO, + "Index out of range: %X State=%p Num=%X", + index, walk_state, state->results.num_results)); } /* Check for a valid result object */ if (!state->results.obj_desc[index]) { - ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X, Index=%X\n", - walk_state, state->results.num_results, - index)); + ACPI_ERROR((AE_INFO, + "Null operand! State=%p #Ops=%X, Index=%X", + walk_state, state->results.num_results, index)); return (AE_AML_NO_RETURN_VALUE); } @@ -160,8 +160,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } if (!state->results.num_results) { - ACPI_REPORT_ERROR(("Result stack is empty! State=%p\n", - walk_state)); + ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -188,7 +188,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } } - ACPI_REPORT_ERROR(("No result objects! State=%p\n", walk_state)); + ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -217,14 +217,14 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", - walk_state)); + ACPI_ERROR((AE_INFO, + "No result object pushed! State=%p", walk_state)); return (AE_NOT_EXIST); } if (!state->results.num_results) { - ACPI_REPORT_ERROR(("No result objects! State=%p\n", - walk_state)); + ACPI_ERROR((AE_INFO, "No result objects! State=%p", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -244,9 +244,10 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, /* Check for a valid result object */ if (!*object) { - ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X Index=%X\n", - walk_state, state->results.num_results, - (u32) index)); + ACPI_ERROR((AE_INFO, + "Null operand! State=%p #Ops=%X Index=%X", + walk_state, state->results.num_results, + (u32) index)); return (AE_AML_NO_RETURN_VALUE); } @@ -281,19 +282,21 @@ acpi_ds_result_push(union acpi_operand_object * object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result stack frame during push\n")); + ACPI_ERROR((AE_INFO, "No result stack frame during push")); return (AE_AML_INTERNAL); } if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { - ACPI_REPORT_ERROR(("Result stack overflow: Obj=%p State=%p Num=%X\n", object, walk_state, state->results.num_results)); + ACPI_ERROR((AE_INFO, + "Result stack overflow: Obj=%p State=%p Num=%X", + object, walk_state, state->results.num_results)); return (AE_STACK_OVERFLOW); } if (!object) { - ACPI_REPORT_ERROR(("Null Object! Obj=%p State=%p Num=%X\n", - object, walk_state, - state->results.num_results)); + ACPI_ERROR((AE_INFO, + "Null Object! Obj=%p State=%p Num=%X", + object, walk_state, state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -402,7 +405,9 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) /* Check for stack overflow */ if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_REPORT_ERROR(("Object stack overflow! Obj=%p State=%p #Ops=%X\n", object, walk_state, walk_state->num_operands)); + ACPI_ERROR((AE_INFO, + "Object stack overflow! Obj=%p State=%p #Ops=%X", + object, walk_state, walk_state->num_operands)); return (AE_STACK_OVERFLOW); } @@ -446,7 +451,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); + ACPI_ERROR((AE_INFO, + "Object stack underflow! Count=%X State=%p #Ops=%X", + pop_count, walk_state, + walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -489,7 +497,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); + ACPI_ERROR((AE_INFO, + "Object stack underflow! Count=%X State=%p #Ops=%X", + pop_count, walk_state, + walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -806,14 +817,14 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) } if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { - ACPI_REPORT_ERROR(("%p is not a valid walk state\n", - walk_state)); + ACPI_ERROR((AE_INFO, "%p is not a valid walk state", + walk_state)); return; } if (walk_state->parser_state.scope) { - ACPI_REPORT_ERROR(("%p walk still has a scope list\n", - walk_state)); + ACPI_ERROR((AE_INFO, "%p walk still has a scope list", + walk_state)); } /* Always must free any linked control states */ @@ -872,18 +883,24 @@ acpi_ds_result_insert(void *object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", - walk_state)); + ACPI_ERROR((AE_INFO, "No result object pushed! State=%p", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_REPORT_ERROR(("Index out of range: %X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); + ACPI_ERROR((AE_INFO, + "Index out of range: %X Obj=%p State=%p Num=%X", + index, object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } if (!object) { - ACPI_REPORT_ERROR(("Null Object! Index=%X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); + ACPI_ERROR((AE_INFO, + "Null Object! Index=%X Obj=%p State=%p Num=%X", + index, object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -957,7 +974,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_REPORT_ERROR(("Missing operand/stack empty! State=%p #Ops=%X\n", walk_state, walk_state->num_operands)); + ACPI_ERROR((AE_INFO, + "Missing operand/stack empty! State=%p #Ops=%X", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } @@ -969,8 +988,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for a valid operand */ if (!walk_state->operands[walk_state->num_operands]) { - ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_ERROR((AE_INFO, + "Null operand! State=%p #Ops=%X", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index b380ae1044b..c9ac05c4685 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c @@ -73,7 +73,7 @@ acpi_status acpi_ev_initialize_events(void) /* Make sure we have ACPI tables */ if (!acpi_gbl_DSDT) { - ACPI_REPORT_WARNING(("No ACPI tables present!\n")); + ACPI_WARNING((AE_INFO, "No ACPI tables present!")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -84,14 +84,15 @@ acpi_status acpi_ev_initialize_events(void) */ status = acpi_ev_fixed_event_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to initialize fixed events")); return_ACPI_STATUS(status); } status = acpi_ev_gpe_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to initialize general purpose events")); return_ACPI_STATUS(status); } @@ -162,7 +163,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void) status = acpi_ev_install_sci_handler(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to install System Control Interrupt handler")); return_ACPI_STATUS(status); } @@ -170,7 +172,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void) status = acpi_ev_init_global_lock_handler(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to initialize Global Lock handler")); return_ACPI_STATUS(status); } @@ -304,7 +307,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event) enable_register_id, 0, ACPI_MTX_DO_NOT_LOCK); - ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event)); + ACPI_ERROR((AE_INFO, + "No installed handler for fixed event [%08X]", + event)); return (ACPI_INTERRUPT_NOT_HANDLED); } diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 353b907edbf..f64f977dd3d 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -379,7 +379,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) u8 enabled_status_byte; u32 status_reg; u32 enable_reg; - acpi_native_uint flags; + acpi_cpu_flags flags; acpi_native_uint i; acpi_native_uint j; @@ -546,7 +546,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) status = acpi_ns_evaluate_by_handle(&info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number)); + ACPI_EXCEPTION((AE_INFO, status, + "While evaluating method [%4.4s] for GPE[%2X]", + acpi_ut_get_node_name + (local_gpe_event_info.dispatch. + method_node), gpe_number)); } } @@ -599,9 +603,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ACPI_GPE_EDGE_TRIGGERED) { status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s, Unable to clear GPE[%2X]\n", - acpi_format_exception(status), - gpe_number)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to clear GPE[%2X]", + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -639,7 +643,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ACPI_GPE_LEVEL_TRIGGERED) { status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to clear GPE[%2X]", + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -653,9 +659,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) */ status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s, Unable to disable GPE[%2X]\n", - acpi_format_exception(status), - gpe_number)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to disable GPE[%2X]", + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } @@ -667,7 +673,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) acpi_ev_asynch_execute_gpe_method, gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to queue handler for GPE[%2X] - event disabled", + gpe_number)); } break; @@ -675,7 +683,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) /* No handler or method to run! */ - ACPI_REPORT_ERROR(("No handler or method for GPE[%2X], disabling event\n", gpe_number)); + ACPI_ERROR((AE_INFO, + "No handler or method for GPE[%2X], disabling event", + gpe_number)); /* * Disable the GPE. The GPE will remain disabled until the ACPI @@ -683,9 +693,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) */ status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s, Unable to disable GPE[%2X]\n", - acpi_format_exception(status), - gpe_number)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to disable GPE[%2X]", + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } break; @@ -728,7 +738,9 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); - ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info)); + ACPI_INFO((AE_INFO, + "GPE %p was updated from wake/run to wake-only", + gpe_event_info)); /* This was a wake-only GPE */ diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 3b9bbdda551..0fd00b5ad65 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; acpi_status status = AE_OK; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); @@ -279,7 +279,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, default: /* Unknown method type, just ignore it! */ - ACPI_REPORT_ERROR(("Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", name)); + ACPI_ERROR((AE_INFO, + "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", + name)); return_ACPI_STATUS(AE_OK); } @@ -289,7 +291,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - ACPI_REPORT_ERROR(("Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", name)); + ACPI_ERROR((AE_INFO, + "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", + name)); return_ACPI_STATUS(AE_OK); } @@ -476,7 +480,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 struct acpi_gpe_xrupt_info *next_gpe_xrupt; struct acpi_gpe_xrupt_info *gpe_xrupt; acpi_status status; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); @@ -523,7 +527,9 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 acpi_ev_gpe_xrupt_handler, gpe_xrupt); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not install GPE interrupt handler at level 0x%X\n", interrupt_number)); + ACPI_ERROR((AE_INFO, + "Could not install GPE interrupt handler at level 0x%X", + interrupt_number)); return_PTR(NULL); } } @@ -548,7 +554,7 @@ static acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) { acpi_status status; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); @@ -606,7 +612,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_block; acpi_status status; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); @@ -659,7 +665,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) { acpi_status status; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); @@ -739,7 +745,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) sizeof(struct acpi_gpe_register_info)); if (!gpe_register_info) { - ACPI_REPORT_ERROR(("Could not allocate the gpe_register_info table\n")); + ACPI_ERROR((AE_INFO, + "Could not allocate the gpe_register_info table")); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -752,7 +759,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ACPI_GPE_REGISTER_WIDTH) * sizeof(struct acpi_gpe_event_info)); if (!gpe_event_info) { - ACPI_REPORT_ERROR(("Could not allocate the gpe_event_info table\n")); + ACPI_ERROR((AE_INFO, + "Could not allocate the gpe_event_info table")); status = AE_NO_MEMORY; goto error_exit; } @@ -1032,8 +1040,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not enable GPEs in gpe_block %p\n", - gpe_block)); + ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", + gpe_block)); } return_ACPI_STATUS(status); @@ -1107,8 +1115,8 @@ acpi_status acpi_ev_gpe_initialize(void) &acpi_gbl_gpe_fadt_blocks[0]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not create GPE Block 0")); } } @@ -1121,7 +1129,12 @@ acpi_status acpi_ev_gpe_initialize(void) if ((register_count0) && (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { - ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); + ACPI_ERROR((AE_INFO, + "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", + gpe_number_max, acpi_gbl_FADT->gpe1_base, + acpi_gbl_FADT->gpe1_base + + ((register_count1 * + ACPI_GPE_REGISTER_WIDTH) - 1))); /* Ignore GPE1 block by setting the register count to zero */ @@ -1139,7 +1152,8 @@ acpi_status acpi_ev_gpe_initialize(void) [1]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not create GPE Block 1")); } /* @@ -1165,7 +1179,9 @@ acpi_status acpi_ev_gpe_initialize(void) /* Check for Max GPE number out-of-range */ if (gpe_number_max > ACPI_GPE_MAX) { - ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max)); + ACPI_ERROR((AE_INFO, + "Maximum GPE number from FADT is too large: 0x%X", + gpe_number_max)); status = AE_BAD_VALUE; goto cleanup; } diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 78883239784..0909ba69577 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -303,7 +303,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore, acpi_gbl_global_lock_thread_count); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n")); + ACPI_ERROR((AE_INFO, + "Could not signal Global Lock semaphore")); } } } @@ -344,7 +345,8 @@ static u32 acpi_ev_global_lock_handler(void *context) acpi_ev_global_lock_thread, context); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not queue Global Lock thread")); return (ACPI_INTERRUPT_NOT_HANDLED); } @@ -384,7 +386,8 @@ acpi_status acpi_ev_init_global_lock_handler(void) * with an error. */ if (status == AE_NO_HARDWARE_RESPONSE) { - ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n")); + ACPI_ERROR((AE_INFO, + "No response from Global Lock hardware, disabling lock")); acpi_gbl_global_lock_present = FALSE; status = AE_OK; @@ -480,7 +483,8 @@ acpi_status acpi_ev_release_global_lock(void) ACPI_FUNCTION_TRACE("ev_release_global_lock"); if (!acpi_gbl_global_lock_thread_count) { - ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); + ACPI_WARNING((AE_INFO, + "Cannot release HW Global Lock, it has not been acquired")); return_ACPI_STATUS(AE_NOT_ACQUIRED); } @@ -542,7 +546,9 @@ void acpi_ev_terminate(void) for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { status = acpi_disable_event((u32) i, 0); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not disable fixed event %d\n", (u32) i)); + ACPI_ERROR((AE_INFO, + "Could not disable fixed event %d", + (u32) i)); } } @@ -554,7 +560,7 @@ void acpi_ev_terminate(void) status = acpi_ev_remove_sci_handler(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not remove SCI handler\n")); + ACPI_ERROR((AE_INFO, "Could not remove SCI handler")); } } @@ -567,7 +573,7 @@ void acpi_ev_terminate(void) if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { status = acpi_disable(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("acpi_disable failed\n")); + ACPI_WARNING((AE_INFO, "acpi_disable failed")); } } return_VOID; diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 900e5b32e59..6da58e77641 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c @@ -295,11 +295,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, handler_desc = region_obj->region.handler; if (!handler_desc) { - ACPI_REPORT_ERROR(("No handler for Region [%4.4s] (%p) [%s]\n", - acpi_ut_get_node_name(region_obj->region. - node), region_obj, - acpi_ut_get_region_name(region_obj->region. - space_id))); + ACPI_ERROR((AE_INFO, + "No handler for Region [%4.4s] (%p) [%s]", + acpi_ut_get_node_name(region_obj->region.node), + region_obj, + acpi_ut_get_region_name(region_obj->region. + space_id))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -316,7 +317,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, if (!region_setup) { /* No initialization routine, exit with error */ - ACPI_REPORT_ERROR(("No init routine for region(%p) [%s]\n", region_obj, acpi_ut_get_region_name(region_obj->region.space_id))); + ACPI_ERROR((AE_INFO, + "No init routine for region(%p) [%s]", + region_obj, + acpi_ut_get_region_name(region_obj->region. + space_id))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -341,11 +346,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, /* Check for failure of the Region Setup */ if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Region Initialization: %s [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name(region_obj-> - region. - space_id))); + ACPI_EXCEPTION((AE_INFO, status, + "During region initialization: [%s]", + acpi_ut_get_region_name(region_obj-> + region. + space_id))); return_ACPI_STATUS(status); } @@ -399,10 +404,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, region_obj2->extra.region_context); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n", - acpi_ut_get_region_name(region_obj->region. - space_id), - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]", + acpi_ut_get_region_name(region_obj->region. + space_id))); } if (! @@ -494,7 +498,10 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, status = acpi_ev_execute_reg_method(region_obj, 0); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s from region _REG, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); + ACPI_EXCEPTION((AE_INFO, status, + "from region _REG, [%s]", + acpi_ut_get_region_name + (region_obj->region.space_id))); } if (acpi_ns_is_locked) { @@ -516,7 +523,10 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s from region init, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); + ACPI_EXCEPTION((AE_INFO, status, + "from region init, [%s]", + acpi_ut_get_region_name + (region_obj->region.space_id))); } region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index de1a38e9ce2..baed8c1a1b9 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c @@ -233,7 +233,11 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, */ status = AE_OK; } else { - ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, + status, + "Could not install pci_config handler for Root Bridge %4.4s", + acpi_ut_get_node_name + (pci_root_node))); } } break; diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index b2f69b1ac4b..b38b39dde54 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -143,8 +143,8 @@ acpi_install_fixed_event_handler(u32 event, if (ACPI_SUCCESS(status)) status = acpi_enable_event(event, 0); if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("Could not enable fixed event %X\n", - event)); + ACPI_WARNING((AE_INFO, "Could not enable fixed event %X", + event)); /* Remove the handler */ @@ -204,7 +204,9 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) acpi_gbl_fixed_event_handlers[event].context = NULL; if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("Could not write to fixed event enable register %X\n", event)); + ACPI_WARNING((AE_INFO, + "Could not write to fixed event enable register %X", + event)); } else { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n", event)); @@ -561,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); @@ -652,7 +654,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; - acpi_native_uint flags; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 90eb7939e98..ec9ce8429f1 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -70,7 +70,7 @@ acpi_status acpi_enable(void) /* Make sure we have the FADT */ if (!acpi_gbl_FADT) { - ACPI_REPORT_WARNING(("No FADT information present!\n")); + ACPI_WARNING((AE_INFO, "No FADT information present!")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -82,7 +82,8 @@ acpi_status acpi_enable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not transition to ACPI mode\n")); + ACPI_ERROR((AE_INFO, + "Could not transition to ACPI mode")); return_ACPI_STATUS(status); } @@ -112,7 +113,7 @@ acpi_status acpi_disable(void) ACPI_FUNCTION_TRACE("acpi_disable"); if (!acpi_gbl_FADT) { - ACPI_REPORT_WARNING(("No FADT information present!\n")); + ACPI_WARNING((AE_INFO, "No FADT information present!")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -125,7 +126,8 @@ acpi_status acpi_disable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not exit ACPI mode to legacy mode")); + ACPI_ERROR((AE_INFO, + "Could not exit ACPI mode to legacy mode")); return_ACPI_STATUS(status); } @@ -182,8 +184,9 @@ acpi_status acpi_enable_event(u32 event, u32 flags) } if (value != 1) { - ACPI_REPORT_ERROR(("Could not enable %s event\n", - acpi_ut_get_event_name(event))); + ACPI_ERROR((AE_INFO, + "Could not enable %s event", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } @@ -380,8 +383,9 @@ acpi_status acpi_disable_event(u32 event, u32 flags) } if (value != 0) { - ACPI_REPORT_ERROR(("Could not disable %s events\n", - acpi_ut_get_event_name(event))); + ACPI_ERROR((AE_INFO, + "Could not disable %s events", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 109d0255a5b..a29782fe3ec 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -413,7 +413,9 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, (!ACPI_STRNCMP(table_ptr->signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { - ACPI_REPORT_ERROR(("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", table_ptr->signature)); + ACPI_ERROR((AE_INFO, + "Table has invalid signature [%4.4s], must be SSDT or PSDT", + table_ptr->signature)); status = AE_BAD_SIGNATURE; goto cleanup; } diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index e6f55cf8ad3..e6d52e12d77 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -641,7 +641,9 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, break; default: - ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type)); + ACPI_ERROR((AE_INFO, + "Bad destination type during conversion: %X", + destination_type)); status = AE_AML_INTERNAL; break; } @@ -654,7 +656,12 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, break; default: - ACPI_REPORT_ERROR(("Unknown Target type ID 0x%X aml_opcode %X dest_type %s\n", GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args), walk_state->opcode, acpi_ut_get_type_name(destination_type))); + ACPI_ERROR((AE_INFO, + "Unknown Target type ID 0x%X aml_opcode %X dest_type %s", + GET_CURRENT_ARG_TYPE(walk_state->op_info-> + runtime_args), + walk_state->opcode, + acpi_ut_get_type_name(destination_type))); status = AE_AML_INTERNAL; } diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index da313dad576..68057540283 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c @@ -300,8 +300,8 @@ acpi_ex_create_region(u8 * aml_start, */ if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && (region_space < ACPI_USER_REGION_BEGIN)) { - ACPI_REPORT_ERROR(("Invalid address_space type %X\n", - region_space)); + ACPI_ERROR((AE_INFO, "Invalid address_space type %X", + region_space)); return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); } diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index 78a76f91a1c..e259201ce9a 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c @@ -249,13 +249,18 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). */ if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { - ACPI_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc))); + ACPI_ERROR((AE_INFO, + "SMBus write requires Buffer, found type %s", + acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { - ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); + ACPI_ERROR((AE_INFO, + "SMBus write requires Buffer of length %X, found length %X", + ACPI_SMBUS_BUFFER_SIZE, + source_desc->buffer.length)); return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); } diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 9fe27fd04a2..bd1af35f7fc 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -94,9 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, /* We must have a valid region */ if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { - ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", - ACPI_GET_OBJECT_TYPE(rgn_desc), - acpi_ut_get_object_type_name(rgn_desc))); + ACPI_ERROR((AE_INFO, "Needed Region, found type %X (%s)", + ACPI_GET_OBJECT_TYPE(rgn_desc), + acpi_ut_get_object_type_name(rgn_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -161,14 +161,28 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * than the region itself. For example, a region of length one * byte, and a field with Dword access specified. */ - ACPI_REPORT_ERROR(("Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.access_byte_width, acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length)); + ACPI_ERROR((AE_INFO, + "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)", + acpi_ut_get_node_name(obj_desc-> + common_field.node), + obj_desc->common_field.access_byte_width, + acpi_ut_get_node_name(rgn_desc->region. + node), + rgn_desc->region.length)); } /* * Offset rounded up to next multiple of field width * exceeds region length, indicate an error */ - ACPI_REPORT_ERROR(("Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.base_byte_offset, field_datum_byte_offset, obj_desc->common_field.access_byte_width, acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length)); + ACPI_ERROR((AE_INFO, + "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)", + acpi_ut_get_node_name(obj_desc->common_field.node), + obj_desc->common_field.base_byte_offset, + field_datum_byte_offset, + obj_desc->common_field.access_byte_width, + acpi_ut_get_node_name(rgn_desc->region.node), + rgn_desc->region.length)); return_ACPI_STATUS(AE_AML_REGION_LIMIT); } @@ -252,17 +266,17 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, if (ACPI_FAILURE(status)) { if (status == AE_NOT_IMPLEMENTED) { - ACPI_REPORT_ERROR(("Region %s(%X) not implemented\n", - acpi_ut_get_region_name(rgn_desc-> - region. - space_id), - rgn_desc->region.space_id)); + ACPI_ERROR((AE_INFO, + "Region %s(%X) not implemented", + acpi_ut_get_region_name(rgn_desc->region. + space_id), + rgn_desc->region.space_id)); } else if (status == AE_NOT_EXIST) { - ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", - acpi_ut_get_region_name(rgn_desc-> - region. - space_id), - rgn_desc->region.space_id)); + ACPI_ERROR((AE_INFO, + "Region %s(%X) has no handler", + acpi_ut_get_region_name(rgn_desc->region. + space_id), + rgn_desc->region.space_id)); } } @@ -495,8 +509,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n", - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_ERROR((AE_INFO, "Wrong object type in field I/O %X", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_INTERNAL; break; } @@ -599,10 +613,11 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Unknown update_rule value: %X\n", - (obj_desc->common_field. - field_flags & - AML_FIELD_UPDATE_RULE_MASK))); + ACPI_ERROR((AE_INFO, + "Unknown update_rule value: %X", + (obj_desc->common_field. + field_flags & + AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } } @@ -657,7 +672,9 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { - ACPI_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_length)); + ACPI_ERROR((AE_INFO, + "Field size %X (bits) is too large for buffer (%X)", + obj_desc->common_field.bit_length, buffer_length)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } @@ -769,7 +786,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { - ACPI_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_length)); + ACPI_ERROR((AE_INFO, + "Field size %X (bits) is too large for buffer (%X)", + obj_desc->common_field.bit_length, buffer_length)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 5ad34566738..48c18d29222 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -98,8 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", - obj_desc->reference.opcode)); + ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } break; @@ -114,8 +114,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Invalid descriptor type %X\n", - ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); + ACPI_ERROR((AE_INFO, "Invalid descriptor type %X", + ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); return_ACPI_STATUS(AE_TYPE); } @@ -166,15 +166,18 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, u8 *end_tag; acpi_size length0; acpi_size length1; + acpi_size new_length; ACPI_FUNCTION_TRACE("ex_concat_template"); /* * Find the end_tag descriptor in each resource template. - * Note: returned pointers point TO the end_tag, not past it. - * - * Compute the length of each resource template + * Note1: returned pointers point TO the end_tag, not past it. + * Note2: zero-length buffers are allowed; treated like one end_tag */ + + /* Get the length of the first resource template */ + status = acpi_ut_get_resource_end_tag(operand0, &end_tag); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -182,19 +185,22 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); + /* Get the length of the second resource template */ + status = acpi_ut_get_resource_end_tag(operand1, &end_tag); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Include the end_tag in the second template length */ + length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer); + + /* Combine both lengths, minimum size will be 2 for end_tag */ - length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) + - sizeof(struct aml_resource_end_tag); + new_length = length0 + length1 + sizeof(struct aml_resource_end_tag); - /* Create a new buffer object for the result */ + /* Create a new buffer object for the result (with one end_tag) */ - return_desc = acpi_ut_create_buffer_object(length0 + length1); + return_desc = acpi_ut_create_buffer_object(new_length); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -207,9 +213,10 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); - /* Set the end_tag checksum to zero, means "ignore checksum" */ + /* Insert end_tag and set the checksum to zero, means "ignore checksum" */ - new_buf[return_desc->buffer.length - 1] = 0; + new_buf[new_length - 1] = 0; + new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1; /* Return the completed resource template */ @@ -268,8 +275,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, break; default: - ACPI_REPORT_ERROR(("Invalid object type: %X\n", - ACPI_GET_OBJECT_TYPE(operand0))); + ACPI_ERROR((AE_INFO, "Invalid object type: %X", + ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; } @@ -370,8 +377,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Invalid object type, should not happen here */ - ACPI_REPORT_ERROR(("Invalid object type: %X\n", - ACPI_GET_OBJECT_TYPE(operand0))); + ACPI_ERROR((AE_INFO, "Invalid object type: %X", + ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; goto cleanup; } diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 89b8ab79410..f843b22e20b 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -153,7 +153,9 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, /* Sanity check -- we must have a valid thread ID */ if (!walk_state->thread) { - ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + ACPI_ERROR((AE_INFO, + "Cannot acquire Mutex [%4.4s], null thread info", + acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -162,7 +164,9 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, * mutex. This mechanism provides some deadlock prevention */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { - ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + ACPI_ERROR((AE_INFO, + "Cannot acquire Mutex [%4.4s], incorrect sync_level", + acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } @@ -237,14 +241,18 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, /* The mutex must have been previously acquired in order to release it */ if (!obj_desc->mutex.owner_thread) { - ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + ACPI_ERROR((AE_INFO, + "Cannot release Mutex [%4.4s], not acquired", + acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); } /* Sanity check -- we must have a valid thread ID */ if (!walk_state->thread) { - ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + ACPI_ERROR((AE_INFO, + "Cannot release Mutex [%4.4s], null thread info", + acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -255,7 +263,11 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { - ACPI_REPORT_ERROR(("Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", walk_state->thread->thread_id, acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.owner_thread->thread_id)); + ACPI_ERROR((AE_INFO, + "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", + walk_state->thread->thread_id, + acpi_ut_get_node_name(obj_desc->mutex.node), + obj_desc->mutex.owner_thread->thread_id)); return_ACPI_STATUS(AE_AML_NOT_OWNER); } @@ -264,7 +276,9 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, * equal to the current sync level */ if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { - ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + ACPI_ERROR((AE_INFO, + "Cannot release Mutex [%4.4s], incorrect sync_level", + acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index de3216b6a4f..054fe5e1a31 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -99,8 +99,8 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) */ name_string = ACPI_MEM_ALLOCATE(size_needed); if (!name_string) { - ACPI_REPORT_ERROR(("Could not allocate size %d\n", - size_needed)); + ACPI_ERROR((AE_INFO, + "Could not allocate size %d", size_needed)); return_PTR(NULL); } @@ -168,7 +168,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) char_buf[0] = *aml_address; if ('0' <= char_buf[0] && char_buf[0] <= '9') { - ACPI_REPORT_ERROR(("Invalid leading digit: %c\n", char_buf[0])); + ACPI_ERROR((AE_INFO, "Invalid leading digit: %c", char_buf[0])); return_ACPI_STATUS(AE_CTRL_PENDING); } @@ -211,8 +211,9 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) * the required 4 */ status = AE_AML_BAD_NAME; - ACPI_REPORT_ERROR(("Bad character %02x in name, at %p\n", - *aml_address, aml_address)); + ACPI_ERROR((AE_INFO, + "Bad character %02x in name, at %p", + *aml_address, aml_address)); } *in_aml_address = ACPI_CAST_PTR(u8, aml_address); @@ -411,7 +412,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, if (AE_CTRL_PENDING == status && has_prefix) { /* Ran out of segments after processing a prefix */ - ACPI_REPORT_ERROR(("Malformed Name at %p\n", name_string)); + ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); status = AE_AML_BAD_NAME; } diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index bc8837ecb71..23d0823bcd5 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -111,8 +111,8 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -189,8 +189,8 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -229,8 +229,8 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -349,7 +349,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Check the range of the digit */ if (temp32 > 9) { - ACPI_REPORT_ERROR(("BCD digit too large (not decimal): 0x%X\n", temp32)); + ACPI_ERROR((AE_INFO, + "BCD digit too large (not decimal): 0x%X", + temp32)); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; @@ -394,7 +396,10 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Overflow if there is any data left in Digit */ if (digit > 0) { - ACPI_REPORT_ERROR(("Integer too large to convert to BCD: %8.8X%8.8X\n", ACPI_FORMAT_UINT64(operand[0]->integer.value))); + ACPI_ERROR((AE_INFO, + "Integer too large to convert to BCD: %8.8X%8.8X", + ACPI_FORMAT_UINT64(operand[0]-> + integer.value))); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } @@ -521,16 +526,16 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* These are two obsolete opcodes */ - ACPI_REPORT_ERROR(("%s is obsolete and not implemented\n", - acpi_ps_get_opcode_name(walk_state-> - opcode))); + ACPI_ERROR((AE_INFO, + "%s is obsolete and not implemented", + acpi_ps_get_opcode_name(walk_state->opcode))); status = AE_SUPPORT; goto cleanup; default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -636,10 +641,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, walk_state); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s: bad operand(s) %s\n", - acpi_ps_get_opcode_name(walk_state-> - opcode), - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "While resolving operands for [%s]", + acpi_ps_get_opcode_name(walk_state-> + opcode))); goto cleanup; } @@ -738,7 +743,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_REPORT_ERROR(("Operand is not Buf/Int/Str/Pkg - found type %s\n", acpi_ut_get_type_name(type))); + ACPI_ERROR((AE_INFO, + "Operand is not Buf/Int/Str/Pkg - found type %s", + acpi_ut_get_type_name(type))); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -935,7 +942,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown Index target_type %X in obj %p\n", operand[0]->reference.target_type, operand[0])); + ACPI_ERROR((AE_INFO, + "Unknown Index target_type %X in obj %p", + operand[0]->reference. + target_type, operand[0])); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -961,7 +971,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_REPORT_ERROR(("Unknown opcode in ref(%p) - %X\n", operand[0], operand[0]->reference.opcode)); + ACPI_ERROR((AE_INFO, + "Unknown opcode in ref(%p) - %X", + operand[0], + operand[0]->reference.opcode)); status = AE_TYPE; goto cleanup; @@ -971,8 +984,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 7c59dda4094..e263a5ddd40 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -111,7 +111,9 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) /* Are notifies allowed on this object? */ if (!acpi_ev_is_notify_object(node)) { - ACPI_REPORT_ERROR(("Unexpected notify object type [%s]\n", acpi_ut_get_type_name(node->type))); + ACPI_ERROR((AE_INFO, + "Unexpected notify object type [%s]", + acpi_ut_get_type_name(node->type))); status = AE_AML_OPERAND_TYPE; break; @@ -155,8 +157,8 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; } @@ -220,8 +222,8 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -389,7 +391,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* Object to be indexed is a Package */ if (index >= operand[0]->package.count) { - ACPI_REPORT_ERROR(("Index value (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->package.count)); + ACPI_ERROR((AE_INFO, + "Index value (%X%8.8X) beyond package end (%X)", + ACPI_FORMAT_UINT64(index), + operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -402,7 +407,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* Object to be indexed is a Buffer/String */ if (index >= operand[0]->buffer.length) { - ACPI_REPORT_ERROR(("Index value (%X%8.8X) beyond end of buffer (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->buffer.length)); + ACPI_ERROR((AE_INFO, + "Index value (%X%8.8X) beyond end of buffer (%X)", + ACPI_FORMAT_UINT64(index), + operand[0]->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -434,8 +442,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -539,8 +547,8 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index a979b338a49..6a3a883cb8a 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c @@ -119,8 +119,8 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -243,8 +243,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index 05e7f9b67f2..e043d924444 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c @@ -234,7 +234,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { - ACPI_REPORT_ERROR(("Match operator out of range\n")); + ACPI_ERROR((AE_INFO, "Match operator out of range")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -243,7 +243,10 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) index = operand[5]->integer.value; if (index >= operand[0]->package.count) { - ACPI_REPORT_ERROR(("Index (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->package.count)); + ACPI_ERROR((AE_INFO, + "Index (%X%8.8X) beyond package end (%X)", + ACPI_FORMAT_UINT64(index), + operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -312,8 +315,8 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 3bde780c94c..7719ae5d4f1 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c @@ -274,7 +274,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, default: /* Invalid field access type */ - ACPI_REPORT_ERROR(("Unknown field access type %X\n", access)); + ACPI_ERROR((AE_INFO, "Unknown field access type %X", access)); return_UINT32(0); } @@ -421,13 +421,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { if (!info->region_node) { - ACPI_REPORT_ERROR(("Null region_node\n")); + ACPI_ERROR((AE_INFO, "Null region_node")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } type = acpi_ns_get_type(info->region_node); if (type != ACPI_TYPE_REGION) { - ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", type, acpi_ut_get_type_name(type))); + ACPI_ERROR((AE_INFO, + "Needed Region, found type %X (%s)", + type, acpi_ut_get_type_name(type))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -496,17 +498,17 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) case ACPI_TYPE_LOCAL_INDEX_FIELD: + /* Get the Index and Data registers */ + obj_desc->index_field.index_obj = acpi_ns_get_attached_object(info->register_node); obj_desc->index_field.data_obj = acpi_ns_get_attached_object(info->data_register_node); - obj_desc->index_field.value = (u32) - (info->field_bit_position / - ACPI_MUL_8(obj_desc->field.access_byte_width)); if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { - ACPI_REPORT_ERROR(("Null Index Object during field prep\n")); + ACPI_ERROR((AE_INFO, + "Null Index Object during field prep")); acpi_ut_delete_object_desc(obj_desc); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -516,6 +518,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) acpi_ut_add_reference(obj_desc->index_field.data_obj); acpi_ut_add_reference(obj_desc->index_field.index_obj); + /* + * The value written to the Index register is the byte offset of the + * target field + * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) + */ + obj_desc->index_field.value = (u32) + (info->field_bit_position / + ACPI_MUL_8(obj_desc->field.access_byte_width)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", obj_desc->index_field.start_field_bit_offset, diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 82983575cca..6a4cfdff606 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -103,8 +103,8 @@ acpi_ex_system_memory_space_handler(u32 function, break; default: - ACPI_REPORT_ERROR(("Invalid system_memory width %d\n", - bit_width)); + ACPI_ERROR((AE_INFO, "Invalid system_memory width %d", + bit_width)); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } @@ -158,7 +158,10 @@ acpi_ex_system_memory_space_handler(u32 function, (void **)&mem_info-> mapped_logical_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X, size %X\n", ACPI_FORMAT_UINT64(address), (u32) window_size)); + ACPI_ERROR((AE_INFO, + "Could not map memory at %8.8X%8.8X, size %X", + ACPI_FORMAT_UINT64(address), + (u32) window_size)); mem_info->mapped_length = 0; return_ACPI_STATUS(status); } diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index a5cca7eda21..01b26c80d22 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c @@ -122,7 +122,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, } if (!source_desc) { - ACPI_REPORT_ERROR(("No object attached to node %p\n", node)); + ACPI_ERROR((AE_INFO, "No object attached to node %p", node)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -134,9 +134,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_PACKAGE: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR(("Object not a Package, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_ERROR((AE_INFO, "Object not a Package, type %s", + acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -152,9 +151,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_BUFFER: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { - ACPI_REPORT_ERROR(("Object not a Buffer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_ERROR((AE_INFO, "Object not a Buffer, type %s", + acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -170,9 +168,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_STRING: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { - ACPI_REPORT_ERROR(("Object not a String, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_ERROR((AE_INFO, "Object not a String, type %s", + acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -185,9 +182,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_INTEGER: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { - ACPI_REPORT_ERROR(("Object not a Integer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_ERROR((AE_INFO, "Object not a Integer, type %s", + acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -231,8 +227,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_ANY: - ACPI_REPORT_ERROR(("Untyped entry %p, no attached object!\n", - node)); + ACPI_ERROR((AE_INFO, + "Untyped entry %p, no attached object!", node)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ @@ -251,7 +247,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, default: /* No named references are allowed here */ - ACPI_REPORT_ERROR(("Unsupported Reference opcode %X (%s)\n", source_desc->reference.opcode, acpi_ps_get_opcode_name(source_desc->reference.opcode))); + ACPI_ERROR((AE_INFO, + "Unsupported Reference opcode %X (%s)", + source_desc->reference.opcode, + acpi_ps_get_opcode_name(source_desc-> + reference.opcode))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -261,8 +261,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* Default case is for unknown types */ - ACPI_REPORT_ERROR(("Node %p - Unknown object type %X\n", - node, entry_type)); + ACPI_ERROR((AE_INFO, + "Node %p - Unknown object type %X", + node, entry_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index ae2d2da0084..1deed492fe8 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c @@ -81,7 +81,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); if (!stack_ptr || !*stack_ptr) { - ACPI_REPORT_ERROR(("Internal - null pointer\n")); + ACPI_ERROR((AE_INFO, "Internal - null pointer")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -97,7 +97,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, } if (!*stack_ptr) { - ACPI_REPORT_ERROR(("Internal - null pointer\n")); + ACPI_ERROR((AE_INFO, "Internal - null pointer")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } } @@ -227,7 +227,9 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, * A NULL object descriptor means an unitialized element of * the package, can't dereference it */ - ACPI_REPORT_ERROR(("Attempt to deref an Index to NULL pkg element Idx=%p\n", stack_desc)); + ACPI_ERROR((AE_INFO, + "Attempt to deref an Index to NULL pkg element Idx=%p", + stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } break; @@ -236,7 +238,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, /* Invalid reference object */ - ACPI_REPORT_ERROR(("Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); + ACPI_ERROR((AE_INFO, + "Unknown target_type %X in Index/Reference obj %p", + stack_desc->reference.target_type, + stack_desc)); status = AE_AML_INTERNAL; break; } @@ -261,7 +266,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); + ACPI_ERROR((AE_INFO, + "Unknown Reference opcode %X (%s) in %p", + opcode, acpi_ps_get_opcode_name(opcode), + stack_desc)); status = AE_AML_INTERNAL; break; } @@ -383,10 +391,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", - node, - acpi_ut_get_descriptor_name - (node))); + ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", + node, + acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -442,10 +449,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", - node, - acpi_ut_get_descriptor_name - (node))); + ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", + node, + acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -514,8 +520,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Unknown Reference subtype %X\n", - obj_desc->reference.opcode)); + ACPI_ERROR((AE_INFO, + "Unknown Reference subtype %X", + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index 804faebf825..a1c000f5a41 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -46,6 +46,7 @@ #include #include #include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exresop") @@ -95,9 +96,10 @@ acpi_ex_check_object_type(acpi_object_type type_needed, } if (type_needed != this_type) { - ACPI_REPORT_ERROR(("Needed type [%s], found [%s] %p\n", - acpi_ut_get_type_name(type_needed), - acpi_ut_get_type_name(this_type), object)); + ACPI_ERROR((AE_INFO, + "Needed type [%s], found [%s] %p", + acpi_ut_get_type_name(type_needed), + acpi_ut_get_type_name(this_type), object)); return (AE_AML_OPERAND_TYPE); } @@ -150,7 +152,7 @@ acpi_ex_resolve_operands(u16 opcode, arg_types = op_info->runtime_args; if (arg_types == ARGI_INVALID_OPCODE) { - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", opcode)); + ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -168,8 +170,8 @@ acpi_ex_resolve_operands(u16 opcode, */ while (GET_CURRENT_ARG_TYPE(arg_types)) { if (!stack_ptr || !*stack_ptr) { - ACPI_REPORT_ERROR(("Null stack entry at %p\n", - stack_ptr)); + ACPI_ERROR((AE_INFO, "Null stack entry at %p", + stack_ptr)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -187,6 +189,22 @@ acpi_ex_resolve_operands(u16 opcode, object_type = ((struct acpi_namespace_node *)obj_desc)->type; + + /* + * Resolve an alias object. The construction of these objects + * guarantees that there is only one level of alias indirection; + * thus, the attached object is always the aliased namespace node + */ + if (object_type == ACPI_TYPE_LOCAL_ALIAS) { + obj_desc = + acpi_ns_get_attached_object((struct + acpi_namespace_node + *)obj_desc); + *stack_ptr = obj_desc; + object_type = + ((struct acpi_namespace_node *)obj_desc)-> + type; + } break; case ACPI_DESC_TYPE_OPERAND: @@ -198,7 +216,9 @@ acpi_ex_resolve_operands(u16 opcode, /* Check for bad acpi_object_type */ if (!acpi_ut_valid_object_type(object_type)) { - ACPI_REPORT_ERROR(("Bad operand object type [%X]\n", object_type)); + ACPI_ERROR((AE_INFO, + "Bad operand object type [%X]", + object_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -236,7 +256,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Operand is a Reference, Unknown Reference Opcode: %X\n", obj_desc->reference.opcode)); + ACPI_ERROR((AE_INFO, + "Operand is a Reference, Unknown Reference Opcode: %X", + obj_desc->reference. + opcode)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -247,10 +270,10 @@ acpi_ex_resolve_operands(u16 opcode, /* Invalid descriptor */ - ACPI_REPORT_ERROR(("Invalid descriptor %p [%s]\n", - obj_desc, - acpi_ut_get_descriptor_name - (obj_desc))); + ACPI_ERROR((AE_INFO, + "Invalid descriptor %p [%s]", + obj_desc, + acpi_ut_get_descriptor_name(obj_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -408,7 +431,10 @@ acpi_ex_resolve_operands(u16 opcode, acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Integer/String/Buffer], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -431,7 +457,10 @@ acpi_ex_resolve_operands(u16 opcode, status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Integer/String/Buffer], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -455,7 +484,10 @@ acpi_ex_resolve_operands(u16 opcode, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Integer/String/Buffer], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -481,7 +513,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Integer/String/Buffer], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -515,7 +550,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Integer/String/Buffer], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -539,7 +577,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Buffer/String/Package/Reference], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Buffer/String/Package/Reference], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -558,7 +599,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Buffer/String/Package], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Buffer/String/Package], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -578,7 +622,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Region/region_field], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed [Region/region_field], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -620,7 +667,10 @@ acpi_ex_resolve_operands(u16 opcode, break; } - ACPI_REPORT_ERROR(("Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_ERROR((AE_INFO, + "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -630,7 +680,9 @@ acpi_ex_resolve_operands(u16 opcode, /* Unknown type */ - ACPI_REPORT_ERROR(("Internal - Unknown ARGI (required operand) type %X\n", this_arg_type)); + ACPI_ERROR((AE_INFO, + "Internal - Unknown ARGI (required operand) type %X", + this_arg_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 202ebe1eb95..3f020c0e2b9 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -250,7 +250,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Validate parameters */ if (!source_desc || !dest_desc) { - ACPI_REPORT_ERROR(("Null parameter\n")); + ACPI_ERROR((AE_INFO, "Null parameter")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -290,7 +290,10 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Destination is not a Reference object */ - ACPI_REPORT_ERROR(("Target is not a Reference or Constant object - %s [%p]\n", acpi_ut_get_object_type_name(dest_desc), dest_desc)); + ACPI_ERROR((AE_INFO, + "Target is not a Reference or Constant object - %s [%p]", + acpi_ut_get_object_type_name(dest_desc), + dest_desc)); ACPI_DUMP_STACK_ENTRY(source_desc); ACPI_DUMP_STACK_ENTRY(dest_desc); @@ -357,8 +360,8 @@ acpi_ex_store(union acpi_operand_object *source_desc, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", - ref_desc->reference.opcode)); + ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", + ref_desc->reference.opcode)); ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); status = AE_AML_INTERNAL; @@ -487,7 +490,9 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, /* All other types are invalid */ - ACPI_REPORT_ERROR(("Source must be Integer/Buffer/String type, not %s\n", acpi_ut_get_object_type_name(source_desc))); + ACPI_ERROR((AE_INFO, + "Source must be Integer/Buffer/String type, not %s", + acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -497,7 +502,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, break; default: - ACPI_REPORT_ERROR(("Target is not a Package or buffer_field\n")); + ACPI_ERROR((AE_INFO, + "Target is not a Package or buffer_field")); status = AE_AML_OPERAND_TYPE; break; } diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 25bbc1d7854..42967baf760 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c @@ -123,7 +123,10 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, && (source_desc->reference.opcode == AML_LOAD_OP))) { /* Conversion successful but still not a valid type */ - ACPI_REPORT_ERROR(("Cannot assign type %s to %s (must be type Int/Str/Buf)\n", acpi_ut_get_object_type_name(source_desc), acpi_ut_get_type_name(target_type))); + ACPI_ERROR((AE_INFO, + "Cannot assign type %s to %s (must be type Int/Str/Buf)", + acpi_ut_get_object_type_name(source_desc), + acpi_ut_get_type_name(target_type))); status = AE_AML_OPERAND_TYPE; } break; @@ -131,9 +134,11 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS: - /* Aliases are resolved by acpi_ex_prep_operands */ - - ACPI_REPORT_ERROR(("Store into Alias - should never happen\n")); + /* + * All aliases should have been resolved earlier, during the + * operand resolution phase. + */ + ACPI_ERROR((AE_INFO, "Store into an unresolved Alias object")); status = AE_AML_INTERNAL; break; @@ -276,8 +281,8 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, /* * All other types come here. */ - ACPI_REPORT_WARNING(("Store into type %s not implemented\n", - acpi_ut_get_object_type_name(dest_desc))); + ACPI_WARNING((AE_INFO, "Store into type %s not implemented", + acpi_ut_get_object_type_name(dest_desc))); status = AE_NOT_IMPLEMENTED; break; diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 9a3684d3cf8..ea9144f42e1 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -129,8 +129,8 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_REPORT_ERROR(("Time parameter is too large (%d)\n", - how_long)); + ACPI_ERROR((AE_INFO, "Time parameter is too large (%d)", + how_long)); status = AE_AML_OPERAND_VALUE; } else { acpi_os_stall(how_long); diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 990c40e0c04..f73a61aeb7e 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -91,7 +91,7 @@ acpi_status acpi_ex_enter_interpreter(void) status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n")); + ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); } return_ACPI_STATUS(status); @@ -127,7 +127,7 @@ void acpi_ex_exit_interpreter(void) status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not release interpreter mutex\n")); + ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); } return_VOID; @@ -200,7 +200,8 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) if (ACPI_SUCCESS(status)) { locked = TRUE; } else { - ACPI_REPORT_ERROR(("Could not acquire Global Lock, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not acquire Global Lock")); } } @@ -235,7 +236,8 @@ void acpi_ex_release_global_lock(u8 locked_by_me) if (ACPI_FAILURE(status)) { /* Report the error, but there isn't much else we can do */ - ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not release ACPI Global Lock")); } } diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 5c068cc4f67..ea2f13271ff 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -68,7 +68,7 @@ acpi_status acpi_hw_initialize(void) /* We must have the ACPI tables by the time we get here */ if (!acpi_gbl_FADT) { - ACPI_REPORT_ERROR(("No FADT is present\n")); + ACPI_ERROR((AE_INFO, "No FADT is present")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -107,7 +107,8 @@ acpi_status acpi_hw_set_mode(u32 mode) * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed\n")); + ACPI_ERROR((AE_INFO, + "No SMI_CMD in FADT, mode transition failed")); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } @@ -119,7 +120,8 @@ acpi_status acpi_hw_set_mode(u32 mode) * transitions are not supported. */ if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { - ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n")); + ACPI_ERROR((AE_INFO, + "No ACPI mode transition supported in this system (enable/disable both zero)")); return_ACPI_STATUS(AE_OK); } @@ -153,8 +155,8 @@ acpi_status acpi_hw_set_mode(u32 mode) } if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not write mode change, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not write ACPI mode change")); return_ACPI_STATUS(status); } @@ -174,7 +176,7 @@ acpi_status acpi_hw_set_mode(u32 mode) retry--; } - ACPI_REPORT_ERROR(("Hardware never changed modes\n")); + ACPI_ERROR((AE_INFO, "Hardware did not change modes")); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index b4b50a3d170..e1fe7549841 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -160,15 +160,16 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) /* Must have a return object */ if (!info.return_object) { - ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n", - sleep_state_name)); + ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", + sleep_state_name)); status = AE_NOT_EXIST; } /* It must be of type Package */ else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR(("Sleep State return object is not a Package\n")); + ACPI_ERROR((AE_INFO, + "Sleep State return object is not a Package")); status = AE_AML_OPERAND_TYPE; } @@ -180,7 +181,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) * one per sleep type (A/B). */ else if (info.return_object->package.count < 2) { - ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n")); + ACPI_ERROR((AE_INFO, + "Sleep State return package does not have at least two elements")); status = AE_AML_NO_OPERAND; } @@ -190,7 +192,12 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) != ACPI_TYPE_INTEGER) || (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { - ACPI_REPORT_ERROR(("Sleep State return package elements are not both Integers (%s, %s)\n", acpi_ut_get_object_type_name(info.return_object->package.elements[0]), acpi_ut_get_object_type_name(info.return_object->package.elements[1]))); + ACPI_ERROR((AE_INFO, + "Sleep State return package elements are not both Integers (%s, %s)", + acpi_ut_get_object_type_name(info.return_object-> + package.elements[0]), + acpi_ut_get_object_type_name(info.return_object-> + package.elements[1]))); status = AE_AML_OPERAND_TYPE; } else { /* Valid _Sx_ package size, type, and value */ @@ -202,7 +209,11 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) } if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", acpi_format_exception(status), sleep_state_name, info.return_object, acpi_ut_get_object_type_name(info.return_object))); + ACPI_EXCEPTION((AE_INFO, status, + "While evaluating sleep_state [%s], bad Sleep object %p type %s", + sleep_state_name, info.return_object, + acpi_ut_get_object_type_name(info. + return_object))); } acpi_ut_remove_reference(info.return_object); @@ -228,8 +239,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) ACPI_FUNCTION_ENTRY(); if (register_id > ACPI_BITREG_MAX) { - ACPI_REPORT_ERROR(("Invalid bit_register ID: %X\n", - register_id)); + ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X", + register_id)); return (NULL); } @@ -329,8 +340,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) bit_reg_info = acpi_hw_get_bit_register_info(register_id); if (!bit_reg_info) { - ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n", - register_id)); + ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X", + register_id)); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -564,7 +575,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) break; default: - ACPI_REPORT_ERROR(("Unknown Register ID: %X\n", register_id)); + ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id)); status = AE_BAD_PARAMETER; break; } @@ -759,8 +770,9 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) break; default: - ACPI_REPORT_ERROR(("Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_ERROR((AE_INFO, + "Unsupported address space: %X", + reg->address_space_id)); return (AE_BAD_PARAMETER); } @@ -829,8 +841,9 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) break; default: - ACPI_REPORT_ERROR(("Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_ERROR((AE_INFO, + "Unsupported address space: %X", + reg->address_space_id)); return (AE_BAD_PARAMETER); } diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 992128d7111..89269272fd6 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c @@ -199,8 +199,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR(("Method _SST failed, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "While executing method _SST")); } return_ACPI_STATUS(AE_OK); @@ -232,9 +232,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { - ACPI_REPORT_ERROR(("Sleep values out of range: A=%X B=%X\n", - acpi_gbl_sleep_type_a, - acpi_gbl_sleep_type_b)); + ACPI_ERROR((AE_INFO, "Sleep values out of range: A=%X B=%X", + acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b)); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } @@ -533,21 +532,18 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) arg.integer.value = ACPI_SST_WAKING; status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR(("Method _SST failed, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During Method _SST")); } arg.integer.value = sleep_state; status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR(("Method _BFS failed, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); } status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR(("Method _WAK failed, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); } /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ @@ -582,8 +578,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) arg.integer.value = ACPI_SST_WORKING; status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR(("Method _SST failed, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During Method _SST")); } return_ACPI_STATUS(status); diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index c2db93e25b7..1149bc18fb3 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -110,7 +110,9 @@ acpi_status acpi_ns_root_initialize(void) ACPI_NS_NO_UPSEARCH, NULL, &new_node); if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ - ACPI_REPORT_ERROR(("Could not create predefined name %s, %s\n", init_val->name, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not create predefined name %s", + init_val->name)); } /* @@ -121,7 +123,9 @@ acpi_status acpi_ns_root_initialize(void) if (init_val->val) { status = acpi_os_predefined_override(init_val, &val); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not override predefined %s\n", init_val->name)); + ACPI_ERROR((AE_INFO, + "Could not override predefined %s", + init_val->name)); } if (!val) { @@ -228,7 +232,9 @@ acpi_status acpi_ns_root_initialize(void) default: - ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type)); + ACPI_ERROR((AE_INFO, + "Unsupported initial type value %X", + init_val->type)); acpi_ut_remove_reference(obj_desc); obj_desc = NULL; continue; @@ -334,10 +340,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, prefix_node = scope_info->scope.node; if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("%p is not a namespace node [%s]\n", - prefix_node, - acpi_ut_get_descriptor_name - (prefix_node))); + ACPI_ERROR((AE_INFO, "%p is not a namespace node [%s]", + prefix_node, + acpi_ut_get_descriptor_name(prefix_node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -427,7 +432,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, if (!this_node) { /* Current scope has no parent scope */ - ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); + ACPI_ERROR((AE_INFO, + "ACPI path has too many parent prefixes (^) - reached beyond root node")); return_ACPI_STATUS(AE_NOT_FOUND); } } @@ -598,7 +604,12 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, (this_node->type != type_to_check_for)) { /* Complain about a type mismatch */ - ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", ACPI_CAST_PTR(char, &simple_name), acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); + ACPI_WARNING((AE_INFO, + "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", + ACPI_CAST_PTR(char, &simple_name), + acpi_ut_get_type_name(this_node->type), + acpi_ut_get_type_name + (type_to_check_for))); } /* diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 3db950f5d5a..9b871f38b61 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -272,8 +272,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) /* Grandchildren should have all been deleted already */ if (child_node->child) { - ACPI_REPORT_ERROR(("Found a grandchild! P=%p C=%p\n", - parent_node, child_node)); + ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p", + parent_node, child_node)); } /* Now we can free this child object */ @@ -301,7 +301,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) /* There should be only one reference remaining on this node */ if (child_node->reference_count != 1) { - ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node)); + ACPI_WARNING((AE_INFO, + "Existing references (%d) on node being deleted (%p)", + child_node->reference_count, child_node)); } /* Now we can delete the node */ diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 2f0b70e3e88..a2807317a84 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -198,13 +198,13 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, /* Check the node type and name */ if (type > ACPI_TYPE_LOCAL_MAX) { - ACPI_REPORT_WARNING(("Invalid ACPI Object Type %08X\n", - type)); + ACPI_WARNING((AE_INFO, "Invalid ACPI Object Type %08X", + type)); } if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { - ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n", - this_node->name.integer)); + ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", + this_node->name.integer)); } acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index e3c667072e2..19d7b94d40c 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -373,7 +373,7 @@ acpi_ns_execute_control_method(struct acpi_parameter_info *info) info->obj_desc = acpi_ns_get_attached_object(info->node); if (!info->obj_desc) { - ACPI_REPORT_ERROR(("No attached method object\n")); + ACPI_ERROR((AE_INFO, "No attached method object")); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(AE_NULL_OBJECT); diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 6c117893f30..9f929e479fd 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -93,8 +93,7 @@ acpi_status acpi_ns_initialize_objects(void) ACPI_UINT32_MAX, acpi_ns_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -159,12 +158,11 @@ acpi_status acpi_ns_initialize_devices(void) (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", + "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n", info.device_count, info.num_STA, info.num_INI)); return_ACPI_STATUS(status); @@ -289,7 +287,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle, } if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("\nCould not execute arguments for [%4.4s] (%s), %s\n", acpi_ut_get_node_name(node), acpi_ut_get_type_name(type), acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not execute arguments for [%4.4s] (%s)", + acpi_ut_get_node_name(node), + acpi_ut_get_type_name(type))); } /* @@ -416,9 +417,8 @@ acpi_ns_init_one_device(acpi_handle obj_handle, #ifdef ACPI_DEBUG_OUTPUT char *scope_name = acpi_ns_get_external_pathname(ini_node); - ACPI_REPORT_WARNING(("%s._INI failed: %s\n", - scope_name, - acpi_format_exception(status))); + ACPI_WARNING((AE_INFO, "%s._INI failed: %s", + scope_name, acpi_format_exception(status))); ACPI_MEM_FREE(scope_name); #endif diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 0b4a866ef5a..4e0b0524c18 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -92,7 +92,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, /* Check validity of the AML start and length */ if (!table_desc->aml_start) { - ACPI_REPORT_ERROR(("Null AML pointer\n")); + ACPI_ERROR((AE_INFO, "Null AML pointer")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -102,8 +102,8 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, /* Ignore table if there is no AML contained within */ if (!table_desc->aml_length) { - ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n", - table_desc->pointer->signature)); + ACPI_WARNING((AE_INFO, "Zero-length AML block in table [%4.4s]", + table_desc->pointer->signature)); return_ACPI_STATUS(AE_OK); } @@ -263,7 +263,7 @@ acpi_status acpi_ns_load_namespace(void) /* There must be at least a DSDT installed */ if (acpi_gbl_DSDT == NULL) { - ACPI_REPORT_ERROR(("DSDT is not in memory\n")); + ACPI_ERROR((AE_INFO, "DSDT is not in memory")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 411e1f8b11d..639f653b4b6 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -110,7 +110,9 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, name_buffer[index] = AML_ROOT_PREFIX; if (index != 0) { - ACPI_REPORT_ERROR(("Could not construct pathname; index=%X, size=%X, Path=%s\n", (u32) index, (u32) size, &name_buffer[size])); + ACPI_ERROR((AE_INFO, + "Could not construct pathname; index=%X, size=%X, Path=%s", + (u32) index, (u32) size, &name_buffer[size])); } return; @@ -146,7 +148,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) name_buffer = ACPI_MEM_CALLOCATE(size); if (!name_buffer) { - ACPI_REPORT_ERROR(("Allocation failure\n")); + ACPI_ERROR((AE_INFO, "Allocation failure")); return_PTR(NULL); } diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 86113093f7b..10ae6292bca 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c @@ -84,22 +84,23 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, if (!node) { /* Invalid handle */ - ACPI_REPORT_ERROR(("Null named_obj handle\n")); + ACPI_ERROR((AE_INFO, "Null named_obj handle")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!object && (ACPI_TYPE_ANY != type)) { /* Null object */ - ACPI_REPORT_ERROR(("Null object, but type not ACPI_TYPE_ANY\n")); + ACPI_ERROR((AE_INFO, + "Null object, but type not ACPI_TYPE_ANY")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { /* Not a name handle */ - ACPI_REPORT_ERROR(("Invalid handle %p [%s]\n", - node, acpi_ut_get_descriptor_name(node))); + ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", + node, acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -254,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); if (!node) { - ACPI_REPORT_WARNING(("Null Node ptr\n")); + ACPI_WARNING((AE_INFO, "Null Node ptr")); return_PTR(NULL); } diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index f094a2eb851..d64b78952f2 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -298,15 +298,17 @@ acpi_ns_search_and_enter(u32 target_name, /* Parameter validation */ if (!node || !target_name || !return_node) { - ACPI_REPORT_ERROR(("Null param: Node %p Name %X return_node %p\n", node, target_name, return_node)); + ACPI_ERROR((AE_INFO, + "Null param: Node %p Name %X return_node %p", + node, target_name, return_node)); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Name must consist of printable characters */ if (!acpi_ut_valid_acpi_name(target_name)) { - ACPI_REPORT_ERROR(("Bad character in ACPI Name: %X\n", - target_name)); + ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", + target_name)); return_ACPI_STATUS(AE_BAD_CHARACTER); } diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index bc779fdd3ca..3e7cad549a3 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -85,7 +85,7 @@ acpi_ns_report_error(char *module_name, if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ - acpi_os_printf("[0x%4.4X] (NON-ASCII)\n", + acpi_os_printf("[0x%4.4X] (NON-ASCII)", *(ACPI_CAST_PTR(u32, internal_name))); } else { /* Convert path to external format */ @@ -106,7 +106,7 @@ acpi_ns_report_error(char *module_name, } } - acpi_os_printf("Namespace lookup failure, %s\n", + acpi_os_printf(" Namespace lookup failure, %s\n", acpi_format_exception(lookup_status)); } @@ -242,7 +242,7 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) ACPI_FUNCTION_TRACE("ns_get_type"); if (!node) { - ACPI_REPORT_WARNING(("Null Node parameter\n")); + ACPI_WARNING((AE_INFO, "Null Node parameter")); return_UINT32(ACPI_TYPE_ANY); } @@ -269,7 +269,7 @@ u32 acpi_ns_local(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* Type code out of range */ - ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); + ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); return_UINT32(ACPI_NS_NORMAL); } @@ -621,7 +621,7 @@ acpi_ns_externalize_name(u32 internal_name_length, * with internal_name (invalid format). */ if (required_length > internal_name_length) { - ACPI_REPORT_ERROR(("Invalid internal name\n")); + ACPI_ERROR((AE_INFO, "Invalid internal name")); return_ACPI_STATUS(AE_BAD_PATHNAME); } @@ -797,7 +797,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* type code out of range */ - ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); + ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); return_UINT32(ACPI_NS_NORMAL); } diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index de13add43ef..a95f636dc35 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -112,7 +112,7 @@ acpi_evaluate_object_typed(acpi_handle handle, if (return_buffer->length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_REPORT_ERROR(("No return value\n")); + ACPI_ERROR((AE_INFO, "No return value")); return_ACPI_STATUS(AE_NULL_OBJECT); } @@ -124,11 +124,11 @@ acpi_evaluate_object_typed(acpi_handle handle, /* Return object type does not match requested type */ - ACPI_REPORT_ERROR(("Incorrect return type [%s] requested [%s]\n", - acpi_ut_get_type_name(((union acpi_object *) - return_buffer->pointer)-> - type), - acpi_ut_get_type_name(return_type))); + ACPI_ERROR((AE_INFO, + "Incorrect return type [%s] requested [%s]", + acpi_ut_get_type_name(((union acpi_object *)return_buffer-> + pointer)->type), + acpi_ut_get_type_name(return_type))); if (must_free) { /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ @@ -235,9 +235,11 @@ acpi_evaluate_object(acpi_handle handle, * qualified names above, this is an error */ if (!pathname) { - ACPI_REPORT_ERROR(("Both Handle and Pathname are NULL\n")); + ACPI_ERROR((AE_INFO, + "Both Handle and Pathname are NULL")); } else { - ACPI_REPORT_ERROR(("Handle is NULL and Pathname is relative\n")); + ACPI_ERROR((AE_INFO, + "Handle is NULL and Pathname is relative")); } status = AE_BAD_PARAMETER; diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 853e6d170c9..8cd8675a47c 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c @@ -300,8 +300,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) status = acpi_ut_execute_CID(node, &cid_list); if (ACPI_SUCCESS(status)) { - size += ((acpi_size) cid_list->count - 1) * - sizeof(struct acpi_compatible_id); + size += cid_list->size; info->valid |= ACPI_VALID_CID; } diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index cc4a4903842..ac5bbaedac1 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1062,9 +1062,9 @@ EXPORT_SYMBOL(max_cstate); * handle is a pointer to the spinlock_t. */ -acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) +acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) { - unsigned long flags; + acpi_cpu_flags flags; spin_lock_irqsave((spinlock_t *) handle, flags); return flags; } @@ -1073,9 +1073,9 @@ acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) * Release a spinlock. See above. */ -void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) +void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) { - spin_unlock_irqrestore((spinlock_t *) handle, (unsigned long) flags); + spin_unlock_irqrestore((spinlock_t *) handle, flags); } #ifndef ACPI_USE_LOCAL_CACHE diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 3c37cd0ecd8..de573be5271 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -298,7 +298,9 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, acpi_ps_append_arg(arg, name_op); if (!method_desc) { - ACPI_REPORT_ERROR(("Control Method %p has no attached object\n", node)); + ACPI_ERROR((AE_INFO, + "Control Method %p has no attached object", + node)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -348,7 +350,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, /* Final exception check (may have been changed from code above) */ if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(path, status); + ACPI_ERROR_NAMESPACE(path, status); if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { @@ -451,7 +453,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, default: - ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); + ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type)); return_VOID; } @@ -709,7 +711,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type)); + ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type)); status = AE_AML_OPERAND_TYPE; break; } diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index c66029b890b..00b072e15d1 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -123,10 +123,12 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) && ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { if (status == AE_AML_NO_RETURN_VALUE) { - ACPI_REPORT_ERROR(("Invoked method did not return a value, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Invoked method did not return a value")); } - ACPI_REPORT_ERROR(("get_predicate Failed, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "get_predicate Failed")); return_ACPI_STATUS(status); } @@ -184,7 +186,11 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* The opcode is unrecognized. Just skip unknown opcodes */ - ACPI_REPORT_ERROR(("Found unknown opcode %X at AML address %p offset %X, ignoring\n", walk_state->opcode, parser_state->aml, walk_state->aml_offset)); + ACPI_ERROR((AE_INFO, + "Found unknown opcode %X at AML address %p offset %X, ignoring", + walk_state->opcode, + parser_state->aml, + walk_state->aml_offset)); ACPI_DUMP_BUFFER(parser_state->aml, 128); @@ -271,7 +277,8 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->descending_callback(walk_state, &op); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("During name lookup/catalog, %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "During name lookup/catalog")); goto close_this_op; } diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 3b540fe17a0..a9f3229f410 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -512,9 +512,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } else if ((status != AE_OK) && (walk_state->method_desc)) { /* Either the method parse or actual execution failed */ - ACPI_REPORT_MTERROR("Method parse/execution failed", - walk_state->method_node, NULL, - status); + ACPI_ERROR_METHOD("Method parse/execution failed", + walk_state->method_node, NULL, + status); /* Check for possible multi-thread reentrancy problem */ @@ -558,7 +558,8 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) walk_state->method_desc->method. thread_count--; } else { - ACPI_REPORT_ERROR(("Invalid zero thread count in method\n")); + ACPI_ERROR((AE_INFO, + "Invalid zero thread count in method")); } } diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index d387e2b01db..dd6f16726fc 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c @@ -132,8 +132,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) if (op_info->class == AML_CLASS_UNKNOWN) { /* Invalid opcode */ - ACPI_REPORT_ERROR(("Invalid AML Opcode: 0x%2.2X\n", - op->common.aml_opcode)); + ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", + op->common.aml_opcode)); return; } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 1dfa6906d45..7d6481d9fbe 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -541,13 +541,13 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, 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))) { + if (*sub_object_list && /* Null object allowed */ + ((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)))) { name_found = TRUE; } else { /* Look at the next element */ diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 7f46ca0bf33..8c128dea325 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -207,14 +207,20 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* Each element of the top-level package must also be a package */ if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR(("(PRT[%X]) Need sub-package, found %s\n", index, acpi_ut_get_object_type_name(*top_object_list))); + ACPI_ERROR((AE_INFO, + "(PRT[%X]) Need sub-package, found %s", + 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_REPORT_ERROR(("(PRT[%X]) Need package of length 4, found length %d\n", index, (*top_object_list)->package.count)); + ACPI_ERROR((AE_INFO, + "(PRT[%X]) Need package of length 4, found length %d", + index, (*top_object_list)->package.count)); return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); } @@ -231,7 +237,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->address = obj_desc->integer.value; } else { - ACPI_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_ERROR((AE_INFO, + "(PRT[%X].Address) Need Integer, found %s", + index, + acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -241,65 +250,83 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->pin = (u32) obj_desc->integer.value; } else { - ACPI_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_ERROR((AE_INFO, + "(PRT[%X].Pin) Need Integer, found %s", + index, + acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } - /* 3) Third subobject: Dereference the PRT.source_name */ - + /* + * 3) Third subobject: Dereference the PRT.source_name + * The name may be unresolved (slack mode), so allow a null object + */ obj_desc = sub_object_list[2]; - switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { - case ACPI_TYPE_LOCAL_REFERENCE: - - if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { - ACPI_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); + if (obj_desc) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { + case ACPI_TYPE_LOCAL_REFERENCE: + + if (obj_desc->reference.opcode != + AML_INT_NAMEPATH_OP) { + ACPI_ERROR((AE_INFO, + "(PRT[%X].Source) Need name, found reference op %X", + index, + obj_desc->reference. + opcode)); + return_ACPI_STATUS(AE_BAD_DATA); + } + + node = obj_desc->reference.node; + + /* 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); + path_buffer.pointer = user_prt->source; + + 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; + break; + + case ACPI_TYPE_STRING: + + ACPI_STRCPY(user_prt->source, + obj_desc->string.pointer); + + /* + * Add to the Length field the length of the string + * (add 1 for terminator) + */ + 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 + * entire buffer was zeroed out, we can leave this alone. + * + * Add to the Length field the length of the u32 NULL + */ + user_prt->length += sizeof(u32); + break; + + default: + + ACPI_ERROR((AE_INFO, + "(PRT[%X].Source) Need Ref/String/Integer, found %s", + index, + acpi_ut_get_object_type_name + (obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } - - node = obj_desc->reference.node; - - /* 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); - path_buffer.pointer = user_prt->source; - - 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; - break; - - case ACPI_TYPE_STRING: - - ACPI_STRCPY(user_prt->source, obj_desc->string.pointer); - - /* - * Add to the Length field the length of the string - * (add 1 for terminator) - */ - 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 - * entire buffer was zeroed out, we can leave this alone. - * - * Add to the Length field the length of the u32 NULL - */ - user_prt->length += sizeof(u32); - break; - - default: - - ACPI_REPORT_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 */ @@ -313,7 +340,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->source_index = (u32) obj_desc->integer.value; } else { - ACPI_REPORT_ERROR(("(PRT[%X].source_index) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_ERROR((AE_INFO, + "(PRT[%X].source_index) Need Integer, found %s", + index, + acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 98356e2482c..e7de061cf88 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -692,7 +692,11 @@ void acpi_rs_dump_irq_list(u8 * route_table) static void acpi_rs_out_string(char *title, char *value) { - acpi_os_printf("%27s : %s\n", title, value); + acpi_os_printf("%27s : %s", title, value); + if (!*value) { + acpi_os_printf("[NULL NAMESTRING]"); + } + acpi_os_printf("\n"); } static void acpi_rs_out_integer8(char *title, u8 value) diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index e4778a51c17..1434e786477 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -94,7 +94,9 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) acpi_gbl_get_resource_dispatch [resource_index]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not convert AML resource (Type %X)", + *aml)); return_ACPI_STATUS(status); } @@ -156,7 +158,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - ACPI_REPORT_ERROR(("Invalid descriptor type (%X) in resource list\n", resource->type)); + ACPI_ERROR((AE_INFO, + "Invalid descriptor type (%X) in resource list", + resource->type)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -169,7 +173,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_gbl_set_resource_dispatch [resource->type]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not convert resource (type %X) to AML", + resource->type)); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 83bfe0dd3eb..ed866cf1c6d 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -84,9 +84,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, ACPI_FUNCTION_TRACE("rs_get_resource"); if (((acpi_native_uint) resource) & 0x3) { - acpi_os_printf - ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", - resource, resource->type, resource->length); + /* Each internal resource struct is expected to be 32-bit aligned */ + + ACPI_WARNING((AE_INFO, + "Misaligned resource pointer (get): %p Type %2.2X Len %X", + resource, resource->type, resource->length)); } /* Extract the resource Length field (does not include header length) */ @@ -274,15 +276,16 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, break; default: - acpi_os_printf - ("*** Invalid conversion sub-opcode\n"); + + ACPI_ERROR((AE_INFO, + "Invalid conversion sub-opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } break; default: - acpi_os_printf("*** Invalid conversion opcode\n"); + ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -486,15 +489,16 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, break; default: - acpi_os_printf - ("*** Invalid conversion sub-opcode\n"); + + ACPI_ERROR((AE_INFO, + "Invalid conversion sub-opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } break; default: - acpi_os_printf("*** Invalid conversion opcode\n"); + ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -523,7 +527,9 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { * polarity/trigger interrupts are allowed (ACPI spec, section * "IRQ Format"), so 0x00 and 0x09 are illegal. */ - ACPI_REPORT_ERROR(("Invalid interrupt polarity/trigger in resource list, %X\n", aml->irq.flags)); + ACPI_ERROR((AE_INFO, + "Invalid interrupt polarity/trigger in resource list, %X", + aml->irq.flags)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -535,7 +541,7 @@ if (temp8 < 1) { } if (resource->data.dma.transfer == 0x03) { - ACPI_REPORT_ERROR(("Invalid DMA.Transfer preference (3)\n")); + ACPI_ERROR((AE_INFO, "Invalid DMA.Transfer preference (3)")); return_ACPI_STATUS(AE_BAD_DATA); } #endif diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 48290b7e6ba..03b37d2223b 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -501,8 +501,8 @@ acpi_status acpi_tb_convert_table_fadt(void) * at least as long as the version 1.0 FADT */ if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev1)) { - ACPI_REPORT_ERROR(("FADT is invalid, too short: 0x%X\n", - acpi_gbl_FADT->length)); + ACPI_ERROR((AE_INFO, "FADT is invalid, too short: 0x%X", + acpi_gbl_FADT->length)); return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } @@ -517,7 +517,10 @@ acpi_status acpi_tb_convert_table_fadt(void) if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { /* Length is too short to be a V2.0 table */ - ACPI_REPORT_WARNING(("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); + ACPI_WARNING((AE_INFO, + "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table", + acpi_gbl_FADT->length, + acpi_gbl_FADT->revision)); acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT); @@ -582,13 +585,15 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) /* Absolute minimum length is 24, but the ACPI spec says 64 */ if (acpi_gbl_FACS->length < 24) { - ACPI_REPORT_ERROR(("Invalid FACS table length: 0x%X\n", - acpi_gbl_FACS->length)); + ACPI_ERROR((AE_INFO, "Invalid FACS table length: 0x%X", + acpi_gbl_FACS->length)); return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } if (acpi_gbl_FACS->length < 64) { - ACPI_REPORT_WARNING(("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", acpi_gbl_FACS->length)); + ACPI_WARNING((AE_INFO, + "FACS is shorter than the ACPI specification allows: 0x%X, using anyway", + acpi_gbl_FACS->length)); } /* Copy fields to the new FACS */ diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 0fedf4b27ea..09b4ee6dfd6 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -91,9 +91,9 @@ acpi_tb_get_table(struct acpi_pointer *address, status = acpi_tb_get_table_body(address, &header, table_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get ACPI table (size %X), %s\n", - header.length, - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not get ACPI table (size %X)", + header.length)); return_ACPI_STATUS(status); } @@ -148,7 +148,6 @@ acpi_tb_get_table_header(struct acpi_pointer *address, sizeof(struct acpi_table_header), (void *)&header); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X for length %X\n", ACPI_FORMAT_UINT64(address->pointer.physical), sizeof(struct acpi_table_header))); return_ACPI_STATUS(status); } @@ -161,8 +160,8 @@ acpi_tb_get_table_header(struct acpi_pointer *address, default: - ACPI_REPORT_ERROR(("Invalid address flags %X\n", - address->pointer_type)); + ACPI_ERROR((AE_INFO, "Invalid address flags %X", + address->pointer_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -253,8 +252,8 @@ acpi_tb_table_override(struct acpi_table_header *header, if (ACPI_FAILURE(status)) { /* Some severe error from the OSL, but we basically ignore it */ - ACPI_REPORT_ERROR(("Could not override ACPI table, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not override ACPI table")); return_ACPI_STATUS(status); } @@ -273,15 +272,14 @@ acpi_tb_table_override(struct acpi_table_header *header, status = acpi_tb_get_this_table(&address, new_table, table_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not copy override ACPI table, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Could not copy ACPI table")); return_ACPI_STATUS(status); } /* Copy the table info */ - ACPI_REPORT_INFO(("Table [%4.4s] replaced by host OS\n", - table_info->pointer->signature)); + ACPI_INFO((AE_INFO, "Table [%4.4s] replaced by host OS", + table_info->pointer->signature)); return_ACPI_STATUS(AE_OK); } @@ -327,7 +325,9 @@ acpi_tb_get_this_table(struct acpi_pointer *address, full_table = ACPI_MEM_ALLOCATE(header->length); if (!full_table) { - ACPI_REPORT_ERROR(("Could not allocate table memory for [%4.4s] length %X\n", header->signature, header->length)); + ACPI_ERROR((AE_INFO, + "Could not allocate table memory for [%4.4s] length %X", + header->signature, header->length)); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -351,7 +351,12 @@ acpi_tb_get_this_table(struct acpi_pointer *address, (acpi_size) header->length, (void *)&full_table); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", header->signature, ACPI_FORMAT_UINT64(address->pointer.physical), header->length)); + ACPI_ERROR((AE_INFO, + "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X", + header->signature, + ACPI_FORMAT_UINT64(address->pointer. + physical), + header->length)); return (status); } @@ -362,8 +367,8 @@ acpi_tb_get_this_table(struct acpi_pointer *address, default: - ACPI_REPORT_ERROR(("Invalid address flags %X\n", - address->pointer_type)); + ACPI_ERROR((AE_INFO, "Invalid address flags %X", + address->pointer_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 496f336b3e3..134e5dce0bc 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c @@ -152,7 +152,9 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, /* Signature must match request */ if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { - ACPI_REPORT_ERROR(("Incorrect table signature - wanted [%s] found [%4.4s]\n", signature, header.signature)); + ACPI_ERROR((AE_INFO, + "Incorrect table signature - wanted [%s] found [%4.4s]", + signature, header.signature)); return_ACPI_STATUS(AE_BAD_SIGNATURE); } @@ -231,14 +233,18 @@ acpi_status acpi_tb_get_required_tables(void) */ status = acpi_tb_get_primary_table(&address, &table_info); if ((status != AE_OK) && (status != AE_TABLE_NOT_SUPPORTED)) { - ACPI_REPORT_WARNING(("%s, while getting table at %8.8X%8.8X\n", acpi_format_exception(status), ACPI_FORMAT_UINT64(address.pointer.value))); + ACPI_WARNING((AE_INFO, + "%s, while getting table at %8.8X%8.8X", + acpi_format_exception(status), + ACPI_FORMAT_UINT64(address.pointer. + value))); } } /* We must have a FADT to continue */ if (!acpi_gbl_FADT) { - ACPI_REPORT_ERROR(("No FADT present in RSDT/XSDT\n")); + ACPI_ERROR((AE_INFO, "No FADT present in RSDT/XSDT")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -248,7 +254,8 @@ acpi_status acpi_tb_get_required_tables(void) */ status = acpi_tb_convert_table_fadt(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert FADT to internal common format\n")); + ACPI_ERROR((AE_INFO, + "Could not convert FADT to internal common format")); return_ACPI_STATUS(status); } @@ -258,8 +265,8 @@ acpi_status acpi_tb_get_required_tables(void) status = acpi_tb_get_secondary_table(&address, FACS_SIG, &table_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get/install the FACS, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not get/install the FACS")); return_ACPI_STATUS(status); } @@ -278,7 +285,7 @@ acpi_status acpi_tb_get_required_tables(void) status = acpi_tb_get_secondary_table(&address, DSDT_SIG, &table_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get/install the DSDT\n")); + ACPI_ERROR((AE_INFO, "Could not get/install the DSDT")); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index e1c9faa3982..7ffd0fddb4e 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -128,8 +128,8 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not acquire table mutex, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not acquire table mutex")); return_ACPI_STATUS(status); } @@ -146,9 +146,9 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) status = acpi_tb_init_table_descriptor(table_info->type, table_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not install table [%4.4s], %s\n", - table_info->pointer->signature, - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not install table [%4.4s]", + table_info->pointer->signature)); } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s located at %p\n", diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 17830902685..4d308220225 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -192,16 +192,21 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) if (no_match) { /* Invalid RSDT or XSDT signature */ - ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located. RSDP:\n")); + ACPI_ERROR((AE_INFO, + "Invalid signature where RSDP indicates RSDT/XSDT should be located. RSDP:")); ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); - ACPI_REPORT_ERROR(("RSDT/XSDT signature at %X (%p) is invalid\n", acpi_gbl_RSDP->rsdt_physical_address, (void *)(acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); + ACPI_ERROR((AE_INFO, + "RSDT/XSDT signature at %X (%p) is invalid", + acpi_gbl_RSDP->rsdt_physical_address, + (void *)(acpi_native_uint) acpi_gbl_RSDP-> + rsdt_physical_address)); if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - ACPI_REPORT_ERROR(("Looking for RSDT\n")) + ACPI_ERROR((AE_INFO, "Looking for RSDT")); } else { - ACPI_REPORT_ERROR(("Looking for XSDT\n")) + ACPI_ERROR((AE_INFO, "Looking for XSDT")); } ACPI_DUMP_BUFFER((char *)table_ptr, 48); @@ -238,9 +243,8 @@ acpi_status acpi_tb_get_table_rsdt(void) table_info.type = ACPI_TABLE_XSDT; status = acpi_tb_get_table(&address, &table_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get the RSDT/XSDT, %s\n", - acpi_format_exception(status))); - + ACPI_EXCEPTION((AE_INFO, status, + "Could not get the RSDT/XSDT")); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 38c6749e43d..bc571592f08 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -149,8 +149,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) /* Verify that this is a valid address */ if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { - ACPI_REPORT_ERROR(("Cannot read table header at %p\n", - table_header)); + ACPI_ERROR((AE_INFO, + "Cannot read table header at %p", table_header)); return (AE_BAD_ADDRESS); } @@ -159,10 +159,12 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) ACPI_MOVE_32_TO_32(&signature, table_header->signature); if (!acpi_ut_valid_acpi_name(signature)) { - ACPI_REPORT_ERROR(("Table signature at %p [%p] has invalid characters\n", table_header, &signature)); + ACPI_ERROR((AE_INFO, + "Table signature at %p [%p] has invalid characters", + table_header, &signature)); - ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", - ACPI_CAST_PTR(char, &signature))); + ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]", + ACPI_CAST_PTR(char, &signature))); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -172,9 +174,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) /* Validate the table length */ if (table_header->length < sizeof(struct acpi_table_header)) { - ACPI_REPORT_ERROR(("Invalid length in table header %p name %4.4s\n", table_header, (char *)&signature)); + ACPI_ERROR((AE_INFO, + "Invalid length in table header %p name %4.4s", + table_header, (char *)&signature)); - ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); + ACPI_WARNING((AE_INFO, + "Invalid table header length (0x%X) found", + (u32) table_header->length)); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -213,7 +219,10 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) /* Return the appropriate exception */ if (checksum) { - ACPI_REPORT_WARNING(("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", table_header->signature, (u32) table_header->checksum, (u32) checksum)); + ACPI_WARNING((AE_INFO, + "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)", + table_header->signature, + (u32) table_header->checksum, (u32) checksum)); status = AE_BAD_CHECKSUM; } @@ -286,7 +295,7 @@ acpi_tb_handle_to_object(u16 table_id, } } - ACPI_REPORT_ERROR(("table_id=%X does not exist\n", table_id)); + ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id)); return (AE_BAD_PARAMETER); } #endif diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 83a9ca8cb98..9fe53c9d5b9 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -75,8 +75,7 @@ acpi_status acpi_load_tables(void) status = acpi_os_get_root_pointer(ACPI_LOGICAL_ADDRESSING, &rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get RSDP, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Could not get the RSDP")); goto error_exit; } @@ -86,8 +85,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_verify_rsdp(&rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("RSDP Failed validation: %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During RSDP validation")); goto error_exit; } @@ -95,8 +93,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_table_rsdt(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not load RSDT: %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Could not load RSDT")); goto error_exit; } @@ -104,7 +101,8 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_required_tables(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get all required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not get all required tables (DSDT/FADT/FACS)")); goto error_exit; } @@ -114,17 +112,14 @@ acpi_status acpi_load_tables(void) status = acpi_ns_load_namespace(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not load namespace: %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Could not load namespace")); goto error_exit; } return_ACPI_STATUS(AE_OK); error_exit: - ACPI_REPORT_ERROR(("Could not load tables: %s\n", - acpi_format_exception(status))); - + ACPI_EXCEPTION((AE_INFO, status, "Could not load tables")); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 6538ed818f5..a62db6af83c 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -396,8 +396,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) status = acpi_tb_find_rsdp(&table_info, flags); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("RSDP structure not found, %s Flags=%X\n", - acpi_format_exception(status), flags)); + ACPI_EXCEPTION((AE_INFO, status, + "RSDP structure not found - Flags=%X", flags)); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -502,7 +502,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_PTR_LENGTH, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); + ACPI_ERROR((AE_INFO, + "Could not map memory at %8.8X for length %X", + ACPI_EBDA_PTR_LOCATION, + ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS(status); } @@ -526,7 +529,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_WINDOW_SIZE, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", physical_address, ACPI_EBDA_WINDOW_SIZE)); + ACPI_ERROR((AE_INFO, + "Could not map memory at %8.8X for length %X", + physical_address, + ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS(status); } @@ -556,7 +562,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); + ACPI_ERROR((AE_INFO, + "Could not map memory at %8.8X for length %X", + ACPI_HI_RSDP_WINDOW_BASE, + ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS(status); } @@ -625,7 +634,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) /* A valid RSDP was not found */ - ACPI_REPORT_ERROR(("No valid RSDP was found\n")); + ACPI_ERROR((AE_INFO, "No valid RSDP was found")); return_ACPI_STATUS(AE_NOT_FOUND); } diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 0efcbdf7e62..03b0044974c 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -301,8 +301,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR(module, line, - ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); + ACPI_ERROR((module, line, + "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); size = 1; } @@ -310,9 +310,9 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, - ("ut_allocate: Could not allocate size %X\n", - (u32) size)); + ACPI_ERROR((module, line, + "ut_allocate: Could not allocate size %X", + (u32) size)); return_PTR(NULL); } @@ -344,8 +344,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR(module, line, - ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); + ACPI_ERROR((module, line, + "Attempt to allocate zero bytes, allocating 1 byte")); size = 1; } @@ -353,9 +353,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, - ("ut_callocate: Could not allocate size %X\n", - (u32) size)); + ACPI_ERROR((module, line, + "Could not allocate size %X", (u32) size)); return_PTR(NULL); } @@ -480,9 +479,8 @@ void *acpi_ut_callocate_and_track(acpi_size size, if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, - ("ut_callocate: Could not allocate size %X\n", - (u32) size)); + ACPI_ERROR((module, line, + "Could not allocate size %X", (u32) size)); return (NULL); } @@ -524,8 +522,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); if (NULL == allocation) { - _ACPI_REPORT_ERROR(module, line, - ("acpi_ut_free: Attempt to delete a NULL address\n")); + ACPI_ERROR((module, line, "Attempt to delete a NULL address")); return_VOID; } @@ -540,14 +537,11 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) status = acpi_ut_remove_allocation(debug_block, component, module, line); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not free memory, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); } acpi_os_free(debug_block); - ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); - return_VOID; } @@ -624,10 +618,12 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, */ element = acpi_ut_find_allocation(allocation); if (element) { - ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); + ACPI_ERROR((AE_INFO, + "ut_track_allocation: Allocation already present in list! (%p)", + allocation)); - ACPI_REPORT_ERROR(("Element %p Address %p\n", - element, allocation)); + ACPI_ERROR((AE_INFO, "Element %p Address %p", + element, allocation)); goto unlock_and_exit; } @@ -687,8 +683,8 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, if (NULL == mem_list->list_head) { /* No allocations! */ - _ACPI_REPORT_ERROR(module, line, - ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); + ACPI_ERROR((module, line, + "Empty allocation list, nothing to free!")); return_ACPI_STATUS(AE_OK); } @@ -863,10 +859,11 @@ void acpi_ut_dump_allocations(u32 component, char *module) /* Print summary */ if (!num_outstanding) { - ACPI_REPORT_INFO(("No outstanding allocations\n")); + ACPI_INFO((AE_INFO, "No outstanding allocations")); } else { - ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n", - num_outstanding, num_outstanding)); + ACPI_ERROR((AE_INFO, + "%d(%X) Outstanding allocations", + num_outstanding, num_outstanding)); } return_VOID; diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 1a4da006822..df2d32096b7 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -606,7 +606,8 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, /* * Packages as external input to control methods are not supported, */ - ACPI_REPORT_ERROR(("Packages as parameters not implemented!\n")); + ACPI_ERROR((AE_INFO, + "Packages as parameters not implemented!")); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -869,7 +870,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, count + 1) * sizeof(void *)); if (!dest_obj->package.elements) { - ACPI_REPORT_ERROR(("Package allocation failure\n")); + ACPI_ERROR((AE_INFO, "Package allocation failure")); return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1079a1a1f19..1db9695b002 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -363,7 +363,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) default: - ACPI_REPORT_ERROR(("Unknown action (%X)\n", action)); + ACPI_ERROR((AE_INFO, "Unknown action (%X)", action)); break; } @@ -373,7 +373,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) */ if (count > ACPI_MAX_REFERENCE_COUNT) { - ACPI_REPORT_WARNING(("Large Reference Count (%X) in object %p\n\n", count, object)); + ACPI_WARNING((AE_INFO, + "Large Reference Count (%X) in object %p", + count, object)); } return; @@ -532,8 +534,8 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) error_exit: - ACPI_REPORT_ERROR(("Could not update object reference count, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not update object reference count")); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index f4dc374a0ee..106cc97cb4a 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -154,8 +154,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_ut_get_node_name(prefix_node), path)); } else { - ACPI_REPORT_MTERROR("Method execution failed", - prefix_node, path, status); + ACPI_ERROR_METHOD("Method execution failed", + prefix_node, path, status); } return_ACPI_STATUS(status); @@ -165,8 +165,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, if (!info.return_object) { if (expected_return_btypes) { - ACPI_REPORT_MTERROR("No object was returned from", - prefix_node, path, AE_NOT_EXIST); + ACPI_ERROR_METHOD("No object was returned from", + prefix_node, path, AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -211,10 +211,14 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, /* Is the return object one of the expected types? */ if (!(expected_return_btypes & return_btype)) { - ACPI_REPORT_MTERROR("Return object type is incorrect", - prefix_node, path, AE_TYPE); - - ACPI_REPORT_ERROR(("Type returned from %s was incorrect: %s, expected Btypes: %X\n", path, acpi_ut_get_object_type_name(info.return_object), expected_return_btypes)); + ACPI_ERROR_METHOD("Return object type is incorrect", + prefix_node, path, AE_TYPE); + + ACPI_ERROR((AE_INFO, + "Type returned from %s was incorrect: %s, expected Btypes: %X", + path, + acpi_ut_get_object_type_name(info.return_object), + expected_return_btypes)); /* On error exit, we must delete the return object */ diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 87ca9a0a8b7..ffd13383a32 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -121,8 +121,8 @@ const char *acpi_format_exception(acpi_status status) if (!exception) { /* Exception code was not recognized */ - ACPI_REPORT_ERROR(("Unknown exception code: 0x%8.8X\n", - status)); + ACPI_ERROR((AE_INFO, + "Unknown exception code: 0x%8.8X", status)); exception = "UNKNOWN_STATUS_CODE"; } diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 7565ba6f90d..ba771b4f39b 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -72,9 +72,9 @@ static void acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) { - ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n", - register_name, value, (u32) offset, - acpi_gbl_FADT)); + ACPI_WARNING((AE_INFO, + "Invalid FADT value %s=%X at offset %X FADT=%p", + register_name, value, (u32) offset, acpi_gbl_FADT)); } /****************************************************************************** @@ -221,7 +221,7 @@ void acpi_ut_subsystem_shutdown(void) /* Just exit if subsystem is already shutdown */ if (acpi_gbl_shutdown) { - ACPI_REPORT_ERROR(("ACPI Subsystem is already terminated\n")); + ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated")); return_VOID; } diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 06214201329..4a3360484e7 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c @@ -82,7 +82,7 @@ acpi_ut_short_divide(acpi_integer dividend, /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR(("Divide by zero\n")); + ACPI_ERROR((AE_INFO, "Divide by zero")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -144,7 +144,7 @@ acpi_ut_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR(("Divide by zero\n")); + ACPI_ERROR((AE_INFO, "Divide by zero")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -266,7 +266,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR(("Divide by zero\n")); + ACPI_ERROR((AE_INFO, "Divide by zero")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -292,7 +292,7 @@ acpi_ut_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR(("Divide by zero\n")); + ACPI_ERROR((AE_INFO, "Divide by zero")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index a77ffcd5570..7364f5f8c9c 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -72,8 +72,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) /* Guard against multiple allocations of ID to the same location */ if (*owner_id) { - ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n", - *owner_id)); + ACPI_ERROR((AE_INFO, "Owner ID [%2.2X] already exists", + *owner_id)); return_ACPI_STATUS(AE_ALREADY_EXISTS); } @@ -143,7 +143,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) * methods, or there may be a bug where the IDs are not released. */ status = AE_OWNER_ID_LIMIT; - ACPI_REPORT_ERROR(("Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT\n")); + ACPI_ERROR((AE_INFO, + "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -180,7 +181,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Zero is not a valid owner_iD */ if (owner_id == 0) { - ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); + ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); return_VOID; } @@ -205,8 +206,9 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) if (acpi_gbl_owner_id_mask[index] & bit) { acpi_gbl_owner_id_mask[index] ^= bit; } else { - ACPI_REPORT_ERROR(("Release of non-allocated owner_id: %2.2X\n", - owner_id + 1)); + ACPI_ERROR((AE_INFO, + "Release of non-allocated owner_id: %2.2X", + owner_id + 1)); } (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -837,55 +839,95 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) /******************************************************************************* * - * FUNCTION: acpi_ut_report_error + * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) + * Format - Printf format string + additional args * * RETURN: None * - * DESCRIPTION: Print error message + * DESCRIPTION: Print message with module/line/version info * ******************************************************************************/ -void acpi_ut_report_error(char *module_name, u32 line_number) +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_error(char *module_name, u32 line_number, char *format, ...) { + va_list args; acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); + + va_start(args, format); + acpi_os_vprintf(format, args); + acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } -/******************************************************************************* - * - * FUNCTION: acpi_ut_report_warning - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * - * RETURN: None - * - * DESCRIPTION: Print warning message - * - ******************************************************************************/ +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_exception(char *module_name, + u32 line_number, acpi_status status, char *format, ...) +{ + va_list args; -void acpi_ut_report_warning(char *module_name, u32 line_number) + acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name, + line_number, acpi_format_exception(status)); + + va_start(args, format); + acpi_os_vprintf(format, args); + acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); +} + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) { + va_list args; acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); + + va_start(args, format); + acpi_os_vprintf(format, args); + acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); +} + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_info(char *module_name, u32 line_number, char *format, ...) +{ + va_list args; + + acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); + + va_start(args, format); + acpi_os_vprintf(format, args); + acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } /******************************************************************************* * - * FUNCTION: acpi_ut_report_info + * FUNCTION: acpi_ut_report_error, Warning, Info * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) * * RETURN: None * - * DESCRIPTION: Print information message + * DESCRIPTION: Print error message + * + * Note: Legacy only, should be removed when no longer used by drivers. * ******************************************************************************/ +void acpi_ut_report_error(char *module_name, u32 line_number) +{ + + acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); +} + +void acpi_ut_report_warning(char *module_name, u32 line_number) +{ + + acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); +} + void acpi_ut_report_info(char *module_name, u32 line_number) { diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index ffaff55270b..45a7244df92 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -216,12 +216,20 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) for (i = mutex_id; i < MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { - ACPI_REPORT_ERROR(("Mutex [%s] already acquired by this thread [%X]\n", acpi_ut_get_mutex_name(mutex_id), this_thread_id)); + ACPI_ERROR((AE_INFO, + "Mutex [%s] already acquired by this thread [%X]", + acpi_ut_get_mutex_name + (mutex_id), + this_thread_id)); return (AE_ALREADY_ACQUIRED); } - ACPI_REPORT_ERROR(("Invalid acquire order: Thread %X owns [%s], wants [%s]\n", this_thread_id, acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); + ACPI_ERROR((AE_INFO, + "Invalid acquire order: Thread %X owns [%s], wants [%s]", + this_thread_id, + acpi_ut_get_mutex_name(i), + acpi_ut_get_mutex_name(mutex_id))); return (AE_ACQUIRE_DEADLOCK); } @@ -244,7 +252,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { - ACPI_REPORT_ERROR(("Thread %X could not acquire Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Thread %X could not acquire Mutex [%X]", + this_thread_id, mutex_id)); } return (status); @@ -282,7 +292,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * Mutex must be acquired in order to release it! */ if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { - ACPI_REPORT_ERROR(("Mutex [%X] is not acquired, cannot release\n", mutex_id)); + ACPI_ERROR((AE_INFO, + "Mutex [%X] is not acquired, cannot release", + mutex_id)); return (AE_NOT_ACQUIRED); } @@ -303,7 +315,10 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) continue; } - ACPI_REPORT_ERROR(("Invalid release order: owns [%s], releasing [%s]\n", acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); + ACPI_ERROR((AE_INFO, + "Invalid release order: owns [%s], releasing [%s]", + acpi_ut_get_mutex_name(i), + acpi_ut_get_mutex_name(mutex_id))); return (AE_RELEASE_DEADLOCK); } @@ -319,7 +334,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Thread %X could not release Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Thread %X could not release Mutex [%X]", + this_thread_id, mutex_id)); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 1b6b2157780..7ee2d1d9807 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -177,8 +177,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) buffer = ACPI_MEM_CALLOCATE(buffer_size); if (!buffer) { - ACPI_REPORT_ERROR(("Could not allocate size %X\n", - (u32) buffer_size)); + ACPI_ERROR((AE_INFO, "Could not allocate size %X", + (u32) buffer_size)); acpi_ut_remove_reference(buffer_desc); return_PTR(NULL); } @@ -229,8 +229,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) */ string = ACPI_MEM_CALLOCATE(string_size + 1); if (!string) { - ACPI_REPORT_ERROR(("Could not allocate size %X\n", - (u32) string_size)); + ACPI_ERROR((AE_INFO, "Could not allocate size %X", + (u32) string_size)); acpi_ut_remove_reference(string_desc); return_PTR(NULL); } @@ -312,8 +312,8 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, object = acpi_os_acquire_object(acpi_gbl_operand_cache); if (!object) { - _ACPI_REPORT_ERROR(module_name, line_number, - ("Could not allocate an object descriptor\n")); + ACPI_ERROR((module_name, line_number, + "Could not allocate an object descriptor")); return_PTR(NULL); } @@ -347,9 +347,9 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object) /* Object must be an union acpi_operand_object */ if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { - ACPI_REPORT_ERROR(("%p is not an ACPI Operand object [%s]\n", - object, - acpi_ut_get_descriptor_name(object))); + ACPI_ERROR((AE_INFO, + "%p is not an ACPI Operand object [%s]", object, + acpi_ut_get_descriptor_name(object))); return_VOID; } @@ -451,7 +451,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, * Notably, Locals and Args are not supported, but this may be * required eventually. */ - ACPI_REPORT_ERROR(("Unsupported Reference opcode=%X in object %p\n", internal_object->reference.opcode, internal_object)); + ACPI_ERROR((AE_INFO, + "Unsupported Reference opcode=%X in object %p", + internal_object->reference.opcode, + internal_object)); status = AE_TYPE; break; } @@ -459,9 +462,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, default: - ACPI_REPORT_ERROR(("Unsupported type=%X in object %p\n", - ACPI_GET_OBJECT_TYPE(internal_object), - internal_object)); + ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p", + ACPI_GET_OBJECT_TYPE(internal_object), + internal_object)); status = AE_TYPE; break; } diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 36bf9e4bf52..16461317113 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -486,6 +486,7 @@ u32 acpi_ut_get_descriptor_length(void *aml) * RETURN: Status, pointer to the end tag * * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template + * Note: allows a buffer length of zero. * ******************************************************************************/ @@ -504,6 +505,13 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, aml = obj_desc->buffer.pointer; end_aml = aml + obj_desc->buffer.length; + /* Allow a buffer length of zero */ + + if (!obj_desc->buffer.length) { + *end_tag = aml; + return_ACPI_STATUS(AE_OK); + } + /* Walk the resource template, one descriptor per iteration */ while (aml < end_aml) { @@ -518,6 +526,14 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_END_TAG) { + /* + * There must be at least one more byte in the buffer for + * the 2nd byte of the end_tag + */ + if ((aml + 1) >= end_aml) { + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + } + /* Return the pointer to the end_tag */ *end_tag = aml; diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index b4bc9488320..308a960871b 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -75,8 +75,7 @@ acpi_status acpi_initialize_subsystem(void) status = acpi_os_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("OSL failed to initialize, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); return_ACPI_STATUS(status); } @@ -88,8 +87,8 @@ acpi_status acpi_initialize_subsystem(void) status = acpi_ut_mutex_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "During Global Mutex creation")); return_ACPI_STATUS(status); } @@ -99,15 +98,14 @@ acpi_status acpi_initialize_subsystem(void) */ status = acpi_ns_root_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "During Namespace initialization")); return_ACPI_STATUS(status); } /* If configured, initialize the AML debugger */ ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); - return_ACPI_STATUS(status); } @@ -154,7 +152,7 @@ acpi_status acpi_enable_subsystem(u32 flags) status = acpi_enable(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("acpi_enable failed\n")); + ACPI_WARNING((AE_INFO, "acpi_enable failed")); return_ACPI_STATUS(status); } } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 675a32f7832..e27dc8f2997 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060113 +#define ACPI_CA_VERSION 0x20060127 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -83,7 +83,7 @@ #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ /* - * Should the subystem abort the loading of an ACPI table if the + * Should the subsystem abort the loading of an ACPI table if the * table checksum is incorrect? */ #define ACPI_CHECKSUM_ABORT FALSE diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 97f8e4185e4..8361820d297 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -416,13 +416,13 @@ struct acpi_field_info { #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 -#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ - u8 data_type; /* To differentiate various internal objs */\ +#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ + u8 data_type; /* To differentiate various internal objs */\ u8 flags; \ u16 value; \ u16 state; \ u16 reserved; \ - void *next; \ + void *next; struct acpi_common_state { ACPI_STATE_COMMON}; @@ -575,8 +575,7 @@ union acpi_parse_value { char aml_op_name[16]) /* Op name (debug only) */\ /* NON-DEBUG members below: */\ struct acpi_namespace_node *node; /* For use by interpreter */\ - union acpi_parse_value value; /* Value or args associated with the opcode */\ - + union acpi_parse_value value; /* Value or args associated with the opcode */ #define ACPI_DASM_BUFFER 0x00 #define ACPI_DASM_RESOURCE 0x01 diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 49ba151766d..f2be2a88173 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -341,8 +341,12 @@ /* * Rounding macros (Power of two boundaries only) */ -#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & (~(((acpi_native_uint) boundary)-1))) -#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + (((acpi_native_uint) boundary)-1)) & (~(((acpi_native_uint) boundary)-1))) +#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ + (~(((acpi_native_uint) boundary)-1))) + +#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ + (((acpi_native_uint) boundary)-1)) & \ + (~(((acpi_native_uint) boundary)-1))) #define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) #define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) @@ -379,10 +383,11 @@ /* Generate a UUID */ -#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ - (b) & 0xFF, ((b) >> 8) & 0xFF, \ - (c) & 0xFF, ((c) >> 8) & 0xFF, \ - (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) +#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ + (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ + (b) & 0xFF, ((b) >> 8) & 0xFF, \ + (c) & 0xFF, ((c) >> 8) & 0xFF, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) /* * An struct acpi_namespace_node * can appear in some contexts, @@ -442,13 +447,12 @@ #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) +#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) /* * Module name is include in both debug and non-debug versions primarily for * error messages. The __FILE__ macro is not very useful for this, because it * often includes the entire pathname to the module */ -#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) - #define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; #else #define ACPI_MODULE_NAME(name) @@ -458,45 +462,31 @@ * Ascii error messages can be configured out */ #ifndef ACPI_NO_ERROR_MESSAGES - -#define ACPI_PARAM_LIST(pl) pl -#define ACPI_LOCATION_INFO _acpi_module_name, __LINE__ +#define AE_INFO _acpi_module_name, __LINE__ /* - * Error reporting. Callers module and line number are inserted automatically - * These macros are used for both the debug and non-debug versions of the code + * Error reporting. Callers module and line number are inserted by AE_INFO, + * the plist contains a set of parens to allow variable-length lists. + * These macros are used for both the debug and non-debug versions of the code. */ -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info (ACPI_LOCATION_INFO); \ - acpi_os_printf ACPI_PARAM_LIST (fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error (ACPI_LOCATION_INFO); \ - acpi_os_printf ACPI_PARAM_LIST (fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning (ACPI_LOCATION_INFO); \ - acpi_os_printf ACPI_PARAM_LIST (fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error (ACPI_LOCATION_INFO, \ - s, e); -#define ACPI_REPORT_MTERROR(s,n,p,e) acpi_ns_report_method_error (ACPI_LOCATION_INFO, \ - s, n, p, e); - -/* Error reporting. These versions pass thru the module and lineno */ +#define ACPI_INFO(plist) acpi_ut_info plist +#define ACPI_WARNING(plist) acpi_ut_warning plist +#define ACPI_EXCEPTION(plist) acpi_ut_exception plist +#define ACPI_ERROR(plist) acpi_ut_error plist +#define ACPI_ERROR_NAMESPACE(s,e) acpi_ns_report_error (AE_INFO, s, e); +#define ACPI_ERROR_METHOD(s,n,p,e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); -#define _ACPI_REPORT_INFO(a,b,fp) {acpi_ut_report_info (a,b); \ - acpi_os_printf ACPI_PARAM_LIST (fp);} -#define _ACPI_REPORT_ERROR(a,b,fp) {acpi_ut_report_error (a,b); \ - acpi_os_printf ACPI_PARAM_LIST (fp);} -#define _ACPI_REPORT_WARNING(a,b,fp) {acpi_ut_report_warning (a,b); \ - acpi_os_printf ACPI_PARAM_LIST (fp);} #else /* No error messages */ -#define ACPI_REPORT_INFO(fp) -#define ACPI_REPORT_ERROR(fp) -#define ACPI_REPORT_WARNING(fp) -#define ACPI_REPORT_NSERROR(s,e) -#define ACPI_REPORT_MTERROR(s,n,p,e) -#define _ACPI_REPORT_INFO(a,b,c,fp) -#define _ACPI_REPORT_ERROR(a,b,c,fp) -#define _ACPI_REPORT_WARNING(a,b,c,fp) +#define ACPI_INFO(plist) +#define ACPI_WARNING(plist) +#define ACPI_EXCEPTION(plist) +#define ACPI_ERROR(plist) +#define ACPI_ERROR_NAMESPACE(s,e) +#define ACPI_ERROR_METHOD(s,n,p,e) + #endif /* @@ -538,7 +528,7 @@ #endif #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace(ACPI_DEBUG_PARAMETERS) + acpi_ut_trace(ACPI_DEBUG_PARAMETERS) #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ @@ -632,18 +622,6 @@ #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) #define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) -#define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a)) - -/* - * Generate INT3 on ACPI_ERROR (Debug only!) - */ -#define ACPI_ERROR_BREAK -#ifdef ACPI_ERROR_BREAK -#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \ - acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n") -#else -#define ACPI_BREAK_ON_ERROR(lvl) -#endif /* * Master debug print macros @@ -651,8 +629,8 @@ * 1) Debug print for the current component is enabled * 2) Debug error level or trace level for the print statement is enabled */ -#define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl) -#define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl) +#define ACPI_DEBUG_PRINT(plist) acpi_ut_debug_print plist +#define ACPI_DEBUG_PRINT_RAW(plist) acpi_ut_debug_print_raw plist #else /* @@ -681,7 +659,6 @@ #define ACPI_DUMP_BUFFER(a,b) #define ACPI_DEBUG_PRINT(pl) #define ACPI_DEBUG_PRINT_RAW(pl) -#define ACPI_BREAK_MSG(a) #define return_VOID return #define return_ACPI_STATUS(s) return(s) diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index 1bd411962c7..d130cfed8d5 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -69,7 +69,7 @@ u8 type; /* acpi_object_type */\ u16 reference_count; /* For object deletion management */\ union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ - u8 flags; \ + u8 flags; /* Values for flag byte above */ diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 768f63f391c..970e9a6372c 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -108,9 +108,9 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle); void acpi_os_delete_lock(acpi_handle handle); -acpi_native_uint acpi_os_acquire_lock(acpi_handle handle); +acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle); -void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags); +void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags); /* * Memory allocation and mapping diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 74819e9b469..7ca89cde706 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -237,17 +237,22 @@ typedef char *acpi_physical_address; #error unknown ACPI_MACHINE_WIDTH #endif +/* Variable-width type, used instead of clib size_t */ + +typedef acpi_native_uint acpi_size; + /******************************************************************************* * * OS- or compiler-dependent types * + * If the defaults below are not appropriate for the host system, they can + * be defined in the compiler-specific or OS-specific header, and this will + * take precedence. + * ******************************************************************************/ -/* - * If acpi_uintptr_t was not defined in the OS- or compiler-dependent header, - * define it now (use C99 uintptr_t for pointer casting if available, - * "void *" otherwise) - */ +/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ + #ifndef acpi_uintptr_t #define acpi_uintptr_t void * #endif @@ -261,9 +266,31 @@ typedef char *acpi_physical_address; #define acpi_cache_t struct acpi_memory_list #endif -/* Variable-width type, used instead of clib size_t */ +/* + * Allow the CPU flags word to be defined per-OS to simplify the use of the + * lock and unlock OSL interfaces. + */ +#ifndef acpi_cpu_flags +#define acpi_cpu_flags acpi_native_uint +#endif -typedef acpi_native_uint acpi_size; +/* + * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because + * some compilers can catch printf format string problems + */ +#ifndef ACPI_PRINTF_LIKE +#define ACPI_PRINTF_LIKE(c) +#endif + +/* + * Some compilers complain about unused variables. Sometimes we don't want to + * use all the variables (for example, _acpi_module_name). This allows us + * to to tell the compiler in a per-variable manner that a variable + * is unused + */ +#ifndef ACPI_UNUSED_VAR +#define ACPI_UNUSED_VAR +#endif /******************************************************************************* * diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 10f6625f639..0927765df6a 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -275,20 +275,22 @@ acpi_ut_ptr_exit(u32 line_number, const char *function_name, char *module_name, u32 component_id, u8 * ptr); +void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); + void acpi_ut_report_error(char *module_name, u32 line_number); void acpi_ut_report_info(char *module_name, u32 line_number); void acpi_ut_report_warning(char *module_name, u32 line_number); -void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); +/* Error and message reporting interfaces */ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print(u32 requested_debug_level, u32 line_number, const char *function_name, char *module_name, - u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE(6); void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw(u32 requested_debug_level, @@ -296,7 +298,24 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, const char *function_name, char *module_name, u32 component_id, - char *format, ...) ACPI_PRINTF_LIKE_FUNC; + char *format, ...) ACPI_PRINTF_LIKE(6); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_error(char *module_name, + u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_exception(char *module_name, + u32 line_number, + acpi_status status, char *format, ...) ACPI_PRINTF_LIKE(4); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_warning(char *module_name, + u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_info(char *module_name, + u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3); /* * utdelete - Object deletion and reference counts diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 31b0f18342f..223ec646710 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -149,6 +149,9 @@ #elif defined(NETWARE) #include "acnetware.h" +#elif defined(__sun) +#include "acsolaris.h" + #else /* All other environments */ @@ -158,13 +161,6 @@ #define COMPILER_DEPENDENT_INT64 long long #define COMPILER_DEPENDENT_UINT64 unsigned long long -/* - * This macro is used to tag functions as "printf-like" because - * some compilers can catch printf format string problems. MSVC - * doesn't, so this is proprocessed away. - */ -#define ACPI_PRINTF_LIKE_FUNC - #endif /* diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index ea2a6322f64..da80933963d 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -48,12 +48,14 @@ #define ACPI_GET_FUNCTION_NAME __FUNCTION__ -/* This macro is used to tag functions as "printf-like" because +/* + * This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. */ -#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7))) +#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1))) -/* Some compilers complain about unused variables. Sometimes we don't want to +/* + * Some compilers complain about unused variables. Sometimes we don't want to * use all the variables (for example, _acpi_module_name). This allows us * to to tell the compiler warning in a per-variable manner that a variable * is unused. diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index c21c27fe7e1..2e6d54569ee 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -102,4 +102,6 @@ #include "acgcc.h" +#define acpi_cpu_flags unsigned long + #endif /* __ACLINUX_H__ */ -- cgit v1.2.3 From 51c2bbfcdb10162b294f31e2b1c7106639caaec2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Jan 2006 15:20:03 +0100 Subject: [ALSA] via82xx - Add dxs entry for a FSC board Modules: VIA82xx driver Add dxs entry for a FSC board. Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index d59fe3e83f1..8d348f27f17 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2374,6 +2374,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */ { .subvendor = 0x1695, .subdevice = 0x300e, .action = VIA_DXS_SRC }, /* EPoX 9HEAI */ { .subvendor = 0x16f3, .subdevice = 0x6405, .action = VIA_DXS_SRC }, /* Jetway K8M8MS */ + { .subvendor = 0x1734, .subdevice = 0x1093, .action = VIA_DXS_SRC }, /* FSC */ { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */ { .subvendor = 0x1849, .subdevice = 0x9761, .action = VIA_DXS_SRC }, /* ASRock mobo(?) */ { .subvendor = 0x1919, .subdevice = 0x200a, .action = VIA_DXS_NO_VRA }, /* Soltek SL-K8Tpro-939 */ -- cgit v1.2.3 From fe25ad8a84c798a82591e5ed14519c001500fa61 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Jan 2006 15:20:38 +0100 Subject: [ALSA] wavefront - Fix a compile warning Modules: Wavefront drivers Fix a gcc-4.1 compile warning regarding uninitialized variables. Signed-off-by: Takashi Iwai --- sound/isa/wavefront/wavefront_synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index ed81eec6e73..68aa091e896 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -866,7 +866,7 @@ wavefront_send_sample (snd_wavefront_t *dev, divided by 2. */ - u16 sample_short; + u16 sample_short = 0; u32 length; u16 __user *data_end = NULL; unsigned int i; -- cgit v1.2.3 From 91134859702e66e5946383f66e6eb50ba4325458 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Jan 2006 15:21:05 +0100 Subject: [ALSA] opti93x - Fix a compile warning Modules: Opti9xx drivers Fix a gcc-4.1 compile warning regarding uninitialized variables. Signed-off-by: Takashi Iwai --- sound/isa/opti9xx/opti92x-ad1848.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 1ea3944ef7a..63d96be11b2 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -1349,7 +1349,7 @@ static int snd_opti93x_pcm(struct snd_opti93x *codec, int device, struct snd_pcm int error; struct snd_pcm *pcm; - if ((error = snd_pcm_new(codec->card, "OPTi 82C93X", device, 1, 1, &pcm))) + if ((error = snd_pcm_new(codec->card, "OPTi 82C93X", device, 1, 1, &pcm)) < 0) return error; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_opti93x_playback_ops); -- cgit v1.2.3 From 68b8bc05213567cfc58d8bdb8917b36c314ba7fd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Jan 2006 15:21:28 +0100 Subject: [ALSA] serial-uart16550 - Fix a compile warning Modules: Generic drivers Fix a gcc-4.1 compile warning regarding uninitialized variables. Signed-off-by: Takashi Iwai --- sound/drivers/serial-u16550.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 29676d800ca..112ddf70540 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -789,7 +789,7 @@ static int __init snd_uart16550_create(struct snd_card *card, if ((err = snd_uart16550_detect(uart)) <= 0) { printk(KERN_ERR "no UART detected at 0x%lx\n", iobase); - return err; + return -ENODEV; } if (irq >= 0 && irq != SNDRV_AUTO_IRQ) { -- cgit v1.2.3 From 50f794c8dcfd0e63f3034d7cfd41e563f35741aa Mon Sep 17 00:00:00 2001 From: Lukasz Stemach Date: Mon, 23 Jan 2006 15:22:13 +0100 Subject: [ALSA] cs4236 - Add PnP ids for Netfinity 3000 Modules: CS4236+ driver PnP ids for Netfinity 3000 builtin soundcard. This one works for me. This patch was submitted through kernel Bugzilla #4214. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/isa/cs423x/cs4236.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index edf9279bf9d..4fa43104056 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -178,6 +178,8 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = { { .id = "CSC7632", .devs = { { "CSC0000" }, { "CSC0010" }, { "PNPb006" } } }, /* SIC CrystalWave 32 (CS4232) */ { .id = "CSCf032", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, + /* Netfinity 3000 on-board soundcard */ + { .id = "CSCe825", .devs = { { "CSC0100" }, { "CSC0110" }, { "CSC010f" } } }, /* --- */ { .id = "" } /* end */ }; -- cgit v1.2.3 From e061bf1aa3af8a3f2ae7e1b5f8a110eae7936615 Mon Sep 17 00:00:00 2001 From: Sasha Khapyorsky Date: Mon, 23 Jan 2006 15:24:16 +0100 Subject: [ALSA] hda-codec - support for Agere's HDA soft modem Modules: HDA Codec driver This adds support for Agere's variant of Si3054/5 based HDA modem. Signed-off-by: Sasha Khapyorsky Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_si3054.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index 8f8840e6002..250242cd6c7 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c @@ -297,6 +297,7 @@ static int patch_si3054(struct hda_codec *codec) struct hda_codec_preset snd_hda_preset_si3054[] = { { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 }, { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 }, + { .id = 0x11c13026, .name = "Si3054", .patch = patch_si3054 }, {} }; -- cgit v1.2.3 From d62c40e04cfcec3cef8093bd79d72fe86c8f2195 Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Mon, 23 Jan 2006 15:26:27 +0100 Subject: [ALSA] hda-codec - add D975XBK support to sigmatel patch Modules: HDA Codec driver Add SigmaTel HDA support for the Intel D975XBK motherboard. Signed-off-by: Matt Porter Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4f78b58416a..f2f9465d4df 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -275,6 +275,9 @@ static struct hda_board_config stac922x_cfg_tbl[] = { { .pci_subvendor = PCI_VENDOR_ID_INTEL, .pci_subdevice = 0x0013, .config = STAC_D945GTP5 }, /* Intel D955XBK - 5 Stack */ + { .pci_subvendor = PCI_VENDOR_ID_INTEL, + .pci_subdevice = 0x0417, + .config = STAC_D945GTP5 }, /* Intel D975XBK - 5 Stack */ {} /* terminator */ }; -- cgit v1.2.3 From 3cc08dc6ea677ed4e843120aa070e145b6781a4b Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Mon, 23 Jan 2006 15:27:49 +0100 Subject: [ALSA] hda-codec - add sigmatel 927x codec support Modules: HDA Codec driver Adds support for the SigmaTel STAC927x HDA codec family. Signed-off-by: Matt Porter Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 149 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 142 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index f2f9465d4df..d5342d20bd8 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -50,10 +50,11 @@ struct sigmatel_spec { unsigned int surr_switch: 1; unsigned int line_switch: 1; unsigned int mic_switch: 1; + unsigned int alt_switch: 1; /* playback */ struct hda_multi_out multiout; - hda_nid_t dac_nids[4]; + hda_nid_t dac_nids[5]; /* capture */ hda_nid_t *adc_nids; @@ -73,7 +74,7 @@ struct sigmatel_spec { /* capture source */ struct hda_input_mux *input_mux; - unsigned int cur_mux[2]; + unsigned int cur_mux[3]; /* i/o switches */ unsigned int io_switch[2]; @@ -107,6 +108,14 @@ static hda_nid_t stac922x_mux_nids[2] = { 0x12, 0x13, }; +static hda_nid_t stac927x_adc_nids[3] = { + 0x07, 0x08, 0x09 +}; + +static hda_nid_t stac927x_mux_nids[3] = { + 0x15, 0x16, 0x17 +}; + static hda_nid_t stac9200_pin_nids[8] = { 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, }; @@ -116,6 +125,12 @@ static hda_nid_t stac922x_pin_nids[10] = { 0x0f, 0x10, 0x11, 0x15, 0x1b, }; +static hda_nid_t stac927x_pin_nids[14] = { + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, + 0x14, 0x21, 0x22, 0x23, +}; + static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); @@ -155,6 +170,12 @@ static struct hda_verb stac922x_core_init[] = { {} }; +static struct hda_verb stac927x_core_init[] = { + /* set master volume and direct control */ + { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, + {} +}; + static struct snd_kcontrol_new stac9200_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), @@ -188,6 +209,21 @@ static struct snd_kcontrol_new stac922x_mixer[] = { { } /* end */ }; +static snd_kcontrol_new_t stac927x_mixer[] = { + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Input Source", + .count = 1, + .info = stac92xx_mux_enum_info, + .get = stac92xx_mux_enum_get, + .put = stac92xx_mux_enum_put, + }, + HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT), + { } /* end */ +}; + static int stac92xx_build_controls(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; @@ -281,6 +317,25 @@ static struct hda_board_config stac922x_cfg_tbl[] = { {} /* terminator */ }; +static unsigned int ref927x_pin_configs[14] = { + 0x01813122, 0x01a19021, 0x01014010, 0x01016011, + 0x01012012, 0x01011014, 0x40000100, 0x40000100, + 0x40000100, 0x40000100, 0x40000100, 0x01441030, + 0x01c41030, 0x40000100, +}; + +static unsigned int *stac927x_brd_tbl[] = { + ref927x_pin_configs, +}; + +static struct hda_board_config stac927x_cfg_tbl[] = { + { .modelname = "ref", + .pci_subvendor = PCI_VENDOR_ID_INTEL, + .pci_subdevice = 0x2668, /* DFI LanParty */ + .config = STAC_REF }, /* SigmaTel reference board */ + {} /* terminator */ +}; + static void stac92xx_set_config_regs(struct hda_codec *codec) { int i; @@ -412,11 +467,23 @@ static struct hda_pcm_stream stac92xx_pcm_analog_playback = { }, }; +static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { + .substreams = 1, + .channels_min = 2, + .channels_max = 2, + .nid = 0x06, /* NID to query formats and rates */ + .ops = { + .open = stac92xx_playback_pcm_open, + .prepare = stac92xx_playback_pcm_prepare, + .cleanup = stac92xx_playback_pcm_cleanup + }, +}; + static struct hda_pcm_stream stac92xx_pcm_analog_capture = { .substreams = 2, .channels_min = 2, .channels_max = 2, - .nid = 0x06, /* NID to query formats and rates */ + /* NID is set in stac92xx_build_pcms */ .ops = { .prepare = stac92xx_capture_pcm_prepare, .cleanup = stac92xx_capture_pcm_cleanup @@ -434,6 +501,14 @@ static int stac92xx_build_pcms(struct hda_codec *codec) info->name = "STAC92xx Analog"; info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; + info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; + + if (spec->alt_switch) { + codec->num_pcms++; + info++; + info->name = "STAC92xx Analog Alt"; + info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; + } if (spec->multiout.dig_out_nid || spec->dig_in_nid) { codec->num_pcms++; @@ -592,6 +667,16 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf return 0; } +/* + * XXX The line_out pin widget connection list may not be set to the + * desired DAC nid. This is the case on 927x where ports A and B can + * be routed to several DACs. + * + * This requires an analysis of the line-out/hp pin configuration + * to provide a best fit for pin/DAC configurations that are routable. + * For now, 927x DAC4 is not supported and 927x DAC1 output to ports + * A and B is not supported. + */ /* fill in the dac_nids table from the parsed pin configuration */ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct auto_pin_cfg *cfg) { @@ -757,7 +842,7 @@ static void stac92xx_auto_init_hp_out(struct hda_codec *codec) stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); } -static int stac922x_parse_auto_config(struct hda_codec *codec) +static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) { struct sigmatel_spec *spec = codec->spec; int err; @@ -781,11 +866,11 @@ static int stac922x_parse_auto_config(struct hda_codec *codec) spec->surr_switch = 1; if (spec->autocfg.dig_out_pin) { - spec->multiout.dig_out_nid = 0x08; + spec->multiout.dig_out_nid = dig_out; stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_out_pin, AC_PINCTL_OUT_EN); } if (spec->autocfg.dig_in_pin) { - spec->dig_in_nid = 0x09; + spec->dig_in_nid = dig_in; stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_in_pin, AC_PINCTL_IN_EN); } @@ -1000,7 +1085,47 @@ static int patch_stac922x(struct hda_codec *codec) spec->multiout.dac_nids = spec->dac_nids; - err = stac922x_parse_auto_config(codec); + err = stac92xx_parse_auto_config(codec, 0x08, 0x09); + if (err < 0) { + stac92xx_free(codec); + return err; + } + + codec->patch_ops = stac92xx_patch_ops; + + return 0; +} + +static int patch_stac927x(struct hda_codec *codec) +{ + struct sigmatel_spec *spec; + int err; + + spec = kzalloc(sizeof(*spec), GFP_KERNEL); + if (spec == NULL) + return -ENOMEM; + + codec->spec = spec; + spec->board_config = snd_hda_check_board_config(codec, stac927x_cfg_tbl); + if (spec->board_config < 0) + snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n"); + else { + spec->num_pins = 14; + spec->pin_nids = stac927x_pin_nids; + spec->pin_configs = stac927x_brd_tbl[spec->board_config]; + stac92xx_set_config_regs(codec); + } + + spec->adc_nids = stac927x_adc_nids; + spec->mux_nids = stac927x_mux_nids; + spec->num_muxes = 3; + + spec->init = stac927x_core_init; + spec->mixer = stac927x_mixer; + + spec->multiout.dac_nids = spec->dac_nids; + + err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); if (err < 0) { stac92xx_free(codec); return err; @@ -1022,5 +1147,15 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = { { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, + { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, + { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, + { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, + { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, + { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, + { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, + { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, + { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, + { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, + { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, {} /* terminator */ }; -- cgit v1.2.3 From 802c00f2f3700423df06a1149c23cd60dd59159c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Jan 2006 15:31:11 +0100 Subject: [ALSA] via82xx - Add dxs entry for P4M800/VIA8237R Modules: VIA82xx driver Added the dxs entry for P4M800/VIA8237R, reported by OGAWA Hirofumi Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 8d348f27f17..42374137119 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2359,6 +2359,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) { .subvendor = 0x1462, .subdevice = 0x7023, .action = VIA_DXS_NO_VRA }, /* MSI K8T Neo2-FI */ { .subvendor = 0x1462, .subdevice = 0x7120, .action = VIA_DXS_ENABLE }, /* MSI KT4V */ { .subvendor = 0x1462, .subdevice = 0x7142, .action = VIA_DXS_ENABLE }, /* MSI K8MM-V */ + { .subvendor = 0x1462, .subdevice = 0xb012, .action = VIA_DXS_SRC }, /* P4M800/VIA8237R */ { .subvendor = 0x147b, .subdevice = 0x1401, .action = VIA_DXS_ENABLE }, /* ABIT KD7(-RAID) */ { .subvendor = 0x147b, .subdevice = 0x1411, .action = VIA_DXS_ENABLE }, /* ABIT VA-20 */ { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ -- cgit v1.2.3 From ad0651f97a3f8c5982921cb57fbedc877279e03d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 24 Jan 2006 10:34:34 +0100 Subject: [ALSA] hda-codec - Fix max_channels computation for STAC92xx codecs Modules: HDA Codec driver Fix max_channels computation for STAC92xx codecs in the case only HP pin without line-out pins is detected in the default pin config. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d5342d20bd8..f7892a5b775 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -691,7 +691,13 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct aut AC_VERB_GET_CONNECT_LIST, 0) & 0xff; } - spec->multiout.num_dacs = cfg->line_outs; + if (cfg->line_outs) + spec->multiout.num_dacs = cfg->line_outs; + else if (cfg->hp_pin) { + spec->multiout.dac_nids[0] = snd_hda_codec_read(codec, cfg->hp_pin, 0, + AC_VERB_GET_CONNECT_LIST, 0) & 0xff; + spec->multiout.num_dacs = 1; + } return 0; } -- cgit v1.2.3 From fd56f2db9385a651d31fe86eb4cc6cacbb0c5a63 Mon Sep 17 00:00:00 2001 From: Jonathan Woithe Date: Tue, 24 Jan 2006 10:35:46 +0100 Subject: [ALSA] hda-codec - Fix init verb of ALC260 Modules: HDA Codec driver Fixed the wrong widget id for line-2 selector in the init verb of ALC260. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 543980d89b8..043513b94b1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2475,7 +2475,7 @@ static struct hda_verb alc260_init_verbs[] = { /* LINE-2 is used for line-out in rear */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* select line-out */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, /* LINE-OUT pin */ {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* enable HP */ -- cgit v1.2.3 From 89ac9c256495cbdbe130be5ed192c8911c89ed87 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 24 Jan 2006 10:36:57 +0100 Subject: [ALSA] intel8x0 - Add MCP51 PCI ID Modules: Documentation,Intel8x0 driver Added MCP51 PCI ID to intel8x0 driver. Also, updated the supported chips in documentation. Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/ALSA-Configuration.txt | 10 +++++++++- sound/pci/intel8x0.c | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index d2578013e82..36b511c7cad 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt @@ -837,8 +837,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. Module for AC'97 motherboards from Intel and compatibles. * Intel i810/810E, i815, i820, i830, i84x, MX440 + ICH5, ICH6, ICH7, ESB2 * SiS 7012 (SiS 735) - * NVidia NForce, NForce2 + * NVidia NForce, NForce2, NForce3, MCP04, CK804 + CK8, CK8S, MCP501 * AMD AMD768, AMD8111 * ALi m5455 @@ -868,6 +870,12 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. -------------------- Module for Intel ICH (i8x0) chipset MC97 modems. + * Intel i810/810E, i815, i820, i830, i84x, MX440 + ICH5, ICH6, ICH7 + * SiS 7013 (SiS 735) + * NVidia NForce, NForce2, NForce2s, NForce3 + * AMD AMD8111 + * ALi m5455 ac97_clock - AC'97 codec clock base (0 = auto-detect) diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index b345894659b..174237f4a22 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -427,6 +427,7 @@ static struct pci_device_id snd_intel8x0_ids[] = { { 0x10de, 0x008a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* CK8 */ { 0x10de, 0x00da, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE3 */ { 0x10de, 0x00ea, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* CK8S */ + { 0x10de, 0x026b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* MCP51 */ { 0x1022, 0x746d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */ { 0x1022, 0x7445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD768 */ { 0x10b9, 0x5455, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALI }, /* Ali5455 */ -- cgit v1.2.3 From 1d79716ab07710465fa9fc1ae7328cc6095d2526 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Wed, 25 Jan 2006 14:30:44 +0100 Subject: [ALSA] Fix adding second dma channel Modules: OPL3SA2 driver,GUS Classic driver dma2 is a global array. sprintf below suggests there was a typo. Signed-off-by: Alexey Dobriyan Signed-off-by: Takashi Iwai --- sound/isa/gus/gusclassic.c | 2 +- sound/isa/opl3sa2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index d1165b96fa3..91c219116d7 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -195,7 +195,7 @@ static int __init snd_gusclassic_probe(struct platform_device *pdev) goto _err; } sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); - if (dma2 >= 0) + if (xdma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%d", xdma2); snd_card_set_dev(card, &pdev->dev); diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 9dc6b20e9a5..9d843197850 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -723,7 +723,7 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) } sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", card->shortname, chip->port, xirq, xdma1); - if (dma2 >= 0) + if (xdma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%d", xdma2); return snd_card_register(card); -- cgit v1.2.3 From 869264c45a6a77d73ec6caa543616a10a9dfd951 Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Wed, 25 Jan 2006 19:20:50 +0100 Subject: [ALSA] hda: sigmatel fixes Modules: HDA Codec driver * Fix init sequence so manually retaskable jacks don't get added to the line_out list. * Update intel mobo config defaults to specify surround outputs as line outs rather than speakers. Signed-off-by: Matt Porter Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index f7892a5b775..35c2823a0a2 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -277,14 +277,14 @@ static unsigned int ref922x_pin_configs[10] = { }; static unsigned int d945gtp3_pin_configs[10] = { - 0x0221401f, 0x01a19022, 0x01813021, 0x01114010, + 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, 0x40000100, 0x40000100, 0x40000100, 0x40000100, 0x02a19120, 0x40000100, }; static unsigned int d945gtp5_pin_configs[10] = { - 0x0221401f, 0x01111012, 0x01813024, 0x01114010, - 0x01a19021, 0x01116011, 0x01452130, 0x40000100, + 0x0221401f, 0x01011012, 0x01813024, 0x01014010, + 0x01a19021, 0x01016011, 0x01452130, 0x40000100, 0x02a19320, 0x40000100, }; @@ -855,12 +855,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) return err; + if (! spec->autocfg.line_outs && ! spec->autocfg.hp_pin) + return 0; /* can't find valid pin config */ + stac92xx_auto_init_multi_out(codec); + stac92xx_auto_init_hp_out(codec); if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) return err; if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) return err; - if (! spec->autocfg.line_outs && ! spec->autocfg.hp_pin) - return 0; /* can't find valid pin config */ if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 || @@ -922,9 +924,6 @@ static int stac92xx_init(struct hda_codec *codec) snd_hda_sequence_write(codec, spec->init); - stac92xx_auto_init_multi_out(codec); - stac92xx_auto_init_hp_out(codec); - return 0; } -- cgit v1.2.3 From 44275f18ec22a31980469567052e932d1023971f Mon Sep 17 00:00:00 2001 From: Giuliano Pochini Date: Fri, 27 Jan 2006 12:02:05 +0100 Subject: [ALSA] fix typos in writing-an-alsa-driver Modules: Documentation Fixed typos in writing-an-alsa-driver document. Signed-off-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index e651ed8d1e6..4251085d38d 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl @@ -5206,14 +5206,14 @@ struct _snd_pcm_runtime { You need to pass the snd_dma_pci_data(pci), where pci is the struct pci_dev pointer of the chip as well. - The snd_sg_buf_t instance is created as + The struct snd_sg_buf instance is created as substream->dma_private. You can cast the pointer like: dma_private; + struct snd_sg_buf *sgbuf = (struct snd_sg_buf *)substream->dma_private; ]]> -- cgit v1.2.3 From bae2bdb334c1ca5f4721e4fab1ca947f44455117 Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Fri, 27 Jan 2006 12:05:02 +0100 Subject: [ALSA] patch_realtek.c: Add new model Modules: HDA Codec driver This little patch add the model for the motherboard K8N51 from Gigabyte to the known models of ALC boards. Signed-off-by: Arnaud Patard Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 043513b94b1..906263e620a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1668,6 +1668,7 @@ static struct hda_board_config alc880_cfg_tbl[] = { { .pci_subvendor = 0x1043, .pci_subdevice = 0x8196, .config = ALC880_6ST }, /* ASUS P5GD1-HVM */ { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b4, .config = ALC880_6ST }, { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_6ST }, /* Acer APFV */ + { .pci_subvendor = 0x1458, .pci_subdevice = 0xa102, .config = ALC880_6ST }, /* Gigabyte K8N51 */ { .modelname = "6stack-digout", .config = ALC880_6ST_DIG }, { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, -- cgit v1.2.3 From 1494a92f4c2b1d5abdaa1f823dd19f797bb137de Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 31 Jan 2006 10:58:46 +0100 Subject: [ALSA] hda-codec - Fix typos in alc882 model table Modules: HDA Codec driver Fixed typos in alc882 model table. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 906263e620a..b7675526473 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3417,12 +3417,12 @@ static struct snd_kcontrol_new alc882_capture_mixer[] = { * configuration and preset */ static struct hda_board_config alc882_cfg_tbl[] = { - { .modelname = "3stack-dig", .config = ALC861_3ST_DIG }, - { .modelname = "6stack-dig", .config = ALC861_6ST_DIG }, + { .modelname = "3stack-dig", .config = ALC882_3ST_DIG }, + { .modelname = "6stack-dig", .config = ALC882_6ST_DIG }, { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, .config = ALC882_6ST_DIG }, /* MSI */ { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, .config = ALC882_6ST_DIG }, /* Foxconn */ { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, .config = ALC882_6ST_DIG }, /* ECS */ - { .modelname = "auto", .config = ALC861_AUTO }, + { .modelname = "auto", .config = ALC882_AUTO }, {} }; -- cgit v1.2.3 From f9bdfa0ecb3304e8b7e74862b1f4b03b6feaaeef Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Wed, 1 Feb 2006 18:19:06 -0600 Subject: [PATCH] PowerPC/PCI Hotplug build break Build break: Building PCI hotplug on PowerPC results in a build break, due to failure to export symbols. Reported today by Dave Jones : drivers/pci/hotplug/rpaphp.ko needs unknown symbol pcibios_add_pci_devices This patch fixes the break in the arch/powerpc tree. Next patch fixes same problem in drivers/pci tree Signed-off-by: Linas Vepstas Signed-off-by: Linus Torvalds --- arch/powerpc/platforms/pseries/pci_dlpar.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index 21934784f93..bdaa8aabdaa 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c @@ -58,6 +58,7 @@ pcibios_find_pci_bus(struct device_node *dn) return find_bus_among_children(pdn->phb->bus, dn); } +EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); /** * pcibios_remove_pci_devices - remove all devices under this bus @@ -106,6 +107,7 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) } } } +EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices); static int pcibios_pci_config_bridge(struct pci_dev *dev) @@ -172,3 +174,4 @@ pcibios_add_pci_devices(struct pci_bus * bus) pcibios_pci_config_bridge(dev); } } +EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); -- cgit v1.2.3 From 61ee9cd5f2e76859222c1d64394ae633f9080163 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Wed, 1 Feb 2006 18:21:09 -0600 Subject: [PATCH] PowerPC/PCI Hotplug build break Build break: Building PCI hotplug on PowerPC results in a build break, due to failure to export symbols. Reported today by Dave Jones : drivers/pci/hotplug/rpaphp.ko needs unknown symbol pcibios_add_pci_devices This patch fixes same problem in drivers/pci tree Previous patch fixes the break in the arch/powerpc tree. Signed-off-by: Linas Vepstas Signed-off-by: Linus Torvalds --- drivers/pci/hotplug/rpaphp_slot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 04cc1e7275c..78943e064b5 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c @@ -159,6 +159,7 @@ int rpaphp_deregister_slot(struct slot *slot) dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); return retval; } +EXPORT_SYMBOL_GPL(rpaphp_deregister_slot); int rpaphp_register_slot(struct slot *slot) { -- cgit v1.2.3 From 9ad11ab48b1ad618bf47076e9e579f267f5306c2 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 2 Feb 2006 16:11:51 +1100 Subject: [PATCH] compat: fix compat_sys_openat and friends Most of the 64 bit architectures will zero extend the first argument to compat_sys_{openat,newfstatat,futimesat} which will fail if the 32 bit syscall was passed AT_FDCWD (which is a small negative number). Declare the first argument to be an unsigned int which will force the correct sign extension when the internal functions are called in each case. Also, do some small white space cleanups in fs/compat.c. Signed-off-by: Stephen Rothwell Acked-by: David S. Miller Signed-off-by: Linus Torvalds --- fs/compat.c | 12 ++++++------ include/linux/syscalls.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/compat.c b/fs/compat.c index cc58a20df57..70c5af4cc27 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -73,17 +73,17 @@ asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __ return do_utimes(AT_FDCWD, filename, t ? tv : NULL); } -asmlinkage long compat_sys_futimesat(int dfd, char __user *filename, struct compat_timeval __user *t) +asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, struct compat_timeval __user *t) { struct timeval tv[2]; - if (t) { + if (t) { if (get_user(tv[0].tv_sec, &t[0].tv_sec) || get_user(tv[0].tv_usec, &t[0].tv_usec) || get_user(tv[1].tv_sec, &t[1].tv_sec) || get_user(tv[1].tv_usec, &t[1].tv_usec)) - return -EFAULT; - } + return -EFAULT; + } return do_utimes(dfd, filename, t ? tv : NULL); } @@ -114,7 +114,7 @@ asmlinkage long compat_sys_newlstat(char __user * filename, return error; } -asmlinkage long compat_sys_newfstatat(int dfd, char __user *filename, +asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename, struct compat_stat __user *statbuf, int flag) { struct kstat stat; @@ -1326,7 +1326,7 @@ compat_sys_open(const char __user *filename, int flags, int mode) * O_LARGEFILE flag. */ asmlinkage long -compat_sys_openat(int dfd, const char __user *filename, int flags, int mode) +compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode) { return do_sys_open(dfd, filename, flags, mode); } diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index fdbd436b24c..3877209d23c 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -559,12 +559,12 @@ asmlinkage long sys_newfstatat(int dfd, char __user *filename, struct stat __user *statbuf, int flag); asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf, int bufsiz); -asmlinkage long compat_sys_futimesat(int dfd, char __user *filename, +asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, struct compat_timeval __user *t); -asmlinkage long compat_sys_newfstatat(int dfd, char __user * filename, +asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, struct compat_stat __user *statbuf, int flag); -asmlinkage long compat_sys_openat(int dfd, const char __user *filename, +asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode); #endif -- cgit v1.2.3 From ce60fe02fbe737cbce09e2ba5a2ef1efd20eff73 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Feb 2006 19:21:38 +1100 Subject: drm: drivers/char/drm/: make some functions static From: Adrian Bunk This patch makes some needlessly global functions static. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Dave Airlie --- drivers/char/drm/i810_dma.c | 2 +- drivers/char/drm/i810_drv.h | 2 -- drivers/char/drm/i830_dma.c | 2 +- drivers/char/drm/i830_drv.h | 3 --- drivers/char/drm/savage_bci.c | 4 +++- drivers/char/drm/savage_drv.h | 1 - drivers/char/drm/via_dma.c | 10 +++++----- drivers/char/drm/via_dmablit.c | 2 +- drivers/char/drm/via_drv.h | 7 ------- drivers/char/drm/via_irq.c | 2 +- 10 files changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c index cc1b8908687..ae0aa6d7e0b 100644 --- a/drivers/char/drm/i810_dma.c +++ b/drivers/char/drm/i810_dma.c @@ -958,7 +958,7 @@ static int i810_flush_queue(drm_device_t * dev) } /* Must be called with the lock held */ -void i810_reclaim_buffers(drm_device_t * dev, struct file *filp) +static void i810_reclaim_buffers(drm_device_t * dev, struct file *filp) { drm_device_dma_t *dma = dev->dma; int i; diff --git a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h index a18b80d9192..e8cf3ff606f 100644 --- a/drivers/char/drm/i810_drv.h +++ b/drivers/char/drm/i810_drv.h @@ -113,8 +113,6 @@ typedef struct drm_i810_private { } drm_i810_private_t; /* i810_dma.c */ -extern void i810_reclaim_buffers(drm_device_t * dev, struct file *filp); - extern int i810_driver_dma_quiescent(drm_device_t * dev); extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp); diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c index 4fea32aed6d..163f2cbfe60 100644 --- a/drivers/char/drm/i830_dma.c +++ b/drivers/char/drm/i830_dma.c @@ -1239,7 +1239,7 @@ static int i830_flush_queue(drm_device_t * dev) } /* Must be called with the lock held */ -void i830_reclaim_buffers(drm_device_t * dev, struct file *filp) +static void i830_reclaim_buffers(drm_device_t * dev, struct file *filp) { drm_device_dma_t *dma = dev->dma; int i; diff --git a/drivers/char/drm/i830_drv.h b/drivers/char/drm/i830_drv.h index bf9075b576b..85bc5be6f91 100644 --- a/drivers/char/drm/i830_drv.h +++ b/drivers/char/drm/i830_drv.h @@ -123,9 +123,6 @@ typedef struct drm_i830_private { extern drm_ioctl_desc_t i830_ioctls[]; extern int i830_max_ioctl; -/* i830_dma.c */ -extern void i830_reclaim_buffers(drm_device_t * dev, struct file *filp); - /* i830_irq.c */ extern int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 0d426deeefe..59c7520bf9a 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c @@ -32,6 +32,8 @@ #define SAVAGE_EVENT_USEC_TIMEOUT 5000000 /* 5s */ #define SAVAGE_FREELIST_DEBUG 0 +static int savage_do_cleanup_bci(drm_device_t *dev); + static int savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n) { @@ -895,7 +897,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init) return 0; } -int savage_do_cleanup_bci(drm_device_t * dev) +static int savage_do_cleanup_bci(drm_device_t * dev) { drm_savage_private_t *dev_priv = dev->dev_private; diff --git a/drivers/char/drm/savage_drv.h b/drivers/char/drm/savage_drv.h index dd46cb85439..8f04b3d8229 100644 --- a/drivers/char/drm/savage_drv.h +++ b/drivers/char/drm/savage_drv.h @@ -212,7 +212,6 @@ extern int savage_driver_load(drm_device_t *dev, unsigned long chipset); extern int savage_driver_firstopen(drm_device_t *dev); extern void savage_driver_lastclose(drm_device_t *dev); extern int savage_driver_unload(drm_device_t *dev); -extern int savage_do_cleanup_bci(drm_device_t * dev); extern void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp); /* state functions */ diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c index 593c0b8f650..a691ae74129 100644 --- a/drivers/char/drm/via_dma.c +++ b/drivers/char/drm/via_dma.c @@ -222,7 +222,7 @@ static int via_initialize(drm_device_t * dev, return 0; } -int via_dma_init(DRM_IOCTL_ARGS) +static int via_dma_init(DRM_IOCTL_ARGS) { DRM_DEVICE; drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; @@ -321,7 +321,7 @@ int via_driver_dma_quiescent(drm_device_t * dev) return 0; } -int via_flush_ioctl(DRM_IOCTL_ARGS) +static int via_flush_ioctl(DRM_IOCTL_ARGS) { DRM_DEVICE; @@ -330,7 +330,7 @@ int via_flush_ioctl(DRM_IOCTL_ARGS) return via_driver_dma_quiescent(dev); } -int via_cmdbuffer(DRM_IOCTL_ARGS) +static int via_cmdbuffer(DRM_IOCTL_ARGS) { DRM_DEVICE; drm_via_cmdbuffer_t cmdbuf; @@ -375,7 +375,7 @@ static int via_dispatch_pci_cmdbuffer(drm_device_t * dev, return ret; } -int via_pci_cmdbuffer(DRM_IOCTL_ARGS) +static int via_pci_cmdbuffer(DRM_IOCTL_ARGS) { DRM_DEVICE; drm_via_cmdbuffer_t cmdbuf; @@ -665,7 +665,7 @@ static void via_cmdbuf_reset(drm_via_private_t * dev_priv) * User interface to the space and lag functions. */ -int via_cmdbuf_size(DRM_IOCTL_ARGS) +static int via_cmdbuf_size(DRM_IOCTL_ARGS) { DRM_DEVICE; drm_via_cmdbuf_size_t d_siz; diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index a28eece6281..b7f17457b42 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c @@ -167,7 +167,7 @@ via_map_blit_for_device(struct pci_dev *pdev, */ -void +static void via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg) { struct page *page; diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h index aad4f99f540..52bcc7b1ba4 100644 --- a/drivers/char/drm/via_drv.h +++ b/drivers/char/drm/via_drv.h @@ -110,11 +110,6 @@ extern int via_mem_free(DRM_IOCTL_ARGS); extern int via_agp_init(DRM_IOCTL_ARGS); extern int via_map_init(DRM_IOCTL_ARGS); extern int via_decoder_futex(DRM_IOCTL_ARGS); -extern int via_dma_init(DRM_IOCTL_ARGS); -extern int via_cmdbuffer(DRM_IOCTL_ARGS); -extern int via_flush_ioctl(DRM_IOCTL_ARGS); -extern int via_pci_cmdbuffer(DRM_IOCTL_ARGS); -extern int via_cmdbuf_size(DRM_IOCTL_ARGS); extern int via_wait_irq(DRM_IOCTL_ARGS); extern int via_dma_blit_sync( DRM_IOCTL_ARGS ); extern int via_dma_blit( DRM_IOCTL_ARGS ); @@ -139,8 +134,6 @@ extern int via_driver_dma_quiescent(drm_device_t * dev); extern void via_init_futex(drm_via_private_t * dev_priv); extern void via_cleanup_futex(drm_via_private_t * dev_priv); extern void via_release_futex(drm_via_private_t * dev_priv, int context); -extern int via_driver_irq_wait(drm_device_t * dev, unsigned int irq, - int force_sequence, unsigned int *sequence); extern void via_dmablit_handler(drm_device_t *dev, int engine, int from_irq); extern void via_init_dmablit(drm_device_t *dev); diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c index 56d7e3daea1..6152415644e 100644 --- a/drivers/char/drm/via_irq.c +++ b/drivers/char/drm/via_irq.c @@ -190,7 +190,7 @@ int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) return ret; } -int +static int via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, unsigned int *sequence) { -- cgit v1.2.3 From 30e2fb188194908e48d3f27a53ccea6740eb1e98 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Feb 2006 19:37:46 +1100 Subject: sem2mutex: drivers/char/drm/ From: Arjan van de Ven Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 5 +-- drivers/char/drm/drm_auth.c | 20 +++++------ drivers/char/drm/drm_bufs.c | 80 +++++++++++++++++++++--------------------- drivers/char/drm/drm_context.c | 52 +++++++++++++-------------- drivers/char/drm/drm_drv.c | 4 +-- drivers/char/drm/drm_fops.c | 12 +++---- drivers/char/drm/drm_ioctl.c | 18 +++++----- drivers/char/drm/drm_irq.c | 16 ++++----- drivers/char/drm/drm_proc.c | 28 +++++++-------- drivers/char/drm/drm_stub.c | 4 +-- drivers/char/drm/drm_vm.c | 12 +++---- 11 files changed, 126 insertions(+), 125 deletions(-) diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 54b561e6948..71b8b32b075 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -57,6 +57,7 @@ #include /* For (un)lock_kernel */ #include #include +#include #if defined(__alpha__) || defined(__powerpc__) #include /* For pte_wrprotect */ #endif @@ -623,7 +624,7 @@ typedef struct drm_device { /** \name Locks */ /*@{ */ spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ - struct semaphore struct_sem; /**< For others */ + struct mutex struct_mutex; /**< For others */ /*@} */ /** \name Usage Counters */ @@ -658,7 +659,7 @@ typedef struct drm_device { /*@{ */ drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ int ctx_count; /**< Number of context handles */ - struct semaphore ctxlist_sem; /**< For ctxlist */ + struct mutex ctxlist_mutex; /**< For ctxlist */ drm_map_t **context_sareas; /**< per-context SAREA's */ int max_context; diff --git a/drivers/char/drm/drm_auth.c b/drivers/char/drm/drm_auth.c index a47b502bc7c..2a37586a7ee 100644 --- a/drivers/char/drm/drm_auth.c +++ b/drivers/char/drm/drm_auth.c @@ -56,7 +56,7 @@ static int drm_hash_magic(drm_magic_t magic) * \param magic magic number. * * Searches in drm_device::magiclist within all files with the same hash key - * the one with matching magic number, while holding the drm_device::struct_sem + * the one with matching magic number, while holding the drm_device::struct_mutex * lock. */ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) @@ -65,14 +65,14 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) drm_magic_entry_t *pt; int hash = drm_hash_magic(magic); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { if (pt->magic == magic) { retval = pt->priv; break; } } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return retval; } @@ -85,7 +85,7 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) * * Creates a drm_magic_entry structure and appends to the linked list * associated the magic number hash key in drm_device::magiclist, while holding - * the drm_device::struct_sem lock. + * the drm_device::struct_mutex lock. */ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, drm_magic_t magic) @@ -104,7 +104,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, entry->priv = priv; entry->next = NULL; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (dev->magiclist[hash].tail) { dev->magiclist[hash].tail->next = entry; dev->magiclist[hash].tail = entry; @@ -112,7 +112,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, dev->magiclist[hash].head = entry; dev->magiclist[hash].tail = entry; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return 0; } @@ -124,7 +124,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, * \param magic magic number. * * Searches and unlinks the entry in drm_device::magiclist with the magic - * number hash key, while holding the drm_device::struct_sem lock. + * number hash key, while holding the drm_device::struct_mutex lock. */ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) { @@ -135,7 +135,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) DRM_DEBUG("%d\n", magic); hash = drm_hash_magic(magic); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { if (pt->magic == magic) { if (dev->magiclist[hash].head == pt) { @@ -147,11 +147,11 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) if (prev) { prev->next = pt->next; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return 0; } } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 1db12dcb680..e2637b4d51d 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c @@ -255,14 +255,14 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, memset(list, 0, sizeof(*list)); list->map = map; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); list_add(&list->head, &dev->maplist->head); /* Assign a 32-bit handle */ - /* We do it here so that dev->struct_sem protects the increment */ + /* We do it here so that dev->struct_mutex protects the increment */ list->user_token = HandleID(map->type == _DRM_SHM ? (unsigned long)map->handle : map->offset, dev); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); *maplist = list; return 0; @@ -392,9 +392,9 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) { int ret; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); ret = drm_rmmap_locked(dev, map); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -423,7 +423,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, return -EFAULT; } - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); list_for_each(list, &dev->maplist->head) { drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head); @@ -439,7 +439,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, * find anything. */ if (list == (&dev->maplist->head)) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } @@ -448,13 +448,13 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, /* Register and framebuffer maps are permanent */ if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return 0; } ret = drm_rmmap_locked(dev, map); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -566,16 +566,16 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) atomic_inc(&dev->buf_alloc); spin_unlock(&dev->count_lock); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); entry = &dma->bufs[order]; if (entry->buf_count) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; /* May only call once for each order */ } if (count < 0 || count > 4096) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -EINVAL; } @@ -583,7 +583,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) entry->buflist = drm_alloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS); if (!entry->buflist) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -616,7 +616,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) /* Set count correctly so we free the proper amount. */ entry->buf_count = count; drm_cleanup_buf_error(dev, entry); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -638,7 +638,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -656,7 +656,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); request->count = entry->buf_count; request->size = size; @@ -722,16 +722,16 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) atomic_inc(&dev->buf_alloc); spin_unlock(&dev->count_lock); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); entry = &dma->bufs[order]; if (entry->buf_count) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; /* May only call once for each order */ } if (count < 0 || count > 4096) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -EINVAL; } @@ -739,7 +739,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) entry->buflist = drm_alloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS); if (!entry->buflist) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -750,7 +750,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) if (!entry->seglist) { drm_free(entry->buflist, count * sizeof(*entry->buflist), DRM_MEM_BUFS); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -766,7 +766,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) count * sizeof(*entry->buflist), DRM_MEM_BUFS); drm_free(entry->seglist, count * sizeof(*entry->seglist), DRM_MEM_SEGS); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -790,7 +790,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) drm_free(temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), DRM_MEM_PAGES); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -831,7 +831,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) (count << page_order)) * sizeof(*dma->pagelist), DRM_MEM_PAGES); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -853,7 +853,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) drm_free(temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), DRM_MEM_PAGES); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -878,7 +878,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) dma->page_count += entry->seg_count << page_order; dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); request->count = entry->buf_count; request->size = size; @@ -948,16 +948,16 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) atomic_inc(&dev->buf_alloc); spin_unlock(&dev->count_lock); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); entry = &dma->bufs[order]; if (entry->buf_count) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; /* May only call once for each order */ } if (count < 0 || count > 4096) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -EINVAL; } @@ -965,7 +965,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) entry->buflist = drm_alloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS); if (!entry->buflist) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -999,7 +999,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) /* Set count correctly so we free the proper amount. */ entry->buf_count = count; drm_cleanup_buf_error(dev, entry); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -1022,7 +1022,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -1040,7 +1040,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); request->count = entry->buf_count; request->size = size; @@ -1110,16 +1110,16 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) atomic_inc(&dev->buf_alloc); spin_unlock(&dev->count_lock); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); entry = &dma->bufs[order]; if (entry->buf_count) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; /* May only call once for each order */ } if (count < 0 || count > 4096) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -EINVAL; } @@ -1127,7 +1127,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) entry->buflist = drm_alloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS); if (!entry->buflist) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -1160,7 +1160,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) /* Set count correctly so we free the proper amount. */ entry->buf_count = count; drm_cleanup_buf_error(dev, entry); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -1182,7 +1182,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } @@ -1200,7 +1200,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); request->count = entry->buf_count; request->size = size; diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index f8425452694..83094c73da6 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c @@ -53,7 +53,7 @@ * \param ctx_handle context handle. * * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and the entry - * in drm_device::context_sareas, while holding the drm_device::struct_sem + * in drm_device::context_sareas, while holding the drm_device::struct_mutex * lock. */ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) @@ -64,10 +64,10 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) goto failed; if (ctx_handle < DRM_MAX_CTXBITMAP) { - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); clear_bit(ctx_handle, dev->ctx_bitmap); dev->context_sareas[ctx_handle] = NULL; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return; } failed: @@ -83,7 +83,7 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) * * Find the first zero bit in drm_device::ctx_bitmap and (re)allocates * drm_device::context_sareas to accommodate the new entry while holding the - * drm_device::struct_sem lock. + * drm_device::struct_mutex lock. */ static int drm_ctxbitmap_next(drm_device_t * dev) { @@ -92,7 +92,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev) if (!dev->ctx_bitmap) return -1; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP); if (bit < DRM_MAX_CTXBITMAP) { set_bit(bit, dev->ctx_bitmap); @@ -113,7 +113,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev) DRM_MEM_MAPS); if (!ctx_sareas) { clear_bit(bit, dev->ctx_bitmap); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -1; } dev->context_sareas = ctx_sareas; @@ -126,16 +126,16 @@ static int drm_ctxbitmap_next(drm_device_t * dev) DRM_MEM_MAPS); if (!dev->context_sareas) { clear_bit(bit, dev->ctx_bitmap); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -1; } dev->context_sareas[bit] = NULL; } } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return bit; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -1; } @@ -145,24 +145,24 @@ static int drm_ctxbitmap_next(drm_device_t * dev) * \param dev DRM device. * * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding - * the drm_device::struct_sem lock. + * the drm_device::struct_mutex lock. */ int drm_ctxbitmap_init(drm_device_t * dev) { int i; int temp; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); dev->ctx_bitmap = (unsigned long *)drm_alloc(PAGE_SIZE, DRM_MEM_CTXBITMAP); if (dev->ctx_bitmap == NULL) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -ENOMEM; } memset((void *)dev->ctx_bitmap, 0, PAGE_SIZE); dev->context_sareas = NULL; dev->max_context = -1; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { temp = drm_ctxbitmap_next(dev); @@ -178,17 +178,17 @@ int drm_ctxbitmap_init(drm_device_t * dev) * \param dev DRM device. * * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding - * the drm_device::struct_sem lock. + * the drm_device::struct_mutex lock. */ void drm_ctxbitmap_cleanup(drm_device_t * dev) { - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (dev->context_sareas) drm_free(dev->context_sareas, sizeof(*dev->context_sareas) * dev->max_context, DRM_MEM_MAPS); drm_free((void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); } /*@}*/ @@ -222,15 +222,15 @@ int drm_getsareactx(struct inode *inode, struct file *filp, if (copy_from_user(&request, argp, sizeof(request))) return -EFAULT; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (dev->max_context < 0 || request.ctx_id >= (unsigned)dev->max_context) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } map = dev->context_sareas[request.ctx_id]; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); request.handle = NULL; list_for_each_entry(_entry, &dev->maplist->head, head) { @@ -274,7 +274,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, (drm_ctx_priv_map_t __user *) arg, sizeof(request))) return -EFAULT; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); list_for_each(list, &dev->maplist->head) { r_list = list_entry(list, drm_map_list_t, head); if (r_list->map @@ -282,7 +282,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, goto found; } bad: - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; found: @@ -294,7 +294,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, if (request.ctx_id >= (unsigned)dev->max_context) goto bad; dev->context_sareas[request.ctx_id] = map; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return 0; } @@ -448,10 +448,10 @@ int drm_addctx(struct inode *inode, struct file *filp, ctx_entry->handle = ctx.handle; ctx_entry->tag = priv; - down(&dev->ctxlist_sem); + mutex_lock(&dev->ctxlist_mutex); list_add(&ctx_entry->head, &dev->ctxlist->head); ++dev->ctx_count; - up(&dev->ctxlist_sem); + mutex_unlock(&dev->ctxlist_mutex); if (copy_to_user(argp, &ctx, sizeof(ctx))) return -EFAULT; @@ -574,7 +574,7 @@ int drm_rmctx(struct inode *inode, struct file *filp, drm_ctxbitmap_free(dev, ctx.handle); } - down(&dev->ctxlist_sem); + mutex_lock(&dev->ctxlist_mutex); if (!list_empty(&dev->ctxlist->head)) { drm_ctx_list_t *pos, *n; @@ -586,7 +586,7 @@ int drm_rmctx(struct inode *inode, struct file *filp, } } } - up(&dev->ctxlist_sem); + mutex_unlock(&dev->ctxlist_mutex); return 0; } diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index c4fa5a29582..dc6bbe8a18d 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c @@ -151,7 +151,7 @@ int drm_lastclose(drm_device_t * dev) if (dev->irq_enabled) drm_irq_uninstall(dev); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); del_timer(&dev->timer); /* Clear pid list */ @@ -231,7 +231,7 @@ int drm_lastclose(drm_device_t * dev) dev->lock.filp = NULL; wake_up_interruptible(&dev->lock.lock_queue); } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); DRM_DEBUG("lastclose completed\n"); return 0; diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 403f44a1bf0..641f7633878 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c @@ -262,7 +262,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, goto out_free; } - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (!dev->file_last) { priv->next = NULL; priv->prev = NULL; @@ -276,7 +276,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, dev->file_last->next = priv; dev->file_last = priv; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); #ifdef __alpha__ /* @@ -413,7 +413,7 @@ int drm_release(struct inode *inode, struct file *filp) drm_fasync(-1, filp, 0); - down(&dev->ctxlist_sem); + mutex_lock(&dev->ctxlist_mutex); if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) { drm_ctx_list_t *pos, *n; @@ -432,9 +432,9 @@ int drm_release(struct inode *inode, struct file *filp) } } } - up(&dev->ctxlist_sem); + mutex_unlock(&dev->ctxlist_mutex); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (priv->remove_auth_on_close == 1) { drm_file_t *temp = dev->file_first; while (temp) { @@ -452,7 +452,7 @@ int drm_release(struct inode *inode, struct file *filp) } else { dev->file_last = priv->prev; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (dev->driver->postclose) dev->driver->postclose(dev, priv); diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index bcd4e604d3e..555f323b8a3 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c @@ -194,9 +194,9 @@ int drm_getmap(struct inode *inode, struct file *filp, return -EFAULT; idx = map.offset; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (idx < 0) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } @@ -209,7 +209,7 @@ int drm_getmap(struct inode *inode, struct file *filp, i++; } if (!r_list || !r_list->map) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } @@ -219,7 +219,7 @@ int drm_getmap(struct inode *inode, struct file *filp, map.flags = r_list->map->flags; map.handle = (void *)(unsigned long)r_list->user_token; map.mtrr = r_list->map->mtrr; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (copy_to_user(argp, &map, sizeof(map))) return -EFAULT; @@ -253,11 +253,11 @@ int drm_getclient(struct inode *inode, struct file *filp, if (copy_from_user(&client, argp, sizeof(client))) return -EFAULT; idx = client.idx; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ; if (!pt) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } client.auth = pt->authenticated; @@ -265,7 +265,7 @@ int drm_getclient(struct inode *inode, struct file *filp, client.uid = pt->uid; client.magic = pt->magic; client.iocs = pt->ioctl_count; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (copy_to_user(argp, &client, sizeof(client))) return -EFAULT; @@ -292,7 +292,7 @@ int drm_getstats(struct inode *inode, struct file *filp, memset(&stats, 0, sizeof(stats)); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (i = 0; i < dev->counters; i++) { if (dev->types[i] == _DRM_STAT_LOCK) @@ -305,7 +305,7 @@ int drm_getstats(struct inode *inode, struct file *filp, stats.count = dev->counters; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats))) return -EFAULT; diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c index b0d4b236e83..611a1173091 100644 --- a/drivers/char/drm/drm_irq.c +++ b/drivers/char/drm/drm_irq.c @@ -98,20 +98,20 @@ static int drm_irq_install(drm_device_t * dev) if (dev->irq == 0) return -EINVAL; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); /* Driver must have been initialized */ if (!dev->dev_private) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } if (dev->irq_enabled) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EBUSY; } dev->irq_enabled = 1; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); @@ -135,9 +135,9 @@ static int drm_irq_install(drm_device_t * dev) ret = request_irq(dev->irq, dev->driver->irq_handler, sh_flags, dev->devname, dev); if (ret < 0) { - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); dev->irq_enabled = 0; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -161,10 +161,10 @@ int drm_irq_uninstall(drm_device_t * dev) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return -EINVAL; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); irq_enabled = dev->irq_enabled; dev->irq_enabled = 0; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (!irq_enabled) return -EINVAL; diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c index 6f943e3309e..362a270af0f 100644 --- a/drivers/char/drm/drm_proc.c +++ b/drivers/char/drm/drm_proc.c @@ -258,7 +258,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, } /** - * Simply calls _vm_info() while holding the drm_device::struct_sem lock. + * Simply calls _vm_info() while holding the drm_device::struct_mutex lock. */ static int drm_vm_info(char *buf, char **start, off_t offset, int request, int *eof, void *data) @@ -266,9 +266,9 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request, drm_device_t *dev = (drm_device_t *) data; int ret; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); ret = drm__vm_info(buf, start, offset, request, eof, data); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -331,7 +331,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset, } /** - * Simply calls _queues_info() while holding the drm_device::struct_sem lock. + * Simply calls _queues_info() while holding the drm_device::struct_mutex lock. */ static int drm_queues_info(char *buf, char **start, off_t offset, int request, int *eof, void *data) @@ -339,9 +339,9 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request, drm_device_t *dev = (drm_device_t *) data; int ret; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); ret = drm__queues_info(buf, start, offset, request, eof, data); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -403,7 +403,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request, } /** - * Simply calls _bufs_info() while holding the drm_device::struct_sem lock. + * Simply calls _bufs_info() while holding the drm_device::struct_mutex lock. */ static int drm_bufs_info(char *buf, char **start, off_t offset, int request, int *eof, void *data) @@ -411,9 +411,9 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request, drm_device_t *dev = (drm_device_t *) data; int ret; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); ret = drm__bufs_info(buf, start, offset, request, eof, data); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -459,7 +459,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset, } /** - * Simply calls _clients_info() while holding the drm_device::struct_sem lock. + * Simply calls _clients_info() while holding the drm_device::struct_mutex lock. */ static int drm_clients_info(char *buf, char **start, off_t offset, int request, int *eof, void *data) @@ -467,9 +467,9 @@ static int drm_clients_info(char *buf, char **start, off_t offset, drm_device_t *dev = (drm_device_t *) data; int ret; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); ret = drm__clients_info(buf, start, offset, request, eof, data); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } @@ -540,9 +540,9 @@ static int drm_vma_info(char *buf, char **start, off_t offset, int request, drm_device_t *dev = (drm_device_t *) data; int ret; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); ret = drm__vma_info(buf, start, offset, request, eof, data); - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return ret; } #endif diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c index 42d766359ca..7a9263ff300 100644 --- a/drivers/char/drm/drm_stub.c +++ b/drivers/char/drm/drm_stub.c @@ -61,8 +61,8 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, spin_lock_init(&dev->count_lock); init_timer(&dev->timer); - sema_init(&dev->struct_sem, 1); - sema_init(&dev->ctxlist_sem, 1); + mutex_init(&dev->struct_mutex); + mutex_init(&dev->ctxlist_mutex); dev->pdev = pdev; diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index 3f73aa774c8..0291cd62c69 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c @@ -188,7 +188,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) map = vma->vm_private_data; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (pt = dev->vmalist, prev = NULL; pt; pt = next) { next = pt->next; if (pt->vma->vm_private_data == map) @@ -248,7 +248,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) drm_free(map, sizeof(*map), DRM_MEM_MAPS); } } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); } /** @@ -404,12 +404,12 @@ static void drm_vm_open(struct vm_area_struct *vma) vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); if (vma_entry) { - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); vma_entry->vma = vma; vma_entry->next = dev->vmalist; vma_entry->pid = current->pid; dev->vmalist = vma_entry; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); } } @@ -431,7 +431,7 @@ static void drm_vm_close(struct vm_area_struct *vma) vma->vm_start, vma->vm_end - vma->vm_start); atomic_dec(&dev->vma_count); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { if (pt->vma == vma) { if (prev) { @@ -443,7 +443,7 @@ static void drm_vm_close(struct vm_area_struct *vma) break; } } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); } /** -- cgit v1.2.3 From 0271fc2db6260dd46f196191e24281af2fddb879 Mon Sep 17 00:00:00 2001 From: Jeremy Higdon Date: Thu, 2 Feb 2006 00:00:46 -0800 Subject: [PATCH] Fix sgiioc4 DMA timeout problem with 64KiB s/g elements. Problem caused by the fact that the code used to only pick the low 16 bits of the bytecount. That may be how some controllers act on it (byte count of 0 means 0x10000), but not for this particular hardware. Signed-off-by: Jeremy Higdon Acked-by: Jes Sorensen Signed-off-by: Linus Torvalds --- drivers/ide/pci/sgiioc4.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 4ee597d0879..2b286e86516 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2003-2006 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License @@ -510,7 +510,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) drive->name); goto use_pio_instead; } else { - u32 xcount, bcount = + u32 bcount = 0x10000 - (cur_addr & 0xffff); if (bcount > cur_len) @@ -525,8 +525,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) *table = 0x0; table++; - xcount = bcount & 0xffff; - *table = cpu_to_be32(xcount); + *table = cpu_to_be32(bcount); table++; cur_addr += bcount; @@ -680,7 +679,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d) return -EIO; /* Create /proc/ide entries */ - create_proc_ide_interfaces(); + create_proc_ide_interfaces(); return 0; } -- cgit v1.2.3 From 6d89332b776fc11bac0073209e44ec8f39831e4e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 2 Feb 2006 14:28:03 -0800 Subject: [PATCH] md: Fix device-size updates in md As 'array_size' is a 'sector_t', it may overflow inappropriately when shifted 10 bits. So We should cast it to a loff_t first. There are two places with this problem, but the second (in update_raid_disks) isn't needed so just remove it: The only personality that handles ->reshape currently is raid1, and it doesn't change the size of the array. When added for raid5/6, reshape again won't change the size of the array, at least not straight away. This code might be need for reshaping 'linear' but linear->shape, if implemented, should probably do the i_size_write itself. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/md.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 7145cd150f7..9fac8ac496c 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3465,7 +3465,7 @@ static int update_size(mddev_t *mddev, unsigned long size) bdev = bdget_disk(mddev->gendisk, 0); if (bdev) { mutex_lock(&bdev->bd_inode->i_mutex); - i_size_write(bdev->bd_inode, mddev->array_size << 10); + i_size_write(bdev->bd_inode, (loff_t)mddev->array_size << 10); mutex_unlock(&bdev->bd_inode->i_mutex); bdput(bdev); } @@ -3485,17 +3485,6 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks) if (mddev->sync_thread) return -EBUSY; rv = mddev->pers->reshape(mddev, raid_disks); - if (!rv) { - struct block_device *bdev; - - bdev = bdget_disk(mddev->gendisk, 0); - if (bdev) { - mutex_lock(&bdev->bd_inode->i_mutex); - i_size_write(bdev->bd_inode, mddev->array_size << 10); - mutex_unlock(&bdev->bd_inode->i_mutex); - bdput(bdev); - } - } return rv; } -- cgit v1.2.3 From f0ca340cd20b350eab8288974e9a6077900846e8 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 2 Feb 2006 14:28:04 -0800 Subject: [PATCH] md: Make sure array geometry changes persist with version-1 superblocks super_1_sync only updates fields in the superblock that might have changed. 'raid_disks' and 'size' could have changed, but this information doesn't get updated.... until this patch. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/md.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index 9fac8ac496c..06dee51456e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1161,6 +1161,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) sb->cnt_corrected_read = atomic_read(&rdev->corrected_errors); + sb->raid_disks = cpu_to_le32(mddev->raid_disks); + sb->size = cpu_to_le64(mddev->size); + if (mddev->bitmap && mddev->bitmap_file == NULL) { sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset); sb->feature_map = cpu_to_le32(MD_FEATURE_BITMAP_OFFSET); -- cgit v1.2.3 From 978f946bb628ef228e13aadf4d4255b8727c4fc3 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 2 Feb 2006 14:28:05 -0800 Subject: [PATCH] md: Don't remove bitmap from md array when switching to read-only While a read-only array doesn't not really need a bitmap, we should not remove the bitmap when switching an array to read-only because a/ There is no code to re-add the bitmap which switching to read-write, b/ There is insufficient locking - the bitmap could be accessed while it is being removed. Cc: Reuben Farrelly Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/md.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 06dee51456e..653d4dcbee2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2689,14 +2689,6 @@ static int do_md_stop(mddev_t * mddev, int ro) set_disk_ro(disk, 1); } - bitmap_destroy(mddev); - if (mddev->bitmap_file) { - atomic_set(&mddev->bitmap_file->f_dentry->d_inode->i_writecount, 1); - fput(mddev->bitmap_file); - mddev->bitmap_file = NULL; - } - mddev->bitmap_offset = 0; - /* * Free resources if final stop */ @@ -2706,6 +2698,14 @@ static int do_md_stop(mddev_t * mddev, int ro) struct gendisk *disk; printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); + bitmap_destroy(mddev); + if (mddev->bitmap_file) { + atomic_set(&mddev->bitmap_file->f_dentry->d_inode->i_writecount, 1); + fput(mddev->bitmap_file); + mddev->bitmap_file = NULL; + } + mddev->bitmap_offset = 0; + ITERATE_RDEV(mddev,rdev,tmp) if (rdev->raid_disk >= 0) { char nm[20]; -- cgit v1.2.3 From 35849c75d7750a254119c1a4b88c90156919df2a Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 2 Feb 2006 14:28:06 -0800 Subject: [PATCH] md: Add sysfs access to raid6 stripe cache size .. just as we already have for raid5. Signed-off-by: Neil Brown Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/raid6main.c | 149 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 115 insertions(+), 34 deletions(-) diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index f618a53b98b..ed2abb2e2e2 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c @@ -115,7 +115,7 @@ static void __release_stripe(raid6_conf_t *conf, struct stripe_head *sh) list_add_tail(&sh->lru, &conf->inactive_list); atomic_dec(&conf->active_stripes); if (!conf->inactive_blocked || - atomic_read(&conf->active_stripes) < (NR_STRIPES*3/4)) + atomic_read(&conf->active_stripes) < (conf->max_nr_stripes*3/4)) wake_up(&conf->wait_for_stripe); } } @@ -273,7 +273,8 @@ static struct stripe_head *get_active_stripe(raid6_conf_t *conf, sector_t sector conf->inactive_blocked = 1; wait_event_lock_irq(conf->wait_for_stripe, !list_empty(&conf->inactive_list) && - (atomic_read(&conf->active_stripes) < (NR_STRIPES *3/4) + (atomic_read(&conf->active_stripes) + < (conf->max_nr_stripes *3/4) || !conf->inactive_blocked), conf->device_lock, unplug_slaves(conf->mddev); @@ -302,9 +303,31 @@ static struct stripe_head *get_active_stripe(raid6_conf_t *conf, sector_t sector return sh; } -static int grow_stripes(raid6_conf_t *conf, int num) +static int grow_one_stripe(raid6_conf_t *conf) { struct stripe_head *sh; + sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); + if (!sh) + return 0; + memset(sh, 0, sizeof(*sh) + (conf->raid_disks-1)*sizeof(struct r5dev)); + sh->raid_conf = conf; + spin_lock_init(&sh->lock); + + if (grow_buffers(sh, conf->raid_disks)) { + shrink_buffers(sh, conf->raid_disks); + kmem_cache_free(conf->slab_cache, sh); + return 0; + } + /* we just created an active stripe so... */ + atomic_set(&sh->count, 1); + atomic_inc(&conf->active_stripes); + INIT_LIST_HEAD(&sh->lru); + release_stripe(sh); + return 1; +} + +static int grow_stripes(raid6_conf_t *conf, int num) +{ kmem_cache_t *sc; int devs = conf->raid_disks; @@ -316,44 +339,33 @@ static int grow_stripes(raid6_conf_t *conf, int num) if (!sc) return 1; conf->slab_cache = sc; - while (num--) { - sh = kmem_cache_alloc(sc, GFP_KERNEL); - if (!sh) - return 1; - memset(sh, 0, sizeof(*sh) + (devs-1)*sizeof(struct r5dev)); - sh->raid_conf = conf; - spin_lock_init(&sh->lock); - - if (grow_buffers(sh, conf->raid_disks)) { - shrink_buffers(sh, conf->raid_disks); - kmem_cache_free(sc, sh); + while (num--) + if (!grow_one_stripe(conf)) return 1; - } - /* we just created an active stripe so... */ - atomic_set(&sh->count, 1); - atomic_inc(&conf->active_stripes); - INIT_LIST_HEAD(&sh->lru); - release_stripe(sh); - } return 0; } -static void shrink_stripes(raid6_conf_t *conf) +static int drop_one_stripe(raid6_conf_t *conf) { struct stripe_head *sh; + spin_lock_irq(&conf->device_lock); + sh = get_free_stripe(conf); + spin_unlock_irq(&conf->device_lock); + if (!sh) + return 0; + if (atomic_read(&sh->count)) + BUG(); + shrink_buffers(sh, conf->raid_disks); + kmem_cache_free(conf->slab_cache, sh); + atomic_dec(&conf->active_stripes); + return 1; +} + +static void shrink_stripes(raid6_conf_t *conf) +{ + while (drop_one_stripe(conf)) + ; - while (1) { - spin_lock_irq(&conf->device_lock); - sh = get_free_stripe(conf); - spin_unlock_irq(&conf->device_lock); - if (!sh) - break; - if (atomic_read(&sh->count)) - BUG(); - shrink_buffers(sh, conf->raid_disks); - kmem_cache_free(conf->slab_cache, sh); - atomic_dec(&conf->active_stripes); - } kmem_cache_destroy(conf->slab_cache); conf->slab_cache = NULL; } @@ -1912,6 +1924,74 @@ static void raid6d (mddev_t *mddev) PRINTK("--- raid6d inactive\n"); } +static ssize_t +raid6_show_stripe_cache_size(mddev_t *mddev, char *page) +{ + raid6_conf_t *conf = mddev_to_conf(mddev); + if (conf) + return sprintf(page, "%d\n", conf->max_nr_stripes); + else + return 0; +} + +static ssize_t +raid6_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) +{ + raid6_conf_t *conf = mddev_to_conf(mddev); + char *end; + int new; + if (len >= PAGE_SIZE) + return -EINVAL; + if (!conf) + return -ENODEV; + + new = simple_strtoul(page, &end, 10); + if (!*page || (*end && *end != '\n') ) + return -EINVAL; + if (new <= 16 || new > 32768) + return -EINVAL; + while (new < conf->max_nr_stripes) { + if (drop_one_stripe(conf)) + conf->max_nr_stripes--; + else + break; + } + while (new > conf->max_nr_stripes) { + if (grow_one_stripe(conf)) + conf->max_nr_stripes++; + else break; + } + return len; +} + +static struct md_sysfs_entry +raid6_stripecache_size = __ATTR(stripe_cache_size, S_IRUGO | S_IWUSR, + raid6_show_stripe_cache_size, + raid6_store_stripe_cache_size); + +static ssize_t +stripe_cache_active_show(mddev_t *mddev, char *page) +{ + raid6_conf_t *conf = mddev_to_conf(mddev); + if (conf) + return sprintf(page, "%d\n", atomic_read(&conf->active_stripes)); + else + return 0; +} + +static struct md_sysfs_entry +raid6_stripecache_active = __ATTR_RO(stripe_cache_active); + +static struct attribute *raid6_attrs[] = { + &raid6_stripecache_size.attr, + &raid6_stripecache_active.attr, + NULL, +}; +static struct attribute_group raid6_attrs_group = { + .name = NULL, + .attrs = raid6_attrs, +}; + static int run(mddev_t *mddev) { raid6_conf_t *conf; @@ -2095,6 +2175,7 @@ static int stop (mddev_t *mddev) shrink_stripes(conf); kfree(conf->stripe_hashtbl); blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ + sysfs_remove_group(&mddev->kobj, &raid6_attrs_group); kfree(conf); mddev->private = NULL; return 0; -- cgit v1.2.3 From 1113a7e92e483074c6235da59460759e33b9b144 Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Thu, 2 Feb 2006 14:28:07 -0800 Subject: [PATCH] device-mapper log bitset: fix big endian find_next_zero_bit This is a fix to the device-mapper-log-bitset-fix-endian patch that switched to ext2_* versions of the set and clear bit functions. The find_next_zero_bit function also has to be the ext2 one. Otherwise the mirror target tries to recover non-existent regions beyond the end of device. Signed-off-by: Stefan Bader Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/dm-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 74039db846b..d73779a4241 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -545,7 +545,8 @@ static int core_get_resync_work(struct dirty_log *log, region_t *region) return 0; do { - *region = find_next_zero_bit((unsigned long *) lc->sync_bits, + *region = ext2_find_next_zero_bit( + (unsigned long *) lc->sync_bits, lc->region_count, lc->sync_search); lc->sync_search = *region + 1; -- cgit v1.2.3