diff options
author | Robert Moore <robert.moore@intel.com> | 2005-07-08 00:00:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-14 00:42:23 -0400 |
commit | f9f4601f331aa1226d7a798a01950efbb388f07f (patch) | |
tree | 62e079a9275749d16a4a0da56a427be201e15d27 /drivers/acpi/utilities/utmisc.c | |
parent | 4c3ffbd79529b680b3c3ef2b6f42f0c89c694ec5 (diff) | |
download | talos-op-linux-f9f4601f331aa1226d7a798a01950efbb388f07f.tar.gz talos-op-linux-f9f4601f331aa1226d7a798a01950efbb388f07f.zip |
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/utilities/utmisc.c')
-rw-r--r-- | drivers/acpi/utilities/utmisc.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 207c836aec64..df715cd89105 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -52,6 +52,100 @@ /******************************************************************************* * + * FUNCTION: acpi_ut_allocate_owner_id + * + * PARAMETERS: owner_id - Where the new owner ID is returned + * + * DESCRIPTION: Allocate a table or method owner id + * + ******************************************************************************/ + +acpi_status +acpi_ut_allocate_owner_id ( + acpi_owner_id *owner_id) +{ + acpi_native_uint i; + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); + + + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Find a free owner ID */ + + for (i = 0; i < 32; i++) { + if (!(acpi_gbl_owner_id_mask & (1 << i))) { + acpi_gbl_owner_id_mask |= (1 << i); + *owner_id = (acpi_owner_id) i; + goto exit; + } + } + + /* + * If we are here, all owner_ids have been allocated. This probably should + * not happen since the IDs are reused after deallocation. The IDs are + * allocated upon table load (one per table) and method execution, and + * they are released when a table is unloaded or a method completes + * execution. + */ + status = AE_OWNER_ID_LIMIT; + ACPI_REPORT_ERROR (( + "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); + +exit: + (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_release_owner_id + * + * PARAMETERS: owner_id - A previously allocated owner ID + * + * DESCRIPTION: Release a table or method owner id + * + ******************************************************************************/ + +acpi_status +acpi_ut_release_owner_id ( + acpi_owner_id owner_id) +{ + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ut_release_owner_id"); + + + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Free the owner ID */ + + if (acpi_gbl_owner_id_mask & (1 << owner_id)) { + acpi_gbl_owner_id_mask ^= (1 << owner_id); + } + else { + /* This owner_id has not been allocated */ + + status = AE_NOT_EXIST; + } + + (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * * FUNCTION: acpi_ut_strupr (strupr) * * PARAMETERS: src_string - The source string to convert |