summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-07-08 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-14 00:42:23 -0400
commitf9f4601f331aa1226d7a798a01950efbb388f07f (patch)
tree62e079a9275749d16a4a0da56a427be201e15d27 /drivers/acpi/dispatcher
parent4c3ffbd79529b680b3c3ef2b6f42f0c89c694ec5 (diff)
downloadop-kernel-dev-f9f4601f331aa1226d7a798a01950efbb388f07f.zip
op-kernel-dev-f9f4601f331aa1226d7a798a01950efbb388f07f.tar.gz
ACPICA 20050708 from Bob Moore <robert.moore@intel.com>
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 <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher')
-rw-r--r--drivers/acpi/dispatcher/dsinit.c6
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c35
2 files changed, 25 insertions, 16 deletions
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index d7790db..ebc07aa 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -99,7 +99,7 @@ acpi_ds_init_one_object (
* was just loaded
*/
if (((struct acpi_namespace_node *) obj_handle)->owner_id !=
- info->table_desc->table_id) {
+ info->table_desc->owner_id) {
return (AE_OK);
}
@@ -168,7 +168,7 @@ acpi_ds_init_one_object (
*/
acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (
- ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
+ ((struct acpi_namespace_node *) obj_handle)->object->method.owner_id);
break;
@@ -237,7 +237,7 @@ acpi_ds_initialize_objects (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
- table_desc->pointer->signature, table_desc->table_id, info.object_count,
+ table_desc->pointer->signature, table_desc->owner_id, info.object_count,
info.device_count, info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index c9d9a6c..1b90813 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -77,7 +77,6 @@ acpi_ds_parse_method (
union acpi_operand_object *obj_desc;
union acpi_parse_object *op;
struct acpi_namespace_node *node;
- acpi_owner_id owner_id;
struct acpi_walk_state *walk_state;
@@ -132,15 +131,18 @@ acpi_ds_parse_method (
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
- owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
- obj_desc->method.owning_id = owner_id;
+ status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
+ walk_state = acpi_ds_create_walk_state (
+ obj_desc->method.owner_id, NULL, NULL, NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
- goto cleanup;
+ goto cleanup2;
}
status = acpi_ds_init_aml_walk (walk_state, op, node,
@@ -148,7 +150,7 @@ acpi_ds_parse_method (
obj_desc->method.aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- goto cleanup;
+ goto cleanup2;
}
/*
@@ -162,13 +164,16 @@ acpi_ds_parse_method (
*/
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ goto cleanup2;
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
acpi_ut_get_node_name (obj_handle), obj_handle, op));
+cleanup2:
+ (void) acpi_ut_release_owner_id (obj_desc->method.owner_id);
+
cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
@@ -265,7 +270,7 @@ acpi_ds_call_control_method (
{
acpi_status status;
struct acpi_namespace_node *method_node;
- struct acpi_walk_state *next_walk_state;
+ struct acpi_walk_state *next_walk_state = NULL;
union acpi_operand_object *obj_desc;
struct acpi_parameter_info info;
u32 i;
@@ -289,20 +294,23 @@ acpi_ds_call_control_method (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
- obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
+ status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Init for new method, wait on concurrency semaphore */
status = acpi_ds_begin_method_execution (method_node, obj_desc,
this_walk_state->method_node);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto cleanup;
}
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
/* 1) Parse: Create a new walk state for the preempting walk */
- next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
op, obj_desc, NULL);
if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -332,7 +340,7 @@ acpi_ds_call_control_method (
/* 2) Execute: Create a new state for the preempting walk */
- next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
NULL, obj_desc, thread);
if (!next_walk_state) {
status = AE_NO_MEMORY;
@@ -383,6 +391,7 @@ acpi_ds_call_control_method (
/* On error, we must delete the new walk state */
cleanup:
+ (void) acpi_ut_release_owner_id (obj_desc->method.owner_id);
if (next_walk_state && (next_walk_state->method_desc)) {
/* Decrement the thread count on the method parse tree */
@@ -584,7 +593,7 @@ acpi_ds_terminate_control_method (
* Delete any namespace entries created anywhere else within
* the namespace
*/
- acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
+ acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
OpenPOWER on IntegriCloud