diff options
author | John Keller <jpk@sgi.com> | 2006-12-19 12:56:19 -0800 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-12-20 01:51:14 -0500 |
commit | 0f0fe1a08aa421266060ac67e50453a06d9ceb63 (patch) | |
tree | adba2e86e815a35fc05b6fd5e5a55362974a444a /drivers/acpi | |
parent | f238085415c56618e042252894f2fcc971add645 (diff) | |
download | blackbird-op-linux-0f0fe1a08aa421266060ac67e50453a06d9ceb63.tar.gz blackbird-op-linux-0f0fe1a08aa421266060ac67e50453a06d9ceb63.zip |
ACPI: Add support for acpi_load_table/acpi_unload_table_id
Make acpi_load_table() available for use by removing it from the #ifdef
ACPI_FUTURE_USAGE.
Also add a new routine used to unload an ACPI table of a given type and "id" -
acpi_unload_table_id(). The implementation of this new routine was almost a
direct copy of existing routine acpi_unload_table() - only difference being
that it only removes a specific table id instead of ALL tables of a given
type. The SN hotplug driver (sgi_hotplug.c) now uses both of these interfaces
to dynamically load and unload SSDT ACPI tables.
Also, a few other ACPI routines now used by the SN hotplug driver are exported
(since the driver can be a loadable module):
acpi_ns_map_handle_to_node
acpi_ns_convert_entry_to_handle
acpi_ns_get_next_node
Signed-off-by: Aaron Young <ayoung@sgi.com>
Cc: Greg KH <greg@kroah.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/namespace/nsxfobj.c | 44 | ||||
-rw-r--r-- | drivers/acpi/tables/tbxface.c | 54 |
2 files changed, 97 insertions, 1 deletions
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index a163e1d3708d..a18b1c223129 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c @@ -50,6 +50,50 @@ ACPI_MODULE_NAME("nsxfobj") /******************************************************************************* * + * FUNCTION: acpi_get_id + * + * PARAMETERS: Handle - Handle of object whose id is desired + * ret_id - Where the id will be placed + * + * RETURN: Status + * + * DESCRIPTION: This routine returns the owner id associated with a handle + * + ******************************************************************************/ +acpi_status acpi_get_id(acpi_handle handle, acpi_owner_id * ret_id) +{ + struct acpi_namespace_node *node; + acpi_status status; + + /* Parameter Validation */ + + if (!ret_id) { + return (AE_BAD_PARAMETER); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return (status); + } + + /* Convert and validate the handle */ + + node = acpi_ns_map_handle_to_node(handle); + if (!node) { + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return (AE_BAD_PARAMETER); + } + + *ret_id = node->owner_id; + + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return (status); +} + +ACPI_EXPORT_SYMBOL(acpi_get_id) + +/******************************************************************************* + * * FUNCTION: acpi_get_type * * PARAMETERS: Handle - Handle of object whose type is desired diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 7767987be15a..5ba9303293ad 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -123,7 +123,6 @@ acpi_status acpi_load_tables(void) ACPI_EXPORT_SYMBOL(acpi_load_tables) -#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * * FUNCTION: acpi_load_table @@ -221,6 +220,59 @@ ACPI_EXPORT_SYMBOL(acpi_load_table) /******************************************************************************* * + * FUNCTION: acpi_unload_table_id + * + * PARAMETERS: table_type - Type of table to be unloaded + * id - Owner ID of the table to be removed. + * + * RETURN: Status + * + * DESCRIPTION: This routine is used to force the unload of a table (by id) + * + ******************************************************************************/ +acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id) +{ + struct acpi_table_desc *table_desc; + acpi_status status; + + ACPI_FUNCTION_TRACE(acpi_unload_table); + + /* Parameter validation */ + if (table_type > ACPI_TABLE_ID_MAX) + return_ACPI_STATUS(AE_BAD_PARAMETER); + + /* Find table from the requested type list */ + table_desc = acpi_gbl_table_lists[table_type].next; + while (table_desc && table_desc->owner_id != id) + table_desc = table_desc->next; + + if (!table_desc) + return_ACPI_STATUS(AE_NOT_EXIST); + + /* + * Delete all namespace objects owned by this table. Note that these + * objects can appear anywhere in the namespace by virtue of the AML + * "Scope" operator. Thus, we need to track ownership by an ID, not + * simply a position within the hierarchy + */ + acpi_ns_delete_namespace_by_owner(table_desc->owner_id); + + status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); + if (ACPI_FAILURE(status)) + return_ACPI_STATUS(status); + + (void)acpi_tb_uninstall_table(table_desc); + + (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); + + return_ACPI_STATUS(AE_OK); +} + +ACPI_EXPORT_SYMBOL(acpi_unload_table_id) + +#ifdef ACPI_FUTURE_USAGE +/******************************************************************************* + * * FUNCTION: acpi_unload_table * * PARAMETERS: table_type - Type of table to be unloaded |