Commit f4af4dd1 authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/src/26-stable-dev

into intel.com:/home/lenb/src/26-latest-dev
parents 316b9b74 2a539154
......@@ -1071,6 +1071,7 @@ acpi_ds_delete_walk_state (
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/******************************************************************************
*
* FUNCTION: acpi_ds_delete_walk_state_cache
......@@ -1094,5 +1095,6 @@ acpi_ds_delete_walk_state_cache (
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
return_VOID;
}
#endif
......@@ -136,6 +136,12 @@ acpi_ex_convert_to_integer (
case ACPI_TYPE_BUFFER:
/* Check for zero-length buffer */
if (!count) {
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
/* Transfer no more than an integer's worth of data */
if (count > acpi_gbl_integer_byte_width) {
......
......@@ -193,7 +193,7 @@ acpi_ns_root_initialize (void)
case ACPI_TYPE_MUTEX:
obj_desc->mutex.node = new_node;
obj_desc->mutex.sync_level = (u8) ACPI_TO_INTEGER (val);
obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1);
if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
/*
......
......@@ -208,6 +208,7 @@ acpi_ps_free_op (
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
* FUNCTION: acpi_ps_delete_parse_cache
......@@ -231,6 +232,7 @@ acpi_ps_delete_parse_cache (
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT);
return_VOID;
}
#endif
/*******************************************************************************
......
......@@ -73,9 +73,12 @@ acpi_ut_release_to_cache (
ACPI_FUNCTION_ENTRY ();
cache_info = &acpi_gbl_memory_lists[list_id];
#ifdef ACPI_ENABLE_OBJECT_CACHE
/* If walk cache is full, just free this wallkstate object */
cache_info = &acpi_gbl_memory_lists[list_id];
if (cache_info->cache_depth >= cache_info->max_cache_depth) {
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
......@@ -101,6 +104,14 @@ acpi_ut_release_to_cache (
(void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
}
#else
/* Object cache is disabled; just free the object */
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
#endif
}
......@@ -130,6 +141,9 @@ acpi_ut_acquire_from_cache (
cache_info = &acpi_gbl_memory_lists[list_id];
#ifdef ACPI_ENABLE_OBJECT_CACHE
if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
return (NULL);
}
......@@ -174,10 +188,19 @@ acpi_ut_acquire_from_cache (
ACPI_MEM_TRACKING (cache_info->total_allocated++);
}
#else
/* Object cache is disabled; just allocate the object */
object = ACPI_MEM_CALLOCATE (cache_info->object_size);
ACPI_MEM_TRACKING (cache_info->total_allocated++);
#endif
return (object);
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/******************************************************************************
*
* FUNCTION: acpi_ut_delete_generic_cache
......@@ -212,6 +235,7 @@ acpi_ut_delete_generic_cache (
cache_info->cache_depth--;
}
}
#endif
/*******************************************************************************
......
......@@ -230,7 +230,7 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] =
{"_TZ_", ACPI_TYPE_THERMAL, NULL},
{"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, (char *) 0},
{"_GL_", ACPI_TYPE_MUTEX, (char *) 1},
#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
{"_OSI", ACPI_TYPE_METHOD, (char *) 1},
......
......@@ -422,6 +422,12 @@ acpi_ut_strtoul64 (
string++;
}
/* Any string left? */
if (!(*string)) {
goto error_exit;
}
/* Main loop: convert the string to a 64-bit integer */
while (*string) {
......@@ -672,7 +678,6 @@ acpi_ut_acquire_mutex (
acpi_mutex_handle mutex_id)
{
acpi_status status;
u32 i;
u32 this_thread_id;
......@@ -685,30 +690,37 @@ acpi_ut_acquire_mutex (
this_thread_id = acpi_os_get_thread_id ();
/*
* Deadlock prevention. Check if this thread owns any mutexes of value
* greater than or equal to this one. If so, the thread has violated
* the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
if (i == mutex_id) {
#ifdef ACPI_MUTEX_DEBUG
{
u32 i;
/*
* Mutex debug code, for internal debugging only.
*
* Deadlock prevention. Check if this thread owns any mutexes of value
* greater than or equal to this one. If so, the thread has violated
* the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
if (i == mutex_id) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Mutex [%s] already acquired by this thread [%X]\n",
acpi_ut_get_mutex_name (mutex_id), this_thread_id));
return (AE_ALREADY_ACQUIRED);
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Mutex [%s] already acquired by this thread [%X]\n",
acpi_ut_get_mutex_name (mutex_id), this_thread_id));
"Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (i),
acpi_ut_get_mutex_name (mutex_id)));
return (AE_ALREADY_ACQUIRED);
return (AE_ACQUIRE_DEADLOCK);
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (i),
acpi_ut_get_mutex_name (mutex_id)));
return (AE_ACQUIRE_DEADLOCK);
}
}
#endif
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
"Thread %X attempting to acquire Mutex [%s]\n",
......@@ -1187,6 +1199,7 @@ acpi_ut_delete_generic_state (
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
* FUNCTION: acpi_ut_delete_generic_state_cache
......@@ -1210,6 +1223,7 @@ acpi_ut_delete_generic_state_cache (
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_STATE);
return_VOID;
}
#endif
/*******************************************************************************
......
......@@ -368,6 +368,7 @@ acpi_ut_delete_object_desc (
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
* FUNCTION: acpi_ut_delete_object_cache
......@@ -391,6 +392,7 @@ acpi_ut_delete_object_cache (
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
return_VOID;
}
#endif
/*******************************************************************************
......
......@@ -514,10 +514,12 @@ acpi_purge_cached_objects (void)
ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects");
#ifdef ACPI_ENABLE_OBJECT_CACHE
acpi_ut_delete_generic_state_cache ();
acpi_ut_delete_object_cache ();
acpi_ds_delete_walk_state_cache ();
acpi_ps_delete_parse_cache ();
#endif
return_ACPI_STATUS (AE_OK);
}
......@@ -64,7 +64,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20050114
#define ACPI_CA_VERSION 0x20050125
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
......
......@@ -484,9 +484,11 @@ struct acpi_walk_state *
acpi_ds_get_current_walk_state (
struct acpi_thread_state *thread);
#ifdef ACPI_ENABLE_OBJECT_CACHE
void
acpi_ds_delete_walk_state_cache (
void);
#endif
#ifdef ACPI_FUTURE_USAGE
acpi_status
......
......@@ -303,9 +303,11 @@ void
acpi_ps_free_op (
union acpi_parse_object *op);
#ifdef ACPI_ENABLE_OBJECT_CACHE
void
acpi_ps_delete_parse_cache (
void);
#endif
u8
acpi_ps_is_leading_char (
......
......@@ -683,6 +683,7 @@ void
acpi_ut_delete_generic_state (
union acpi_generic_state *state);
#ifdef ACPI_ENABLE_OBJECT_CACHE
void
acpi_ut_delete_generic_state_cache (
void);
......@@ -690,6 +691,7 @@ acpi_ut_delete_generic_state_cache (
void
acpi_ut_delete_object_cache (
void);
#endif
/*
* utmisc
......@@ -778,9 +780,11 @@ acpi_ut_release_to_cache (
u32 list_id,
void *object);
#ifdef ACPI_ENABLE_OBJECT_CACHE
void
acpi_ut_delete_generic_cache (
u32 list_id);
#endif
acpi_status
acpi_ut_validate_buffer (
......
......@@ -57,6 +57,7 @@
#define ACPI_DISASSEMBLER
#define ACPI_NO_METHOD_EXECUTION
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_ENABLE_OBJECT_CACHE
#endif
#ifdef _ACPI_EXEC_APP
......@@ -67,6 +68,7 @@
#define ACPI_DEBUGGER
#define ACPI_DISASSEMBLER
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_ENABLE_OBJECT_CACHE
#endif
#ifdef _ACPI_ASL_COMPILER
......@@ -75,6 +77,7 @@
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_ENABLE_OBJECT_CACHE
#endif
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment