From 73459f73e5d1602c59ebec114fc45185521353c1 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 24 Jun 2005 00:00:00 -0400 Subject: ACPICA 20050617-0624 from Bob Moore ACPICA 20050617: Moved the object cache operations into the OS interface layer (OSL) to allow the host OS to handle these operations if desired (for example, the Linux OSL will invoke the slab allocator). This support is optional; the compile time define ACPI_USE_LOCAL_CACHE may be used to utilize the original cache code in the ACPI CA core. The new OSL interfaces are shown below. See utalloc.c for an example implementation, and acpiosxf.h for the exact interface definitions. Thanks to Alexey Starikovskiy. acpi_os_create_cache acpi_os_delete_cache acpi_os_purge_cache acpi_os_acquire_object acpi_os_release_object Modified the interfaces to acpi_os_acquire_lock and acpi_os_release_lock to return and restore a flags parameter. This fits better with many OS lock models. Note: the current execution state (interrupt handler or not) is no longer passed to these interfaces. If necessary, the OSL must determine this state by itself, a simple and fast operation. Thanks to Alexey Starikovskiy. Fixed a problem in the ACPI table handling where a valid XSDT was assumed present if the revision of the RSDP was 2 or greater. According to the ACPI specification, the XSDT is optional in all cases, and the table manager therefore now checks for both an RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs contain only the RSDT. Fixed an interpreter problem with the Mid() operator in the case of an input string where the resulting output string is of zero length. It now correctly returns a valid, null terminated string object instead of a string object with a null pointer. Fixed a problem with the control method argument handling to allow a store to an Arg object that already contains an object of type Device. The Device object is now correctly overwritten. Previously, an error was returned. ACPICA 20050624: Modified the new OSL cache interfaces to use ACPI_CACHE_T as the type for the host-defined cache object. This allows the OSL implementation to define and type this object in any manner desired, simplifying the OSL implementation. For example, ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be defined in the OS-specific header file for other operating systems as required. Changed the interface to AcpiOsAcquireObject to directly return the requested object as the function return (instead of ACPI_STATUS.) This change was made for performance reasons, since this is the purpose of the interface in the first place. acpi_os_acquire_object is now similar to the acpi_os_allocate interface. Thanks to Alexey Starikovskiy. Modified the initialization sequence in acpi_initialize_subsystem to call the OSL interface acpi_osl_initialize first, before any local initialization. This change was required because the global initialization now calls OSL interfaces. Restructured the code base to split some files because of size and/or because the code logically belonged in a separate file. New files are listed below. utilities/utcache.c /* Local cache interfaces */ utilities/utmutex.c /* Local mutex support */ utilities/utstate.c /* State object support */ parser/psloop.c /* Main AML parse loop */ Signed-off-by: Len Brown --- include/acpi/acutils.h | 63 ++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 38 deletions(-) (limited to 'include/acpi/acutils.h') diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 192d0bea388..e9c1584dd78 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -557,16 +557,6 @@ void acpi_ut_delete_generic_state ( union acpi_generic_state *state); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_state_cache ( - void); - -void -acpi_ut_delete_object_cache ( - void); -#endif - /* * utmath @@ -622,22 +612,6 @@ acpi_ut_strtoul64 ( #define ACPI_ANY_BASE 0 -acpi_status -acpi_ut_mutex_initialize ( - void); - -void -acpi_ut_mutex_terminate ( - void); - -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id); - -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id); - u8 * acpi_ut_get_resource_end_tag ( union acpi_operand_object *obj_desc); @@ -666,22 +640,35 @@ acpi_ut_display_init_pathname ( /* - * utalloc - memory allocation and object caching + * utmutex - mutex support */ -void * -acpi_ut_acquire_from_cache ( - u32 list_id); +acpi_status +acpi_ut_mutex_initialize ( + void); void -acpi_ut_release_to_cache ( - u32 list_id, - void *object); +acpi_ut_mutex_terminate ( + void); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_cache ( - u32 list_id); -#endif +acpi_status +acpi_ut_acquire_mutex ( + acpi_mutex_handle mutex_id); + +acpi_status +acpi_ut_release_mutex ( + acpi_mutex_handle mutex_id); + + +/* + * utalloc - memory allocation and object caching + */ +acpi_status +acpi_ut_create_caches ( + void); + +acpi_status +acpi_ut_delete_caches ( + void); acpi_status acpi_ut_validate_buffer ( -- cgit v1.2.3 From f9f4601f331aa1226d7a798a01950efbb388f07f Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 8 Jul 2005 00:00:00 -0400 Subject: ACPICA 20050708 from Bob Moore The use of the CPU stack in the debug version of the subsystem has been considerably reduced. Previously, a debug structure was declared in every function that used the debug macros. This structure has been removed in favor of declaring the individual elements as parameters to the debug functions. This reduces the cumulative stack use during nested execution of ACPI function calls at the cost of a small increase in the code size of the debug version of the subsystem. With assistance from Alexey Starikovskiy and Len Brown. Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent headers to define a macro that will return the current function name at runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent header, the function name is saved on the CPU stack (one pointer per function.) This mechanism is used because apparently there exists no standard ANSI-C defined macro that that returns the function name. Alexey Starikovskiy redesigned and reimplemented the "Owner ID" mechanism used to track namespace objects created/deleted by ACPI tables and control method execution. A bitmap is now used to allocate and free the IDs, thus solving the wraparound problem present in the previous implementation. The size of the namespace node descriptor was reduced by 2 bytes as a result. Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield flag definitions within the headers for the predefined ACPI tables. These have been replaced by UINT8_BIT in order to increase the code portability of the subsystem. If the use of UINT8 remains a problem, we may be forced to eliminate bitfields entirely because of a lack of portability. Alexey Starikovksiy enhanced the performance of acpi_ut_update_object_reference. This is a frequently used function and this improvement increases the performance of the entire subsystem. Alexey Starikovskiy fixed several possible memory leaks and the inverse - premature object deletion. Signed-off-by: Len Brown --- include/acpi/acutils.h | 56 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 16 deletions(-) (limited to 'include/acpi/acutils.h') diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index e9c1584dd78..9c05c10e379 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -120,10 +120,6 @@ u8 acpi_ut_valid_object_type ( acpi_object_type type); -acpi_owner_id -acpi_ut_allocate_owner_id ( - u32 id_type); - /* * utinit - miscellaneous initialization and shutdown @@ -306,47 +302,63 @@ acpi_ut_track_stack_ptr ( void acpi_ut_trace ( u32 line_number, - struct acpi_debug_print_info *dbg_info); + char *function_name, + char *module_name, + u32 component_id); void acpi_ut_trace_ptr ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, void *pointer); void acpi_ut_trace_u32 ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u32 integer); void acpi_ut_trace_str ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *string); void acpi_ut_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info); + char *function_name, + char *module_name, + u32 component_id); void acpi_ut_status_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_status status); void acpi_ut_value_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_integer value); void acpi_ut_ptr_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u8 *ptr); void @@ -378,7 +390,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -386,7 +400,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -477,8 +493,8 @@ acpi_ut_allocate_object_desc_dbg ( u32 line_number, u32 component_id); -#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t) -#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT) +#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t) +#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT) void acpi_ut_delete_object_desc ( @@ -579,6 +595,14 @@ acpi_ut_short_divide ( * utmisc */ acpi_status +acpi_ut_allocate_owner_id ( + acpi_owner_id *owner_id); + +acpi_status +acpi_ut_release_owner_id ( + acpi_owner_id owner_id); + +acpi_status acpi_ut_walk_package_tree ( union acpi_operand_object *source_object, void *target_object, -- cgit v1.2.3 From 0c9938cc75057c0fca1af55a55dcfc2842436695 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 29 Jul 2005 15:15:00 -0700 Subject: [ACPI] ACPICA 20050729 from Bob Moore Implemented support to ignore an attempt to install/load a particular ACPI table more than once. Apparently there exists BIOS code that repeatedly attempts to load the same SSDT upon certain events. Thanks to Venkatesh Pallipadi. Restructured the main interface to the AML parser in order to correctly handle all exceptional conditions. This will prevent leakage of the OwnerId resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some machines. Thanks to Alexey Starikovskiy. Support for "module level code" has been disabled in this version due to a number of issues that have appeared on various machines. The support can be enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When the issues are fully resolved, the code will be enabled by default again. Modified the internal functions for debug print support to define the FunctionName parameter as a (const char *) for compatibility with compiler built-in macros such as __FUNCTION__, etc. Linted the entire ACPICA source tree for both 32-bit and 64-bit. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- include/acpi/acutils.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'include/acpi/acutils.h') diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 9c05c10e379..0e7b0a3e3b5 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -302,14 +302,14 @@ acpi_ut_track_stack_ptr ( void acpi_ut_trace ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id); void acpi_ut_trace_ptr ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, void *pointer); @@ -317,7 +317,7 @@ acpi_ut_trace_ptr ( void acpi_ut_trace_u32 ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u32 integer); @@ -325,7 +325,7 @@ acpi_ut_trace_u32 ( void acpi_ut_trace_str ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *string); @@ -333,14 +333,14 @@ acpi_ut_trace_str ( void acpi_ut_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id); void acpi_ut_status_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_status status); @@ -348,7 +348,7 @@ acpi_ut_status_exit ( void acpi_ut_value_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_integer value); @@ -356,7 +356,7 @@ acpi_ut_value_exit ( void acpi_ut_ptr_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u8 *ptr); @@ -390,7 +390,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -400,7 +400,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -598,9 +598,9 @@ acpi_status acpi_ut_allocate_owner_id ( acpi_owner_id *owner_id); -acpi_status +void acpi_ut_release_owner_id ( - acpi_owner_id owner_id); + acpi_owner_id *owner_id); acpi_status acpi_ut_walk_package_tree ( @@ -609,7 +609,7 @@ acpi_ut_walk_package_tree ( acpi_pkg_callback walk_callback, void *context); -char * +void acpi_ut_strupr ( char *src_string); -- cgit v1.2.3