From 52fc0b026e99b5d5d585095148d997d5634bbc25 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Mon, 2 Oct 2006 00:00:00 -0400 Subject: [ACPI] ACPICA 20060210 Removed a couple of extraneous ACPI_ERROR messages that appeared during normal execution. These became apparent after the conversion from ACPI_DEBUG_PRINT. Fixed a problem where the CreateField operator could hang if the BitIndex or NumBits parameter referred to a named object. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5359 Fixed a problem where a DeRefOf operation on a buffer object incorrectly failed with an exception. This also fixes a couple of related RefOf and DeRefOf issues. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5360 http://bugzilla.kernel.org/show_bug.cgi?id=5387 http://bugzilla.kernel.org/show_bug.cgi?id=5392 Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead of AE_STRING_LIMIT on an out-of-bounds Index() operation. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5480 Implemented a memory cleanup at the end of the execution of each iteration of an AML While() loop, preventing the accumulation of outstanding objects. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5427 Eliminated a chunk of duplicate code in the object resolution code. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5336 Fixed several warnings during the 64-bit code generation. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utalloc.c | 5 +++++ drivers/acpi/utilities/utcache.c | 2 ++ drivers/acpi/utilities/utcopy.c | 1 + drivers/acpi/utilities/utdebug.c | 4 ++++ drivers/acpi/utilities/utdelete.c | 3 +++ drivers/acpi/utilities/uteval.c | 4 ++++ drivers/acpi/utilities/utglobal.c | 2 ++ drivers/acpi/utilities/utmisc.c | 31 ++++++------------------------- drivers/acpi/utilities/utobject.c | 2 ++ drivers/acpi/utilities/utresrc.c | 4 ++++ drivers/acpi/utilities/utstate.c | 2 ++ 11 files changed, 35 insertions(+), 25 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 03b0044974c2..34de3791d4c2 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -308,6 +308,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) allocation = acpi_os_allocate(size); if (!allocation) { + /* Report allocation error */ ACPI_ERROR((module, line, @@ -351,6 +352,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) allocation = acpi_os_allocate(size); if (!allocation) { + /* Report allocation error */ ACPI_ERROR((module, line, @@ -477,6 +479,7 @@ void *acpi_ut_callocate_and_track(acpi_size size, acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), component, module, line); if (!allocation) { + /* Report allocation error */ ACPI_ERROR((module, line, @@ -681,6 +684,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, mem_list = acpi_gbl_global_list; if (NULL == mem_list->list_head) { + /* No allocations! */ ACPI_ERROR((module, line, @@ -807,6 +811,7 @@ void acpi_ut_dump_allocations(u32 component, char *module) if ((element->component & component) && ((module == NULL) || (0 == ACPI_STRCMP(module, element->module)))) { + /* Ignore allocated objects that are in a cache */ descriptor = diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 2177cb1ef2c4..044c890e5b3c 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -118,6 +118,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) /* Walk the list of objects in this cache */ while (cache->list_head) { + /* Delete and unlink one cached state object */ next = *(ACPI_CAST_INDIRECT_PTR(char, @@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) /* Check the cache first */ if (cache->list_head) { + /* There is an object available, use it */ object = cache->list_head; diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index df2d32096b72..47875935c3f4 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -882,6 +882,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, acpi_ut_copy_ielement_to_ielement, walk_state); if (ACPI_FAILURE(status)) { + /* On failure, delete the destination package object */ acpi_ut_remove_reference(dest_obj); diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 35f3d581e034..6e92b2a3c0fd 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -123,12 +123,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name) /* All Function names are longer than 4 chars, check is safe */ if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { + /* This is the case where the original source has not been modified */ return (function_name + 4); } if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { + /* This is the case where the source has been 'linuxized' */ return (function_name + 5); @@ -545,6 +547,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) /* Nasty little dump buffer routine! */ while (i < count) { + /* Print current offset */ acpi_os_printf("%6.4X: ", (u32) i); @@ -553,6 +556,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) for (j = 0; j < 16;) { if (i + j >= count) { + /* Dump fill spaces */ acpi_os_printf("%*s", ((display * 2) + 1), " "); diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1db9695b0029..dbae72121cea 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) /* Free the actual string buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { + /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->string.pointer; @@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) /* Free the actual buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { + /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->buffer.pointer; @@ -415,6 +417,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); while (object) { + /* Make sure that this isn't a namespace handle */ if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 106cc97cb4af..952ffdea93aa 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) ACPI_CAST_PTR(char, acpi_gbl_valid_osi_strings[i]))) { + /* This string is supported */ return_desc->integer.value = 0xFFFFFFFF; @@ -343,6 +344,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { + /* Convert the Numeric HID to string */ acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, @@ -479,6 +481,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, /* The _CID object can be either a single CID or a package (list) of CIDs */ if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { + /* Translate each package element */ for (i = 0; i < count; i++) { @@ -543,6 +546,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { + /* Convert the Numeric UID to string */ acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index ffd13383a325..767c5e44a04b 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -119,6 +119,7 @@ const char *acpi_format_exception(acpi_status status) } if (!exception) { + /* Exception code was not recognized */ ACPI_ERROR((AE_INFO, @@ -747,6 +748,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) { if (type > ACPI_TYPE_LOCAL_MAX) { + /* Note: Assumes all TYPEs are contiguous (external/local) */ return (FALSE); diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 7364f5f8c9cd..60f36130663c 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -97,6 +97,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * 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 */ break; @@ -273,6 +274,7 @@ void acpi_ut_print_string(char *string, u8 max_length) acpi_os_printf("\""); for (i = 0; string[i] && (i < max_length); i++) { + /* Escape sequences */ switch (string[i]) { @@ -601,11 +603,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) while (*string) { if (ACPI_IS_DIGIT(*string)) { + /* Convert ASCII 0-9 to Decimal value */ this_digit = ((u8) * string) - '0'; } else { if (base == 10) { + /* Digit is out of range */ goto error_exit; @@ -613,6 +617,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) this_digit = (u8) ACPI_TOUPPER(*string); if (ACPI_IS_XDIGIT((char)this_digit)) { + /* Convert ASCII Hex char to value */ this_digit = this_digit - 'A' + 10; @@ -727,6 +732,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, } while (state) { + /* Get one element of the package */ this_index = state->pkg.index; @@ -812,31 +818,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, return_ACPI_STATUS(AE_AML_INTERNAL); } -/******************************************************************************* - * - * FUNCTION: acpi_ut_generate_checksum - * - * PARAMETERS: Buffer - Buffer to be scanned - * Length - number of bytes to examine - * - * RETURN: The generated checksum - * - * DESCRIPTION: Generate a checksum on a raw buffer - * - ******************************************************************************/ - -u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) -{ - u32 i; - signed char sum = 0; - - for (i = 0; i < length; i++) { - sum = (signed char)(sum + buffer[i]); - } - - return ((u8) (0 - sum)); -} - /******************************************************************************* * * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 7ee2d1d98071..b1205a58028c 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -173,6 +173,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) /* Create an actual buffer only if size > 0 */ if (buffer_size > 0) { + /* Allocate the actual buffer */ buffer = ACPI_MEM_CALLOCATE(buffer_size); @@ -397,6 +398,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, length = sizeof(union acpi_object); if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { + /* Object is a named object (reference), just return the length */ *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 16461317113f..27158dd0f877 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -273,6 +273,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) * 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) { @@ -376,6 +377,7 @@ u8 acpi_ut_get_resource_type(void *aml) * Examine the large/small bit in the resource header */ if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ return (ACPI_GET8(aml)); @@ -411,6 +413,7 @@ u16 acpi_ut_get_resource_length(void *aml) * Examine the large/small bit in the resource header */ 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, ACPI_ADD_PTR(u8, aml, 1)); @@ -515,6 +518,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, /* 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); diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 4b134a722907..69f2bfdc26ab 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -129,6 +129,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state state = *list_head; if (state) { + /* Update the list head */ *list_head = state->common.next; @@ -158,6 +159,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) state = acpi_os_acquire_object(acpi_gbl_state_cache); if (state) { + /* Initialize */ memset(state, 0, sizeof(union acpi_generic_state)); state->common.data_type = ACPI_DESC_TYPE_STATE; -- cgit v1.2.3 From 8313524a0d466f451a62709aaedf988d8257b21c Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Tue, 3 Oct 2006 00:00:00 -0400 Subject: ACPI: ACPICA 20060310 Tagged all external interfaces to the subsystem with the new ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary to assist kernel integration. For Linux, the macro resolves to the EXPORT_SYMBOL macro. The default definition is NULL. Added the ACPI_THREAD_ID type for the return value from acpi_os_get_thread_id(). This allows the host to define this as necessary to simplify kernel integration. The default definition is ACPI_NATIVE_UINT. Valery Podrezov fixed two interpreter problems related to error processing, the deletion of objects, and placing invalid pointers onto the internal operator result stack. http://bugzilla.kernel.org/show_bug.cgi?id=6028 http://bugzilla.kernel.org/show_bug.cgi?id=6151 Increased the reference count threshold where a warning is emitted for large reference counts in order to eliminate unnecessary warnings on systems with large namespaces (especially 64-bit.) Increased the value from 0x400 to 0x800. Due to universal disagreement as to the meaning of the 'c' in the calloc() function, the ACPI_MEM_CALLOCATE macro has been renamed to ACPI_ALLOCATE_ZEROED so that the purpose of the interface is 'clear'. ACPI_MEM_ALLOCATE and ACPI_MEM_FREE are renamed to ACPI_ALLOCATE and ACPI_FREE. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utalloc.c | 2 +- drivers/acpi/utilities/utcache.c | 8 ++++---- drivers/acpi/utilities/utcopy.c | 24 +++++++++++------------- drivers/acpi/utilities/utdebug.c | 23 +++++++---------------- drivers/acpi/utilities/utdelete.c | 4 ++-- drivers/acpi/utilities/uteval.c | 4 ++-- drivers/acpi/utilities/utglobal.c | 6 +++--- drivers/acpi/utilities/utinit.c | 8 ++++---- drivers/acpi/utilities/utmisc.c | 2 +- drivers/acpi/utilities/utmutex.c | 4 ++-- drivers/acpi/utilities/utobject.c | 5 +++-- drivers/acpi/utilities/utxface.c | 24 ++++++++++++++---------- 12 files changed, 54 insertions(+), 60 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 34de3791d4c2..7b35eb84d058 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -252,7 +252,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, /* Allocate a new buffer with local interface to allow tracking */ - buffer->pointer = ACPI_MEM_CALLOCATE(required_length); + buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); if (!buffer->pointer) { return (AE_NO_MEMORY); } diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 044c890e5b3c..5d2f4b2802a5 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -125,7 +125,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) &(((char *)cache-> list_head)[cache-> link_offset]))); - ACPI_MEM_FREE(cache->list_head); + ACPI_FREE(cache->list_head); cache->list_head = next; cache->current_depth--; @@ -194,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) /* If cache is full, just free this object */ if (cache->current_depth >= cache->max_depth) { - ACPI_MEM_FREE(object); + ACPI_FREE(object); ACPI_MEM_TRACKING(cache->total_freed++); } @@ -289,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) ACPI_MEM_TRACKING(cache->total_allocated++); - /* Avoid deadlock with ACPI_MEM_CALLOCATE */ + /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ status = acpi_ut_release_mutex(ACPI_MTX_CACHES); if (ACPI_FAILURE(status)) { return (NULL); } - object = ACPI_MEM_CALLOCATE(cache->object_size); + object = ACPI_ALLOCATE_ZEROED(cache->object_size); if (!object) { return (NULL); } diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 47875935c3f4..371cddc0d574 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, case ACPI_TYPE_STRING: internal_object->string.pointer = - ACPI_MEM_CALLOCATE((acpi_size) external_object->string. - length + 1); + ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. + length + 1); if (!internal_object->string.pointer) { goto error_exit; } @@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, case ACPI_TYPE_BUFFER: internal_object->buffer.pointer = - ACPI_MEM_CALLOCATE(external_object->buffer.length); + ACPI_ALLOCATE_ZEROED(external_object->buffer.length); if (!internal_object->buffer.pointer) { goto error_exit; } @@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, if ((source_desc->buffer.pointer) && (source_desc->buffer.length)) { dest_desc->buffer.pointer = - ACPI_MEM_ALLOCATE(source_desc->buffer.length); + ACPI_ALLOCATE(source_desc->buffer.length); if (!dest_desc->buffer.pointer) { return (AE_NO_MEMORY); } @@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, */ if (source_desc->string.pointer) { dest_desc->string.pointer = - ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. - length + 1); + ACPI_ALLOCATE((acpi_size) source_desc->string. + length + 1); if (!dest_desc->string.pointer) { return (AE_NO_MEMORY); } @@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, /* * Create the object array */ - target_object->package.elements = - ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. - count + 1) * sizeof(void *)); + target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); if (!target_object->package.elements) { status = AE_NO_MEMORY; goto error_exit; @@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, /* * Create the object array and walk the source package tree */ - dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) - source_obj->package. - count + - 1) * sizeof(void *)); + dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) + source_obj->package. + count + + 1) * sizeof(void *)); if (!dest_obj->package.elements) { ACPI_ERROR((AE_INFO, "Package allocation failure")); return_ACPI_STATUS(AE_NO_MEMORY); diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 6e92b2a3c0fd..a8c350643d57 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #define _COMPONENT ACPI_UTILITIES @@ -164,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level, const char *function_name, char *module_name, u32 component_id, char *format, ...) { - u32 thread_id; + acpi_thread_id thread_id; va_list args; /* @@ -179,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_level, * Thread tracking and context switch notification */ thread_id = acpi_os_get_thread_id(); - if (thread_id != acpi_gbl_prev_thread_id) { if (ACPI_LV_THREADS & acpi_dbg_level) { acpi_os_printf @@ -208,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_level, acpi_os_vprintf(format, args); } -EXPORT_SYMBOL(acpi_ut_debug_print); +ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) /******************************************************************************* * @@ -228,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print); * debug_print so that the same macros can be used. * ******************************************************************************/ - void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw(u32 requested_debug_level, u32 line_number, @@ -246,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, acpi_os_vprintf(format, args); } -EXPORT_SYMBOL(acpi_ut_debug_print_raw); +ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) /******************************************************************************* * @@ -263,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); * set in debug_level * ******************************************************************************/ - void acpi_ut_trace(u32 line_number, const char *function_name, char *module_name, u32 component_id) @@ -277,7 +272,7 @@ acpi_ut_trace(u32 line_number, component_id, "%s\n", acpi_gbl_fn_entry_str); } -EXPORT_SYMBOL(acpi_ut_trace); +ACPI_EXPORT_SYMBOL(acpi_ut_trace) /******************************************************************************* * @@ -295,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace); * set in debug_level * ******************************************************************************/ - void acpi_ut_trace_ptr(u32 line_number, const char *function_name, @@ -402,7 +396,7 @@ acpi_ut_exit(u32 line_number, acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_exit); +ACPI_EXPORT_SYMBOL(acpi_ut_exit) /******************************************************************************* * @@ -420,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit); * set in debug_level. Prints exit status also. * ******************************************************************************/ - void acpi_ut_status_exit(u32 line_number, const char *function_name, @@ -444,7 +437,7 @@ acpi_ut_status_exit(u32 line_number, acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_status_exit); +ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) /******************************************************************************* * @@ -462,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit); * set in debug_level. Prints exit value also. * ******************************************************************************/ - void acpi_ut_value_exit(u32 line_number, const char *function_name, @@ -477,7 +469,7 @@ acpi_ut_value_exit(u32 line_number, acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_value_exit); +ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) /******************************************************************************* * @@ -495,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit); * set in debug_level. Prints exit value also. * ******************************************************************************/ - void acpi_ut_ptr_exit(u32 line_number, const char *function_name, diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index dbae72121cea..9c6867fcf009 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -236,7 +236,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) if (obj_pointer) { ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", obj_pointer)); - ACPI_MEM_FREE(obj_pointer); + ACPI_FREE(obj_pointer); } /* Now the object can be safely deleted */ @@ -275,7 +275,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) /* Free the combined parameter pointer list and object array */ - ACPI_MEM_FREE(obj_list); + ACPI_FREE(obj_list); return_VOID; } diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 952ffdea93aa..68b9eff4b326 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -461,7 +461,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, size = (((count - 1) * sizeof(struct acpi_compatible_id)) + sizeof(struct acpi_compatible_id_list)); - cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); + cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); if (!cid_list) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -502,7 +502,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, /* Cleanup on error */ if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(cid_list); + ACPI_FREE(cid_list); } else { *return_cid_list = cid_list; } diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 767c5e44a04b..5bc8da7acc6c 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -43,7 +43,6 @@ #define DEFINE_ACPI_GLOBALS -#include #include #include @@ -144,12 +143,10 @@ const char *acpi_format_exception(acpi_status status) /* Debug switch - level and trace mask */ u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; -EXPORT_SYMBOL(acpi_dbg_level); /* Debug switch - layer (component) mask */ u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; -EXPORT_SYMBOL(acpi_dbg_layer); u32 acpi_gbl_nesting_level = 0; /* Debugger globals */ @@ -871,3 +868,6 @@ void acpi_ut_init_globals(void) return_VOID; } + +ACPI_EXPORT_SYMBOL(acpi_dbg_level) +ACPI_EXPORT_SYMBOL(acpi_dbg_layer) diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index ba771b4f39bc..40313de6977d 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -186,14 +186,14 @@ static void acpi_ut_terminate(void) gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { next_gpe_block = gpe_block->next; - ACPI_MEM_FREE(gpe_block->event_info); - ACPI_MEM_FREE(gpe_block->register_info); - ACPI_MEM_FREE(gpe_block); + ACPI_FREE(gpe_block->event_info); + ACPI_FREE(gpe_block->register_info); + ACPI_FREE(gpe_block); gpe_block = next_gpe_block; } next_gpe_xrupt_info = gpe_xrupt_info->next; - ACPI_MEM_FREE(gpe_xrupt_info); + ACPI_FREE(gpe_xrupt_info); gpe_xrupt_info = next_gpe_xrupt_info; } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 60f36130663c..77268ba86291 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -463,7 +463,7 @@ acpi_ut_display_init_pathname(u8 type, } acpi_os_printf("\n"); - ACPI_MEM_FREE(buffer.pointer); + ACPI_FREE(buffer.pointer); } #endif diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 45a7244df924..0ac6700a45f8 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -192,7 +192,7 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - u32 this_thread_id; + acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME("ut_acquire_mutex"); @@ -275,7 +275,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - u32 this_thread_id; + acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME("ut_release_mutex"); diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index b1205a58028c..8e3dcbd23f5d 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -176,7 +176,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) /* Allocate the actual buffer */ - buffer = ACPI_MEM_CALLOCATE(buffer_size); + buffer = ACPI_ALLOCATE_ZEROED(buffer_size); if (!buffer) { ACPI_ERROR((AE_INFO, "Could not allocate size %X", (u32) buffer_size)); @@ -228,7 +228,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) * Allocate the actual string buffer -- (Size + 1) for NULL terminator. * NOTE: Zero-length strings are NULL terminated */ - string = ACPI_MEM_CALLOCATE(string_size + 1); + string = ACPI_ALLOCATE_ZEROED(string_size + 1); if (!string) { ACPI_ERROR((AE_INFO, "Could not allocate size %X", (u32) string_size)); @@ -320,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, } /* Mark the descriptor type */ + memset(object, 0, sizeof(union acpi_operand_object)); ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 308a960871be..ac90048a8a5b 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(void) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) + /******************************************************************************* * * FUNCTION: acpi_enable_subsystem @@ -121,7 +121,6 @@ acpi_status acpi_initialize_subsystem(void) * Puts system into ACPI mode if it isn't already. * ******************************************************************************/ - acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; @@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 flags) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) + /******************************************************************************* * * FUNCTION: acpi_initialize_objects @@ -241,7 +242,6 @@ acpi_status acpi_enable_subsystem(u32 flags) * objects and executing AML code for Regions, buffers, etc. * ******************************************************************************/ - acpi_status acpi_initialize_objects(u32 flags) { acpi_status status = AE_OK; @@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 flags) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_initialize_objects) + /******************************************************************************* * * FUNCTION: acpi_terminate @@ -316,7 +318,6 @@ acpi_status acpi_initialize_objects(u32 flags) * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. * ******************************************************************************/ - acpi_status acpi_terminate(void) { acpi_status status; @@ -348,6 +349,8 @@ acpi_status acpi_terminate(void) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_terminate) + #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -362,7 +365,6 @@ acpi_status acpi_terminate(void) * initialized successfully. * ******************************************************************************/ - acpi_status acpi_subsystem_status(void) { @@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void) } } +ACPI_EXPORT_SYMBOL(acpi_subsystem_status) + /******************************************************************************* * * FUNCTION: acpi_get_system_info @@ -390,7 +394,6 @@ acpi_status acpi_subsystem_status(void) * and the value of out_buffer is undefined. * ******************************************************************************/ - acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) { struct acpi_system_info *info_ptr; @@ -456,7 +459,7 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_get_system_info); +ACPI_EXPORT_SYMBOL(acpi_get_system_info) /***************************************************************************** * @@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info); * TBD: When a second function is added, must save the Function also. * ****************************************************************************/ - acpi_status acpi_install_initialization_handler(acpi_init_handler handler, u32 function) { @@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) return AE_OK; } +ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) #endif /* ACPI_FUTURE_USAGE */ /***************************************************************************** @@ -502,7 +505,6 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) * DESCRIPTION: Empty all caches (delete the cached objects) * ****************************************************************************/ - acpi_status acpi_purge_cached_objects(void) { ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); @@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(void) (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); return_ACPI_STATUS(AE_OK); } + +ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) -- cgit v1.2.3 From 61686124f47d7c4b78610346c5f8f9d8a6d46bb5 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 17 Mar 2006 16:44:00 -0500 Subject: [ACPI] ACPICA 20060317 Implemented the use of a cache object for all internal namespace nodes. Since there are about 1000 static nodes in a typical system, this will decrease memory use for cache implementations that minimize per-allocation overhead (such as a slab allocator.) Removed the reference count mechanism for internal namespace nodes, since it was deemed unnecessary. This reduces the size of each namespace node by about 5%-10% on all platforms. Nodes are now 20 bytes for the 32-bit case, and 32 bytes for the 64-bit case. Optimized several internal data structures to reduce object size on 64-bit platforms by packing data within the 64-bit alignment. This includes the frequently used ACPI_OPERAND_OBJECT, of which there can be ~1000 static instances corresponding to the namespace objects. Added two new strings for the predefined _OSI method: "Windows 2001.1 SP1" and "Windows 2006". Split the allocation tracking mechanism out to a separate file, from utalloc.c to uttrack.c. This mechanism appears to be only useful for application-level code. Kernels may wish to not include uttrack.c in distributions. Removed all remnants of the obsolete ACPI_REPORT_* macros and the associated code. (These macros have been replaced by the ACPI_ERROR and ACPI_WARNING macros.) Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utalloc.c | 590 ++------------------------------------ drivers/acpi/utilities/utcache.c | 6 +- drivers/acpi/utilities/utdelete.c | 3 +- drivers/acpi/utilities/utglobal.c | 8 +- drivers/acpi/utilities/utmisc.c | 33 --- drivers/acpi/utilities/utresrc.c | 150 +++++++--- drivers/acpi/utilities/utstate.c | 10 +- 7 files changed, 148 insertions(+), 652 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 7b35eb84d058..3b29aecaaca5 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -46,24 +46,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utalloc") -/* Local prototypes */ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); - -static acpi_status -acpi_ut_track_allocation(struct acpi_debug_mem_block *address, - acpi_size size, - u8 alloc_type, u32 component, char *module, u32 line); - -static acpi_status -acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, - u32 component, char *module, u32 line); - -static acpi_status -acpi_ut_create_list(char *list_name, - u16 object_size, struct acpi_memory_list **return_cache); -#endif - /******************************************************************************* * * FUNCTION: acpi_ut_create_caches @@ -75,7 +57,6 @@ acpi_ut_create_list(char *list_name, * DESCRIPTION: Create all local caches * ******************************************************************************/ - acpi_status acpi_ut_create_caches(void) { acpi_status status; @@ -101,7 +82,16 @@ acpi_status acpi_ut_create_caches(void) /* Object Caches, for frequently used objects */ status = - acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), + acpi_os_create_cache("Acpi-Namespace", + sizeof(struct acpi_namespace_node), + ACPI_MAX_NAMESPACE_CACHE_DEPTH, + &acpi_gbl_namespace_cache); + if (ACPI_FAILURE(status)) { + return (status); + } + + status = + acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state), ACPI_MAX_STATE_CACHE_DEPTH, &acpi_gbl_state_cache); if (ACPI_FAILURE(status)) { @@ -109,7 +99,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("acpi_parse", + acpi_os_create_cache("Acpi-Parse", sizeof(struct acpi_parse_obj_common), ACPI_MAX_PARSE_CACHE_DEPTH, &acpi_gbl_ps_node_cache); @@ -118,7 +108,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("acpi_parse_ext", + acpi_os_create_cache("Acpi-parse_ext", sizeof(struct acpi_parse_obj_named), ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache); @@ -127,7 +117,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("acpi_operand", + acpi_os_create_cache("Acpi-Operand", sizeof(union acpi_operand_object), ACPI_MAX_OBJECT_CACHE_DEPTH, &acpi_gbl_operand_cache); @@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void) acpi_status acpi_ut_delete_caches(void) { + (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); + acpi_gbl_namespace_cache = NULL; + (void)acpi_os_delete_cache(acpi_gbl_state_cache); acpi_gbl_state_cache = NULL; @@ -288,7 +281,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, * * RETURN: Address of the allocated memory on success, NULL on failure. * - * DESCRIPTION: The subsystem's equivalent of malloc. + * DESCRIPTION: Subsystem equivalent of malloc. * ******************************************************************************/ @@ -301,8 +294,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_ERROR((module, line, - "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); + ACPI_WARNING((module, line, + "Attempt to allocate zero bytes, allocating 1 byte")); size = 1; } @@ -311,9 +304,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) /* Report allocation error */ - ACPI_ERROR((module, line, - "ut_allocate: Could not allocate size %X", - (u32) size)); + ACPI_WARNING((module, line, + "Could not allocate size %X", (u32) size)); return_PTR(NULL); } @@ -323,7 +315,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) /******************************************************************************* * - * FUNCTION: acpi_ut_callocate + * FUNCTION: acpi_ut_allocate_zeroed * * PARAMETERS: Size - Size of the allocation * Component - Component type of caller @@ -332,546 +324,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) * * RETURN: Address of the allocated memory on success, NULL on failure. * - * DESCRIPTION: Subsystem equivalent of calloc. + * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. * ******************************************************************************/ -void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) +void *acpi_ut_allocate_zeroed(acpi_size size, + u32 component, char *module, u32 line) { void *allocation; - ACPI_FUNCTION_TRACE_U32("ut_callocate", size); - - /* Check for an inadvertent size of zero bytes */ - - if (!size) { - ACPI_ERROR((module, line, - "Attempt to allocate zero bytes, allocating 1 byte")); - size = 1; - } - - allocation = acpi_os_allocate(size); - if (!allocation) { - - /* Report allocation error */ - - ACPI_ERROR((module, line, - "Could not allocate size %X", (u32) size)); - return_PTR(NULL); - } - - /* Clear the memory block */ - - ACPI_MEMSET(allocation, 0, size); - return_PTR(allocation); -} - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -/* - * These procedures are used for tracking memory leaks in the subsystem, and - * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. - * - * Each memory allocation is tracked via a doubly linked list. Each - * element contains the caller's component, module name, function name, and - * line number. acpi_ut_allocate and acpi_ut_callocate call - * acpi_ut_track_allocation to add an element to the list; deletion - * occurs in the body of acpi_ut_free. - */ - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_list - * - * PARAMETERS: cache_name - Ascii name for the cache - * object_size - Size of each cached object - * return_cache - Where the new cache object is returned - * - * RETURN: Status - * - * DESCRIPTION: Create a local memory list for tracking purposed - * - ******************************************************************************/ - -static acpi_status -acpi_ut_create_list(char *list_name, - u16 object_size, struct acpi_memory_list **return_cache) -{ - struct acpi_memory_list *cache; - - cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); - if (!cache) { - return (AE_NO_MEMORY); - } - - ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); - - cache->list_name = list_name; - cache->object_size = object_size; - - *return_cache = cache; - return (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_allocate_and_track - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: The subsystem's equivalent of malloc. - * - ******************************************************************************/ - -void *acpi_ut_allocate_and_track(acpi_size size, - u32 component, char *module, u32 line) -{ - struct acpi_debug_mem_block *allocation; - acpi_status status; - - allocation = - acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), - component, module, line); - if (!allocation) { - return (NULL); - } - - status = acpi_ut_track_allocation(allocation, size, - ACPI_MEM_MALLOC, component, module, - line); - if (ACPI_FAILURE(status)) { - acpi_os_free(allocation); - return (NULL); - } - - acpi_gbl_global_list->total_allocated++; - acpi_gbl_global_list->current_total_size += (u32) size; - - return ((void *)&allocation->user_space); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_callocate_and_track - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of calloc. - * - ******************************************************************************/ - -void *acpi_ut_callocate_and_track(acpi_size size, - u32 component, char *module, u32 line) -{ - struct acpi_debug_mem_block *allocation; - acpi_status status; - - allocation = - acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), - component, module, line); - if (!allocation) { - - /* Report allocation error */ - - ACPI_ERROR((module, line, - "Could not allocate size %X", (u32) size)); - return (NULL); - } - - status = acpi_ut_track_allocation(allocation, size, - ACPI_MEM_CALLOC, component, module, - line); - if (ACPI_FAILURE(status)) { - acpi_os_free(allocation); - return (NULL); - } - - acpi_gbl_global_list->total_allocated++; - acpi_gbl_global_list->current_total_size += (u32) size; - - return ((void *)&allocation->user_space); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_free_and_track - * - * PARAMETERS: Allocation - Address of the memory to deallocate - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: None - * - * DESCRIPTION: Frees the memory at Allocation - * - ******************************************************************************/ - -void -acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) -{ - struct acpi_debug_mem_block *debug_block; - acpi_status status; - - ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); - - if (NULL == allocation) { - ACPI_ERROR((module, line, "Attempt to delete a NULL address")); - - return_VOID; - } - - debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, - (((char *)allocation) - - sizeof(struct acpi_debug_mem_header))); - - acpi_gbl_global_list->total_freed++; - acpi_gbl_global_list->current_total_size -= debug_block->size; - - status = acpi_ut_remove_allocation(debug_block, - component, module, line); - if (ACPI_FAILURE(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; -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_find_allocation - * - * PARAMETERS: Allocation - Address of allocated memory - * - * RETURN: A list element if found; NULL otherwise. - * - * DESCRIPTION: Searches for an element in the global allocation tracking list. - * - ******************************************************************************/ - -static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) -{ - struct acpi_debug_mem_block *element; - ACPI_FUNCTION_ENTRY(); - element = acpi_gbl_global_list->list_head; - - /* Search for the address. */ - - while (element) { - if (element == allocation) { - return (element); - } - - element = element->next; - } - - return (NULL); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_track_allocation - * - * PARAMETERS: Allocation - Address of allocated memory - * Size - Size of the allocation - * alloc_type - MEM_MALLOC or MEM_CALLOC - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: None. - * - * DESCRIPTION: Inserts an element into the global allocation tracking list. - * - ******************************************************************************/ - -static acpi_status -acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, - acpi_size size, - u8 alloc_type, u32 component, char *module, u32 line) -{ - struct acpi_memory_list *mem_list; - struct acpi_debug_mem_block *element; - acpi_status status = AE_OK; - - ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); - - mem_list = acpi_gbl_global_list; - status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* - * Search list for this address to make sure it is not already on the list. - * This will catch several kinds of problems. - */ - element = acpi_ut_find_allocation(allocation); - if (element) { - ACPI_ERROR((AE_INFO, - "ut_track_allocation: Allocation already present in list! (%p)", - allocation)); + allocation = acpi_ut_allocate(size, component, module, line); + if (allocation) { - ACPI_ERROR((AE_INFO, "Element %p Address %p", - element, allocation)); + /* Clear the memory block */ - goto unlock_and_exit; + ACPI_MEMSET(allocation, 0, size); } - /* Fill in the instance data. */ - - allocation->size = (u32) size; - allocation->alloc_type = alloc_type; - allocation->component = component; - allocation->line = line; - - ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); - allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; - - /* Insert at list head */ - - if (mem_list->list_head) { - ((struct acpi_debug_mem_block *)(mem_list->list_head))-> - previous = allocation; - } - - allocation->next = mem_list->list_head; - allocation->previous = NULL; - - mem_list->list_head = allocation; - - unlock_and_exit: - status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); - return_ACPI_STATUS(status); + return (allocation); } - -/******************************************************************************* - * - * FUNCTION: acpi_ut_remove_allocation - * - * PARAMETERS: Allocation - Address of allocated memory - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: - * - * DESCRIPTION: Deletes an element from the global allocation tracking list. - * - ******************************************************************************/ - -static acpi_status -acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, - u32 component, char *module, u32 line) -{ - struct acpi_memory_list *mem_list; - acpi_status status; - - ACPI_FUNCTION_TRACE("ut_remove_allocation"); - - mem_list = acpi_gbl_global_list; - if (NULL == mem_list->list_head) { - - /* No allocations! */ - - ACPI_ERROR((module, line, - "Empty allocation list, nothing to free!")); - - return_ACPI_STATUS(AE_OK); - } - - status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Unlink */ - - if (allocation->previous) { - (allocation->previous)->next = allocation->next; - } else { - mem_list->list_head = allocation->next; - } - - if (allocation->next) { - (allocation->next)->previous = allocation->previous; - } - - /* Mark the segment as deleted */ - - ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); - - ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", - allocation->size)); - - status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_dump_allocation_info - * - * PARAMETERS: - * - * RETURN: None - * - * DESCRIPTION: Print some info about the outstanding allocations. - * - ******************************************************************************/ - -#ifdef ACPI_FUTURE_USAGE -void acpi_ut_dump_allocation_info(void) -{ -/* - struct acpi_memory_list *mem_list; -*/ - - ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); - -/* - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current allocations", - mem_list->current_count, - ROUND_UP_TO_1K (mem_list->current_size))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", - mem_list->max_concurrent_count, - ROUND_UP_TO_1K (mem_list->max_concurrent_size))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", - running_object_count, - ROUND_UP_TO_1K (running_object_size))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", - running_alloc_count, - ROUND_UP_TO_1K (running_alloc_size))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Nodes", - acpi_gbl_current_node_count, - ROUND_UP_TO_1K (acpi_gbl_current_node_size))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max Nodes", - acpi_gbl_max_concurrent_node_count, - ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * - sizeof (struct acpi_namespace_node))))); -*/ - return_VOID; -} -#endif /* ACPI_FUTURE_USAGE */ - -/******************************************************************************* - * - * FUNCTION: acpi_ut_dump_allocations - * - * PARAMETERS: Component - Component(s) to dump info for. - * Module - Module to dump info for. NULL means all. - * - * RETURN: None - * - * DESCRIPTION: Print a list of all outstanding allocations. - * - ******************************************************************************/ - -void acpi_ut_dump_allocations(u32 component, char *module) -{ - struct acpi_debug_mem_block *element; - union acpi_descriptor *descriptor; - u32 num_outstanding = 0; - - ACPI_FUNCTION_TRACE("ut_dump_allocations"); - - /* - * Walk the allocation list. - */ - if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { - return; - } - - element = acpi_gbl_global_list->list_head; - while (element) { - if ((element->component & component) && - ((module == NULL) - || (0 == ACPI_STRCMP(module, element->module)))) { - - /* Ignore allocated objects that are in a cache */ - - descriptor = - ACPI_CAST_PTR(union acpi_descriptor, - &element->user_space); - if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { - acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", - descriptor, element->size, - element->module, element->line, - acpi_ut_get_descriptor_name - (descriptor)); - - /* Most of the elements will be Operand objects. */ - - switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { - case ACPI_DESC_TYPE_OPERAND: - acpi_os_printf("%12.12s R%hd", - acpi_ut_get_type_name - (descriptor->object. - common.type), - descriptor->object. - common.reference_count); - break; - - case ACPI_DESC_TYPE_PARSER: - acpi_os_printf("aml_opcode %04hX", - descriptor->op.asl. - aml_opcode); - break; - - case ACPI_DESC_TYPE_NAMED: - acpi_os_printf("%4.4s", - acpi_ut_get_node_name - (&descriptor->node)); - break; - - default: - break; - } - - acpi_os_printf("\n"); - num_outstanding++; - } - } - element = element->next; - } - - (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); - - /* Print summary */ - - if (!num_outstanding) { - ACPI_INFO((AE_INFO, "No outstanding allocations")); - } else { - ACPI_ERROR((AE_INFO, - "%d(%X) Outstanding allocations", - num_outstanding, num_outstanding)); - } - - return_VOID; -} - -#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 5d2f4b2802a5..593b08ccd6bf 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -272,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) cache->current_depth--; ACPI_MEM_TRACKING(cache->hits++); - ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Object %p from %s cache\n", - object, cache->list_name))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Object %p from %s cache\n", object, + cache->list_name)); status = acpi_ut_release_mutex(ACPI_MTX_CACHES); if (ACPI_FAILURE(status)) { diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 9c6867fcf009..51356e8eb999 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -200,8 +200,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) */ handler_desc = object->region.handler; if (handler_desc) { - if (handler_desc->address_space. - hflags & + if (handler_desc->address_space.handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { obj_pointer = second_desc->extra.region_context; diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 5bc8da7acc6c..8a05bb5ef4fe 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -191,12 +191,14 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { "Linux", "Windows 2000", "Windows 2001", - "Windows 2001.1", "Windows 2001 SP0", "Windows 2001 SP1", "Windows 2001 SP2", "Windows 2001 SP3", "Windows 2001 SP4", + "Windows 2001.1", + "Windows 2001.1 SP1", /* Added 03/2006 */ + "Windows 2006", /* Added 03/2006 */ /* Feature Group Strings */ @@ -633,7 +635,7 @@ char *acpi_ut_get_node_name(void *object) /* Descriptor must be a namespace node */ - if (node->descriptor != ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { return ("####"); } @@ -855,7 +857,7 @@ void acpi_ut_init_globals(void) 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.descriptor_type = ACPI_DESC_TYPE_NAMED; acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; acpi_gbl_root_node_struct.child = NULL; acpi_gbl_root_node_struct.peer = NULL; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 77268ba86291..017a87ebc40b 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -881,36 +881,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } - -/******************************************************************************* - * - * 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 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) -{ - - acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); -} diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 27158dd0f877..4c24e6d5400a 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -238,6 +238,104 @@ static const u8 acpi_gbl_resource_types[] = { ACPI_FIXED_LENGTH }; +/******************************************************************************* + * + * FUNCTION: acpi_ut_walk_aml_resources + * + * PARAMETERS: Aml - Pointer to the raw AML resource template + * aml_length - Length of the entire template + * user_function - Called once for each descriptor found. If + * NULL, a pointer to the end_tag is returned + * Context - Passed to user_function + * + * RETURN: Status + * + * DESCRIPTION: Walk a raw AML resource list(buffer). User function called + * once for each resource found. + * + ******************************************************************************/ + +acpi_status +acpi_ut_walk_aml_resources(u8 * aml, + acpi_size aml_length, + acpi_walk_aml_callback user_function, void *context) +{ + acpi_status status; + u8 *end_aml; + u8 resource_index; + u32 length; + u32 offset = 0; + + ACPI_FUNCTION_TRACE("ut_walk_aml_resources"); + + /* The absolute minimum resource template is one end_tag descriptor */ + + if (aml_length < sizeof(struct aml_resource_end_tag)) { + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + } + + /* Point to the end of the resource template buffer */ + + end_aml = aml + aml_length; + + /* Walk the byte list, abort on any invalid descriptor type or length */ + + while (aml < end_aml) { + + /* Validate the Resource Type and Resource Length */ + + status = acpi_ut_validate_resource(aml, &resource_index); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Get the length of this descriptor */ + + length = acpi_ut_get_descriptor_length(aml); + + /* Invoke the user function */ + + if (user_function) { + status = + user_function(aml, length, offset, resource_index, + context); + if (ACPI_FAILURE(status)) { + return (status); + } + } + + /* An end_tag descriptor terminates this resource template */ + + 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 if requested */ + + if (!user_function) { + *(void **)context = aml; + } + + /* Normal exit */ + + return_ACPI_STATUS(AE_OK); + } + + aml += length; + offset += length; + } + + /* Did not find an end_tag descriptor */ + + return (AE_AML_NO_RESOURCE_END_TAG); +} + /******************************************************************************* * * FUNCTION: acpi_ut_validate_resource @@ -498,61 +596,21 @@ 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; - /* Allow a buffer length of zero */ if (!obj_desc->buffer.length) { - *end_tag = aml; + *end_tag = obj_desc->buffer.pointer; return_ACPI_STATUS(AE_OK); } - /* 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) { - /* - * 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; - 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); - } + /* Validate the template and get a pointer to the end_tag */ - /* Did not find an end_tag resource descriptor */ + status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, + obj_desc->buffer.length, NULL, + end_tag); - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 69f2bfdc26ab..637c5f964879 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -162,7 +162,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) /* Initialize */ memset(state, 0, sizeof(union acpi_generic_state)); - state->common.data_type = ACPI_DESC_TYPE_STATE; + state->common.descriptor_type = ACPI_DESC_TYPE_STATE; } return (state); @@ -196,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) /* Init fields specific to the update struct */ - state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; + state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; state->thread.thread_id = acpi_os_get_thread_id(); return_PTR((struct acpi_thread_state *)state); @@ -233,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object /* Init fields specific to the update struct */ - state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; + state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; state->update.object = object; state->update.value = action; @@ -270,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, /* Init fields specific to the update struct */ - state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; + state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; state->pkg.source_object = (union acpi_operand_object *)internal_object; state->pkg.dest_object = external_object; state->pkg.index = index; @@ -307,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) /* Init fields specific to the control struct */ - state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; + state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; return_PTR(state); -- cgit v1.2.3 From 793c2388cae3fd023b3b5166354931752d42353c Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 31 Mar 2006 00:00:00 -0500 Subject: ACPI: ACPICA 20060331 Implemented header file support for the following additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT. With this support, all current and known ACPI tables are now defined in the ACPICA headers and are available for use by device drivers and other software. Implemented support to allow tables that contain ACPI names with invalid characters to be loaded. Previously, this would cause the table load to fail, but since there are several known cases of such tables on existing machines, this change was made to enable ACPI support for them. Also, this matches the behavior of the Microsoft ACPI implementation. https://bugzilla.novell.com/show_bug.cgi?id=147621 Fixed a couple regressions introduced during the memory optimization in the 20060317 release. The namespace node definition required additional reorganization and an internal datatype that had been changed to 8-bit was restored to 32-bit. (Valery Podrezov) Fixed a problem where a null pointer passed to acpi_ut_delete_generic_state() could be passed through to acpi_os_release_object which is unexpected. Such null pointers are now trapped and ignored, matching the behavior of the previous implementation before the deployment of acpi_os_release_object(). (Valery Podrezov, Fiodor Suietov) Fixed a memory mapping leak during the deletion of a SystemMemory operation region where a cached memory mapping was not deleted. This became a noticeable problem for operation regions that are defined within frequently used control methods. (Dana Meyers) Reorganized the ACPI table header files into two main files: one for the ACPI tables consumed by the ACPICA core, and another for the miscellaneous ACPI tables that are consumed by the drivers and other software. The various FADT definitions were merged into one common section and three different tables (ACPI 1.0, 1.0+, and 2.0) Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utdebug.c | 38 +++++++++++--- drivers/acpi/utilities/utdelete.c | 16 +++++- drivers/acpi/utilities/utglobal.c | 2 +- drivers/acpi/utilities/utinit.c | 6 +-- drivers/acpi/utilities/utmisc.c | 104 +++++++++++++++++++++++++++++++------- drivers/acpi/utilities/utresrc.c | 6 +-- drivers/acpi/utilities/utstate.c | 10 ++-- 7 files changed, 145 insertions(+), 37 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index a8c350643d57..5ec1cfcc611d 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -517,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number, * ******************************************************************************/ -void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) +void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) { acpi_native_uint i = 0; acpi_native_uint j; u32 temp32; u8 buf_char; - /* Only dump the buffer if tracing is enabled */ - - if (!((ACPI_LV_TABLES & acpi_dbg_level) && - (component_id & acpi_dbg_layer))) { - return; - } - if ((count < 4) || (count & 0x01)) { display = DB_BYTE_DISPLAY; } @@ -556,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) } switch (display) { + case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ acpi_os_printf("%02X ", buffer[i + j]); @@ -613,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) return; } + +/******************************************************************************* + * + * FUNCTION: acpi_ut_dump_buffer + * + * PARAMETERS: Buffer - Buffer to dump + * Count - Amount to dump, in bytes + * Display - BYTE, WORD, DWORD, or QWORD display + * component_iD - Caller's component ID + * + * RETURN: None + * + * DESCRIPTION: Generic dump buffer in both hex and ascii. + * + ******************************************************************************/ + +void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) +{ + + /* Only dump the buffer if tracing is enabled */ + + if (!((ACPI_LV_TABLES & acpi_dbg_level) && + (component_id & acpi_dbg_layer))) { + return; + } + + acpi_ut_dump_buffer2(buffer, count, display); +} diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 51356e8eb999..b4e34a2f81f7 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -202,8 +202,20 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) if (handler_desc) { if (handler_desc->address_space.handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { - obj_pointer = - second_desc->extra.region_context; + + /* Deactivate region and free region context */ + + if (handler_desc->address_space.setup) { + (void)handler_desc-> + address_space.setup(object, + ACPI_REGION_DEACTIVATE, + handler_desc-> + address_space. + context, + &second_desc-> + extra. + region_context); + } } acpi_ut_remove_reference(handler_desc); diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 8a05bb5ef4fe..e8ae417c9848 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -642,7 +642,7 @@ char *acpi_ut_get_node_name(void *object) /* Name must be a valid ACPI name */ if (!acpi_ut_valid_acpi_name(node->name.integer)) { - return ("????"); + node->name.integer = acpi_ut_repair_name(node->name.integer); } /* Return the name */ diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 40313de6977d..7538b165b6e5 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit") /* Local prototypes */ static void -acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); +acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset); static void acpi_ut_terminate(void); @@ -69,12 +69,12 @@ static void acpi_ut_terminate(void); ******************************************************************************/ static void -acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) +acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset) { ACPI_WARNING((AE_INFO, "Invalid FADT value %s=%X at offset %X FADT=%p", - register_name, value, (u32) offset, acpi_gbl_FADT)); + register_name, value, offset, acpi_gbl_FADT)); } /****************************************************************************** diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 017a87ebc40b..4623d7e215d3 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -47,6 +47,33 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") +/******************************************************************************* + * + * FUNCTION: acpi_ut_is_aml_table + * + * PARAMETERS: Table - An ACPI table + * + * RETURN: TRUE if table contains executable AML; FALSE otherwise + * + * DESCRIPTION: Check ACPI Signature for a table that contains AML code. + * Currently, these are DSDT,SSDT,PSDT. All other table types are + * data tables that do not contain AML code. + * + ******************************************************************************/ +u8 acpi_ut_is_aml_table(struct acpi_table_header *table) +{ + + /* Ignore tables that contain AML */ + + if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || + ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || + ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { + return (TRUE); + } + + return (FALSE); +} + /******************************************************************************* * * FUNCTION: acpi_ut_allocate_owner_id @@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc") * when the method exits or the table is unloaded. * ******************************************************************************/ + acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) { acpi_native_uint i; @@ -467,6 +495,41 @@ acpi_ut_display_init_pathname(u8 type, } #endif +/******************************************************************************* + * + * FUNCTION: acpi_ut_valid_acpi_char + * + * PARAMETERS: Char - The character to be examined + * + * RETURN: TRUE if the character is valid, FALSE otherwise + * + * DESCRIPTION: Check for a valid ACPI character. Must be one of: + * 1) Upper case alpha + * 2) numeric + * 3) underscore + * + * We allow a '!' as the last character because of the ASF! table + * + ******************************************************************************/ + +u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) +{ + + if (!((character >= 'A' && character <= 'Z') || + (character >= '0' && character <= '9') || (character == '_'))) { + + /* Allow a '!' in the last position */ + + if (character == '!' && position == 3) { + return (TRUE); + } + + return (FALSE); + } + + return (TRUE); +} + /******************************************************************************* * * FUNCTION: acpi_ut_valid_acpi_name @@ -484,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type, u8 acpi_ut_valid_acpi_name(u32 name) { - char *name_ptr = (char *)&name; - char character; acpi_native_uint i; ACPI_FUNCTION_ENTRY(); for (i = 0; i < ACPI_NAME_SIZE; i++) { - character = *name_ptr; - name_ptr++; - - if (!((character == '_') || - (character >= 'A' && character <= 'Z') || - (character >= '0' && character <= '9'))) { + if (!acpi_ut_valid_acpi_char + ((ACPI_CAST_PTR(char, &name))[i], i)) { return (FALSE); } } @@ -506,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name) /******************************************************************************* * - * FUNCTION: acpi_ut_valid_acpi_character + * FUNCTION: acpi_ut_repair_name * - * PARAMETERS: Character - The character to be examined + * PARAMETERS: Name - The ACPI name to be repaired * - * RETURN: 1 if Character may appear in a name, else 0 + * RETURN: Repaired version of the name * - * DESCRIPTION: Check for a printable character + * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and + * return the new name. * ******************************************************************************/ -u8 acpi_ut_valid_acpi_character(char character) +acpi_name acpi_ut_repair_name(acpi_name name) { + char *name_ptr = ACPI_CAST_PTR(char, &name); + char new_name[ACPI_NAME_SIZE]; + acpi_native_uint i; - ACPI_FUNCTION_ENTRY(); + for (i = 0; i < ACPI_NAME_SIZE; i++) { + new_name[i] = name_ptr[i]; + + /* + * Replace a bad character with something printable, yet technically + * still invalid. This prevents any collisions with existing "good" + * names in the namespace. + */ + if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { + new_name[i] = '*'; + } + } - return ((u8) ((character == '_') || - (character >= 'A' && character <= 'Z') || - (character >= '0' && character <= '9'))); + return (*ACPI_CAST_PTR(u32, new_name)); } /******************************************************************************* diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 4c24e6d5400a..1e680794c6df 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -258,7 +258,7 @@ static const u8 acpi_gbl_resource_types[] = { acpi_status acpi_ut_walk_aml_resources(u8 * aml, acpi_size aml_length, - acpi_walk_aml_callback user_function, void *context) + acpi_walk_aml_callback user_function, void **context) { acpi_status status; u8 *end_aml; @@ -319,7 +319,7 @@ acpi_ut_walk_aml_resources(u8 * aml, /* Return the pointer to the end_tag if requested */ if (!user_function) { - *(void **)context = aml; + *context = aml; } /* Normal exit */ @@ -610,7 +610,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, obj_desc->buffer.length, NULL, - end_tag); + (void **)end_tag); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 637c5f964879..aec5034cd978 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -321,8 +321,8 @@ union acpi_generic_state *acpi_ut_create_control_state(void) * * RETURN: None * - * DESCRIPTION: Put a state object back into the global state cache. The object - * is not actually freed at this time. + * DESCRIPTION: Release a state object to the state cache. NULL state objects + * are ignored. * ******************************************************************************/ @@ -330,6 +330,10 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state) { ACPI_FUNCTION_TRACE("ut_delete_generic_state"); - (void)acpi_os_release_object(acpi_gbl_state_cache, state); + /* Ignore null state */ + + if (state) { + (void)acpi_os_release_object(acpi_gbl_state_cache, state); + } return_VOID; } -- cgit v1.2.3 From b229cf92eee616c7cb5ad8cdb35a19b119f00bc8 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 21 Apr 2006 17:15:00 -0400 Subject: ACPI: ACPICA 20060421 Removed a device initialization optimization introduced in 20051216 where the _STA method was not run unless an _INI was also present for the same device. This optimization could cause problems because it could allow _INI methods to be run within a not-present device subtree (If a not-present device had no _INI, _STA would not be run, the not-present status would not be discovered, and the children of the device would be incorrectly traversed.) Implemented a new _STA optimization where namespace subtrees that do not contain _INI are identified and ignored during device initialization. Selectively running _STA can significantly improve boot time on large machines (with assistance from Len Brown.) Implemented support for the device initialization case where the returned _STA flags indicate a device not-present but functioning. In this case, _INI is not run, but the device children are examined for presence, as per the ACPI specification. Implemented an additional change to the IndexField support in order to conform to MS behavior. The value written to the Index Register is not simply a byte offset, it is a byte offset in units of the access width of the parent Index Field. (Fiodor Suietov) Defined and deployed a new OSL interface, acpi_os_validate_address(). This interface is called during the creation of all AML operation regions, and allows the host OS to exert control over what addresses it will allow the AML code to access. Operation Regions whose addresses are disallowed will cause a runtime exception when they are actually accessed (will not affect or abort table loading.) Defined and deployed a new OSL interface, acpi_os_validate_interface(). This interface allows the host OS to match the various "optional" interface/behavior strings for the _OSI predefined control method as appropriate (with assistance from Bjorn Helgaas.) Restructured and corrected various problems in the exception handling code paths within DsCallControlMethod and DsTerminateControlMethod in dsmethod (with assistance from Takayoshi Kochi.) Modified the Linux source converter to ignore quoted string literals while converting identifiers from mixed to lower case. This will correct problems with the disassembler and other areas where such strings must not be modified. The ACPI_FUNCTION_* macros no longer require quotes around the function name. This allows the Linux source converter to convert the names, now that the converter ignores quoted strings. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utalloc.c | 4 +- drivers/acpi/utilities/utcache.c | 2 +- drivers/acpi/utilities/utcopy.c | 16 +++--- drivers/acpi/utilities/utdelete.c | 12 ++--- drivers/acpi/utilities/uteval.c | 88 +++++++++++++++++++++++-------- drivers/acpi/utilities/utglobal.c | 38 +++----------- drivers/acpi/utilities/utinit.c | 4 +- drivers/acpi/utilities/utmath.c | 8 +-- drivers/acpi/utilities/utmisc.c | 16 +++--- drivers/acpi/utilities/utmutex.c | 12 ++--- drivers/acpi/utilities/utobject.c | 16 +++--- drivers/acpi/utilities/utresrc.c | 106 +++++++++++++++++++------------------- drivers/acpi/utilities/utstate.c | 14 ++--- drivers/acpi/utilities/utxface.c | 20 +++---- 14 files changed, 189 insertions(+), 167 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 3b29aecaaca5..65a7c2ed9aa1 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -108,7 +108,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("Acpi-parse_ext", + acpi_os_create_cache("Acpi-ParseExt", sizeof(struct acpi_parse_obj_named), ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache); @@ -289,7 +289,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) { void *allocation; - ACPI_FUNCTION_TRACE_U32("ut_allocate", size); + ACPI_FUNCTION_TRACE_U32(ut_allocate, size); /* Check for an inadvertent size of zero bytes */ diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 593b08ccd6bf..56270a30718a 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -244,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) acpi_status status; void *object; - ACPI_FUNCTION_NAME("os_acquire_object"); + ACPI_FUNCTION_NAME(os_acquire_object); if (!cache) { return (NULL); diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 371cddc0d574..5e1a80d1bc36 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); + ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple); *buffer_space_used = 0; @@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, acpi_status status; struct acpi_pkg_info info; - ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); + ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage); /* * First package at head of the buffer @@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, { acpi_status status; - ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); + ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject); if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { /* @@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, { union acpi_operand_object *internal_object; - ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); + ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple); /* * Simple types supported are: String, Buffer, Integer @@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, union acpi_operand_object *this_internal_obj; union acpi_object *this_external_obj; - ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); + ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); /* * First package at head of the buffer @@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, { acpi_status status; - ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); + ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); if (external_object->type == ACPI_TYPE_PACKAGE) { /* @@ -854,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); + ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage); dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); dest_obj->common.flags = source_obj->common.flags; @@ -910,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); + ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject); /* Create the top level object */ diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index b4e34a2f81f7..0bb4b59b2804 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) union acpi_operand_object *second_desc; union acpi_operand_object *next_desc; - ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); + ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); if (!object) { return_VOID; @@ -276,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) { union acpi_operand_object **internal_obj; - ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); + ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); /* Walk the null-terminated internal list */ @@ -309,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) u16 count; u16 new_count; - ACPI_FUNCTION_NAME("ut_update_ref_count"); + ACPI_FUNCTION_NAME(ut_update_ref_count); if (!object) { return; @@ -425,7 +425,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) union acpi_generic_state *state; acpi_native_uint i; - ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); + ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); while (object) { @@ -570,7 +570,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) void acpi_ut_add_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); + ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); /* Ensure that we have a valid object */ @@ -603,7 +603,7 @@ void acpi_ut_add_reference(union acpi_operand_object *object) void acpi_ut_remove_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); + ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); /* * Allow a NULL pointer to be passed in, just ignore it. This saves diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 68b9eff4b326..444d3a502c46 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -56,6 +56,34 @@ static acpi_status acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, struct acpi_compatible_id *one_cid); +/* + * Strings supported by the _OSI predefined (internal) method. + */ +static const char *acpi_interfaces_supported[] = { + /* Operating System Vendor Strings */ + + "Linux", + "Windows 2000", + "Windows 2001", + "Windows 2001 SP0", + "Windows 2001 SP1", + "Windows 2001 SP2", + "Windows 2001 SP3", + "Windows 2001 SP4", + "Windows 2001.1", + "Windows 2001.1 SP1", /* Added 03/2006 */ + "Windows 2006", /* Added 03/2006 */ + + /* Feature Group Strings */ + + "Extended Address Space Descriptor" + /* + * All "optional" feature group strings (features that are implemented + * by the host) should be implemented in the host version of + * acpi_os_validate_interface and should not be added here. + */ +}; + /******************************************************************************* * * FUNCTION: acpi_ut_osi_implementation @@ -64,18 +92,18 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, * * RETURN: Status * - * DESCRIPTION: Implementation of _OSI predefined control method - * Supported = _OSI (String) + * DESCRIPTION: Implementation of the _OSI predefined control method * ******************************************************************************/ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) { + acpi_status status; union acpi_operand_object *string_desc; union acpi_operand_object *return_desc; acpi_native_uint i; - ACPI_FUNCTION_TRACE("ut_osi_implementation"); + ACPI_FUNCTION_TRACE(ut_osi_implementation); /* Validate the string input argument */ @@ -84,29 +112,47 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) return_ACPI_STATUS(AE_TYPE); } - /* Create a return object (Default value = 0) */ + /* Create a return object */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } - /* Compare input string to table of supported strings */ + /* Default return value is SUPPORTED */ - for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { - if (!ACPI_STRCMP(string_desc->string.pointer, - ACPI_CAST_PTR(char, - acpi_gbl_valid_osi_strings[i]))) - { + return_desc->integer.value = ACPI_UINT32_MAX; + walk_state->return_desc = return_desc; + + /* Compare input string to static table of supported interfaces */ - /* This string is supported */ + for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { + if (!ACPI_STRCMP + (string_desc->string.pointer, + acpi_interfaces_supported[i])) { - return_desc->integer.value = 0xFFFFFFFF; - break; + /* The interface is supported */ + + return_ACPI_STATUS(AE_CTRL_TERMINATE); } } - walk_state->return_desc = return_desc; + /* + * Did not match the string in the static table, call the host OSL to + * check for a match with one of the optional strings (such as + * "Module Device", "3.0 Thermal Model", etc.) + */ + status = acpi_os_validate_interface(string_desc->string.pointer); + if (ACPI_SUCCESS(status)) { + + /* The interface is supported */ + + return_ACPI_STATUS(AE_CTRL_TERMINATE); + } + + /* The interface is not supported */ + + return_desc->integer.value = 0; return_ACPI_STATUS(AE_CTRL_TERMINATE); } @@ -139,7 +185,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_status status; u32 return_btype; - ACPI_FUNCTION_TRACE("ut_evaluate_object"); + ACPI_FUNCTION_TRACE(ut_evaluate_object); info.node = prefix_node; info.parameters = NULL; @@ -258,7 +304,7 @@ acpi_ut_evaluate_numeric_object(char *object_name, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); + ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object); status = acpi_ut_evaluate_object(device_node, object_name, ACPI_BTYPE_INTEGER, &obj_desc); @@ -334,7 +380,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE("ut_execute_HID"); + ACPI_FUNCTION_TRACE(ut_execute_HID); status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, @@ -438,7 +484,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, struct acpi_compatible_id_list *cid_list; acpi_native_uint i; - ACPI_FUNCTION_TRACE("ut_execute_CID"); + ACPI_FUNCTION_TRACE(ut_execute_CID); /* Evaluate the _CID method for this device */ @@ -536,7 +582,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE("ut_execute_UID"); + ACPI_FUNCTION_TRACE(ut_execute_UID); status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, @@ -586,7 +632,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE("ut_execute_STA"); + ACPI_FUNCTION_TRACE(ut_execute_STA); status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, ACPI_BTYPE_INTEGER, &obj_desc); @@ -636,7 +682,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) acpi_status status; u32 i; - ACPI_FUNCTION_TRACE("ut_execute_Sxds"); + ACPI_FUNCTION_TRACE(ut_execute_sxds); for (i = 0; i < 4; i++) { highest[i] = 0xFF; diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index e8ae417c9848..e666c71be0bf 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -181,30 +181,6 @@ const char *acpi_gbl_highest_dstate_names[4] = { "_S4D" }; -/* - * Strings supported by the _OSI predefined (internal) method. - * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS. - */ -const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { - /* Operating System Vendor Strings */ - - "Linux", - "Windows 2000", - "Windows 2001", - "Windows 2001 SP0", - "Windows 2001 SP1", - "Windows 2001 SP2", - "Windows 2001 SP3", - "Windows 2001 SP4", - "Windows 2001.1", - "Windows 2001.1 SP1", /* Added 03/2006 */ - "Windows 2006", /* Added 03/2006 */ - - /* Feature Group Strings */ - - "Extended Address Space Descriptor" -}; - /******************************************************************************* * * Namespace globals @@ -317,9 +293,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) * ******************************************************************************/ -struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; +struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; -struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { +struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, @@ -483,9 +459,9 @@ char *acpi_ut_get_region_name(u8 space_id) { if (space_id >= ACPI_USER_REGION_BEGIN) { - return ("user_defined_region"); + return ("UserDefinedRegion"); } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { - return ("invalid_space_id"); + return ("InvalidSpaceId"); } return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); @@ -519,7 +495,7 @@ char *acpi_ut_get_event_name(u32 event_id) { if (event_id > ACPI_EVENT_MAX) { - return ("invalid_event_iD"); + return ("InvalidEventID"); } return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); @@ -774,7 +750,7 @@ void acpi_ut_init_globals(void) acpi_status status; u32 i; - ACPI_FUNCTION_TRACE("ut_init_globals"); + ACPI_FUNCTION_TRACE(ut_init_globals); /* Create all memory caches */ @@ -785,7 +761,7 @@ void acpi_ut_init_globals(void) /* ACPI table structure */ - for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { + for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { acpi_gbl_table_lists[i].next = NULL; acpi_gbl_table_lists[i].count = 0; } diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 7538b165b6e5..c65747d3c880 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -176,7 +176,7 @@ static void acpi_ut_terminate(void) struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; - ACPI_FUNCTION_TRACE("ut_terminate"); + ACPI_FUNCTION_TRACE(ut_terminate); /* Free global tables, etc. */ /* Free global GPE blocks and related info structures */ @@ -216,7 +216,7 @@ static void acpi_ut_terminate(void) void acpi_ut_subsystem_shutdown(void) { - ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); + ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); /* Just exit if subsystem is already shutdown */ diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 4a3360484e72..19d74bedce27 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c @@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend, union uint64_overlay quotient; u32 remainder32; - ACPI_FUNCTION_TRACE("ut_short_divide"); + ACPI_FUNCTION_TRACE(ut_short_divide); /* Always check for a zero divisor */ @@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend, union uint64_overlay partial2; union uint64_overlay partial3; - ACPI_FUNCTION_TRACE("ut_divide"); + ACPI_FUNCTION_TRACE(ut_divide); /* Always check for a zero divisor */ @@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, acpi_integer * out_quotient, u32 * out_remainder) { - ACPI_FUNCTION_TRACE("ut_short_divide"); + ACPI_FUNCTION_TRACE(ut_short_divide); /* Always check for a zero divisor */ @@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend, acpi_integer in_divisor, acpi_integer * out_quotient, acpi_integer * out_remainder) { - ACPI_FUNCTION_TRACE("ut_divide"); + ACPI_FUNCTION_TRACE(ut_divide); /* Always check for a zero divisor */ diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 4623d7e215d3..874467117cec 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -95,7 +95,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) acpi_native_uint k; acpi_status status; - ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); + ACPI_FUNCTION_TRACE(ut_allocate_owner_id); /* Guard against multiple allocations of ID to the same location */ @@ -152,7 +152,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); ACPI_DEBUG_PRINT((ACPI_DB_VALUES, - "Allocated owner_id: %2.2X\n", + "Allocated OwnerId: %2.2X\n", (unsigned int)*owner_id)); goto exit; } @@ -173,7 +173,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) */ status = AE_OWNER_ID_LIMIT; ACPI_ERROR((AE_INFO, - "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); + "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -201,7 +201,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) acpi_native_uint index; u32 bit; - ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); + ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); /* Always clear the input owner_id (zero is an invalid ID) */ @@ -210,7 +210,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_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); + ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id)); return_VOID; } @@ -236,7 +236,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) acpi_gbl_owner_id_mask[index] ^= bit; } else { ACPI_ERROR((AE_INFO, - "Release of non-allocated owner_id: %2.2X", + "Release of non-allocated OwnerId: %2.2X", owner_id + 1)); } @@ -618,7 +618,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) acpi_integer return_value = 0; acpi_integer quotient; - ACPI_FUNCTION_TRACE("ut_stroul64"); + ACPI_FUNCTION_TRACE(ut_stroul64); if ((!string) || !(*string)) { goto error_exit; @@ -794,7 +794,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, u32 this_index; union acpi_operand_object *this_source_obj; - ACPI_FUNCTION_TRACE("ut_walk_package_tree"); + ACPI_FUNCTION_TRACE(ut_walk_package_tree); state = acpi_ut_create_pkg_state(source_object, target_object, 0); if (!state) { diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 0ac6700a45f8..b851f7be5d58 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -68,7 +68,7 @@ acpi_status acpi_ut_mutex_initialize(void) u32 i; acpi_status status; - ACPI_FUNCTION_TRACE("ut_mutex_initialize"); + ACPI_FUNCTION_TRACE(ut_mutex_initialize); /* * Create each of the predefined mutex objects @@ -100,7 +100,7 @@ void acpi_ut_mutex_terminate(void) { u32 i; - ACPI_FUNCTION_TRACE("ut_mutex_terminate"); + ACPI_FUNCTION_TRACE(ut_mutex_terminate); /* * Delete each predefined mutex object @@ -129,7 +129,7 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); + ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); if (mutex_id > MAX_MUTEX) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -163,7 +163,7 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); + ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); if (mutex_id > MAX_MUTEX) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -194,7 +194,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_status status; acpi_thread_id this_thread_id; - ACPI_FUNCTION_NAME("ut_acquire_mutex"); + ACPI_FUNCTION_NAME(ut_acquire_mutex); if (mutex_id > MAX_MUTEX) { return (AE_BAD_PARAMETER); @@ -277,7 +277,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) acpi_status status; acpi_thread_id this_thread_id; - ACPI_FUNCTION_NAME("ut_release_mutex"); + ACPI_FUNCTION_NAME(ut_release_mutex); this_thread_id = acpi_os_get_thread_id(); ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 8e3dcbd23f5d..ba7d8ac702df 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, union acpi_operand_object *object; union acpi_operand_object *second_object; - ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", + ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg, acpi_ut_get_type_name(type)); /* Allocate the raw object descriptor */ @@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) union acpi_operand_object *buffer_desc; u8 *buffer = NULL; - ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); + ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size); /* Create a new Buffer object */ @@ -215,7 +215,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) union acpi_operand_object *string_desc; char *string; - ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); + ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size); /* Create a new String object */ @@ -261,7 +261,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) u8 acpi_ut_valid_internal_object(void *object) { - ACPI_FUNCTION_NAME("ut_valid_internal_object"); + ACPI_FUNCTION_NAME(ut_valid_internal_object); /* Check for a null pointer */ @@ -309,7 +309,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, { union acpi_operand_object *object; - ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); + ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg); object = acpi_os_acquire_object(acpi_gbl_operand_cache); if (!object) { @@ -344,7 +344,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, void acpi_ut_delete_object_desc(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); + ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); /* Object must be an union acpi_operand_object */ @@ -383,7 +383,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, acpi_size length; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); + ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); /* * Handle a null object (Could be a uninitialized package @@ -562,7 +562,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, acpi_status status; struct acpi_pkg_info info; - ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); + ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object); info.length = 0; info.object_space = 0; diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 1e680794c6df..5a2de92831d3 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -45,113 +45,113 @@ #include #define _COMPONENT ACPI_UTILITIES -ACPI_MODULE_NAME("utmisc") +ACPI_MODULE_NAME("utresrc") #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_bm_decode[] = { + "NotBusMaster", + "BusMaster" }; -const char *acpi_gbl_config_decode[4] = { +const char *acpi_gbl_config_decode[] = { "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_consume_decode[] = { + "ResourceProducer", + "ResourceConsumer" }; -const char *acpi_gbl_DECdecode[2] = { - "pos_decode", - "sub_decode" +const char *acpi_gbl_dec_decode[] = { + "PosDecode", + "SubDecode" }; -const char *acpi_gbl_HEdecode[2] = { +const char *acpi_gbl_he_decode[] = { "Level", "Edge" }; -const char *acpi_gbl_io_decode[2] = { +const char *acpi_gbl_io_decode[] = { "Decode10", "Decode16" }; -const char *acpi_gbl_LLdecode[2] = { - "active_high", - "active_low" +const char *acpi_gbl_ll_decode[] = { + "ActiveHigh", + "ActiveLow" }; -const char *acpi_gbl_max_decode[2] = { - "max_not_fixed", - "max_fixed" +const char *acpi_gbl_max_decode[] = { + "MaxNotFixed", + "MaxFixed" }; -const char *acpi_gbl_MEMdecode[4] = { - "non_cacheable", +const char *acpi_gbl_mem_decode[] = { + "NonCacheable", "Cacheable", - "write_combining", + "WriteCombining", "Prefetchable" }; -const char *acpi_gbl_min_decode[2] = { - "min_not_fixed", - "min_fixed" +const char *acpi_gbl_min_decode[] = { + "MinNotFixed", + "MinFixed" }; -const char *acpi_gbl_MTPdecode[4] = { - "address_range_memory", - "address_range_reserved", - "address_range_aCPI", - "address_range_nVS" +const char *acpi_gbl_mtp_decode[] = { + "AddressRangeMemory", + "AddressRangeReserved", + "AddressRangeACPI", + "AddressRangeNVS" }; -const char *acpi_gbl_RNGdecode[4] = { - "invalid_ranges", - "non_iSAonly_ranges", - "ISAonly_ranges", - "entire_range" +const char *acpi_gbl_rng_decode[] = { + "InvalidRanges", + "NonISAOnlyRanges", + "ISAOnlyRanges", + "EntireRange" }; -const char *acpi_gbl_RWdecode[2] = { - "read_only", - "read_write" +const char *acpi_gbl_rw_decode[] = { + "ReadOnly", + "ReadWrite" }; -const char *acpi_gbl_SHRdecode[2] = { +const char *acpi_gbl_shr_decode[] = { "Exclusive", "Shared" }; -const char *acpi_gbl_SIZdecode[4] = { +const char *acpi_gbl_siz_decode[] = { "Transfer8", "Transfer8_16", "Transfer16", - "invalid_size" + "InvalidSize" }; -const char *acpi_gbl_TRSdecode[2] = { - "dense_translation", - "sparse_translation" +const char *acpi_gbl_trs_decode[] = { + "DenseTranslation", + "SparseTranslation" }; -const char *acpi_gbl_TTPdecode[2] = { - "type_static", - "type_translation" +const char *acpi_gbl_ttp_decode[] = { + "TypeStatic", + "TypeTranslation" }; -const char *acpi_gbl_TYPdecode[4] = { +const char *acpi_gbl_typ_decode[] = { "Compatibility", - "type_a", - "type_b", - "type_f" + "TypeA", + "TypeB", + "TypeF" }; #endif @@ -266,7 +266,7 @@ acpi_ut_walk_aml_resources(u8 * aml, u32 length; u32 offset = 0; - ACPI_FUNCTION_TRACE("ut_walk_aml_resources"); + ACPI_FUNCTION_TRACE(ut_walk_aml_resources); /* The absolute minimum resource template is one end_tag descriptor */ @@ -597,7 +597,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, { acpi_status status; - ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); + ACPI_FUNCTION_TRACE(ut_get_resource_end_tag); /* Allow a buffer length of zero */ diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index aec5034cd978..0f5c5bb5deff 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -96,7 +96,7 @@ void acpi_ut_push_generic_state(union acpi_generic_state **list_head, union acpi_generic_state *state) { - ACPI_FUNCTION_TRACE("ut_push_generic_state"); + ACPI_FUNCTION_TRACE(ut_push_generic_state); /* Push the state object onto the front of the list (stack) */ @@ -123,7 +123,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE("ut_pop_generic_state"); + ACPI_FUNCTION_TRACE(ut_pop_generic_state); /* Remove the state object at the head of the list (stack) */ @@ -185,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE("ut_create_thread_state"); + ACPI_FUNCTION_TRACE(ut_create_thread_state); /* Create the generic state object */ @@ -222,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); + ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); /* Create the generic state object */ @@ -259,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); + ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); /* Create the generic state object */ @@ -296,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE("ut_create_control_state"); + ACPI_FUNCTION_TRACE(ut_create_control_state); /* Create the generic state object */ @@ -328,7 +328,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) void acpi_ut_delete_generic_state(union acpi_generic_state *state) { - ACPI_FUNCTION_TRACE("ut_delete_generic_state"); + ACPI_FUNCTION_TRACE(ut_delete_generic_state); /* Ignore null state */ diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index ac90048a8a5b..3538f69c82a1 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -65,7 +65,7 @@ acpi_status acpi_initialize_subsystem(void) { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); + ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); @@ -125,7 +125,7 @@ acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); + ACPI_FUNCTION_TRACE(acpi_enable_subsystem); /* * We must initialize the hardware before we can enable ACPI. @@ -151,7 +151,7 @@ acpi_status acpi_enable_subsystem(u32 flags) status = acpi_enable(); if (ACPI_FAILURE(status)) { - ACPI_WARNING((AE_INFO, "acpi_enable failed")); + ACPI_WARNING((AE_INFO, "AcpiEnable failed")); return_ACPI_STATUS(status); } } @@ -246,7 +246,7 @@ acpi_status acpi_initialize_objects(u32 flags) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_initialize_objects"); + ACPI_FUNCTION_TRACE(acpi_initialize_objects); /* * Run all _REG methods @@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags) */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "[Init] Executing _REG op_region methods\n")); + "[Init] Executing _REG OpRegion methods\n")); status = acpi_ev_initialize_op_regions(); if (ACPI_FAILURE(status)) { @@ -322,7 +322,7 @@ acpi_status acpi_terminate(void) { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_terminate"); + ACPI_FUNCTION_TRACE(acpi_terminate); /* Terminate the AML Debugger if present */ @@ -400,7 +400,7 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) acpi_status status; u32 i; - ACPI_FUNCTION_TRACE("acpi_get_system_info"); + ACPI_FUNCTION_TRACE(acpi_get_system_info); /* Parameter validation */ @@ -451,8 +451,8 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) /* Current status of the ACPI tables, per table type */ - info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES; - for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { + info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1; + for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; } @@ -507,7 +507,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) ****************************************************************************/ acpi_status acpi_purge_cached_objects(void) { - ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); + ACPI_FUNCTION_TRACE(acpi_purge_cached_objects); (void)acpi_os_purge_cache(acpi_gbl_state_cache); (void)acpi_os_purge_cache(acpi_gbl_operand_cache); -- cgit v1.2.3 From 958dd242b691f64ab4632b4903dbb1e16fee8269 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 12 May 2006 17:12:00 -0400 Subject: ACPI: ACPICA 20060512 Replaced the acpi_os_queue_for_execution() with a new interface named acpi_os_execute(). The major difference is that the new interface does not have a Priority parameter, this appeared to be useless and has been replaced by a Type parameter. The Type tells the OS what type of execution is being requested, such as global lock handler, notify handler, GPE handler, etc. This allows the host to queue and execute the request as appropriate for the request type, possibly using different work queues and different priorities for the various request types. This enables fixes for multithreading deadlock problems such as http://bugzilla.kernel.org/show_bug.cgi?id=5534 (Alexey Starikovskiy and Bob Moore) Fixed a possible memory leak associated with the support for the so-called "implicit return" ACPI extension. Reported by FreeBSD (Fiodor Suietov) http://bugzilla.kernel.org/show_bug.cgi?id=6514 Fixed a problem with the Load() operator where a table load from an operation region could overwrite an internal table buffer by up to 7 bytes and cause alignment faults on IPF systems. (With assistance from Luming Yu) Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utglobal.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index e666c71be0bf..9450f9b5bfb2 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -443,7 +443,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = /* Region type decoding */ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { -/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ "SystemMemory", "SystemIO", "PCI_Config", @@ -452,7 +451,6 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { "CMOS", "PCIBARTarget", "DataTable" -/*! [End] no source code translation !*/ }; char *acpi_ut_get_region_name(u8 space_id) @@ -482,13 +480,11 @@ 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", "GlobalLock", "PowerButton", "SleepButton", "RealTimeClock", -/*! [End] no source code translation !*/ }; char *acpi_ut_get_event_name(u32 event_id) @@ -526,7 +522,6 @@ 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", @@ -558,7 +553,6 @@ static const char *acpi_gbl_ns_type_names[] = { /* 28 */ "Extra", /* 29 */ "Data", /* 30 */ "Invalid" -/*! [End] no source code translation !*/ }; char *acpi_ut_get_type_name(acpi_object_type type) @@ -641,7 +635,6 @@ 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", @@ -658,7 +651,6 @@ 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) -- cgit v1.2.3 From 4119532c95547821dbe72d6916dfa1b2148475b3 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 26 May 2006 16:36:00 -0400 Subject: ACPI: ACPICA 20060526 Restructured, flattened, and simplified the internal interfaces for namespace object evaluation - resulting in smaller code, less CPU stack use, and fewer interfaces. (With assistance from Mikhail Kouzmich) Fixed a problem with the CopyObject operator where the first parameter was not typed correctly for the parser, interpreter, compiler, and disassembler. Caused various errors and unexpected behavior. Fixed a problem where a ShiftLeft or ShiftRight of more than 64 bits produced incorrect results with some C compilers. Since the behavior of C compilers when the shift value is larger than the datatype width is apparently not well defined, the interpreter now detects this condition and simply returns zero as expected in all such cases. (BZ 395) Fixed problem reports (Valery Podrezov) integrated: - Update String-to-Integer conversion to match ACPI 3.0A spec http://bugzilla.kernel.org/show_bug.cgi?id=5329 Allow interpreter to handle nested method declarations http://bugzilla.kernel.org/show_bug.cgi?id=5361 Fixed problem reports (Fiodor Suietov) integrated: - acpi_terminate() doesn't free debug memory allocation list objects (BZ 355) - After Core Subsystem shutdown, acpi_subsystem_status() returns AE_OK (BZ 356) - acpi_os_unmap_memory() for RSDP can be invoked inconsistently (BZ 357) - Resource Manager should return AE_TYPE for non-device objects (BZ 358) - Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359) - Use acpi_os_free() instead of ACPI_FREE in acpi_rs_set_srs_method_data (BZ 360) - Incomplete cleanup branch in acpi_ps_parse_aml (BZ 361) - Incomplete cleanup branch in acpi_ds_delete_walk_state (BZ 362) - acpi_get_table_header returns AE_NO_ACPI_TABLES until DSDT is loaded (BZ 365) - Status of the Global Initialization Handler call not used (BZ 366) - Incorrect object parameter to Global Initialization Handler (BZ 367) Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utalloc.c | 51 +++++++++++------- drivers/acpi/utilities/utdelete.c | 24 ++++----- drivers/acpi/utilities/uteval.c | 45 ++++++++++------ drivers/acpi/utilities/utinit.c | 8 +-- drivers/acpi/utilities/utmisc.c | 109 +++++++++++++++++++++++++------------- 5 files changed, 143 insertions(+), 94 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 65a7c2ed9aa1..7940fc1bd69e 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -61,24 +61,6 @@ acpi_status acpi_ut_create_caches(void) { acpi_status status; -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Memory allocation lists */ - - status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); - if (ACPI_FAILURE(status)) { - return (status); - } - - status = - acpi_ut_create_list("Acpi-Namespace", - sizeof(struct acpi_namespace_node), - &acpi_gbl_ns_node_list); - if (ACPI_FAILURE(status)) { - return (status); - } -#endif - /* Object Caches, for frequently used objects */ status = @@ -125,6 +107,24 @@ acpi_status acpi_ut_create_caches(void) return (status); } +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + + /* Memory allocation lists */ + + status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); + if (ACPI_FAILURE(status)) { + return (status); + } + + status = + acpi_ut_create_list("Acpi-Namespace", + sizeof(struct acpi_namespace_node), + &acpi_gbl_ns_node_list); + if (ACPI_FAILURE(status)) { + return (status); + } +#endif + return (AE_OK); } @@ -158,6 +158,21 @@ acpi_status acpi_ut_delete_caches(void) (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); acpi_gbl_ps_node_ext_cache = NULL; +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + + /* Debug only - display leftover memory allocation, if any */ + + acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); + + /* Free memory lists */ + + acpi_os_free(acpi_gbl_global_list); + acpi_gbl_global_list = NULL; + + acpi_os_free(acpi_gbl_ns_node_list); + acpi_gbl_ns_node_list = NULL; +#endif + return (AE_OK); } diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 0bb4b59b2804..67b9f325c6fa 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -319,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) new_count = count; /* - * Perform the reference count action - * (increment, decrement, or force delete) + * Perform the reference count action (increment, decrement, force delete) */ switch (action) { - case REF_INCREMENT: new_count++; @@ -360,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) if (new_count == 0) { acpi_ut_delete_internal_obj(object); } - break; case REF_FORCE_DELETE: @@ -385,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) * (A deleted object will have a huge reference count) */ if (count > ACPI_MAX_REFERENCE_COUNT) { - ACPI_WARNING((AE_INFO, - "Large Reference Count (%X) in object %p", - count, object)); + "Large Reference Count (%X) in object %p", count, + object)); } - - return; } /******************************************************************************* @@ -417,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) ******************************************************************************/ acpi_status -acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) +acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) { acpi_status status = AE_OK; union acpi_generic_state *state_list = NULL; @@ -521,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) case ACPI_TYPE_REGION: default: - break; /* No subobjects */ + break; /* No subobjects for all other types */ } /* - * Now we can update the count in the main object. This can only + * Now we can update the count in the main object. This can only * happen after we update the sub-objects in case this causes the * main object to be deleted. */ @@ -606,8 +600,8 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); /* - * Allow a NULL pointer to be passed in, just ignore it. This saves - * each caller from having to check. Also, ignore NS nodes. + * Allow a NULL pointer to be passed in, just ignore it. This saves + * each caller from having to check. Also, ignore NS nodes. * */ if (!object || @@ -627,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) /* * Decrement the reference count, and only actually delete the object - * if the reference count becomes 0. (Must also decrement the ref count + * if the reference count becomes 0. (Must also decrement the ref count * of all subobjects!) */ (void)acpi_ut_update_object_reference(object, REF_DECREMENT); diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 444d3a502c46..d6d7121583c0 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -181,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, u32 expected_return_btypes, union acpi_operand_object **return_desc) { - struct acpi_parameter_info info; + struct acpi_evaluate_info *info; acpi_status status; u32 return_btype; ACPI_FUNCTION_TRACE(ut_evaluate_object); - info.node = prefix_node; - info.parameters = NULL; - info.parameter_type = ACPI_PARAM_ARGS; + /* Allocate the evaluation information block */ + + info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); + if (!info) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + info->prefix_node = prefix_node; + info->pathname = path; + info->parameter_type = ACPI_PARAM_ARGS; /* Evaluate the object/method */ - status = acpi_ns_evaluate_relative(path, &info); + status = acpi_ns_evaluate(info); if (ACPI_FAILURE(status)) { if (status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -205,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, prefix_node, path, status); } - return_ACPI_STATUS(status); + goto cleanup; } /* Did we get a return object? */ - if (!info.return_object) { + if (!info->return_object) { if (expected_return_btypes) { ACPI_ERROR_METHOD("No object was returned from", prefix_node, path, AE_NOT_EXIST); - return_ACPI_STATUS(AE_NOT_EXIST); + status = AE_NOT_EXIST; } - return_ACPI_STATUS(AE_OK); + goto cleanup; } /* Map the return object type to the bitmapped type */ - switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { + switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { case ACPI_TYPE_INTEGER: return_btype = ACPI_BTYPE_INTEGER; break; @@ -251,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, * happen frequently if the "implicit return" feature is enabled. * Just delete the return object and return AE_OK. */ - acpi_ut_remove_reference(info.return_object); - return_ACPI_STATUS(AE_OK); + acpi_ut_remove_reference(info->return_object); + goto cleanup; } /* Is the return object one of the expected types? */ @@ -264,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, ACPI_ERROR((AE_INFO, "Type returned from %s was incorrect: %s, expected Btypes: %X", path, - acpi_ut_get_object_type_name(info.return_object), + acpi_ut_get_object_type_name(info->return_object), expected_return_btypes)); /* On error exit, we must delete the return object */ - acpi_ut_remove_reference(info.return_object); - return_ACPI_STATUS(AE_TYPE); + acpi_ut_remove_reference(info->return_object); + status = AE_TYPE; + goto cleanup; } /* Object type is OK, return it */ - *return_desc = info.return_object; - return_ACPI_STATUS(AE_OK); + *return_desc = info->return_object; + + cleanup: + ACPI_FREE(info); + return_ACPI_STATUS(status); } /******************************************************************************* diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index c65747d3c880..ff76055eb7d6 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -228,6 +228,7 @@ void acpi_ut_subsystem_shutdown(void) /* Subsystem appears active, go ahead and shut it down */ acpi_gbl_shutdown = TRUE; + acpi_gbl_startup_flags = 0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); /* Close the acpi_event Handling */ @@ -245,12 +246,5 @@ void acpi_ut_subsystem_shutdown(void) /* Purge the local caches */ (void)acpi_ut_delete_caches(); - - /* Debug only - display leftover memory allocation, if any */ - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); -#endif - return_VOID; } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 874467117cec..5c75d35ad1cd 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -601,7 +601,8 @@ acpi_name acpi_ut_repair_name(acpi_name name) * FUNCTION: acpi_ut_strtoul64 * * PARAMETERS: String - Null terminated string - * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE + * Base - Radix of the string: 16 or ACPI_ANY_BASE; + * ACPI_ANY_BASE means 'in behalf of to_integer' * ret_integer - Where the converted integer is returned * * RETURN: Status and Converted value @@ -617,16 +618,17 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) u32 this_digit = 0; acpi_integer return_value = 0; acpi_integer quotient; + acpi_integer dividend; + u32 to_integer_op = (base == ACPI_ANY_BASE); + u32 mode32 = (acpi_gbl_integer_byte_width == 4); + u8 valid_digits = 0; + u8 sign_of0x = 0; + u8 term = 0; ACPI_FUNCTION_TRACE(ut_stroul64); - if ((!string) || !(*string)) { - goto error_exit; - } - switch (base) { case ACPI_ANY_BASE: - case 10: case 16: break; @@ -635,39 +637,45 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) return_ACPI_STATUS(AE_BAD_PARAMETER); } + if (!string) { + goto error_exit; + } + /* Skip over any white space in the buffer */ - while (ACPI_IS_SPACE(*string) || *string == '\t') { + while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { string++; } - /* - * If the input parameter Base is zero, then we need to - * determine if it is decimal or hexadecimal: - */ - if (base == 0) { + if (to_integer_op) { + /* + * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. + * We need to determine if it is decimal or hexadecimal. + */ if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { + sign_of0x = 1; base = 16; + + /* Skip over the leading '0x' */ string += 2; } else { base = 10; } } - /* - * For hexadecimal base, skip over the leading - * 0 or 0x, if they are present. - */ - if ((base == 16) && - (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { - string += 2; + /* Any string left? Check that '0x' is not followed by white space. */ + + if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { + if (to_integer_op) { + goto error_exit; + } else { + goto all_done; + } } - /* Any string left? */ + dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; - if (!(*string)) { - goto error_exit; - } + /* At least one character in the string here */ /* Main loop: convert the string to a 64-bit integer */ @@ -677,14 +685,12 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) /* Convert ASCII 0-9 to Decimal value */ this_digit = ((u8) * string) - '0'; - } else { - if (base == 10) { + } else if (base == 10) { - /* Digit is out of range */ - - goto error_exit; - } + /* Digit is out of range; possible in to_integer case only */ + term = 1; + } else { this_digit = (u8) ACPI_TOUPPER(*string); if (ACPI_IS_XDIGIT((char)this_digit)) { @@ -692,22 +698,49 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) this_digit = this_digit - 'A' + 10; } else { - /* - * We allow non-hex chars, just stop now, same as end-of-string. - * See ACPI spec, string-to-integer conversion. - */ + term = 1; + } + } + + if (term) { + if (to_integer_op) { + goto error_exit; + } else { break; } + } else if ((valid_digits == 0) && (this_digit == 0) + && !sign_of0x) { + + /* Skip zeros */ + string++; + continue; + } + + valid_digits++; + + if (sign_of0x + && ((valid_digits > 16) + || ((valid_digits > 8) && mode32))) { + /* + * This is to_integer operation case. + * No any restrictions for string-to-integer conversion, + * see ACPI spec. + */ + goto error_exit; } /* Divide the digit into the correct position */ (void) - acpi_ut_short_divide((ACPI_INTEGER_MAX - - (acpi_integer) this_digit), base, - "ient, NULL); + acpi_ut_short_divide((dividend - (acpi_integer) this_digit), + base, "ient, NULL); + if (return_value > quotient) { - goto error_exit; + if (to_integer_op) { + goto error_exit; + } else { + break; + } } return_value *= base; @@ -717,6 +750,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) /* All done, normal exit */ + all_done: + *ret_integer = return_value; return_ACPI_STATUS(AE_OK); -- cgit v1.2.3 From 4c90ece249992c7a2e3fc921e5cdb8eb92193067 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Thu, 8 Jun 2006 16:29:00 -0400 Subject: ACPI: ACPICA 20060608 Converted the locking mutex used for the ACPI hardware to a spinlock. This change should eliminate all problems caused by attempting to acquire a semaphore at interrupt level, and it means that all ACPICA external interfaces that directly access the ACPI hardware can be safely called from interrupt level. Fixed a regression introduced in 20060526 where the ACPI device initialization could be prematurely aborted with an AE_NOT_FOUND if a device did not have an optional _INI method. Fixed an IndexField issue where a write to the Data Register should be limited in size to the AccessSize (width) of the IndexField itself. (BZ 433, Fiodor Suietov) Fixed problem reports (Valery Podrezov) integrated: - Allow store of ThermalZone objects to Debug object. http://bugzilla.kernel.org/show_bug.cgi?id=5369 http://bugzilla.kernel.org/show_bug.cgi?id=5370 Fixed problem reports (Fiodor Suietov) integrated: - acpi_get_table_header() doesn't handle multiple instances correctly (BZ 364) Removed four global mutexes that were obsolete and were no longer being used. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/utilities/utglobal.c | 4 ++-- drivers/acpi/utilities/utmutex.c | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'drivers/acpi/utilities') diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 9450f9b5bfb2..e5999c65c0b8 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -691,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object) char *acpi_ut_get_mutex_name(u32 mutex_id) { - if (mutex_id > MAX_MUTEX) { + if (mutex_id > ACPI_MAX_MUTEX) { return ("Invalid Mutex ID"); } @@ -760,7 +760,7 @@ void acpi_ut_init_globals(void) /* Mutex locked flags */ - for (i = 0; i < NUM_MUTEX; i++) { + for (i = 0; i < ACPI_NUM_MUTEX; i++) { acpi_gbl_mutex_info[i].mutex = NULL; acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[i].use_count = 0; diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index b851f7be5d58..25eb34369afa 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -73,14 +73,21 @@ acpi_status acpi_ut_mutex_initialize(void) /* * Create each of the predefined mutex objects */ - for (i = 0; i < NUM_MUTEX; i++) { + for (i = 0; i < ACPI_NUM_MUTEX; i++) { status = acpi_ut_create_mutex(i); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } + /* Create the spinlocks for use at interrupt level */ + status = acpi_os_create_lock(&acpi_gbl_gpe_lock); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + status = acpi_os_create_lock(&acpi_gbl_hardware_lock); return_ACPI_STATUS(status); } @@ -105,11 +112,14 @@ void acpi_ut_mutex_terminate(void) /* * Delete each predefined mutex object */ - for (i = 0; i < NUM_MUTEX; i++) { + for (i = 0; i < ACPI_NUM_MUTEX; i++) { (void)acpi_ut_delete_mutex(i); } + /* Delete the spinlocks */ + acpi_os_delete_lock(acpi_gbl_gpe_lock); + acpi_os_delete_lock(acpi_gbl_hardware_lock); return_VOID; } @@ -131,7 +141,7 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); - if (mutex_id > MAX_MUTEX) { + if (mutex_id > ACPI_MAX_MUTEX) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -165,7 +175,7 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); - if (mutex_id > MAX_MUTEX) { + if (mutex_id > ACPI_MAX_MUTEX) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -196,7 +206,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) ACPI_FUNCTION_NAME(ut_acquire_mutex); - if (mutex_id > MAX_MUTEX) { + if (mutex_id > ACPI_MAX_MUTEX) { return (AE_BAD_PARAMETER); } @@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = mutex_id; i < MAX_MUTEX; i++) { + for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { ACPI_ERROR((AE_INFO, @@ -284,7 +294,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) "Thread %X releasing Mutex [%s]\n", this_thread_id, acpi_ut_get_mutex_name(mutex_id))); - if (mutex_id > MAX_MUTEX) { + if (mutex_id > ACPI_MAX_MUTEX) { return (AE_BAD_PARAMETER); } @@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = mutex_id; i < MAX_MUTEX; i++) { + for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { continue; -- cgit v1.2.3