aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-01-09 00:13:17 -0500
committerLen Brown <len.brown@intel.com>2009-01-09 03:30:47 -0500
commit95b482a8d31116f3f5c2a5089569393234d06385 (patch)
treef32aec8673a285a9d188948be97af3034ee06e93 /drivers/acpi/utilities
parent6620e0c49f577454b772fb381543d60ae53eb885 (diff)
ACPICA: create acpica/ directory
also, delete sleep/ and delete ACPI_CFLAGS from Makefile Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/Makefile9
-rw-r--r--drivers/acpi/utilities/utalloc.c383
-rw-r--r--drivers/acpi/utilities/utcopy.c970
-rw-r--r--drivers/acpi/utilities/utdebug.c651
-rw-r--r--drivers/acpi/utilities/utdelete.c677
-rw-r--r--drivers/acpi/utilities/uteval.c752
-rw-r--r--drivers/acpi/utilities/utglobal.c823
-rw-r--r--drivers/acpi/utilities/utinit.c152
-rw-r--r--drivers/acpi/utilities/utmath.c312
-rw-r--r--drivers/acpi/utilities/utmisc.c1093
-rw-r--r--drivers/acpi/utilities/utmutex.c342
-rw-r--r--drivers/acpi/utilities/utobject.c677
-rw-r--r--drivers/acpi/utilities/utresrc.c616
-rw-r--r--drivers/acpi/utilities/utstate.c347
-rw-r--r--drivers/acpi/utilities/utxface.c512
15 files changed, 0 insertions, 8316 deletions
diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile
deleted file mode 100644
index 66a71a54cb0..00000000000
--- a/drivers/acpi/utilities/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Makefile for all Linux ACPI interpreter subdirectories
-#
-
-obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
- utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
- utstate.o utmutex.o utobject.o utresrc.o
-
-EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
deleted file mode 100644
index 2a017b29aa4..00000000000
--- a/drivers/acpi/utilities/utalloc.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utalloc - local memory allocation routines
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acdebug.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utalloc")
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_caches
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create all local caches
- *
- ******************************************************************************/
-acpi_status acpi_ut_create_caches(void)
-{
- acpi_status status;
-
- /* Object Caches, for frequently used objects */
-
- status =
- acpi_os_create_cache("Acpi-Namespace",
- sizeof(struct acpi_namespace_node),
- ACPI_MAX_NAMESPACE_CACHE_DEPTH,
- &acpi_gbl_namespace_cache);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-
- status =
- acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state),
- ACPI_MAX_STATE_CACHE_DEPTH,
- &acpi_gbl_state_cache);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-
- status =
- acpi_os_create_cache("Acpi-Parse",
- sizeof(struct acpi_parse_obj_common),
- ACPI_MAX_PARSE_CACHE_DEPTH,
- &acpi_gbl_ps_node_cache);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-
- status =
- acpi_os_create_cache("Acpi-ParseExt",
- sizeof(struct acpi_parse_obj_named),
- ACPI_MAX_EXTPARSE_CACHE_DEPTH,
- &acpi_gbl_ps_node_ext_cache);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-
- status =
- acpi_os_create_cache("Acpi-Operand",
- sizeof(union acpi_operand_object),
- ACPI_MAX_OBJECT_CACHE_DEPTH,
- &acpi_gbl_operand_cache);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
- /* Memory allocation lists */
-
- status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-
- status =
- acpi_ut_create_list("Acpi-Namespace",
- sizeof(struct acpi_namespace_node),
- &acpi_gbl_ns_node_list);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-#endif
-
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_caches
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Purge and delete all local caches
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_delete_caches(void)
-{
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- char buffer[7];
-
- if (acpi_gbl_display_final_mem_stats) {
- ACPI_STRCPY(buffer, "MEMORY");
- (void)acpi_db_display_statistics(buffer);
- }
-#endif
-
- (void)acpi_os_delete_cache(acpi_gbl_namespace_cache);
- acpi_gbl_namespace_cache = NULL;
-
- (void)acpi_os_delete_cache(acpi_gbl_state_cache);
- acpi_gbl_state_cache = NULL;
-
- (void)acpi_os_delete_cache(acpi_gbl_operand_cache);
- acpi_gbl_operand_cache = NULL;
-
- (void)acpi_os_delete_cache(acpi_gbl_ps_node_cache);
- acpi_gbl_ps_node_cache = NULL;
-
- (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache);
- acpi_gbl_ps_node_ext_cache = NULL;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
- /* Debug only - display leftover memory allocation, if any */
-
- acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL);
-
- /* Free memory lists */
-
- ACPI_FREE(acpi_gbl_global_list);
- acpi_gbl_global_list = NULL;
-
- ACPI_FREE(acpi_gbl_ns_node_list);
- acpi_gbl_ns_node_list = NULL;
-#endif
-
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_validate_buffer
- *
- * PARAMETERS: Buffer - Buffer descriptor to be validated
- *
- * RETURN: Status
- *
- * DESCRIPTION: Perform parameter validation checks on an struct acpi_buffer
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
-{
-
- /* Obviously, the structure pointer must be valid */
-
- if (!buffer) {
- return (AE_BAD_PARAMETER);
- }
-
- /* Special semantics for the length */
-
- if ((buffer->length == ACPI_NO_BUFFER) ||
- (buffer->length == ACPI_ALLOCATE_BUFFER) ||
- (buffer->length == ACPI_ALLOCATE_LOCAL_BUFFER)) {
- return (AE_OK);
- }
-
- /* Length is valid, the buffer pointer must be also */
-
- if (!buffer->pointer) {
- return (AE_BAD_PARAMETER);
- }
-
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_initialize_buffer
- *
- * PARAMETERS: Buffer - Buffer to be validated
- * required_length - Length needed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Validate that the buffer is of the required length or
- * allocate a new buffer. Returned buffer is always zeroed.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
- acpi_size required_length)
-{
- acpi_size input_buffer_length;
-
- /* Parameter validation */
-
- if (!buffer || !required_length) {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Buffer->Length is used as both an input and output parameter. Get the
- * input actual length and set the output required buffer length.
- */
- input_buffer_length = buffer->length;
- buffer->length = required_length;
-
- /*
- * The input buffer length contains the actual buffer length, or the type
- * of buffer to be allocated by this routine.
- */
- switch (input_buffer_length) {
- case ACPI_NO_BUFFER:
-
- /* Return the exception (and the required buffer length) */
-
- return (AE_BUFFER_OVERFLOW);
-
- case ACPI_ALLOCATE_BUFFER:
-
- /* Allocate a new buffer */
-
- buffer->pointer = acpi_os_allocate(required_length);
- break;
-
- case ACPI_ALLOCATE_LOCAL_BUFFER:
-
- /* Allocate a new buffer with local interface to allow tracking */
-
- buffer->pointer = ACPI_ALLOCATE(required_length);
- break;
-
- default:
-
- /* Existing buffer: Validate the size of the buffer */
-
- if (input_buffer_length < required_length) {
- return (AE_BUFFER_OVERFLOW);
- }
- break;
- }
-
- /* Validate allocation from above or input buffer pointer */
-
- if (!buffer->pointer) {
- return (AE_NO_MEMORY);
- }
-
- /* Have a valid buffer, clear it */
-
- ACPI_MEMSET(buffer->pointer, 0, required_length);
- return (AE_OK);
-}
-
-#ifdef NOT_USED_BY_LINUX
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_allocate
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of malloc.
- *
- ******************************************************************************/
-
-void *acpi_ut_allocate(acpi_size size,
- u32 component, const char *module, u32 line)
-{
- void *allocation;
-
- ACPI_FUNCTION_TRACE_U32(ut_allocate, size);
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!size) {
- ACPI_WARNING((module, line,
- "Attempt to allocate zero bytes, allocating 1 byte"));
- size = 1;
- }
-
- allocation = acpi_os_allocate(size);
- if (!allocation) {
-
- /* Report allocation error */
-
- ACPI_WARNING((module, line,
- "Could not allocate size %X", (u32) size));
-
- return_PTR(NULL);
- }
-
- return_PTR(allocation);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_allocate_zeroed
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
- *
- ******************************************************************************/
-
-void *acpi_ut_allocate_zeroed(acpi_size size,
- u32 component, const char *module, u32 line)
-{
- void *allocation;
-
- ACPI_FUNCTION_ENTRY();
-
- allocation = acpi_ut_allocate(size, component, module, line);
- if (allocation) {
-
- /* Clear the memory block */
-
- ACPI_MEMSET(allocation, 0, size);
- }
-
- return (allocation);
-}
-#endif
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
deleted file mode 100644
index e6f3002312e..00000000000
--- a/drivers/acpi/utilities/utcopy.c
+++ /dev/null
@@ -1,970 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utcopy - Internal to external object translation utilities
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acnamesp.h>
-
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utcopy")
-
-/* Local prototypes */
-static acpi_status
-acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
- union acpi_object *external_object,
- u8 * data_space, acpi_size * buffer_space_used);
-
-static acpi_status
-acpi_ut_copy_ielement_to_ielement(u8 object_type,
- union acpi_operand_object *source_object,
- union acpi_generic_state *state,
- void *context);
-
-static acpi_status
-acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
- u8 * buffer, acpi_size * space_used);
-
-static acpi_status
-acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
- union acpi_operand_object **return_obj);
-
-static acpi_status
-acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
- union acpi_operand_object **internal_object);
-
-static acpi_status
-acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
- union acpi_operand_object *dest_desc);
-
-static acpi_status
-acpi_ut_copy_ielement_to_eelement(u8 object_type,
- union acpi_operand_object *source_object,
- union acpi_generic_state *state,
- void *context);
-
-static acpi_status
-acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
- union acpi_operand_object *dest_obj,
- struct acpi_walk_state *walk_state);
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_isimple_to_esimple
- *
- * PARAMETERS: internal_object - Source object to be copied
- * external_object - Where to return the copied object
- * data_space - Where object data is returned (such as
- * buffer and string data)
- * buffer_space_used - Length of data_space that was used
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to copy a simple internal object to
- * an external object.
- *
- * The data_space buffer is assumed to have sufficient space for
- * the object.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
- union acpi_object *external_object,
- u8 * data_space, acpi_size * buffer_space_used)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple);
-
- *buffer_space_used = 0;
-
- /*
- * Check for NULL object case (could be an uninitialized
- * package element)
- */
- if (!internal_object) {
- return_ACPI_STATUS(AE_OK);
- }
-
- /* Always clear the external object */
-
- ACPI_MEMSET(external_object, 0, sizeof(union acpi_object));
-
- /*
- * In general, the external object will be the same type as
- * the internal object
- */
- external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
-
- /* However, only a limited number of external types are supported */
-
- switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
- case ACPI_TYPE_STRING:
-
- external_object->string.pointer = (char *)data_space;
- external_object->string.length = internal_object->string.length;
- *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
- internal_object->
- string.
- length + 1);
-
- ACPI_MEMCPY((void *)data_space,
- (void *)internal_object->string.pointer,
- (acpi_size) internal_object->string.length + 1);
- break;
-
- case ACPI_TYPE_BUFFER:
-
- external_object->buffer.pointer = data_space;
- external_object->buffer.length = internal_object->buffer.length;
- *buffer_space_used =
- ACPI_ROUND_UP_TO_NATIVE_WORD(internal_object->string.
- length);
-
- ACPI_MEMCPY((void *)data_space,
- (void *)internal_object->buffer.pointer,
- internal_object->buffer.length);
- break;
-
- case ACPI_TYPE_INTEGER:
-
- external_object->integer.value = internal_object->integer.value;
- break;
-
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- /* This is an object reference. */
-
- switch (internal_object->reference.class) {
- case ACPI_REFCLASS_NAME:
-
- /*
- * For namepath, return the object handle ("reference")
- * We are referring to the namespace node
- */
- external_object->reference.handle =
- internal_object->reference.node;
- external_object->reference.actual_type =
- acpi_ns_get_type(internal_object->reference.node);
- break;
-
- default:
-
- /* All other reference types are unsupported */
-
- return_ACPI_STATUS(AE_TYPE);
- }
- break;
-
- case ACPI_TYPE_PROCESSOR:
-
- external_object->processor.proc_id =
- internal_object->processor.proc_id;
- external_object->processor.pblk_address =
- internal_object->processor.address;
- external_object->processor.pblk_length =
- internal_object->processor.length;
- break;
-
- case ACPI_TYPE_POWER:
-
- external_object->power_resource.system_level =
- internal_object->power_resource.system_level;
-
- external_object->power_resource.resource_order =
- internal_object->power_resource.resource_order;
- break;
-
- default:
- /*
- * There is no corresponding external object type
- */
- ACPI_ERROR((AE_INFO,
- "Unsupported object type, cannot convert to external object: %s",
- acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
- (internal_object))));
-
- return_ACPI_STATUS(AE_SUPPORT);
- }
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_ielement_to_eelement
- *
- * PARAMETERS: acpi_pkg_callback
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy one package element to another package element
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_ielement_to_eelement(u8 object_type,
- union acpi_operand_object *source_object,
- union acpi_generic_state *state,
- void *context)
-{
- acpi_status status = AE_OK;
- struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
- acpi_size object_space;
- u32 this_index;
- union acpi_object *target_object;
-
- ACPI_FUNCTION_ENTRY();
-
- this_index = state->pkg.index;
- target_object = (union acpi_object *)
- &((union acpi_object *)(state->pkg.dest_object))->package.
- elements[this_index];
-
- switch (object_type) {
- case ACPI_COPY_TYPE_SIMPLE:
-
- /*
- * This is a simple or null object
- */
- status = acpi_ut_copy_isimple_to_esimple(source_object,
- target_object,
- info->free_space,
- &object_space);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
- break;
-
- case ACPI_COPY_TYPE_PACKAGE:
-
- /*
- * Build the package object
- */
- target_object->type = ACPI_TYPE_PACKAGE;
- target_object->package.count = source_object->package.count;
- target_object->package.elements =
- ACPI_CAST_PTR(union acpi_object, info->free_space);
-
- /*
- * Pass the new package object back to the package walk routine
- */
- state->pkg.this_target_obj = target_object;
-
- /*
- * Save space for the array of objects (Package elements)
- * update the buffer length counter
- */
- object_space = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
- target_object->
- package.count *
- sizeof(union
- acpi_object));
- break;
-
- default:
- return (AE_BAD_PARAMETER);
- }
-
- info->free_space += object_space;
- info->length += object_space;
- return (status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_ipackage_to_epackage
- *
- * PARAMETERS: internal_object - Pointer to the object we are returning
- * Buffer - Where the object is returned
- * space_used - Where the object length is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to place a package object in a user
- * buffer. A package object by definition contains other objects.
- *
- * The buffer is assumed to have sufficient space for the object.
- * The caller must have verified the buffer length needed using the
- * acpi_ut_get_object_size function before calling this function.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
- u8 * buffer, acpi_size * space_used)
-{
- union acpi_object *external_object;
- acpi_status status;
- struct acpi_pkg_info info;
-
- ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage);
-
- /*
- * First package at head of the buffer
- */
- external_object = ACPI_CAST_PTR(union acpi_object, buffer);
-
- /*
- * Free space begins right after the first package
- */
- info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
- info.free_space =
- buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
- info.object_space = 0;
- info.num_packages = 1;
-
- external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
- external_object->package.count = internal_object->package.count;
- external_object->package.elements = ACPI_CAST_PTR(union acpi_object,
- info.free_space);
-
- /*
- * Leave room for an array of ACPI_OBJECTS in the buffer
- * and move the free space past it
- */
- info.length += (acpi_size) external_object->package.count *
- ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
- info.free_space += external_object->package.count *
- ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
-
- status = acpi_ut_walk_package_tree(internal_object, external_object,
- acpi_ut_copy_ielement_to_eelement,
- &info);
-
- *space_used = info.length;
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_iobject_to_eobject
- *
- * PARAMETERS: internal_object - The internal object to be converted
- * buffer_ptr - Where the object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to build an API object to be returned to
- * the caller.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
- struct acpi_buffer *ret_buffer)
-{
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
-
- if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) {
- /*
- * Package object: Copy all subobjects (including
- * nested packages)
- */
- status = acpi_ut_copy_ipackage_to_epackage(internal_object,
- ret_buffer->pointer,
- &ret_buffer->length);
- } else {
- /*
- * Build a simple object (no nested objects)
- */
- status = acpi_ut_copy_isimple_to_esimple(internal_object,
- ACPI_CAST_PTR(union
- acpi_object,
- ret_buffer->
- pointer),
- ACPI_ADD_PTR(u8,
- ret_buffer->
- pointer,
- ACPI_ROUND_UP_TO_NATIVE_WORD
- (sizeof
- (union
- acpi_object))),
- &ret_buffer->length);
- /*
- * build simple does not include the object size in the length
- * so we add it in here
- */
- ret_buffer->length += sizeof(union acpi_object);
- }
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_esimple_to_isimple
- *
- * PARAMETERS: external_object - The external object to be converted
- * ret_internal_object - Where the internal object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function copies an external object to an internal one.
- * NOTE: Pointers can be copied, we don't need to copy data.
- * (The pointers have to be valid in our address space no matter
- * what we do with them!)
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
- union acpi_operand_object **ret_internal_object)
-{
- union acpi_operand_object *internal_object;
-
- ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple);
-
- /*
- * Simple types supported are: String, Buffer, Integer
- */
- switch (external_object->type) {
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- internal_object = acpi_ut_create_internal_object((u8)
- external_object->
- type);
- if (!internal_object) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
- break;
-
- case ACPI_TYPE_ANY: /* This is the case for a NULL object */
-
- *ret_internal_object = NULL;
- return_ACPI_STATUS(AE_OK);
-
- default:
- /* All other types are not supported */
-
- ACPI_ERROR((AE_INFO,
- "Unsupported object type, cannot convert to internal object: %s",
- acpi_ut_get_type_name(external_object->type)));
-
- return_ACPI_STATUS(AE_SUPPORT);
- }
-
- /* Must COPY string and buffer contents */
-
- switch (external_object->type) {
- case ACPI_TYPE_STRING:
-
- internal_object->string.pointer =
- ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string.
- length + 1);
- if (!internal_object->string.pointer) {
- goto error_exit;
- }
-
- ACPI_MEMCPY(internal_object->string.pointer,
- external_object->string.pointer,
- external_object->string.length);
-
- internal_object->string.length = external_object->string.length;
- break;
-
- case ACPI_TYPE_BUFFER:
-
- internal_object->buffer.pointer =
- ACPI_ALLOCATE_ZEROED(external_object->buffer.length);
- if (!internal_object->buffer.pointer) {
- goto error_exit;
- }
-
- ACPI_MEMCPY(internal_object->buffer.pointer,
- external_object->buffer.pointer,
- external_object->buffer.length);
-
- internal_object->buffer.length = external_object->buffer.length;
-
- /* Mark buffer data valid */
-
- internal_object->buffer.flags |= AOPOBJ_DATA_VALID;
- break;
-
- case ACPI_TYPE_INTEGER:
-
- internal_object->integer.value = external_object->integer.value;
- break;
-
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- /* TBD: should validate incoming handle */
-
- internal_object->reference.class = ACPI_REFCLASS_NAME;
- internal_object->reference.node =
- external_object->reference.handle;
- break;
-
- default:
- /* Other types can't get here */
- break;
- }
-
- *ret_internal_object = internal_object;
- return_ACPI_STATUS(AE_OK);
-
- error_exit:
- acpi_ut_remove_reference(internal_object);
- return_ACPI_STATUS(AE_NO_MEMORY);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_epackage_to_ipackage
- *
- * PARAMETERS: external_object - The external object to be converted
- * internal_object - Where the internal object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy an external package object to an internal package.
- * Handles nested packages.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
- union acpi_operand_object **internal_object)
-{
- acpi_status status = AE_OK;
- union acpi_operand_object *package_object;
- union acpi_operand_object **package_elements;
- u32 i;
-
- ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage);
-
- /* Create the package object */
-
- package_object =
- acpi_ut_create_package_object(external_object->package.count);
- if (!package_object) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- package_elements = package_object->package.elements;
-
- /*
- * Recursive implementation. Probably ok, since nested external packages
- * as parameters should be very rare.
- */
- for (i = 0; i < external_object->package.count; i++) {
- status =
- acpi_ut_copy_eobject_to_iobject(&external_object->package.
- elements[i],
- &package_elements[i]);
- if (ACPI_FAILURE(status)) {
-
- /* Truncate package and delete it */
-
- package_object->package.count = i;
- package_elements[i] = NULL;
- acpi_ut_remove_reference(package_object);
- return_ACPI_STATUS(status);
- }
- }
-
- /* Mark package data valid */
-
- package_object->package.flags |= AOPOBJ_DATA_VALID;
-
- *internal_object = package_object;
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_eobject_to_iobject
- *
- * PARAMETERS: external_object - The external object to be converted
- * internal_object - Where the internal object is returned
- *
- * RETURN: Status - the status of the call
- *
- * DESCRIPTION: Converts an external object to an internal object.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
- union acpi_operand_object **internal_object)
-{
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject);
-
- if (external_object->type == ACPI_TYPE_PACKAGE) {
- status =
- acpi_ut_copy_epackage_to_ipackage(external_object,
- internal_object);
- } else {
- /*
- * Build a simple object (no nested objects)
- */
- status =
- acpi_ut_copy_esimple_to_isimple(external_object,
- internal_object);
- }
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_simple_object
- *
- * PARAMETERS: source_desc - The internal object to be copied
- * dest_desc - New target object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Simple copy of one internal object to another. Reference count
- * of the destination object is preserved.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
- union acpi_operand_object *dest_desc)
-{
- u16 reference_count;
- union acpi_operand_object *next_object;
-
- /* Save fields from destination that we don't want to overwrite */
-
- reference_count = dest_desc->common.reference_count;
- next_object = dest_desc->common.next_object;
-
- /* Copy the entire source object over the destination object */
-
- ACPI_MEMCPY((char *)dest_desc, (char *)source_desc,
- sizeof(union acpi_operand_object));
-
- /* Restore the saved fields */
-
- dest_desc->common.reference_count = reference_count;
- dest_desc->common.next_object = next_object;
-
- /* New object is not static, regardless of source */
-
- dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-
- /* Handle the objects with extra data */
-
- switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
- case ACPI_TYPE_BUFFER:
- /*
- * Allocate and copy the actual buffer if and only if:
- * 1) There is a valid buffer pointer
- * 2) The buffer has a length > 0
- */
- if ((source_desc->buffer.pointer) &&
- (source_desc->buffer.length)) {
- dest_desc->buffer.pointer =
- ACPI_ALLOCATE(source_desc->buffer.length);
- if (!dest_desc->buffer.pointer) {
- return (AE_NO_MEMORY);
- }
-
- /* Copy the actual buffer data */
-
- ACPI_MEMCPY(dest_desc->buffer.pointer,
- source_desc->buffer.pointer,
- source_desc->buffer.length);
- }
- break;
-
- case ACPI_TYPE_STRING:
- /*
- * Allocate and copy the actual string if and only if:
- * 1) There is a valid string pointer
- * (Pointer to a NULL string is allowed)
- */
- if (source_desc->string.pointer) {
- dest_desc->string.pointer =
- ACPI_ALLOCATE((acpi_size) source_desc->string.
- length + 1);
- if (!dest_desc->string.pointer) {
- return (AE_NO_MEMORY);
- }
-
- /* Copy the actual string data */
-
- ACPI_MEMCPY(dest_desc->string.pointer,
- source_desc->string.pointer,
- (acpi_size) source_desc->string.length + 1);
- }
- break;
-
- case ACPI_TYPE_LOCAL_REFERENCE:
- /*
- * We copied the reference object, so we now must add a reference
- * to the object pointed to by the reference
- *
- * DDBHandle reference (from Load/load_table) is a special reference,
- * it does not have a Reference.Object, so does not need to
- * increase the reference count
- */
- if (source_desc->reference.class == ACPI_REFCLASS_TABLE) {
- break;
- }
-
- acpi_ut_add_reference(source_desc->reference.object);
- break;
-
- case ACPI_TYPE_REGION:
- /*
- * We copied the Region Handler, so we now must add a reference
- */
- if (dest_desc->region.handler) {
- acpi_ut_add_reference(dest_desc->region.handler);
- }
- break;
-
- default:
- /* Nothing to do for other simple objects */
- break;
- }
-
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_ielement_to_ielement
- *
- * PARAMETERS: acpi_pkg_callback
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy one package element to another package element
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_ielement_to_ielement(u8 object_type,
- union acpi_operand_object *source_object,
- union acpi_generic_state *state,
- void *context)
-{
- acpi_status status = AE_OK;
- u32 this_index;
- union acpi_operand_object **this_target_ptr;
- union acpi_operand_object *target_object;
-
- ACPI_FUNCTION_ENTRY();
-
- this_index = state->pkg.index;
- this_target_ptr = (union acpi_operand_object **)
- &state->pkg.dest_object->package.elements[this_index];
-
- switch (object_type) {
- case ACPI_COPY_TYPE_SIMPLE:
-
- /* A null source object indicates a (legal) null package element */
-
- if (source_object) {
- /*
- * This is a simple object, just copy it
- */
- target_object =
- acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
- (source_object));
- if (!target_object) {
- return (AE_NO_MEMORY);
- }
-
- status =
- acpi_ut_copy_simple_object(source_object,
- target_object);
- if (ACPI_FAILURE(status)) {
- goto error_exit;
- }
-
- *this_target_ptr = target_object;
- } else {
- /* Pass through a null element */
-
- *this_target_ptr = NULL;
- }
- break;
-
- case ACPI_COPY_TYPE_PACKAGE:
-
- /*
- * This object is a package - go down another nesting level
- * Create and build the package object
- */
- target_object =
- acpi_ut_create_package_object(source_object->package.count);
- if (!target_object) {
- return (AE_NO_MEMORY);
- }
-
- target_object->common.flags = source_object->common.flags;
-
- /* Pass the new package object back to the package walk routine */
-
- state->pkg.this_target_obj = target_object;
-
- /* Store the object pointer in the parent package object */
-
- *this_target_ptr = target_object;
- break;
-
- default:
- return (AE_BAD_PARAMETER);
- }
-
- return (status);
-
- error_exit:
- acpi_ut_remove_reference(target_object);
- return (status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_ipackage_to_ipackage
- *
- * PARAMETERS: *source_obj - Pointer to the source package object
- * *dest_obj - Where the internal object is returned
- *
- * RETURN: Status - the status of the call
- *
- * DESCRIPTION: This function is called to copy an internal package object
- * into another internal package object.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
- union acpi_operand_object *dest_obj,
- struct acpi_walk_state *walk_state)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage);
-
- dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj);
- dest_obj->common.flags = source_obj->common.flags;
- dest_obj->package.count = source_obj->package.count;
-
- /*
- * Create the object array and walk the source package tree
- */
- dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
- source_obj->package.
- count +
- 1) * sizeof(void *));
- if (!dest_obj->package.elements) {
- ACPI_ERROR((AE_INFO, "Package allocation failure"));
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- /*
- * Copy the package element-by-element by walking the package "tree".
- * This handles nested packages of arbitrary depth.
- */
- status = acpi_ut_walk_package_tree(source_obj, dest_obj,
- acpi_ut_copy_ielement_to_ielement,
- walk_state);
- if (ACPI_FAILURE(status)) {
-
- /* On failure, delete the destination package object */
-
- acpi_ut_remove_reference(dest_obj);
- }
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_iobject_to_iobject
- *
- * PARAMETERS: walk_state - Current walk state
- * source_desc - The internal object to be copied
- * dest_desc - Where the copied object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy an internal object to a new internal object
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
- union acpi_operand_object **dest_desc,
- struct acpi_walk_state *walk_state)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject);
-
- /* Create the top level object */
-
- *dest_desc =
- acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE(source_desc));
- if (!*dest_desc) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- /* Copy the object and possible subobjects */
-
- if (ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_PACKAGE) {
- status =
- acpi_ut_copy_ipackage_to_ipackage(source_desc, *dest_desc,
- walk_state);
- } else {
- status = acpi_ut_copy_simple_object(source_desc, *dest_desc);
- }
-
- return_ACPI_STATUS(status);
-}
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
deleted file mode 100644
index 9a3538c497d..00000000000
--- a/drivers/acpi/utilities/utdebug.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utdebug - Debug print routines
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utdebug")
-#ifdef ACPI_DEBUG_OUTPUT
-static acpi_thread_id acpi_gbl_prev_thread_id;
-static char *acpi_gbl_fn_entry_str = "----Entry";
-static char *acpi_gbl_fn_exit_str = "----Exit-";
-
-/* Local prototypes */
-
-static const char *acpi_ut_trim_function_name(const char *function_name);
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_init_stack_ptr_trace
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
- *
- ******************************************************************************/
-
-void acpi_ut_init_stack_ptr_trace(void)
-{
- acpi_size current_sp;
-
- acpi_gbl_entry_stack_pointer = &current_sp;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_track_stack_ptr
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Save the current CPU stack pointer
- *
- ******************************************************************************/
-
-void acpi_ut_track_stack_ptr(void)
-{
- acpi_size current_sp;
-
- if (&current_sp < acpi_gbl_lowest_stack_pointer) {
- acpi_gbl_lowest_stack_pointer = &current_sp;
- }
-
- if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
- acpi_gbl_deepest_nesting = acpi_gbl_nesting_level;
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_trim_function_name
- *
- * PARAMETERS: function_name - Ascii string containing a procedure name
- *
- * RETURN: Updated pointer to the function name
- *
- * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
- * This allows compiler macros such as __func__ to be used
- * with no change to the debug output.
- *
- ******************************************************************************/
-
-static const char *acpi_ut_trim_function_name(const char *function_name)
-{
-
- /* All Function names are longer than 4 chars, check is safe */
-
- if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
-
- /* This is the case where the original source has not been modified */
-
- return (function_name + 4);
- }
-
- if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
-
- /* This is the case where the source has been 'linuxized' */
-
- return (function_name + 5);
- }
-
- return (function_name);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_debug_print
- *
- * PARAMETERS: requested_debug_level - Requested debug print level
- * line_number - Caller's line number (for error output)
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Format - Printf format field
- * ... - Optional printf arguments
- *
- * RETURN: None
- *
- * DESCRIPTION: Print error message with prefix consisting of the module name,
- * line number, and component ID.
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_debug_print(u32 requested_debug_level,
- u32 line_number,
- const char *function_name,
- const char *module_name,
- u32 component_id, const char *format, ...)
-{
- acpi_thread_id thread_id;
- va_list args;
-
- /*
- * Stay silent if the debug level or component ID is disabled
- */
- if (!(requested_debug_level & acpi_dbg_level) ||
- !(component_id & acpi_dbg_layer)) {
- return;
- }
-
- /*
- * Thread tracking and context switch notification
- */
- thread_id = acpi_os_get_thread_id();
- if (thread_id != acpi_gbl_prev_thread_id) {
- if (ACPI_LV_THREADS & acpi_dbg_level) {
- acpi_os_printf
- ("\n**** Context Switch from TID %lX to TID %lX ****\n\n",
- (unsigned long)acpi_gbl_prev_thread_id,
- (unsigned long)thread_id);
- }
-
- acpi_gbl_prev_thread_id = thread_id;
- }
-
- /*
- * Display the module name, current line number, thread ID (if requested),
- * current procedure nesting level, and the current procedure name
- */
- acpi_os_printf("%8s-%04ld ", module_name, line_number);
-
- if (ACPI_LV_THREADS & acpi_dbg_level) {
- acpi_os_printf("[%04lX] ", (unsigned long)thread_id);
- }
-
- acpi_os_printf("[%02ld] %-22.22s: ",
- acpi_gbl_nesting_level,
- acpi_ut_trim_function_name(function_name));
-
- va_start(args, format);
- acpi_os_vprintf(format, args);
- va_end(args);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_debug_print)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_debug_print_raw
- *
- * PARAMETERS: requested_debug_level - Requested debug print level
- * line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Format - Printf format field
- * ... - Optional printf arguments
- *
- * RETURN: None
- *
- * DESCRIPTION: Print message with no headers. Has same interface as
- * debug_print so that the same macros can be used.
- *
- ******************************************************************************/
-void ACPI_INTERNAL_VAR_XFACE
-acpi_debug_print_raw(u32 requested_debug_level,
- u32 line_number,
- const char *function_name,
- const char *module_name,
- u32 component_id, const char *format, ...)
-{
- va_list args;
-
- if (!(requested_debug_level & acpi_dbg_level) ||
- !(component_id & acpi_dbg_layer)) {
- return;
- }
-
- va_start(args, format);
- acpi_os_vprintf(format, args);
- va_end(args);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_debug_print_raw)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_trace
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- *
- * RETURN: None
- *
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level
- *
- ******************************************************************************/
-void
-acpi_ut_trace(u32 line_number,
- const char *function_name,
- const char *module_name, u32 component_id)
-{
-
- acpi_gbl_nesting_level++;
- acpi_ut_track_stack_ptr();
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s\n", acpi_gbl_fn_entry_str);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_ut_trace)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_trace_ptr
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Pointer - Pointer to display
- *
- * RETURN: None
- *
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level
- *
- ******************************************************************************/
-void
-acpi_ut_trace_ptr(u32 line_number,
- const char *function_name,
- const char *module_name, u32 component_id, void *pointer)
-{
- acpi_gbl_nesting_level++;
- acpi_ut_track_stack_ptr();
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s %p\n", acpi_gbl_fn_entry_str, pointer);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_trace_str
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * String - Additional string to display
- *
- * RETURN: None
- *
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level
- *
- ******************************************************************************/
-
-void
-acpi_ut_trace_str(u32 line_number,
- const char *function_name,
- const char *module_name, u32 component_id, char *string)
-{
-
- acpi_gbl_nesting_level++;
- acpi_ut_track_stack_ptr();
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s %s\n", acpi_gbl_fn_entry_str, string);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_trace_u32
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Integer - Integer to display
- *
- * RETURN: None
- *
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level
- *
- ******************************************************************************/
-
-void
-acpi_ut_trace_u32(u32 line_number,
- const char *function_name,
- const char *module_name, u32 component_id, u32 integer)
-{
-
- acpi_gbl_nesting_level++;
- acpi_ut_track_stack_ptr();
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s %08X\n", acpi_gbl_fn_entry_str, integer);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_exit
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- *
- * RETURN: None
- *
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level
- *
- ******************************************************************************/
-
-void
-acpi_ut_exit(u32 line_number,
- const char *function_name,
- const char *module_name, u32 component_id)
-{
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s\n", acpi_gbl_fn_exit_str);
-
- acpi_gbl_nesting_level--;
-}
-
-ACPI_EXPORT_SYMBOL(acpi_ut_exit)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_status_exit
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Status - Exit status code
- *
- * RETURN: None
- *
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level. Prints exit status also.
- *
- ******************************************************************************/
-void
-acpi_ut_status_exit(u32 line_number,
- const char *function_name,
- const char *module_name,
- u32 component_id, acpi_status status)
-{
-
- if (ACPI_SUCCESS(status)) {
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name,
- component_id, "%s %s\n", acpi_gbl_fn_exit_str,
- acpi_format_exception(status));
- } else {
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name,
- component_id, "%s ****Exception****: %s\n",
- acpi_gbl_fn_exit_str,
- acpi_format_exception(status));
- }
-
- acpi_gbl_nesting_level--;
-}
-
-ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_value_exit
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Value - Value to be printed with exit msg
- *
- * RETURN: None
- *
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level. Prints exit value also.
- *
- ******************************************************************************/
-void
-acpi_ut_value_exit(u32 line_number,
- const char *function_name,
- const char *module_name,
- u32 component_id, acpi_integer value)
-{
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
- ACPI_FORMAT_UINT64(value));
-
- acpi_gbl_nesting_level--;
-}
-
-ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_ptr_exit
- *
- * PARAMETERS: line_number - Caller's line number
- * function_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
- * Ptr - Pointer to display
- *
- * RETURN: None
- *
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in debug_level. Prints exit value also.
- *
- ******************************************************************************/
-void
-acpi_ut_ptr_exit(u32 line_number,
- const char *function_name,
- const char *module_name, u32 component_id, u8 *ptr)
-{
-
- acpi_debug_print(ACPI_LV_FUNCTIONS,
- line_number, function_name, module_name, component_id,
- "%s %p\n", acpi_gbl_fn_exit_str, ptr);
-
- acpi_gbl_nesting_level--;
-}
-
-#endif
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_dump_buffer
- *
- * PARAMETERS: Buffer - Buffer to dump
- * Count - Amount to dump, in bytes
- * Display - BYTE, WORD, DWORD, or QWORD display
- * component_iD - Caller's component ID
- *
- * RETURN: None
- *
- * DESCRIPTION: Generic dump buffer in both hex and ascii.
- *
- ******************************************************************************/
-
-void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
-{
- u32 i = 0;
- u32 j;
- u32 temp32;
- u8 buf_char;
-
- if (!buffer) {
- acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
- return;
- }
-
- if ((count < 4) || (count & 0x01)) {
- display = DB_BYTE_DISPLAY;
- }
-
- /* Nasty little dump buffer routine! */
-
- while (i < count) {
-
- /* Print current offset */
-
- acpi_os_printf("%6.4X: ", i);
-
- /* Print 16 hex chars */
-
- for (j = 0; j < 16;) {
- if (i + j >= count) {
-
- /* Dump fill spaces */
-
- acpi_os_printf("%*s", ((display * 2) + 1), " ");
- j += display;
- continue;
- }
-
- switch (display) {
- case DB_BYTE_DISPLAY:
- default: /* Default is BYTE display */
-
- acpi_os_printf("%02X ",
- buffer[(acpi_size) i + j]);
- break;
-
- case DB_WORD_DISPLAY:
-
- ACPI_MOVE_16_TO_32(&temp32,
- &buffer[(acpi_size) i + j]);
- acpi_os_printf("%04X ", temp32);
- break;
-
- case DB_DWORD_DISPLAY:
-
- ACPI_MOVE_32_TO_32(&temp32,
- &buffer[(acpi_size) i + j]);
- acpi_os_printf("%08X ", temp32);
- break;
-
- case DB_QWORD_DISPLAY:
-
- ACPI_MOVE_32_TO_32(&temp32,
- &buffer[(acpi_size) i + j]);
- acpi_os_printf("%08X", temp32);
-
- ACPI_MOVE_32_TO_32(&temp32,
- &buffer[(acpi_size) i + j +
- 4]);
- acpi_os_printf("%08X ", temp32);
- break;
- }
-
- j += display;
- }
-
- /*
- * Print the ASCII equivalent characters but watch out for the bad
- * unprintable ones (printable chars are 0x20 through 0x7E)
- */
- acpi_os_printf(" ");
- for (j = 0; j < 16; j++) {
- if (i + j >= count) {
- acpi_os_printf("\n");
- return;
- }
-
- buf_char = buffer[(acpi_size) i + j];
- if (ACPI_IS_PRINT(buf_char)) {
- acpi_os_printf("%c", buf_char);
- } else {
- acpi_os_printf(".");
- }
- }
-
- /* Done with that line. */
-
- acpi_os_printf("\n");
- i += 16;
- }
-
- return;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_dump_buffer
- *
- * PARAMETERS: Buffer - Buffer to dump
- * Count - Amount to dump, in bytes
- * Display - BYTE, WORD, DWORD, or QWORD display
- * component_iD - Caller's component ID
- *
- * RETURN: None
- *
- * DESCRIPTION: Generic dump buffer in both hex and ascii.
- *
- ******************************************************************************/
-
-void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
-{
-
- /* Only dump the buffer if tracing is enabled */
-
- if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
- (component_id & acpi_dbg_layer))) {
- return;
- }
-
- acpi_ut_dump_buffer2(buffer, count, display);
-}
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
deleted file mode 100644
index 5b4e3b1a752..00000000000
--- a/drivers/acpi/utilities/utdelete.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: utdelete - object deletion and reference count utilities
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utdelete")
-
-/* Local prototypes */
-static void acpi_ut_delete_internal_obj(union acpi_operand_object *object);
-
-static void
-acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action);
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_internal_obj
- *
- * PARAMETERS: Object - Object to be deleted
- *
- * RETURN: None
- *
- * DESCRIPTION: Low level object deletion, after reference counts have been
- * updated (All reference counts, including sub-objects!)
- *
- ******************************************************************************/
-
-static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
-{
- void *obj_pointer = NULL;
- union acpi_operand_object *handler_desc;
- union acpi_operand_object *second_desc;
- union acpi_operand_object *next_desc;
-
- ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object);
-
- if (!object) {
- return_VOID;
- }
-
- /*
- * Must delete or free any pointers within the object that are not
- * actual ACPI objects (for example, a raw buffer pointer).
- */
- switch (ACPI_GET_OBJECT_TYPE(object)) {
- case ACPI_TYPE_STRING:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "**** String %p, ptr %p\n", object,
- object->string.pointer));
-
- /* Free the actual string buffer */
-
- if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
-
- /* But only if it is NOT a pointer into an ACPI table */
-
- obj_pointer = object->string.pointer;
- }
- break;
-
- case ACPI_TYPE_BUFFER:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "**** Buffer %p, ptr %p\n", object,
- object->buffer.pointer));
-
- /* Free the actual buffer */
-
- if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
-
- /* But only if it is NOT a pointer into an ACPI table */
-
- obj_pointer = object->buffer.pointer;
- }
- break;
-
- case ACPI_TYPE_PACKAGE:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- " **** Package of count %X\n",
- object->package.count));
-
- /*
- * Elements of the package are not handled here, they are deleted
- * separately
- */
-
- /* Free the (variable length) element pointer array */
-
- obj_pointer = object->package.elements;
- break;
-
- /*
- * These objects have a possible list of notify handlers.
- * Device object also may have a GPE block.
- */
- case ACPI_TYPE_DEVICE:
-
- if (object->device.gpe_block) {
- (void)acpi_ev_delete_gpe_block(object->device.
- gpe_block);
- }
-
- /*lint -fallthrough */
-
- case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_THERMAL:
-
- /* Walk the notify handler list for this object */
-
- handler_desc = object->common_notify.handler;
- while (handler_desc) {
- next_desc = handler_desc->address_space.next;
- acpi_ut_remove_reference(handler_desc);
- handler_desc = next_desc;
- }
- break;
-
- case ACPI_TYPE_MUTEX:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "***** Mutex %p, OS Mutex %p\n",
- object, object->mutex.os_mutex));
-
- if (object == acpi_gbl_global_lock_mutex) {
-
- /* Global Lock has extra semaphore */
-
- (void)
- acpi_os_delete_semaphore
- (acpi_gbl_global_lock_semaphore);
- acpi_gbl_global_lock_semaphore = NULL;
-
- acpi_os_delete_mutex(object->mutex.os_mutex);
- acpi_gbl_global_lock_mutex = NULL;
- } else {
- acpi_ex_unlink_mutex(object);
- acpi_os_delete_mutex(object->mutex.os_mutex);
- }
- break;
-
- case ACPI_TYPE_EVENT:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "***** Event %p, OS Semaphore %p\n",
- object, object->event.os_semaphore));
-
- (void)acpi_os_delete_semaphore(object->event.os_semaphore);
- object->event.os_semaphore = NULL;
- break;
-
- case ACPI_TYPE_METHOD:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "***** Method %p\n", object));
-
- /* Delete the method mutex if it exists */
-
- if (object->method.mutex) {
- acpi_os_delete_mutex(object->method.mutex->mutex.
- os_mutex);
- acpi_ut_delete_object_desc(object->method.mutex);
- object->method.mutex = NULL;
- }
- break;
-
- case ACPI_TYPE_REGION:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "***** Region %p\n", object));
-
- second_desc = acpi_ns_get_secondary_object(object);
- if (second_desc) {
- /*
- * Free the region_context if and only if the handler is one of the
- * default handlers -- and therefore, we created the context object
- * locally, it was not created by an external caller.
- */
- handler_desc = object->region.handler;
- if (handler_desc) {
- if (handler_desc->address_space.handler_flags &
- ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
-
- /* Deactivate region and free region context */
-
- if (handler_desc->address_space.setup) {
- (void)handler_desc->
- address_space.setup(object,
- ACPI_REGION_DEACTIVATE,
- handler_desc->
- address_space.
- context,
- &second_desc->
- extra.
- region_context);
- }
- }
-
- acpi_ut_remove_reference(handler_desc);
- }
-
- /* Now we can free the Extra object */
-
- acpi_ut_delete_object_desc(second_desc);
- }
- break;
-
- case ACPI_TYPE_BUFFER_FIELD:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "***** Buffer Field %p\n", object));
-
- second_desc = acpi_ns_get_secondary_object(object);
- if (second_desc) {
- acpi_ut_delete_object_desc(second_desc);
- }
- break;
-
- case ACPI_TYPE_LOCAL_BANK_FIELD:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "***** Bank Field %p\n", object));
-
- second_desc = acpi_ns_get_secondary_object(object);
- if (second_desc) {
- acpi_ut_delete_object_desc(second_desc);
- }
- break;
-
- default:
- break;
- }
-
- /* Free any allocated memory (pointer within the object) found above */
-
- if (obj_pointer) {
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Deleting Object Subptr %p\n", obj_pointer));
- ACPI_FREE(obj_pointer);
- }
-
- /* Now the object can be safely deleted */
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
- object, acpi_ut_get_object_type_name(object)));
-
- acpi_ut_delete_object_desc(object);
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_internal_object_list
- *
- * PARAMETERS: obj_list - Pointer to the list to be deleted
- *
- * RETURN: None
- *
- * DESCRIPTION: This function deletes an internal object list, including both
- * simple objects and package objects
- *
- ******************************************************************************/
-
-void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
-{
- union acpi_operand_object **internal_obj;
-
- ACPI_FUNCTION_TRACE(ut_delete_internal_object_list);
-
- /* Walk the null-terminated internal list */
-
- for (internal_obj = obj_list; *internal_obj; internal_obj++) {
- acpi_ut_remove_reference(*internal_obj);
- }
-
- /* Free the combined parameter pointer list and object array */
-
- ACPI_FREE(obj_list);
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_update_ref_count
- *
- * PARAMETERS: Object - Object whose ref count is to be updated
- * Action - What to do
- *
- * RETURN: New ref count
- *
- * DESCRIPTION: Modify the ref count and return it.
- *
- ******************************************************************************/
-
-static void
-acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
-{
- u16 count;
- u16 new_count;
-
- ACPI_FUNCTION_NAME(ut_update_ref_count);
-
- if (!object) {
- return;
- }
-
- count = object->common.reference_count;
- new_count = count;
-
- /*
- * Perform the reference count action (increment, decrement, force delete)
- */
- switch (action) {
- case REF_INCREMENT:
-
- new_count++;
- object->common.reference_count = new_count;
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Obj %p Refs=%X, [Incremented]\n",
- object, new_count));
- break;
-
- case REF_DECREMENT:
-
- if (count < 1) {
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
- object, new_count));
-
- new_count = 0;
- } else {
- new_count--;
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Obj %p Refs=%X, [Decremented]\n",
- object, new_count));
- }
-
- if (ACPI_GET_OBJECT_TYPE(object) == ACPI_TYPE_METHOD) {
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Method Obj %p Refs=%X, [Decremented]\n",
- object, new_count));
- }
-
- object->common.reference_count = new_count;
- if (new_count == 0) {
- acpi_ut_delete_internal_obj(object);
- }
- break;
-
- case REF_FORCE_DELETE:
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Obj %p Refs=%X, Force delete! (Set to 0)\n",
- object, count));
-
- new_count = 0;
- object->common.reference_count = new_count;
- acpi_ut_delete_internal_obj(object);
- break;
-
- default:
-
- ACPI_ERROR((AE_INFO, "Unknown action (%X)", action));
- break;
- }
-
- /*
- * Sanity check the reference count, for debug purposes only.
- * (A deleted object will have a huge reference count)
- */
- if (count > ACPI_MAX_REFERENCE_COUNT) {
- ACPI_WARNING((AE_INFO,
- "Large Reference Count (%X) in object %p", count,
- object));
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_update_object_reference
- *
- * PARAMETERS: Object - Increment ref count for this object
- * and all sub-objects
- * Action - Either REF_INCREMENT or REF_DECREMENT or
- * REF_FORCE_DELETE
- *
- * RETURN: Status
- *
- * DESCRIPTION: Increment the object reference count
- *
- * Object references are incremented when:
- * 1) An object is attached to a Node (namespace object)
- * 2) An object is copied (all subobjects must be incremented)
- *
- * Object references are decremented when:
- * 1) An object is detached from an Node
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
-{
- acpi_status status = AE_OK;
- union acpi_generic_state *state_list = NULL;
- union acpi_operand_object *next_object = NULL;
- union acpi_generic_state *state;
- u32 i;
-
- ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object);
-
- while (object) {
-
- /* Make sure that this isn't a namespace handle */
-
- if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Object %p is NS handle\n", object));
- return_ACPI_STATUS(AE_OK);
- }
-
- /*
- * All sub-objects must have their reference count incremented also.
- * Different object types have different subobjects.
- */
- switch (ACPI_GET_OBJECT_TYPE(object)) {
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_POWER:
- case ACPI_TYPE_THERMAL:
-
- /* Update the notify objects for these types (if present) */
-
- acpi_ut_update_ref_count(object->common_notify.
- system_notify, action);
- acpi_ut_update_ref_count(object->common_notify.
- device_notify, action);
- break;
-
- case ACPI_TYPE_PACKAGE:
- /*
- * We must update all the sub-objects of the package,
- * each of whom may have their own sub-objects.
- */
- for (i = 0; i < object->package.count; i++) {
- /*
- * Push each element onto the stack for later processing.
- * Note: There can be null elements within the package,
- * these are simply ignored
- */
- status =
- acpi_ut_create_update_state_and_push
- (object->package.elements[i], action,
- &state_list);
- if (ACPI_FAILURE(status)) {
- goto error_exit;
- }
- }
- break;
-
- case ACPI_TYPE_BUFFER_FIELD:
-
- next_object = object->buffer_field.buffer_obj;
- break;
-
- case ACPI_TYPE_LOCAL_REGION_FIELD:
-
- next_object = object->field.region_obj;
- break;
-
- case ACPI_TYPE_LOCAL_BANK_FIELD:
-
- next_object = object->bank_field.bank_obj;
- status =
- acpi_ut_create_update_state_and_push(object->
- bank_field.
- region_obj,
- action,
- &state_list);
- if (ACPI_FAILURE(status)) {
- goto error_exit;
- }
- break;
-
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
-
- next_object = object->index_field.index_obj;
- status =
- acpi_ut_create_update_state_and_push(object->
- index_field.
- data_obj,
- action,
- &state_list);
- if (ACPI_FAILURE(status)) {
- goto error_exit;
- }
- break;
-
- case ACPI_TYPE_LOCAL_REFERENCE:
- /*
- * The target of an Index (a package, string, or buffer) or a named
- * reference must track changes to the ref count of the index or
- * target object.
- */
- if ((object->reference.class == ACPI_REFCLASS_INDEX) ||
- (object->reference.class == ACPI_REFCLASS_NAME)) {
- next_object = object->reference.object;
- }
- break;
-
- case ACPI_TYPE_REGION:
- default:
- break; /* No subobjects for all other types */
- }
-
- /*
- * Now we can update the count in the main object. This can only
- * happen after we update the sub-objects in case this causes the
- * main object to be deleted.
- */
- acpi_ut_update_ref_count(object, action);
- object = NULL;
-
- /* Move on to the next object to be updated */
-
- if (next_object) {
- object = next_object;
- next_object = NULL;
- } else if (state_list) {
- state = acpi_ut_pop_generic_state(&state_list);
- object = state->update.object;
- acpi_ut_delete_generic_state(state);
- }
- }
-
- return_ACPI_STATUS(AE_OK);
-
- error_exit:
-
- ACPI_EXCEPTION((AE_INFO, status,
- "Could not update object reference count"));
-
- /* Free any stacked Update State objects */
-
- while (state_list) {
- state = acpi_ut_pop_generic_state(&state_list);
- acpi_ut_delete_generic_state(state);
- }
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_add_reference
- *
- * PARAMETERS: Object - Object whose reference count is to be
- * incremented
- *
- * RETURN: None
- *
- * DESCRIPTION: Add one reference to an ACPI object
- *
- ******************************************************************************/
-
-void acpi_ut_add_reference(union acpi_operand_object *object)
-{
-
- ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object);
-
- /* Ensure that we have a valid object */
-
- if (!acpi_ut_valid_internal_object(object)) {
- return_VOID;
- }
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Obj %p Current Refs=%X [To Be Incremented]\n",
- object, object->common.reference_count));
-
- /* Increment the reference count */
-
- (void)acpi_ut_update_object_reference(object, REF_INCREMENT);
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_remove_reference
- *
- * PARAMETERS: Object - Object whose ref count will be decremented
- *
- * RETURN: None
- *
- * DESCRIPTION: Decrement the reference count of an ACPI internal object
- *
- ******************************************************************************/
-
-void acpi_ut_remove_reference(union acpi_operand_object *object)
-{
-
- ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object);
-
- /*
- * Allow a NULL pointer to be passed in, just ignore it. This saves
- * each caller from having to check. Also, ignore NS nodes.
- *
- */
- if (!object ||
- (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {
- return_VOID;
- }
-
- /* Ensure that we have a valid object */
-
- if (!acpi_ut_valid_internal_object(object)) {
- return_VOID;
- }
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
- "Obj %p Current Refs=%X [To Be Decremented]\n",
- object, object->common.reference_count));
-
- /*
- * Decrement the reference count, and only actually delete the object
- * if the reference count becomes 0. (Must also decrement the ref count
- * of all subobjects!)
- */
- (void)acpi_ut_update_object_reference(object, REF_DECREMENT);
- return_VOID;
-}
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
deleted file mode 100644
index e1e438cd54a..00000000000
--- a/drivers/acpi/utilities/uteval.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/******************************************************************************
- *
- * Module Name: uteval - Object evaluation
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acinterp.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("uteval")
-
-/* Local prototypes */
-static void
-acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
-
-static acpi_status
-acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
- struct acpi_compatible_id *one_cid);
-
-/*
- * Strings supported by the _OSI predefined (internal) method.
- */
-static char *acpi_interfaces_supported[] = {
- /* Operating System Vendor Strings */
-
- "Windows 2000", /* Windows 2000 */
- "Windows 2001", /* Windows XP */
- "Windows 2001 SP1", /* Windows XP SP1 */
- "Windows 2001 SP2", /* Windows XP SP2 */
- "Windows 2001.1", /* Windows Server 2003 */
- "Windows 2001.1 SP1", /* Windows Server 2003 SP1 - Added 03/2006 */
- "Windows 2006", /* Windows Vista - Added 03/2006 */
-
- /* Feature Group Strings */
-
- "Extended Address Space Descriptor"
- /*
- * All "optional" feature group strings (features that are implemented
- * by the host) should be implemented in the host version of
- * acpi_os_validate_interface and should not be added here.
- */
-};
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_osi_implementation
- *
- * PARAMETERS: walk_state - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Implementation of the _OSI predefined control method
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
-{
- acpi_status status;
- union acpi_operand_object *string_desc;
- union acpi_operand_object *return_desc;
- u32 i;
-
- ACPI_FUNCTION_TRACE(ut_osi_implementation);
-
- /* Validate the string input argument */
-
- string_desc = walk_state->arguments[0].object;
- if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
- return_ACPI_STATUS(AE_TYPE);
- }
-
- /* Create a return object */
-
- return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
- if (!return_desc) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- /* Default return value is SUPPORTED */
-
- return_desc->integer.value = ACPI_UINT32_MAX;
- walk_state->return_desc = return_desc;
-
- /* Compare input string to static table of supported interfaces */
-
- for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
- if (!ACPI_STRCMP
- (string_desc->string.pointer,
- acpi_interfaces_supported[i])) {
-
- /* The interface is supported */
-
- return_ACPI_STATUS(AE_OK);
- }
- }
-
- /*
- * Did not match the string in the static table, call the host OSL to
- * check for a match with one of the optional strings (such as
- * "Module Device", "3.0 Thermal Model", etc.)
- */
- status = acpi_os_validate_interface(string_desc->string.pointer);
- if (ACPI_SUCCESS(status)) {
-
- /* The interface is supported */
-
- return_ACPI_STATUS(AE_OK);
- }
-
- /* The interface is not supported */
-
- return_desc->integer.value = 0;
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_osi_invalidate
- *
- * PARAMETERS: interface_string
- *
- * RETURN: Status
- *
- * DESCRIPTION: invalidate string in pre-defiend _OSI string list
- *
- ******************************************************************************/
-
-acpi_status acpi_osi_invalidate(char *interface)
-{
- int i;
-
- for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
- if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) {
- *acpi_interfaces_supported[i] = '\0';
- return AE_OK;
- }
- }
- return AE_NOT_FOUND;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_evaluate_object
- *
- * PARAMETERS: prefix_node - Starting node
- * Path - Path to object from starting node
- * expected_return_types - Bitmap of allowed return types
- * return_desc - Where a return value is stored
- *
- * RETURN: Status
- *
- * DESCRIPTION: Evaluates a namespace object and verifies the type of the
- * return object. Common code that simplifies accessing objects
- * that have required return objects of fixed types.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
- char *path,
- u32 expected_return_btypes,
- union acpi_operand_object **return_desc)
-{
- struct acpi_evaluate_info *info;
- acpi_status status;
- u32 return_btype;
-
- ACPI_FUNCTION_TRACE(ut_evaluate_object);
-
- /* Allocate the evaluation information block */
-
- info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
- if (!info) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- info->prefix_node = prefix_node;
- info->pathname = path;
-
- /* Evaluate the object/method */
-
- status = acpi_ns_evaluate(info);
- if (ACPI_FAILURE(status)) {
- if (status == AE_NOT_FOUND) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[%4.4s.%s] was not found\n",
- acpi_ut_get_node_name(prefix_node),
- path));
- } else {
- ACPI_ERROR_METHOD("Method execution failed",
- prefix_node, path, status);
- }
-
- goto cleanup;
- }
-
- /* Did we get a return object? */
-
- if (!info->return_object) {
- if (expected_return_btypes) {
- ACPI_ERROR_METHOD("No object was returned from",
- prefix_node, path, AE_NOT_EXIST);
-
- status = AE_NOT_EXIST;
- }
-
- goto cleanup;
- }
-
- /* Map the return object type to the bitmapped type */
-
- switch (ACPI_GET_OBJECT_TYPE(info->return_object)) {
- case ACPI_TYPE_INTEGER:
- return_btype = ACPI_BTYPE_INTEGER;
- break;
-
- case ACPI_TYPE_BUFFER:
- return_btype = ACPI_BTYPE_BUFFER;
- break;
-
- case ACPI_TYPE_STRING:
- return_btype = ACPI_BTYPE_STRING;
- break;
-
- case ACPI_TYPE_PACKAGE:
- return_btype = ACPI_BTYPE_PACKAGE;
- break;
-
- default:
- return_btype = 0;
- break;
- }
-
- if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
- /*
- * We received a return object, but one was not expected. This can
- * happen frequently if the "implicit return" feature is enabled.
- * Just delete the return object and return AE_OK.
- */
- acpi_ut_remove_reference(info->return_object);
- goto cleanup;
- }
-
- /* Is the return object one of the expected types? */
-
- if (!(expected_return_btypes & return_btype)) {
- ACPI_ERROR_METHOD("Return object type is incorrect",
- prefix_node, path, AE_TYPE);
-
- ACPI_ERROR((AE_INFO,
- "Type returned from %s was incorrect: %s, expected Btypes: %X",
- path,
- acpi_ut_get_object_type_name(info->return_object),
- expected_return_btypes));
-
- /* On error exit, we must delete the return object */
-
- acpi_ut_remove_reference(info->return_object);
- status = AE_TYPE;
- goto cleanup;
- }
-
- /* Object type is OK, return it */
-
- *return_desc = info->return_object;
-
- cleanup:
- ACPI_FREE(info);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_evaluate_numeric_object
- *
- * PARAMETERS: object_name - Object name to be evaluated
- * device_node - Node for the device
- * Address - Where the value is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Evaluates a numeric namespace object for a selected device
- * and stores result in *Address.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_evaluate_numeric_object(char *object_name,
- struct acpi_namespace_node *device_node,
- acpi_integer * address)
-{
- union acpi_operand_object *obj_desc;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object);
-
- status = acpi_ut_evaluate_object(device_node, object_name,
- ACPI_BTYPE_INTEGER, &obj_desc);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /* Get the returned Integer */
-
- *address = obj_desc->integer.value;
-
- /* On exit, we must delete the return object */
-
- acpi_ut_remove_reference(obj_desc);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_copy_id_string
- *
- * PARAMETERS: Destination - Where to copy the string
- * Source - Source string
- * max_length - Length of the destination buffer
- *
- * RETURN: None
- *
- * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
- * Performs removal of a leading asterisk if present -- workaround
- * for a known issue on a bunch of machines.
- *
- ******************************************************************************/
-
-static void
-acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
-{
-
- /*
- * Workaround for ID strings that have a leading asterisk. This construct
- * is not allowed by the ACPI specification (ID strings must be
- * alphanumeric), but enough existing machines have this embedded in their
- * ID strings that the following code is useful.
- */
- if (*source == '*') {
- source++;
- }
-
- /* Do the actual copy */
-
- ACPI_STRNCPY(destination, source, max_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_execute_HID
- *
- * PARAMETERS: device_node - Node for the device
- * Hid - Where the HID is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Executes the _HID control method that returns the hardware
- * ID of the device.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
- struct acpica_device_id *hid)
-{
- union acpi_operand_object *obj_desc;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_execute_HID);
-
- status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
- ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
- &obj_desc);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
-
- /* Convert the Numeric HID to string */
-
- acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
- hid->value);
- } else {
- /* Copy the String HID from the returned object */
-
- acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
- sizeof(hid->value));
- }
-
- /* On exit, we must delete the return object */
-
- acpi_ut_remove_reference(obj_desc);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_translate_one_cid
- *
- * PARAMETERS: obj_desc - _CID object, must be integer or string
- * one_cid - Where the CID string is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Return a numeric or string _CID value as a string.
- * (Compatible ID)
- *
- * NOTE: Assumes a maximum _CID string length of
- * ACPI_MAX_CID_LENGTH.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
- struct acpi_compatible_id *one_cid)
-{
-
- switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
- case ACPI_TYPE_INTEGER:
-
- /* Convert the Numeric CID to string */
-
- acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
- one_cid->value);
- return (AE_OK);
-
- case ACPI_TYPE_STRING:
-
- if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) {
- return (AE_AML_STRING_LIMIT);
- }
-
- /* Copy the String CID from the returned object */
-
- acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
- ACPI_MAX_CID_LENGTH);
- return (AE_OK);
-
- default:
-
- return (AE_TYPE);
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_execute_CID
- *
- * PARAMETERS: device_node - Node for the device
- * return_cid_list - Where the CID list is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Executes the _CID control method that returns one or more
- * compatible hardware IDs for the device.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
- struct acpi_compatible_id_list ** return_cid_list)
-{
- union acpi_operand_object *obj_desc;
- acpi_status status;
- u32 count;
- u32 size;
- struct acpi_compatible_id_list *cid_list;
- u32 i;
-
- ACPI_FUNCTION_TRACE(ut_execute_CID);
-
- /* Evaluate the _CID method for this device */
-
- status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
- ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
- | ACPI_BTYPE_PACKAGE, &obj_desc);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /* Get the number of _CIDs returned */
-
- count = 1;
- if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
- count = obj_desc->package.count;
- }
-
- /* Allocate a worst-case buffer for the _CIDs */
-
- size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
- sizeof(struct acpi_compatible_id_list));
-
- cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size);
- if (!cid_list) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- /* Init CID list */
-
- cid_list->count = count;
- cid_list->size = size;
-
- /*
- * A _CID can return either a single compatible ID or a package of
- * compatible IDs. Each compatible ID can be one of the following:
- * 1) Integer (32 bit compressed EISA ID) or
- * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
- */
-
- /* The _CID object can be either a single CID or a package (list) of CIDs */
-
- if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
-
- /* Translate each package element */
-
- for (i = 0; i < count; i++) {
- status =
- acpi_ut_translate_one_cid(obj_desc->package.
- elements[i],
- &cid_list->id[i]);
- if (ACPI_FAILURE(status)) {
- break;
- }
- }
- } else {
- /* Only one CID, translate to a string */
-
- status = acpi_ut_translate_one_cid(obj_desc, cid_list->id);
- }
-
- /* Cleanup on error */
-
- if (ACPI_FAILURE(status)) {
- ACPI_FREE(cid_list);
- } else {
- *return_cid_list = cid_list;
- }
-
- /* On exit, we must delete the _CID return object */
-
- acpi_ut_remove_reference(obj_desc);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_execute_UID
- *
- * PARAMETERS: device_node - Node for the device
- * Uid - Where the UID is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Executes the _UID control method that returns the hardware
- * ID of the device.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
- struct acpica_device_id *uid)
-{
- union acpi_operand_object *obj_desc;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_execute_UID);
-
- status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
- ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
- &obj_desc);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
-
- /* Convert the Numeric UID to string */
-
- acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
- uid->value);
- } else {
- /* Copy the String UID from the returned object */
-
- acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer,
- sizeof(uid->value));
- }
-
- /* On exit, we must delete the return object */
-
- acpi_ut_remove_reference(obj_desc);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_execute_STA
- *
- * PARAMETERS: device_node - Node for the device
- * Flags - Where the status flags are returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Executes _STA for selected device and stores results in
- * *Flags.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
-{
- union acpi_operand_object *obj_desc;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_execute_STA);
-
- status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
- ACPI_BTYPE_INTEGER, &obj_desc);
- if (ACPI_FAILURE(status)) {
- if (AE_NOT_FOUND == status) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "_STA on %4.4s was not found, assuming device is present\n",
- acpi_ut_get_node_name(device_node)));
-
- *flags = ACPI_UINT32_MAX;
- status = AE_OK;
- }
-
- return_ACPI_STATUS(status);
- }
-
- /* Extract the status flags */
-
- *flags = (u32) obj_desc->integer.value;
-
- /* On exit, we must delete the return object */
-
- acpi_ut_remove_reference(obj_desc);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_execute_Sxds
- *
- * PARAMETERS: device_node - Node for the device
- * Flags - Where the status flags are returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Executes _STA for selected device and stores results in
- * *Flags.
- *
- * NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
-{
- union acpi_operand_object *obj_desc;
- acpi_status status;
- u32 i;
-
- ACPI_FUNCTION_TRACE(ut_execute_sxds);
-
- for (i = 0; i < 4; i++) {
- highest[i] = 0xFF;
- status = acpi_ut_evaluate_object(device_node,
- ACPI_CAST_PTR(char,
- acpi_gbl_highest_dstate_names
- [i]),
- ACPI_BTYPE_INTEGER, &obj_desc);
- if (ACPI_FAILURE(status)) {
- if (status != AE_NOT_FOUND) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "%s on Device %4.4s, %s\n",
- ACPI_CAST_PTR(char,
- acpi_gbl_highest_dstate_names
- [i]),
- acpi_ut_get_node_name
- (device_node),
- acpi_format_exception
- (status)));
-
- return_ACPI_STATUS(status);
- }
- } else {
- /* Extract the Dstate value */
-
- highest[i] = (u8) obj_desc->integer.value;
-
- /* Delete the return object */
-
- acpi_ut_remove_reference(obj_desc);
- }
- }
-
- return_ACPI_STATUS(AE_OK);
-}
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
deleted file mode 100644
index 3e28d8c4045..00000000000
--- a/drivers/acpi/utilities/utglobal.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utglobal - Global variables for the ACPI subsystem
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#define DEFINE_ACPI_GLOBALS
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acnamesp.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utglobal")
-
-/*******************************************************************************
- *
- * Static global variable initialization.
- *
- ******************************************************************************/
-/*
- * We want the debug switches statically initialized so they
- * are already set when the debugger is entered.
- */
-/* Debug switch - level and trace mask */
-u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
-
-/* Debug switch - layer (component) mask */
-
-u32 acpi_dbg_layer = 0;
-u32 acpi_gbl_nesting_level = 0;
-
-/* Debugger globals */
-
-u8 acpi_gbl_db_terminate_threads = FALSE;
-u8 acpi_gbl_abort_method = FALSE;
-u8 acpi_gbl_method_executing = FALSE;
-
-/* System flags */
-
-u32 acpi_gbl_startup_flags = 0;
-
-/* System starts uninitialized */
-
-u8 acpi_gbl_shutdown = TRUE;
-
-const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
- "\\_S0_",
- "\\_S1_",
- "\\_S2_",
- "\\_S3_",
- "\\_S4_",
- "\\_S5_"
-};
-
-const char *acpi_gbl_highest_dstate_names[4] = {
- "_S1D",
- "_S2D",
- "_S3D",
- "_S4D"
-};
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_format_exception
- *
- * PARAMETERS: Status - The acpi_status code to be formatted
- *
- * RETURN: A string containing the exception text. A valid pointer is
- * always returned.
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string
- * It is here instead of utxface.c so it is always present.
- *
- ******************************************************************************/
-
-const char *acpi_format_exception(acpi_status status)
-{
- const char *exception = NULL;
-
- ACPI_FUNCTION_ENTRY();
-
- exception = acpi_ut_validate_exception(status);
- if (!exception) {
-
- /* Exception code was not recognized */
-
- ACPI_ERROR((AE_INFO,
- "Unknown exception code: 0x%8.8X", status));
-
- exception = "UNKNOWN_STATUS_CODE";
- dump_stack();
- }
-
- return (ACPI_CAST_PTR(const char, exception));
-}
-
-ACPI_EXPORT_SYMBOL(acpi_format_exception)
-
-/*******************************************************************************
- *
- * Namespace globals
- *
- ******************************************************************************/
-/*
- * Predefined ACPI Names (Built-in to the Interpreter)
- *
- * NOTES:
- * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
- * during the initialization sequence.
- * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
- * perform a Notify() operation on it.
- */
-const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
- {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
- {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
- {"_SB_", ACPI_TYPE_DEVICE, NULL},
- {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
- {"_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 *)1},
-
-#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
- {"_OSI", ACPI_TYPE_METHOD, (char *)1},
-#endif
-
- /* Table terminator */
-
- {NULL, ACPI_TYPE_ANY, NULL}
-};
-
-/*
- * Properties of the ACPI Object Types, both internal and external.
- * The table is indexed by values of acpi_object_type
- */
-const u8 acpi_gbl_ns_properties[] = {
- ACPI_NS_NORMAL, /* 00 Any */
- ACPI_NS_NORMAL, /* 01 Number */
- ACPI_NS_NORMAL, /* 02 String */
- ACPI_NS_NORMAL, /* 03 Buffer */
- ACPI_NS_NORMAL, /* 04 Package */
- ACPI_NS_NORMAL, /* 05 field_unit */
- ACPI_NS_NEWSCOPE, /* 06 Device */
- ACPI_NS_NORMAL, /* 07 Event */
- ACPI_NS_NEWSCOPE, /* 08 Method */
- ACPI_NS_NORMAL, /* 09 Mutex */
- ACPI_NS_NORMAL, /* 10 Region */
- ACPI_NS_NEWSCOPE, /* 11 Power */
- ACPI_NS_NEWSCOPE, /* 12 Processor */
- ACPI_NS_NEWSCOPE, /* 13 Thermal */
- ACPI_NS_NORMAL, /* 14 buffer_field */
- ACPI_NS_NORMAL, /* 15 ddb_handle */
- ACPI_NS_NORMAL, /* 16 Debug Object */
- ACPI_NS_NORMAL, /* 17 def_field */
- ACPI_NS_NORMAL, /* 18 bank_field */
- ACPI_NS_NORMAL, /* 19 index_field */
- ACPI_NS_NORMAL, /* 20 Reference */
- ACPI_NS_NORMAL, /* 21 Alias */
- ACPI_NS_NORMAL, /* 22 method_alias */
- ACPI_NS_NORMAL, /* 23 Notify */
- ACPI_NS_NORMAL, /* 24 Address Handler */
- ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
- ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
- ACPI_NS_NEWSCOPE, /* 27 Scope */
- ACPI_NS_NORMAL, /* 28 Extra */
- ACPI_NS_NORMAL, /* 29 Data */
- ACPI_NS_NORMAL /* 30 Invalid */
-};
-
-/* Hex to ASCII conversion table */
-
-static const char acpi_gbl_hex_to_ascii[] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
-};
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_hex_to_ascii_char
- *
- * PARAMETERS: Integer - Contains the hex digit
- * Position - bit position of the digit within the
- * integer (multiple of 4)
- *
- * RETURN: The converted Ascii character
- *
- * DESCRIPTION: Convert a hex digit to an Ascii character
- *
- ******************************************************************************/
-
-char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
-{
-
- return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
-}
-
-/******************************************************************************
- *
- * Event and Hardware globals
- *
- ******************************************************************************/
-
-struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
- /* Name Parent Register Register Bit Position Register Bit Mask */
-
- /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_TIMER_STATUS,
- ACPI_BITMASK_TIMER_STATUS},
- /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_BUS_MASTER_STATUS,
- ACPI_BITMASK_BUS_MASTER_STATUS},
- /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
- ACPI_BITMASK_GLOBAL_LOCK_STATUS},
- /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_POWER_BUTTON_STATUS,
- ACPI_BITMASK_POWER_BUTTON_STATUS},
- /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
- ACPI_BITMASK_SLEEP_BUTTON_STATUS},
- /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_RT_CLOCK_STATUS,
- ACPI_BITMASK_RT_CLOCK_STATUS},
- /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_WAKE_STATUS,
- ACPI_BITMASK_WAKE_STATUS},
- /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
- ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
- ACPI_BITMASK_PCIEXP_WAKE_STATUS},
-
- /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
- ACPI_BITPOSITION_TIMER_ENABLE,
- ACPI_BITMASK_TIMER_ENABLE},
- /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
- ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
- ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
- /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
- ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
- ACPI_BITMASK_POWER_BUTTON_ENABLE},
- /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
- ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
- ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
- /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
- ACPI_BITPOSITION_RT_CLOCK_ENABLE,
- ACPI_BITMASK_RT_CLOCK_ENABLE},
- /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
- ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
- ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
-
- /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
- ACPI_BITPOSITION_SCI_ENABLE,
- ACPI_BITMASK_SCI_ENABLE},
- /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
- ACPI_BITPOSITION_BUS_MASTER_RLD,
- ACPI_BITMASK_BUS_MASTER_RLD},
- /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
- ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
- ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
- /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL,
- ACPI_BITPOSITION_SLEEP_TYPE_X,
- ACPI_BITMASK_SLEEP_TYPE_X},
- /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL,
- ACPI_BITPOSITION_SLEEP_TYPE_X,
- ACPI_BITMASK_SLEEP_TYPE_X},
- /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
- ACPI_BITPOSITION_SLEEP_ENABLE,
- ACPI_BITMASK_SLEEP_ENABLE},
-
- /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
- ACPI_BITPOSITION_ARB_DISABLE,
- ACPI_BITMASK_ARB_DISABLE}
-};
-
-struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
- /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
- ACPI_BITREG_TIMER_ENABLE,
- ACPI_BITMASK_TIMER_STATUS,
- ACPI_BITMASK_TIMER_ENABLE},
- /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
- ACPI_BITREG_GLOBAL_LOCK_ENABLE,
- ACPI_BITMASK_GLOBAL_LOCK_STATUS,
- ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
- /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
- ACPI_BITREG_POWER_BUTTON_ENABLE,
- ACPI_BITMASK_POWER_BUTTON_STATUS,
- ACPI_BITMASK_POWER_BUTTON_ENABLE},
- /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
- ACPI_BITREG_SLEEP_BUTTON_ENABLE,
- ACPI_BITMASK_SLEEP_BUTTON_STATUS,
- ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
- /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
- ACPI_BITREG_RT_CLOCK_ENABLE,
- ACPI_BITMASK_RT_CLOCK_STATUS,
- ACPI_BITMASK_RT_CLOCK_ENABLE},
-};
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_region_name
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Space ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-/* Region type decoding */
-
-const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
- "SystemMemory",
- "SystemIO",
- "PCI_Config",
- "EmbeddedControl",
- "SMBus",
- "SystemCMOS",
- "PCIBARTarget",
- "DataTable"
-};
-
-char *acpi_ut_get_region_name(u8 space_id)
-{
-
- if (space_id >= ACPI_USER_REGION_BEGIN) {
- return ("UserDefinedRegion");
- } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
- return ("InvalidSpaceId");
- }
-
- return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_event_name
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Event ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-/* Event type decoding */
-
-static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
- "PM_Timer",
- "GlobalLock",
- "PowerButton",
- "SleepButton",
- "RealTimeClock",
-};
-
-char *acpi_ut_get_event_name(u32 event_id)
-{
-
- if (event_id > ACPI_EVENT_MAX) {
- return ("InvalidEventID");
- }
-
- return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_type_name
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Type ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-/*
- * Elements of acpi_gbl_ns_type_names below must match
- * one-to-one with values of acpi_object_type
- *
- * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
- * when stored in a table it really means that we have thus far seen no
- * evidence to indicate what type is actually going to be stored for this entry.
- */
-static const char acpi_gbl_bad_type[] = "UNDEFINED";
-
-/* Printable names of the ACPI object types */
-
-static const char *acpi_gbl_ns_type_names[] = {
- /* 00 */ "Untyped",
- /* 01 */ "Integer",
- /* 02 */ "String",
- /* 03 */ "Buffer",
- /* 04 */ "Package",
- /* 05 */ "FieldUnit",
- /* 06 */ "Device",
- /* 07 */ "Event",
- /* 08 */ "Method",
- /* 09 */ "Mutex",
- /* 10 */ "Region",
- /* 11 */ "Power",
- /* 12 */ "Processor",
- /* 13 */ "Thermal",
- /* 14 */ "BufferField",
- /* 15 */ "DdbHandle",
- /* 16 */ "DebugObject",
- /* 17 */ "RegionField",
- /* 18 */ "BankField",
- /* 19 */ "IndexField",
- /* 20 */ "Reference",
- /* 21 */ "Alias",
- /* 22 */ "MethodAlias",
- /* 23 */ "Notify",
- /* 24 */ "AddrHandler",
- /* 25 */ "ResourceDesc",
- /* 26 */ "ResourceFld",
- /* 27 */ "Scope",
- /* 28 */ "Extra",
- /* 29 */ "Data",
- /* 30 */ "Invalid"
-};
-
-char *acpi_ut_get_type_name(acpi_object_type type)
-{
-
- if (type > ACPI_TYPE_INVALID) {
- return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
- }
-
- return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
-}
-
-char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
-{
-
- if (!obj_desc) {
- return ("[NULL Object Descriptor]");
- }
-
- return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)));
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_node_name
- *
- * PARAMETERS: Object - A namespace node
- *
- * RETURN: Pointer to a string
- *
- * DESCRIPTION: Validate the node and return the node's ACPI name.
- *
- ******************************************************************************/
-
-char *acpi_ut_get_node_name(void *object)
-{
- struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
-
- /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
-
- if (!object) {
- return ("NULL");
- }
-
- /* Check for Root node */
-
- if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
- return ("\"\\\" ");
- }
-
- /* Descriptor must be a namespace node */
-
- if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
- return ("####");
- }
-
- /* Name must be a valid ACPI name */
-
- if (!acpi_ut_valid_acpi_name(node->name.integer)) {
- node->name.integer = acpi_ut_repair_name(node->name.ascii);
- }
-
- /* Return the name */
-
- return (node->name.ascii);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_descriptor_name
- *
- * PARAMETERS: Object - An ACPI object
- *
- * RETURN: Pointer to a string
- *
- * DESCRIPTION: Validate object and return the descriptor type
- *
- ******************************************************************************/
-
-/* Printable names of object descriptor types */
-
-static const char *acpi_gbl_desc_type_names[] = {
- /* 00 */ "Invalid",
- /* 01 */ "Cached",
- /* 02 */ "State-Generic",
- /* 03 */ "State-Update",
- /* 04 */ "State-Package",
- /* 05 */ "State-Control",
- /* 06 */ "State-RootParseScope",
- /* 07 */ "State-ParseScope",
- /* 08 */ "State-WalkScope",
- /* 09 */ "State-Result",
- /* 10 */ "State-Notify",
- /* 11 */ "State-Thread",
- /* 12 */ "Walk",
- /* 13 */ "Parser",
- /* 14 */ "Operand",
- /* 15 */ "Node"
-};
-
-char *acpi_ut_get_descriptor_name(void *object)
-{
-
- if (!object) {
- return ("NULL OBJECT");
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
- return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
- }
-
- return (ACPI_CAST_PTR(char,
- acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
- (object)]));
-
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_reference_name
- *
- * PARAMETERS: Object - An ACPI reference object
- *
- * RETURN: Pointer to a string
- *
- * DESCRIPTION: Decode a reference object sub-type to a string.
- *
- ******************************************************************************/
-
-/* Printable names of reference object sub-types */
-
-static const char *acpi_gbl_ref_class_names[] = {
- /* 00 */ "Local",
- /* 01 */ "Argument",
- /* 02 */ "RefOf",
- /* 03 */ "Index",
- /* 04 */ "DdbHandle",
- /* 05 */ "Named Object",
- /* 06 */ "Debug"
-};
-
-const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
-{
- if (!object)
- return "NULL Object";
-
- if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND)
- return "Not an Operand object";
-
- if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE)
- return "Not a Reference object";
-
- if (object->reference.class > ACPI_REFCLASS_MAX)
- return "Unknown Reference class";
-
- return acpi_gbl_ref_class_names[object->reference.class];
-}
-
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-/*
- * Strings and procedures used for debug only
- */
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_mutex_name
- *
- * PARAMETERS: mutex_id - The predefined ID for this mutex.
- *
- * RETURN: String containing the name of the mutex. Always returns a valid
- * pointer.
- *
- * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-char *acpi_ut_get_mutex_name(u32 mutex_id)
-{
-
- if (mutex_id > ACPI_MAX_MUTEX) {
- return ("Invalid Mutex ID");
- }
-
- return (acpi_gbl_mutex_names[mutex_id]);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_notify_name
- *
- * PARAMETERS: notify_value - Value from the Notify() request
- *
- * RETURN: String corresponding to the Notify Value.
- *
- * DESCRIPTION: Translate a Notify Value to a notify namestring.
- *
- ******************************************************************************/
-
-/* Names for Notify() values, used for debug output */
-
-static const char *acpi_gbl_notify_value_names[] = {
- "Bus Check",
- "Device Check",
- "Device Wake",
- "Eject Request",
- "Device Check Light",
- "Frequency Mismatch",
- "Bus Mode Mismatch",
- "Power Fault",
- "Capabilities Check",
- "Device PLD Check",
- "Reserved",
- "System Locality Update"
-};
-
-const char *acpi_ut_get_notify_name(u32 notify_value)
-{
-
- if (notify_value <= ACPI_NOTIFY_MAX) {
- return (acpi_gbl_notify_value_names[notify_value]);
- } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
- return ("Reserved");
- } else { /* Greater or equal to 0x80 */
-
- return ("**Device Specific**");
- }
-}
-#endif
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_valid_object_type
- *
- * PARAMETERS: Type - Object type to be validated
- *
- * RETURN: TRUE if valid object type, FALSE otherwise
- *
- * DESCRIPTION: Validate an object type
- *
- ******************************************************************************/
-
-u8 acpi_ut_valid_object_type(acpi_object_type type)
-{
-
- if (type > ACPI_TYPE_LOCAL_MAX) {
-
- /* Note: Assumes all TYPEs are contiguous (external/local) */
-
- return (FALSE);
- }
-
- return (TRUE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_init_globals
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Init library globals. All globals that require specific
- * initialization should be initialized here!
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_init_globals(void)
-{
- acpi_status status;
- u32 i;
-
- ACPI_FUNCTION_TRACE(ut_init_globals);
-
- /* Create all memory caches */
-
- status = acpi_ut_create_caches();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /* Mutex locked flags */
-
- for (i = 0; i < ACPI_NUM_MUTEX; i++) {
- acpi_gbl_mutex_info[i].mutex = NULL;
- acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
- acpi_gbl_mutex_info[i].use_count = 0;
- }
-
- for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
- acpi_gbl_owner_id_mask[i] = 0;
- }
- acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
-
- /* GPE support */
-
- acpi_gbl_gpe_xrupt_list_head = NULL;
- acpi_gbl_gpe_fadt_blocks[0] = NULL;
- acpi_gbl_gpe_fadt_blocks[1] = NULL;
- acpi_current_gpe_count = 0;
-
- /* Global handlers */
-
- acpi_gbl_system_notify.handler = NULL;
- acpi_gbl_device_notify.handler = NULL;
- acpi_gbl_exception_handler = NULL;
- acpi_gbl_init_handler = NULL;
- acpi_gbl_table_handler = NULL;
-
- /* Global Lock support */
-
- acpi_gbl_global_lock_semaphore = NULL;
- acpi_gbl_global_lock_mutex = NULL;
- acpi_gbl_global_lock_acquired = FALSE;
- acpi_gbl_global_lock_handle = 0;
- acpi_gbl_global_lock_present = FALSE;
-
- /* Miscellaneous variables */
-
- acpi_gbl_cm_single_step = FALSE;
- acpi_gbl_db_terminate_threads = FALSE;
- acpi_gbl_shutdown = FALSE;
- acpi_gbl_ns_lookup_count = 0;
- acpi_gbl_ps_find_count = 0;
- acpi_gbl_acpi_hardware_present = TRUE;
- acpi_gbl_last_owner_id_index = 0;
- acpi_gbl_next_owner_id_offset = 0;
- acpi_gbl_trace_method_name = 0;
- acpi_gbl_trace_dbg_level = 0;
- acpi_gbl_trace_dbg_layer = 0;
- acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
- acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
-
- /* Hardware oriented */
-
- acpi_gbl_events_initialized = FALSE;
- acpi_gbl_system_awake_and_running = TRUE;
-
- /* Namespace */
-
- acpi_gbl_root_node = NULL;
- acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
- acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
- acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
- acpi_gbl_root_node_struct.child = NULL;
- acpi_gbl_root_node_struct.peer = NULL;
- acpi_gbl_root_node_struct.object = NULL;
- acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
-
-#ifdef ACPI_DEBUG_OUTPUT
- acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
-#endif
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- acpi_gbl_display_final_mem_stats = FALSE;
-#endif
-
- return_ACPI_STATUS(AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
-ACPI_EXPORT_SYMBOL(acpi_dbg_level)
-ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
-ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
deleted file mode 100644
index 9316ec36a83..00000000000
--- a/drivers/acpi/utilities/utinit.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utinit - Common ACPI subsystem initialization
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
-#include <acpi/actables.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utinit")
-
-/* Local prototypes */
-static void acpi_ut_terminate(void);
-
-/******************************************************************************
- *
- * FUNCTION: acpi_ut_terminate
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Free global memory
- *
- ******************************************************************************/
-
-static void acpi_ut_terminate(void)
-{
- struct acpi_gpe_block_info *gpe_block;
- struct acpi_gpe_block_info *next_gpe_block;
- struct acpi_gpe_xrupt_info *gpe_xrupt_info;
- struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
-
- ACPI_FUNCTION_TRACE(ut_terminate);
-
- /* Free global GPE blocks and related info structures */
-
- gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
- while (gpe_xrupt_info) {
- gpe_block = gpe_xrupt_info->gpe_block_list_head;
- while (gpe_block) {
- next_gpe_block = gpe_block->next;
- ACPI_FREE(gpe_block->event_info);
- ACPI_FREE(gpe_block->register_info);
- ACPI_FREE(gpe_block);
-
- gpe_block = next_gpe_block;
- }
- next_gpe_xrupt_info = gpe_xrupt_info->next;
- ACPI_FREE(gpe_xrupt_info);
- gpe_xrupt_info = next_gpe_xrupt_info;
- }
-
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_subsystem_shutdown
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex
- * objects here -- because the AML debugger may be still running.
- *
- ******************************************************************************/
-
-void acpi_ut_subsystem_shutdown(void)
-{
-
- ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
-
- /* Just exit if subsystem is already shutdown */
-
- if (acpi_gbl_shutdown) {
- ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
- return_VOID;
- }
-
- /* Subsystem appears active, go ahead and shut it down */
-
- acpi_gbl_shutdown = TRUE;
- acpi_gbl_startup_flags = 0;
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
-
-#ifndef ACPI_ASL_COMPILER
-
- /* Close the acpi_event Handling */
-
- acpi_ev_terminate();
-#endif
-
- /* Close the Namespace */
-
- acpi_ns_terminate();
-
- /* Delete the ACPI tables */
-
- acpi_tb_terminate();
-
- /* Close the globals */
-
- acpi_ut_terminate();
-
- /* Purge the local caches */
-
- (void)acpi_ut_delete_caches();
- return_VOID;
-}
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
deleted file mode 100644
index 616d7b271c9..00000000000
--- a/drivers/acpi/utilities/utmath.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: utmath - Integer math support routines
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utmath")
-
-/*
- * Support for double-precision integer divide. This code is included here
- * in order to support kernel environments where the double-precision math
- * library is not available.
- */
-#ifndef ACPI_USE_NATIVE_DIVIDE
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_short_divide
- *
- * PARAMETERS: Dividend - 64-bit dividend
- * Divisor - 32-bit divisor
- * out_quotient - Pointer to where the quotient is returned
- * out_remainder - Pointer to where the remainder is returned
- *
- * RETURN: Status (Checks for divide-by-zero)
- *
- * DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits)
- * divide and modulo. The result is a 64-bit quotient and a
- * 32-bit remainder.
- *
- ******************************************************************************/
-acpi_status
-acpi_ut_short_divide(acpi_integer dividend,
- u32 divisor,
- acpi_integer * out_quotient, u32 * out_remainder)
-{
- union uint64_overlay dividend_ovl;
- union uint64_overlay quotient;
- u32 remainder32;
-
- ACPI_FUNCTION_TRACE(ut_short_divide);
-
- /* Always check for a zero divisor */
-
- if (divisor == 0) {
- ACPI_ERROR((AE_INFO, "Divide by zero"));
- return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
- }
-
- dividend_ovl.full = dividend;
-
- /*
- * The quotient is 64 bits, the remainder is always 32 bits,
- * and is generated by the second divide.
- */
- ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor,
- quotient.part.hi, remainder32);
- ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor,
- quotient.part.lo, remainder32);
-
- /* Return only what was requested */
-
- if (out_quotient) {
- *out_quotient = quotient.full;
- }
- if (out_remainder) {
- *out_remainder = remainder32;
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_divide
- *
- * PARAMETERS: in_dividend - Dividend
- * in_divisor - Divisor
- * out_quotient - Pointer to where the quotient is returned
- * out_remainder - Pointer to where the remainder is returned
- *
- * RETURN: Status (Checks for divide-by-zero)
- *
- * DESCRIPTION: Perform a divide and modulo.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_divide(acpi_integer in_dividend,
- acpi_integer in_divisor,
- acpi_integer * out_quotient, acpi_integer * out_remainder)
-{
- union uint64_overlay dividend;
- union uint64_overlay divisor;
- union uint64_overlay quotient;
- union uint64_overlay remainder;
- union uint64_overlay normalized_dividend;
- union uint64_overlay normalized_divisor;
- u32 partial1;
- union uint64_overlay partial2;
- union uint64_overlay partial3;
-
- ACPI_FUNCTION_TRACE(ut_divide);
-
- /* Always check for a zero divisor */
-
- if (in_divisor == 0) {
- ACPI_ERROR((AE_INFO, "Divide by zero"));
- return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
- }
-
- divisor.full = in_divisor;
- dividend.full = in_dividend;
- if (divisor.part.hi == 0) {
- /*
- * 1) Simplest case is where the divisor is 32 bits, we can
- * just do two divides
- */
- remainder.part.hi = 0;
-
- /*
- * The quotient is 64 bits, the remainder is always 32 bits,
- * and is generated by the second divide.
- */
- ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo,
- quotient.part.hi, partial1);
- ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo,
- quotient.part.lo, remainder.part.lo);
- }
-
- else {
- /*
- * 2) The general case where the divisor is a full 64 bits
- * is more difficult
- */
- quotient.part.hi = 0;
- normalized_dividend = dividend;
- normalized_divisor = divisor;
-
- /* Normalize the operands (shift until the divisor is < 32 bits) */
-
- do {
- ACPI_SHIFT_RIGHT_64(normalized_divisor.part.hi,
- normalized_divisor.part.lo);
- ACPI_SHIFT_RIGHT_64(normalized_dividend.part.hi,
- normalized_dividend.part.lo);
-
- } while (normalized_divisor.part.hi != 0);
-
- /* Partial divide */
-
- ACPI_DIV_64_BY_32(normalized_dividend.part.hi,
- normalized_dividend.part.lo,
- normalized_divisor.part.lo,
- quotient.part.lo, partial1);
-
- /*
- * The quotient is always 32 bits, and simply requires adjustment.
- * The 64-bit remainder must be generated.
- */
- partial1 = quotient.part.lo * divisor.part.hi;
- partial2.full =
- (acpi_integer) quotient.part.lo * divisor.part.lo;
- partial3.full = (acpi_integer) partial2.part.hi + partial1;
-
- remainder.part.hi = partial3.part.lo;
- remainder.part.lo = partial2.part.lo;
-
- if (partial3.part.hi == 0) {
- if (partial3.part.lo >= dividend.part.hi) {
- if (partial3.part.lo == dividend.part.hi) {
- if (partial2.part.lo > dividend.part.lo) {
- quotient.part.lo--;
- remainder.full -= divisor.full;
- }
- } else {
- quotient.part.lo--;
- remainder.full -= divisor.full;
- }
- }
-
- remainder.full = remainder.full - dividend.full;
- remainder.part.hi = (u32) - ((s32) remainder.part.hi);
- remainder.part.lo = (u32) - ((s32) remainder.part.lo);
-
- if (remainder.part.lo) {
- remainder.part.hi--;
- }
- }
- }
-
- /* Return only what was requested */
-
- if (out_quotient) {
- *out_quotient = quotient.full;
- }
- if (out_remainder) {
- *out_remainder = remainder.full;
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-#else
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_short_divide, acpi_ut_divide
- *
- * PARAMETERS: See function headers above
- *
- * DESCRIPTION: Native versions of the ut_divide functions. Use these if either
- * 1) The target is a 64-bit platform and therefore 64-bit
- * integer math is supported directly by the machine.
- * 2) The target is a 32-bit or 16-bit platform, and the
- * double-precision integer math library is available to
- * perform the divide.
- *
- ******************************************************************************/
-acpi_status
-acpi_ut_short_divide(acpi_integer in_dividend,
- u32 divisor,
- acpi_integer * out_quotient, u32 * out_remainder)
-{
-
- ACPI_FUNCTION_TRACE(ut_short_divide);
-
- /* Always check for a zero divisor */
-
- if (divisor == 0) {
- ACPI_ERROR((AE_INFO, "Divide by zero"));
- return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
- }
-
- /* Return only what was requested */
-
- if (out_quotient) {
- *out_quotient = in_dividend / divisor;
- }
- if (out_remainder) {
- *out_remainder = (u32) (in_dividend % divisor);
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-acpi_status
-acpi_ut_divide(acpi_integer in_dividend,
- acpi_integer in_divisor,
- acpi_integer * out_quotient, acpi_integer * out_remainder)
-{
- ACPI_FUNCTION_TRACE(ut_divide);
-
- /* Always check for a zero divisor */
-
- if (in_divisor == 0) {
- ACPI_ERROR((AE_INFO, "Divide by zero"));
- return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
- }
-
- /* Return only what was requested */
-
- if (out_quotient) {
- *out_quotient = in_dividend / in_divisor;
- }
- if (out_remainder) {
- *out_remainder = in_dividend % in_divisor;
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-#endif
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
deleted file mode 100644
index 8f8b407142e..00000000000
--- a/drivers/acpi/utilities/utmisc.c
+++ /dev/null
@@ -1,1093 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: utmisc - common utility procedures
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <linux/module.h>
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acnamesp.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utmisc")
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_validate_exception
- *
- * PARAMETERS: Status - The acpi_status code to be formatted
- *
- * RETURN: A string containing the exception text. NULL if exception is
- * not valid.
- *
- * DESCRIPTION: This function validates and translates an ACPI exception into
- * an ASCII string.
- *
- ******************************************************************************/
-const char *acpi_ut_validate_exception(acpi_status status)
-{
- u32 sub_status;
- const char *exception = NULL;
-
- ACPI_FUNCTION_ENTRY();
-
- /*
- * Status is composed of two parts, a "type" and an actual code
- */
- sub_status = (status & ~AE_CODE_MASK);
-
- switch (status & AE_CODE_MASK) {
- case AE_CODE_ENVIRONMENTAL:
-
- if (sub_status <= AE_CODE_ENV_MAX) {
- exception = acpi_gbl_exception_names_env[sub_status];
- }
- break;
-
- case AE_CODE_PROGRAMMER:
-
- if (sub_status <= AE_CODE_PGM_MAX) {
- exception = acpi_gbl_exception_names_pgm[sub_status];
- }
- break;
-
- case AE_CODE_ACPI_TABLES:
-
- if (sub_status <= AE_CODE_TBL_MAX) {
- exception = acpi_gbl_exception_names_tbl[sub_status];
- }
- break;
-
- case AE_CODE_AML:
-
- if (sub_status <= AE_CODE_AML_MAX) {
- exception = acpi_gbl_exception_names_aml[sub_status];
- }
- break;
-
- case AE_CODE_CONTROL:
-
- if (sub_status <= AE_CODE_CTRL_MAX) {
- exception = acpi_gbl_exception_names_ctrl[sub_status];
- }
- break;
-
- default:
- break;
- }
-
- return (ACPI_CAST_PTR(const char, exception));
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_is_aml_table
- *
- * PARAMETERS: Table - An ACPI table
- *
- * RETURN: TRUE if table contains executable AML; FALSE otherwise
- *
- * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
- * Currently, these are DSDT,SSDT,PSDT. All other table types are
- * data tables that do not contain AML code.
- *
- ******************************************************************************/
-
-u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
-{
-
- /* These are the only tables that contain executable AML */
-
- if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
- ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
- ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
- return (TRUE);
- }
-
- return (FALSE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_allocate_owner_id
- *
- * PARAMETERS: owner_id - Where the new owner ID is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
- * track objects created by the table or method, to be deleted
- * when the method exits or the table is unloaded.
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
-{
- u32 i;
- u32 j;
- u32 k;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_allocate_owner_id);
-
- /* Guard against multiple allocations of ID to the same location */
-
- if (*owner_id) {
- ACPI_ERROR((AE_INFO, "Owner ID [%2.2X] already exists",
- *owner_id));
- return_ACPI_STATUS(AE_ALREADY_EXISTS);
- }
-
- /* Mutex for the global ID mask */
-
- status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /*
- * Find a free owner ID, cycle through all possible IDs on repeated
- * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
- * to be scanned twice.
- */
- for (i = 0, j = acpi_gbl_last_owner_id_index;
- i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) {
- if (j >= ACPI_NUM_OWNERID_MASKS) {
- j = 0; /* Wraparound to start of mask array */
- }
-
- for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
- if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
-
- /* There are no free IDs in this mask */
-
- break;
- }
-
- if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) {
- /*
- * Found a free ID. The actual ID is the bit index plus one,
- * making zero an invalid Owner ID. Save this as the last ID
- * allocated and update the global ID mask.
- */
- acpi_gbl_owner_id_mask[j] |= (1 << k);
-
- acpi_gbl_last_owner_id_index = (u8) j;
- acpi_gbl_next_owner_id_offset = (u8) (k + 1);
-
- /*
- * Construct encoded ID from the index and bit position
- *
- * Note: Last [j].k (bit 255) is never used and is marked
- * permanently allocated (prevents +1 overflow)
- */
- *owner_id =
- (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
-
- ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
- "Allocated OwnerId: %2.2X\n",
- (unsigned int)*owner_id));
- goto exit;
- }
- }
-
- acpi_gbl_next_owner_id_offset = 0;
- }
-
- /*
- * All owner_ids have been allocated. This typically 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.
- *
- * If this error happens, there may be very deep nesting of invoked control
- * methods, or there may be a bug where the IDs are not released.
- */
- status = AE_OWNER_ID_LIMIT;
- ACPI_ERROR((AE_INFO,
- "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
-
- exit:
- (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_release_owner_id
- *
- * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD
- *
- * RETURN: None. No error is returned because we are either exiting a
- * control method or unloading a table. Either way, we would
- * ignore any error anyway.
- *
- * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
- *
- ******************************************************************************/
-
-void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
-{
- acpi_owner_id owner_id = *owner_id_ptr;
- acpi_status status;
- u32 index;
- u32 bit;
-
- ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id);
-
- /* Always clear the input owner_id (zero is an invalid ID) */
-
- *owner_id_ptr = 0;
-
- /* Zero is not a valid owner_iD */
-
- if (owner_id == 0) {
- ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id));
- return_VOID;
- }
-
- /* Mutex for the global ID mask */
-
- status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
- if (ACPI_FAILURE(status)) {
- return_VOID;
- }
-
- /* Normalize the ID to zero */
-
- owner_id--;
-
- /* Decode ID to index/offset pair */
-
- index = ACPI_DIV_32(owner_id);
- bit = 1 << ACPI_MOD_32(owner_id);
-
- /* Free the owner ID only if it is valid */
-
- if (acpi_gbl_owner_id_mask[index] & bit) {
- acpi_gbl_owner_id_mask[index] ^= bit;
- } else {
- ACPI_ERROR((AE_INFO,
- "Release of non-allocated OwnerId: %2.2X",
- owner_id + 1));
- }
-
- (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_strupr (strupr)
- *
- * PARAMETERS: src_string - The source string to convert
- *
- * RETURN: None
- *
- * DESCRIPTION: Convert string to uppercase
- *
- * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
- *
- ******************************************************************************/
-
-void acpi_ut_strupr(char *src_string)
-{
- char *string;
-
- ACPI_FUNCTION_ENTRY();
-
- if (!src_string) {
- return;
- }
-
- /* Walk entire string, uppercasing the letters */
-
- for (string = src_string; *string; string++) {
- *string = (char)ACPI_TOUPPER(*string);
- }
-
- return;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_print_string
- *
- * PARAMETERS: String - Null terminated ASCII string
- * max_length - Maximum output length
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
- * sequences.
- *
- ******************************************************************************/
-
-void acpi_ut_print_string(char *string, u8 max_length)
-{
- u32 i;
-
- if (!string) {
- acpi_os_printf("<\"NULL STRING PTR\">");
- return;
- }
-
- acpi_os_printf("\"");
- for (i = 0; string[i] && (i < max_length); i++) {
-
- /* Escape sequences */
-
- switch (string[i]) {
- case 0x07:
- acpi_os_printf("\\a"); /* BELL */
- break;
-
- case 0x08:
- acpi_os_printf("\\b"); /* BACKSPACE */
- break;
-
- case 0x0C:
- acpi_os_printf("\\f"); /* FORMFEED */
- break;
-
- case 0x0A:
- acpi_os_printf("\\n"); /* LINEFEED */
- break;
-
- case 0x0D:
- acpi_os_printf("\\r"); /* CARRIAGE RETURN */
- break;
-
- case 0x09:
- acpi_os_printf("\\t"); /* HORIZONTAL TAB */
- break;
-
- case 0x0B:
- acpi_os_printf("\\v"); /* VERTICAL TAB */
- break;
-
- case '\'': /* Single Quote */
- case '\"': /* Double Quote */
- case '\\': /* Backslash */
- acpi_os_printf("\\%c", (int)string[i]);
- break;
-
- default:
-
- /* Check for printable character or hex escape */
-
- if (ACPI_IS_PRINT(string[i])) {
- /* This is a normal character */
-
- acpi_os_printf("%c", (int)string[i]);
- } else {
- /* All others will be Hex escapes */
-
- acpi_os_printf("\\x%2.2X", (s32) string[i]);
- }
- break;
- }
- }
- acpi_os_printf("\"");
-
- if (i == max_length && string[i]) {
- acpi_os_printf("...");
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_dword_byte_swap
- *
- * PARAMETERS: Value - Value to be converted
- *
- * RETURN: u32 integer with bytes swapped
- *
- * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
- *
- ******************************************************************************/
-
-u32 acpi_ut_dword_byte_swap(u32 value)
-{
- union {
- u32 value;
- u8 bytes[4];
- } out;
- union {
- u32 value;
- u8 bytes[4];
- } in;
-
- ACPI_FUNCTION_ENTRY();
-
- in.value = value;
-
- out.bytes[0] = in.bytes[3];
- out.bytes[1] = in.bytes[2];
- out.bytes[2] = in.bytes[1];
- out.bytes[3] = in.bytes[0];
-
- return (out.value);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_set_integer_width
- *
- * PARAMETERS: Revision From DSDT header
- *
- * RETURN: None
- *
- * DESCRIPTION: Set the global integer bit width based upon the revision
- * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
- * For Revision 2 and above, Integers are 64 bits. Yes, this
- * makes a difference.
- *
- ******************************************************************************/
-
-void acpi_ut_set_integer_width(u8 revision)
-{
-
- if (revision < 2) {
-
- /* 32-bit case */
-
- acpi_gbl_integer_bit_width = 32;
- acpi_gbl_integer_nybble_width = 8;
- acpi_gbl_integer_byte_width = 4;
- } else {
- /* 64-bit case (ACPI 2.0+) */
-
- acpi_gbl_integer_bit_width = 64;
- acpi_gbl_integer_nybble_width = 16;
- acpi_gbl_integer_byte_width = 8;
- }
-}
-
-#ifdef ACPI_DEBUG_OUTPUT
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_display_init_pathname
- *
- * PARAMETERS: Type - Object type of the node
- * obj_handle - Handle whose pathname will be displayed
- * Path - Additional path string to be appended.
- * (NULL if no extra path)
- *
- * RETURN: acpi_status
- *
- * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
- *
- ******************************************************************************/
-
-void
-acpi_ut_display_init_pathname(u8 type,
- struct acpi_namespace_node *obj_handle,
- char *path)
-{
- acpi_status status;
- struct acpi_buffer buffer;
-
- ACPI_FUNCTION_ENTRY();
-
- /* Only print the path if the appropriate debug level is enabled */
-
- if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
- return;
- }
-
- /* Get the full pathname to the node */
-
- buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_ns_handle_to_pathname(obj_handle, &buffer);
- if (ACPI_FAILURE(status)) {
- return;
- }
-
- /* Print what we're doing */
-
- switch (type) {
- case ACPI_TYPE_METHOD:
- acpi_os_printf("Executing ");
- break;
-
- default:
- acpi_os_printf("Initializing ");
- break;
- }
-
- /* Print the object type and pathname */
-
- acpi_os_printf("%-12s %s",
- acpi_ut_get_type_name(type), (char *)buffer.pointer);
-
- /* Extra path is used to append names like _STA, _INI, etc. */
-
- if (path) {
- acpi_os_printf(".%s", path);
- }
- acpi_os_printf("\n");
-
- ACPI_FREE(buffer.pointer);
-}
-#endif
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_valid_acpi_char
- *
- * PARAMETERS: Char - The character to be examined
- * Position - Byte position (0-3)
- *
- * RETURN: TRUE if the character is valid, FALSE otherwise
- *
- * DESCRIPTION: Check for a valid ACPI character. Must be one of:
- * 1) Upper case alpha
- * 2) numeric
- * 3) underscore
- *
- * We allow a '!' as the last character because of the ASF! table
- *
- ******************************************************************************/
-
-u8 acpi_ut_valid_acpi_char(char character, u32 position)
-{
-
- if (!((character >= 'A' && character <= 'Z') ||
- (character >= '0' && character <= '9') || (character == '_'))) {
-
- /* Allow a '!' in the last position */
-
- if (character == '!' && position == 3) {
- return (TRUE);
- }
-
- return (FALSE);
- }
-
- return (TRUE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_valid_acpi_name
- *
- * PARAMETERS: Name - The name to be examined
- *
- * RETURN: TRUE if the name is valid, FALSE otherwise
- *
- * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
- * 1) Upper case alpha
- * 2) numeric
- * 3) underscore
- *
- ******************************************************************************/
-
-u8 acpi_ut_valid_acpi_name(u32 name)
-{
- u32 i;
-
- ACPI_FUNCTION_ENTRY();
-
- for (i = 0; i < ACPI_NAME_SIZE; i++) {
- if (!acpi_ut_valid_acpi_char
- ((ACPI_CAST_PTR(char, &name))[i], i)) {
- return (FALSE);
- }
- }
-
- return (TRUE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_repair_name
- *
- * PARAMETERS: Name - The ACPI name to be repaired
- *
- * RETURN: Repaired version of the name
- *
- * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
- * return the new name.
- *
- ******************************************************************************/
-
-acpi_name acpi_ut_repair_name(char *name)
-{
- u32 i;
- char new_name[ACPI_NAME_SIZE];
-
- for (i = 0; i < ACPI_NAME_SIZE; i++) {
- new_name[i] = name[i];
-
- /*
- * Replace a bad character with something printable, yet technically
- * still invalid. This prevents any collisions with existing "good"
- * names in the namespace.
- */
- if (!acpi_ut_valid_acpi_char(name[i], i)) {
- new_name[i] = '*';
- }
- }
-
- return (*(u32 *) new_name);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_strtoul64
- *
- * PARAMETERS: String - Null terminated string
- * Base - Radix of the string: 16 or ACPI_ANY_BASE;
- * ACPI_ANY_BASE means 'in behalf of to_integer'
- * ret_integer - Where the converted integer is returned
- *
- * RETURN: Status and Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value. Performs either a
- * 32-bit or 64-bit conversion, depending on the current mode
- * of the interpreter.
- * NOTE: Does not support Octal strings, not needed.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
-{
- u32 this_digit = 0;
- acpi_integer return_value = 0;
- acpi_integer quotient;
- acpi_integer dividend;
- u32 to_integer_op = (base == ACPI_ANY_BASE);
- u32 mode32 = (acpi_gbl_integer_byte_width == 4);
- u8 valid_digits = 0;
- u8 sign_of0x = 0;
- u8 term = 0;
-
- ACPI_FUNCTION_TRACE_STR(ut_stroul64, string);
-
- switch (base) {
- case ACPI_ANY_BASE:
- case 16:
- break;
-
- default:
- /* Invalid Base */
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- if (!string) {
- goto error_exit;
- }
-
- /* Skip over any white space in the buffer */
-
- while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
- string++;
- }
-
- if (to_integer_op) {
- /*
- * Base equal to ACPI_ANY_BASE means 'to_integer operation case'.
- * We need to determine if it is decimal or hexadecimal.
- */
- if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
- sign_of0x = 1;
- base = 16;
-
- /* Skip over the leading '0x' */
- string += 2;
- } else {
- base = 10;
- }
- }
-
- /* Any string left? Check that '0x' is not followed by white space. */
-
- if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
- if (to_integer_op) {
- goto error_exit;
- } else {
- goto all_done;
- }
- }
-
- /*
- * Perform a 32-bit or 64-bit conversion, depending upon the current
- * execution mode of the interpreter
- */
- dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
-
- /* Main loop: convert the string to a 32- or 64-bit integer */
-
- while (*string) {
- if (ACPI_IS_DIGIT(*string)) {
-
- /* Convert ASCII 0-9 to Decimal value */
-
- this_digit = ((u8) * string) - '0';
- } else if (base == 10) {
-
- /* Digit is out of range; possible in to_integer case only */
-
- term = 1;
- } else {
- this_digit = (u8) ACPI_TOUPPER(*string);
- if (ACPI_IS_XDIGIT((char)this_digit)) {
-
- /* Convert ASCII Hex char to value */
-
- this_digit = this_digit - 'A' + 10;
- } else {
- term = 1;
- }
- }
-
- if (term) {
- if (to_integer_op) {
- goto error_exit;
- } else {
- break;
- }
- } else if ((valid_digits == 0) && (this_digit == 0)
- && !sign_of0x) {
-
- /* Skip zeros */
- string++;
- continue;
- }
-
- valid_digits++;
-
- if (sign_of0x && ((valid_digits > 16)
- || ((valid_digits > 8) && mode32))) {
- /*
- * This is to_integer operation case.
- * No any restrictions for string-to-integer conversion,
- * see ACPI spec.
- */
- goto error_exit;
- }
-
- /* Divide the digit into the correct position */
-
- (void)
- acpi_ut_short_divide((dividend - (acpi_integer) this_digit),
- base, &quotient, NULL);
-
- if (return_value > quotient) {
- if (to_integer_op) {
- goto error_exit;
- } else {
- break;
- }
- }
-
- return_value *= base;
- return_value += this_digit;
- string++;
- }
-
- /* All done, normal exit */
-
- all_done:
-
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(return_value)));
-
- *ret_integer = return_value;
- return_ACPI_STATUS(AE_OK);
-
- error_exit:
- /* Base was set/validated above */
-
- if (base == 10) {
- return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
- } else {
- return_ACPI_STATUS(AE_BAD_HEX_CONSTANT);
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_update_state_and_push
- *
- * PARAMETERS: Object - Object to be added to the new state
- * Action - Increment/Decrement
- * state_list - List the state will be added to
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
- u16 action,
- union acpi_generic_state **state_list)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_ENTRY();
-
- /* Ignore null objects; these are expected */
-
- if (!object) {
- return (AE_OK);
- }
-
- state = acpi_ut_create_update_state(object, action);
- if (!state) {
- return (AE_NO_MEMORY);
- }
-
- acpi_ut_push_generic_state(state_list, state);
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_walk_package_tree
- *
- * PARAMETERS: source_object - The package to walk
- * target_object - Target object (if package is being copied)
- * walk_callback - Called once for each package element
- * Context - Passed to the callback function
- *
- * RETURN: Status
- *
- * DESCRIPTION: Walk through a package
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
- void *target_object,
- acpi_pkg_callback walk_callback, void *context)
-{
- acpi_status status = AE_OK;
- union acpi_generic_state *state_list = NULL;
- union acpi_generic_state *state;
- u32 this_index;
- union acpi_operand_object *this_source_obj;
-
- ACPI_FUNCTION_TRACE(ut_walk_package_tree);
-
- state = acpi_ut_create_pkg_state(source_object, target_object, 0);
- if (!state) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- while (state) {
-
- /* Get one element of the package */
-
- this_index = state->pkg.index;
- this_source_obj = (union acpi_operand_object *)
- state->pkg.source_object->package.elements[this_index];
-
- /*
- * Check for:
- * 1) An uninitialized package element. It is completely
- * legal to declare a package and leave it uninitialized
- * 2) Not an internal object - can be a namespace node instead
- * 3) Any type other than a package. Packages are handled in else
- * case below.
- */
- if ((!this_source_obj) ||
- (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) !=
- ACPI_DESC_TYPE_OPERAND)
- || (ACPI_GET_OBJECT_TYPE(this_source_obj) !=
- ACPI_TYPE_PACKAGE)) {
- status =
- walk_callback(ACPI_COPY_TYPE_SIMPLE,
- this_source_obj, state, context);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- state->pkg.index++;
- while (state->pkg.index >=
- state->pkg.source_object->package.count) {
- /*
- * We've handled all of the objects at this level, This means
- * that we have just completed a package. That package may
- * have contained one or more packages itself.
- *
- * Delete this state and pop the previous state (package).
- */
- acpi_ut_delete_generic_state(state);
- state = acpi_ut_pop_generic_state(&state_list);
-
- /* Finished when there are no more states */
-
- if (!state) {
- /*
- * We have handled all of the objects in the top level
- * package just add the length of the package objects
- * and exit
- */
- return_ACPI_STATUS(AE_OK);
- }
-
- /*
- * Go back up a level and move the index past the just
- * completed package object.
- */
- state->pkg.index++;
- }
- } else {
- /* This is a subobject of type package */
-
- status =
- walk_callback(ACPI_COPY_TYPE_PACKAGE,
- this_source_obj, state, context);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /*
- * Push the current state and create a new one
- * The callback above returned a new target package object.
- */
- acpi_ut_push_generic_state(&state_list, state);
- state = acpi_ut_create_pkg_state(this_source_obj,
- state->pkg.
- this_target_obj, 0);
- if (!state) {
-
- /* Free any stacked Update State objects */
-
- while (state_list) {
- state =
- acpi_ut_pop_generic_state
- (&state_list);
- acpi_ut_delete_generic_state(state);
- }
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
- }
- }
-
- /* We should never get here */
-
- return_ACPI_STATUS(AE_AML_INTERNAL);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info
- *
- * PARAMETERS: module_name - Caller's module name (for error output)
- * line_number - Caller's line number (for error output)
- * Format - Printf format string + additional args
- *
- * RETURN: None
- *
- * DESCRIPTION: Print message with module/line/version info
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_error(const char *module_name, u32 line_number, const char *format, ...)
-{
- va_list args;
-
- acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
-
- va_start(args, format);
- acpi_os_vprintf(format, args);
- acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
- va_end(args);
-}
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_exception(const char *module_name,
- u32 line_number, acpi_status status, const char *format, ...)
-{
- va_list args;
-
- acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name,
- line_number, acpi_format_exception(status));
-
- va_start(args, format);
- acpi_os_vprintf(format, args);
- acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
- va_end(args);
-}
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
-{
- va_list args;
-
- acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
-
- va_start(args, format);
- acpi_os_vprintf(format, args);
- acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
- va_end(args);
-}
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_info(const char *module_name, u32 line_number, const char *format, ...)
-{
- va_list args;
-
- /*
- * Removed module_name, line_number, and acpica version, not needed
- * for info output
- */
- acpi_os_printf("ACPI: ");
-
- va_start(args, format);
- acpi_os_vprintf(format, args);
- acpi_os_printf("\n");
- va_end(args);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_error)
-ACPI_EXPORT_SYMBOL(acpi_exception)
-ACPI_EXPORT_SYMBOL(acpi_warning)
-ACPI_EXPORT_SYMBOL(acpi_info)
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
deleted file mode 100644
index 7b48ba3f3f8..00000000000
--- a/drivers/acpi/utilities/utmutex.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: utmutex - local mutex support
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utmutex")
-
-/* Local prototypes */
-static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id);
-
-static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_mutex_initialize
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create the system mutex objects.
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_mutex_initialize(void)
-{
- u32 i;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_mutex_initialize);
-
- /*
- * Create each of the predefined mutex objects
- */
- for (i = 0; i < ACPI_NUM_MUTEX; i++) {
- status = acpi_ut_create_mutex(i);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- /* Create the spinlocks for use at interrupt level */
-
- spin_lock_init(acpi_gbl_gpe_lock);
- spin_lock_init(acpi_gbl_hardware_lock);
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_mutex_terminate
- *
- * PARAMETERS: None.
- *
- * RETURN: None.
- *
- * DESCRIPTION: Delete all of the system mutex objects.
- *
- ******************************************************************************/
-
-void acpi_ut_mutex_terminate(void)
-{
- u32 i;
-
- ACPI_FUNCTION_TRACE(ut_mutex_terminate);
-
- /*
- * Delete each predefined mutex object
- */
- for (i = 0; i < ACPI_NUM_MUTEX; i++) {
- (void)acpi_ut_delete_mutex(i);
- }
-
- /* Delete the spinlocks */
-
- acpi_os_delete_lock(acpi_gbl_gpe_lock);
- acpi_os_delete_lock(acpi_gbl_hardware_lock);
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_mutex
- *
- * PARAMETERS: mutex_iD - ID of the mutex to be created
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a mutex object.
- *
- ******************************************************************************/
-
-static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
-
- if (mutex_id > ACPI_MAX_MUTEX) {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- if (!acpi_gbl_mutex_info[mutex_id].mutex) {
- status =
- acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex);
- acpi_gbl_mutex_info[mutex_id].thread_id =
- ACPI_MUTEX_NOT_ACQUIRED;
- acpi_gbl_mutex_info[mutex_id].use_count = 0;
- }
-
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_mutex
- *
- * PARAMETERS: mutex_iD - ID of the mutex to be deleted
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete a mutex object.
- *
- ******************************************************************************/
-
-static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
-{
-
- ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
-
- if (mutex_id > ACPI_MAX_MUTEX) {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
-
- acpi_gbl_mutex_info[mutex_id].mutex = NULL;
- acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
-
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_acquire_mutex
- *
- * PARAMETERS: mutex_iD - ID of the mutex to be acquired
- *
- * RETURN: Status
- *
- * DESCRIPTION: Acquire a mutex object.
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
-{
- acpi_status status;
- acpi_thread_id this_thread_id;
-
- ACPI_FUNCTION_NAME(ut_acquire_mutex);
-
- if (mutex_id > ACPI_MAX_MUTEX) {
- return (AE_BAD_PARAMETER);
- }
-
- this_thread_id = acpi_os_get_thread_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 < ACPI_NUM_MUTEX; i++) {
- if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
- if (i == mutex_id) {
- ACPI_ERROR((AE_INFO,
- "Mutex [%s] already acquired by this thread [%X]",
- acpi_ut_get_mutex_name
- (mutex_id),
- this_thread_id));
-
- return (AE_ALREADY_ACQUIRED);
- }
-
- ACPI_ERROR((AE_INFO,
- "Invalid acquire order: Thread %X owns [%s], wants [%s]",
- 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 %lX attempting to acquire Mutex [%s]\n",
- (unsigned long)this_thread_id,
- acpi_ut_get_mutex_name(mutex_id)));
-
- status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex,
- ACPI_WAIT_FOREVER);
- if (ACPI_SUCCESS(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
- "Thread %lX acquired Mutex [%s]\n",
- (unsigned long)this_thread_id,
- acpi_ut_get_mutex_name(mutex_id)));
-
- acpi_gbl_mutex_info[mutex_id].use_count++;
- acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
- } else {
- ACPI_EXCEPTION((AE_INFO, status,
- "Thread %lX could not acquire Mutex [%X]",
- (unsigned long)this_thread_id, mutex_id));
- }
-
- return (status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_release_mutex
- *
- * PARAMETERS: mutex_iD - ID of the mutex to be released
- *
- * RETURN: Status
- *
- * DESCRIPTION: Release a mutex object.
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
-{
- acpi_thread_id this_thread_id;
-
- ACPI_FUNCTION_NAME(ut_release_mutex);
-
- this_thread_id = acpi_os_get_thread_id();
- ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
- "Thread %lX releasing Mutex [%s]\n",
- (unsigned long)this_thread_id,
- acpi_ut_get_mutex_name(mutex_id)));
-
- if (mutex_id > ACPI_MAX_MUTEX) {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Mutex must be acquired in order to release it!
- */
- if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
- ACPI_ERROR((AE_INFO,
- "Mutex [%X] is not acquired, cannot release",
- mutex_id));
-
- return (AE_NOT_ACQUIRED);
- }
-#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 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 < ACPI_NUM_MUTEX; i++) {
- if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
- if (i == mutex_id) {
- continue;
- }
-
- ACPI_ERROR((AE_INFO,
- "Invalid release order: owns [%s], releasing [%s]",
- acpi_ut_get_mutex_name(i),
- acpi_ut_get_mutex_name(mutex_id)));
-
- return (AE_RELEASE_DEADLOCK);
- }
- }
- }
-#endif
-
- /* Mark unlocked FIRST */
-
- acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
-
- acpi_os_release_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
- return (AE_OK);
-}
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
deleted file mode 100644
index 964b23c1161..00000000000
--- a/drivers/acpi/utilities/utobject.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utobject - ACPI object create/delete/size/cache routines
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acnamesp.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utobject")
-
-/* Local prototypes */
-static acpi_status
-acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
- acpi_size * obj_length);
-
-static acpi_status
-acpi_ut_get_package_object_size(union acpi_operand_object *obj,
- acpi_size * obj_length);
-
-static acpi_status
-acpi_ut_get_element_length(u8 object_type,
- union acpi_operand_object *source_object,
- union acpi_generic_state *state, void *context);
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_internal_object_dbg
- *
- * PARAMETERS: module_name - Source file name of caller
- * line_number - Line number of caller
- * component_id - Component type of caller
- * Type - ACPI Type of the new object
- *
- * RETURN: A new internal object, null on failure
- *
- * DESCRIPTION: Create and initialize a new internal object.
- *
- * NOTE: We always allocate the worst-case object descriptor because
- * these objects are cached, and we want them to be
- * one-size-satisifies-any-request. This in itself may not be
- * the most memory efficient, but the efficiency of the object
- * cache should more than make up for this!
- *
- ******************************************************************************/
-
-union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
- *module_name,
- u32 line_number,
- u32 component_id,
- acpi_object_type
- type)
-{
- union acpi_operand_object *object;
- union acpi_operand_object *second_object;
-
- ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
- acpi_ut_get_type_name(type));
-
- /* Allocate the raw object descriptor */
-
- object =
- acpi_ut_allocate_object_desc_dbg(module_name, line_number,
- component_id);
- if (!object) {
- return_PTR(NULL);
- }
-
- switch (type) {
- case ACPI_TYPE_REGION:
- case ACPI_TYPE_BUFFER_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
-
- /* These types require a secondary object */
-
- second_object = acpi_ut_allocate_object_desc_dbg(module_name,
- line_number,
- component_id);
- if (!second_object) {
- acpi_ut_delete_object_desc(object);
- return_PTR(NULL);
- }
-
- second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
- second_object->common.reference_count = 1;
-
- /* Link the second object to the first */
-
- object->common.next_object = second_object;
- break;
-
- default:
- /* All others have no secondary object */
- break;
- }
-
- /* Save the object type in the object descriptor */
-
- object->common.type = (u8) type;
-
- /* Init the reference count */
-
- object->common.reference_count = 1;
-
- /* Any per-type initialization should go here */
-
- return_PTR(object);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_package_object
- *
- * PARAMETERS: Count - Number of package elements
- *
- * RETURN: Pointer to a new Package object, null on failure
- *
- * DESCRIPTION: Create a fully initialized package object
- *
- ******************************************************************************/
-
-union acpi_operand_object *acpi_ut_create_package_object(u32 count)
-{
- union acpi_operand_object *package_desc;
- union acpi_operand_object **package_elements;
-
- ACPI_FUNCTION_TRACE_U32(ut_create_package_object, count);
-
- /* Create a new Package object */
-
- package_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
- if (!package_desc) {
- return_PTR(NULL);
- }
-
- /*
- * Create the element array. Count+1 allows the array to be null
- * terminated.
- */
- package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count +
- 1) * sizeof(void *));
- if (!package_elements) {
- acpi_ut_remove_reference(package_desc);
- return_PTR(NULL);
- }
-
- package_desc->package.count = count;
- package_desc->package.elements = package_elements;
- return_PTR(package_desc);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_buffer_object
- *
- * PARAMETERS: buffer_size - Size of buffer to be created
- *
- * RETURN: Pointer to a new Buffer object, null on failure
- *
- * DESCRIPTION: Create a fully initialized buffer object
- *
- ******************************************************************************/
-
-union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
-{
- union acpi_operand_object *buffer_desc;
- u8 *buffer = NULL;
-
- ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size);
-
- /* Create a new Buffer object */
-
- buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
- if (!buffer_desc) {
- return_PTR(NULL);
- }
-
- /* Create an actual buffer only if size > 0 */
-
- if (buffer_size > 0) {
-
- /* Allocate the actual buffer */
-
- buffer = ACPI_ALLOCATE_ZEROED(buffer_size);
- if (!buffer) {
- ACPI_ERROR((AE_INFO, "Could not allocate size %X",
- (u32) buffer_size));
- acpi_ut_remove_reference(buffer_desc);
- return_PTR(NULL);
- }
- }
-
- /* Complete buffer object initialization */
-
- buffer_desc->buffer.flags |= AOPOBJ_DATA_VALID;
- buffer_desc->buffer.pointer = buffer;
- buffer_desc->buffer.length = (u32) buffer_size;
-
- /* Return the new buffer descriptor */
-
- return_PTR(buffer_desc);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_string_object
- *
- * PARAMETERS: string_size - Size of string to be created. Does not
- * include NULL terminator, this is added
- * automatically.
- *
- * RETURN: Pointer to a new String object
- *
- * DESCRIPTION: Create a fully initialized string object
- *
- ******************************************************************************/
-
-union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
-{
- union acpi_operand_object *string_desc;
- char *string;
-
- ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size);
-
- /* Create a new String object */
-
- string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING);
- if (!string_desc) {
- return_PTR(NULL);
- }
-
- /*
- * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
- * NOTE: Zero-length strings are NULL terminated
- */
- string = ACPI_ALLOCATE_ZEROED(string_size + 1);
- if (!string) {
- ACPI_ERROR((AE_INFO, "Could not allocate size %X",
- (u32) string_size));
- acpi_ut_remove_reference(string_desc);
- return_PTR(NULL);
- }
-
- /* Complete string object initialization */
-
- string_desc->string.pointer = string;
- string_desc->string.length = (u32) string_size;
-
- /* Return the new string descriptor */
-
- return_PTR(string_desc);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_valid_internal_object
- *
- * PARAMETERS: Object - Object to be validated
- *
- * RETURN: TRUE if object is valid, FALSE otherwise
- *
- * DESCRIPTION: Validate a pointer to be an union acpi_operand_object
- *
- ******************************************************************************/
-
-u8 acpi_ut_valid_internal_object(void *object)
-{
-
- ACPI_FUNCTION_NAME(ut_valid_internal_object);
-
- /* Check for a null pointer */
-
- if (!object) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Null Object Ptr\n"));
- return (FALSE);
- }
-
- /* Check the descriptor type field */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE(object)) {
- case ACPI_DESC_TYPE_OPERAND:
-
- /* The object appears to be a valid union acpi_operand_object */
-
- return (TRUE);
-
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "%p is not not an ACPI operand obj [%s]\n",
- object, acpi_ut_get_descriptor_name(object)));
- break;
- }
-
- return (FALSE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_allocate_object_desc_dbg
- *
- * PARAMETERS: module_name - Caller's module name (for error output)
- * line_number - Caller's line number (for error output)
- * component_id - Caller's component ID (for error output)
- *
- * RETURN: Pointer to newly allocated object descriptor. Null on error
- *
- * DESCRIPTION: Allocate a new object descriptor. Gracefully handle
- * error conditions.
- *
- ******************************************************************************/
-
-void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
- u32 line_number, u32 component_id)
-{
- union acpi_operand_object *object;
-
- ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
-
- object = acpi_os_acquire_object(acpi_gbl_operand_cache);
- if (!object) {
- ACPI_ERROR((module_name, line_number,
- "Could not allocate an object descriptor"));
-
- return_PTR(NULL);
- }
-
- /* Mark the descriptor type */
-
- memset(object, 0, sizeof(union acpi_operand_object));
- ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
-
- ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
- object, (u32) sizeof(union acpi_operand_object)));
-
- return_PTR(object);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_object_desc
- *
- * PARAMETERS: Object - An Acpi internal object to be deleted
- *
- * RETURN: None.
- *
- * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
- *
- ******************************************************************************/
-
-void acpi_ut_delete_object_desc(union acpi_operand_object *object)
-{
- ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
-
- /* Object must be an union acpi_operand_object */
-
- if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
- ACPI_ERROR((AE_INFO,
- "%p is not an ACPI Operand object [%s]", object,
- acpi_ut_get_descriptor_name(object)));
- return_VOID;
- }
-
- (void)acpi_os_release_object(acpi_gbl_operand_cache, object);
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_simple_object_size
- *
- * PARAMETERS: internal_object - An ACPI operand object
- * obj_length - Where the length is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to determine the space required to
- * contain a simple object for return to an external user.
- *
- * The length includes the object structure plus any additional
- * needed space.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
- acpi_size * obj_length)
-{
- acpi_size length;
- acpi_size size;
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
-
- /*
- * Handle a null object (Could be a uninitialized package
- * element -- which is legal)
- */
- if (!internal_object) {
- *obj_length = sizeof(union acpi_object);
- return_ACPI_STATUS(AE_OK);
- }
-
- /* Start with the length of the Acpi object */
-
- length = sizeof(union acpi_object);
-
- if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
-
- /* Object is a named object (reference), just return the length */
-
- *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
- return_ACPI_STATUS(status);
- }
-
- /*
- * The final length depends on the object type
- * Strings and Buffers are packed right up against the parent object and
- * must be accessed bytewise or there may be alignment problems on
- * certain processors
- */
- switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
- case ACPI_TYPE_STRING:
-
- length += (acpi_size) internal_object->string.length + 1;
- break;
-
- case ACPI_TYPE_BUFFER:
-
- length += (acpi_size) internal_object->buffer.length;
- break;
-
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_POWER:
-
- /* No extra data for these types */
-
- break;
-
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- switch (internal_object->reference.class) {
- case ACPI_REFCLASS_NAME:
-
- /*
- * Get the actual length of the full pathname to this object.
- * The reference will be converted to the pathname to the object
- */
- size =
- acpi_ns_get_pathname_length(internal_object->
- reference.node);
- if (!size) {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- length += ACPI_ROUND_UP_TO_NATIVE_WORD(size);
- break;
-
- default:
-
- /*
- * No other reference opcodes are supported.
- * Notably, Locals and Args are not supported, but this may be
- * required eventually.
- */
- ACPI_ERROR((AE_INFO,
- "Cannot convert to external object - "
- "unsupported Reference Class [%s] %X in object %p",
- acpi_ut_get_reference_name(internal_object),
- internal_object->reference.class,
- internal_object));
- status = AE_TYPE;
- break;
- }
- break;
-
- default:
-
- ACPI_ERROR((AE_INFO, "Cannot convert to external object - "
- "unsupported type [%s] %X in object %p",
- acpi_ut_get_object_type_name(internal_object),
- ACPI_GET_OBJECT_TYPE(internal_object),
- internal_object));
- status = AE_TYPE;
- break;
- }
-
- /*
- * Account for the space required by the object rounded up to the next
- * multiple of the machine word size. This keeps each object aligned
- * on a machine word boundary. (preventing alignment faults on some
- * machines.)
- */
- *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_element_length
- *
- * PARAMETERS: acpi_pkg_callback
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get the length of one package element.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_get_element_length(u8 object_type,
- union acpi_operand_object *source_object,
- union acpi_generic_state *state, void *context)
-{
- acpi_status status = AE_OK;
- struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
- acpi_size object_space;
-
- switch (object_type) {
- case ACPI_COPY_TYPE_SIMPLE:
-
- /*
- * Simple object - just get the size (Null object/entry is handled
- * here also) and sum it into the running package length
- */
- status =
- acpi_ut_get_simple_object_size(source_object,
- &object_space);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
-
- info->length += object_space;
- break;
-
- case ACPI_COPY_TYPE_PACKAGE:
-
- /* Package object - nothing much to do here, let the walk handle it */
-
- info->num_packages++;
- state->pkg.this_target_obj = NULL;
- break;
-
- default:
-
- /* No other types allowed */
-
- return (AE_BAD_PARAMETER);
- }
-
- return (status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_package_object_size
- *
- * PARAMETERS: internal_object - An ACPI internal object
- * obj_length - Where the length is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to determine the space required to
- * contain a package object for return to an external user.
- *
- * This is moderately complex since a package contains other
- * objects including packages.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
- acpi_size * obj_length)
-{
- acpi_status status;
- struct acpi_pkg_info info;
-
- ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object);
-
- info.length = 0;
- info.object_space = 0;
- info.num_packages = 1;
-
- status = acpi_ut_walk_package_tree(internal_object, NULL,
- acpi_ut_get_element_length, &info);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /*
- * We have handled all of the objects in all levels of the package.
- * just add the length of the package objects themselves.
- * Round up to the next machine word.
- */
- info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
- (acpi_size) info.num_packages;
-
- /* Return the total package length */
-
- *obj_length = info.length;
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_object_size
- *
- * PARAMETERS: internal_object - An ACPI internal object
- * obj_length - Where the length will be returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to determine the space required to
- * contain an object for return to an API user.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_get_object_size(union acpi_operand_object *internal_object,
- acpi_size * obj_length)
-{
- acpi_status status;
-
- ACPI_FUNCTION_ENTRY();
-
- if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) ==
- ACPI_DESC_TYPE_OPERAND)
- && (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE)) {
- status =
- acpi_ut_get_package_object_size(internal_object,
- obj_length);
- } else {
- status =
- acpi_ut_get_simple_object_size(internal_object, obj_length);
- }
-
- return (status);
-}
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
deleted file mode 100644
index 0755c5cdbe1..00000000000
--- a/drivers/acpi/utilities/utresrc.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: utresrc - Resource management utilities
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/amlresrc.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utresrc")
-#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
-/*
- * Strings used to decode resource descriptors.
- * Used by both the disasssembler and the debugger resource dump routines
- */
-const char *acpi_gbl_bm_decode[] = {
- "NotBusMaster",
- "BusMaster"
-};
-
-const char *acpi_gbl_config_decode[] = {
- "0 - Good Configuration",
- "1 - Acceptable Configuration",
- "2 - Suboptimal Configuration",
- "3 - ***Invalid Configuration***",
-};
-
-const char *acpi_gbl_consume_decode[] = {
- "ResourceProducer",
- "ResourceConsumer"
-};
-
-const char *acpi_gbl_dec_decode[] = {
- "PosDecode",
- "SubDecode"
-};
-
-const char *acpi_gbl_he_decode[] = {
- "Level",
- "Edge"
-};
-
-const char *acpi_gbl_io_decode[] = {
- "Decode10",
- "Decode16"
-};
-
-const char *acpi_gbl_ll_decode[] = {
- "ActiveHigh",
- "ActiveLow"
-};
-
-const char *acpi_gbl_max_decode[] = {
- "MaxNotFixed",
- "MaxFixed"
-};
-
-const char *acpi_gbl_mem_decode[] = {
- "NonCacheable",
- "Cacheable",
- "WriteCombining",
- "Prefetchable"
-};
-
-const char *acpi_gbl_min_decode[] = {
- "MinNotFixed",
- "MinFixed"
-};
-
-const char *acpi_gbl_mtp_decode[] = {
- "AddressRangeMemory",
- "AddressRangeReserved",
- "AddressRangeACPI",
- "AddressRangeNVS"
-};
-
-const char *acpi_gbl_rng_decode[] = {
- "InvalidRanges",
- "NonISAOnlyRanges",
- "ISAOnlyRanges",
- "EntireRange"
-};
-
-const char *acpi_gbl_rw_decode[] = {
- "ReadOnly",
- "ReadWrite"
-};
-
-const char *acpi_gbl_shr_decode[] = {
- "Exclusive",
- "Shared"
-};
-
-const char *acpi_gbl_siz_decode[] = {
- "Transfer8",
- "Transfer8_16",
- "Transfer16",
- "InvalidSize"
-};
-
-const char *acpi_gbl_trs_decode[] = {
- "DenseTranslation",
- "SparseTranslation"
-};
-
-const char *acpi_gbl_ttp_decode[] = {
- "TypeStatic",
- "TypeTranslation"
-};
-
-const char *acpi_gbl_typ_decode[] = {
- "Compatibility",
- "TypeA",
- "TypeB",
- "TypeF"
-};
-
-#endif
-
-/*
- * Base sizes of the raw AML resource descriptors, indexed by resource type.
- * Zero indicates a reserved (and therefore invalid) resource type.
- */
-const u8 acpi_gbl_resource_aml_sizes[] = {
- /* Small descriptors */
-
- 0,
- 0,
- 0,
- 0,
- ACPI_AML_SIZE_SMALL(struct aml_resource_irq),
- ACPI_AML_SIZE_SMALL(struct aml_resource_dma),
- ACPI_AML_SIZE_SMALL(struct aml_resource_start_dependent),
- ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent),
- ACPI_AML_SIZE_SMALL(struct aml_resource_io),
- ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io),
- 0,
- 0,
- 0,
- 0,
- ACPI_AML_SIZE_SMALL(struct aml_resource_vendor_small),
- ACPI_AML_SIZE_SMALL(struct aml_resource_end_tag),
-
- /* Large descriptors */
-
- 0,
- ACPI_AML_SIZE_LARGE(struct aml_resource_memory24),
- ACPI_AML_SIZE_LARGE(struct aml_resource_generic_register),
- 0,
- ACPI_AML_SIZE_LARGE(struct aml_resource_vendor_large),
- ACPI_AML_SIZE_LARGE(struct aml_resource_memory32),
- ACPI_AML_SIZE_LARGE(struct aml_resource_fixed_memory32),
- ACPI_AML_SIZE_LARGE(struct aml_resource_address32),
- ACPI_AML_SIZE_LARGE(struct aml_resource_address16),
- ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq),
- ACPI_AML_SIZE_LARGE(struct aml_resource_address64),
- ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64)
-};
-
-/*
- * Resource types, used to validate the resource length field.
- * The length of fixed-length types must match exactly, variable
- * lengths must meet the minimum required length, etc.
- * Zero indicates a reserved (and therefore invalid) resource type.
- */
-static const u8 acpi_gbl_resource_types[] = {
- /* Small descriptors */
-
- 0,
- 0,
- 0,
- 0,
- ACPI_SMALL_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_SMALL_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- 0,
- 0,
- 0,
- 0,
- ACPI_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
-
- /* Large descriptors */
-
- 0,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- 0,
- ACPI_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH
-};
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_walk_aml_resources
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource template
- * aml_length - Length of the entire template
- * user_function - Called once for each descriptor found. If
- * NULL, a pointer to the end_tag is returned
- * Context - Passed to user_function
- *
- * RETURN: Status
- *
- * DESCRIPTION: Walk a raw AML resource list(buffer). User function called
- * once for each resource found.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_walk_aml_resources(u8 * aml,
- acpi_size aml_length,
- acpi_walk_aml_callback user_function, void **context)
-{
- acpi_status status;
- u8 *end_aml;
- u8 resource_index;
- u32 length;
- u32 offset = 0;
-
- ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
-
- /* The absolute minimum resource template is one end_tag descriptor */
-
- if (aml_length < sizeof(struct aml_resource_end_tag)) {
- return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
- }
-
- /* Point to the end of the resource template buffer */
-
- end_aml = aml + aml_length;
-
- /* Walk the byte list, abort on any invalid descriptor type or length */
-
- while (aml < end_aml) {
-
- /* Validate the Resource Type and Resource Length */
-
- status = acpi_ut_validate_resource(aml, &resource_index);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /* Get the length of this descriptor */
-
- length = acpi_ut_get_descriptor_length(aml);
-
- /* Invoke the user function */
-
- if (user_function) {
- status =
- user_function(aml, length, offset, resource_index,
- context);
- if (ACPI_FAILURE(status)) {
- return (status);
- }
- }
-
- /* An end_tag descriptor terminates this resource template */
-
- if (acpi_ut_get_resource_type(aml) ==
- ACPI_RESOURCE_NAME_END_TAG) {
- /*
- * There must be at least one more byte in the buffer for
- * the 2nd byte of the end_tag
- */
- if ((aml + 1) >= end_aml) {
- return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
- }
-
- /* Return the pointer to the end_tag if requested */
-
- if (!user_function) {
- *context = aml;
- }
-
- /* Normal exit */
-
- return_ACPI_STATUS(AE_OK);
- }
-
- aml += length;
- offset += length;
- }
-
- /* Did not find an end_tag descriptor */
-
- return (AE_AML_NO_RESOURCE_END_TAG);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_validate_resource
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- * return_index - Where the resource index is returned. NULL
- * if the index is not required.
- *
- * RETURN: Status, and optionally the Index into the global resource tables
- *
- * DESCRIPTION: Validate an AML resource descriptor by checking the Resource
- * Type and Resource Length. Returns an index into the global
- * resource information/dispatch tables for later use.
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
-{
- u8 resource_type;
- u8 resource_index;
- acpi_rs_length resource_length;
- acpi_rs_length minimum_resource_length;
-
- ACPI_FUNCTION_ENTRY();
-
- /*
- * 1) Validate the resource_type field (Byte 0)
- */
- resource_type = ACPI_GET8(aml);
-
- /*
- * Byte 0 contains the descriptor name (Resource Type)
- * Examine the large/small bit in the resource header
- */
- if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
-
- /* Verify the large resource type (name) against the max */
-
- if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
- return (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- /*
- * Large Resource Type -- bits 6:0 contain the name
- * Translate range 0x80-0x8B to index range 0x10-0x1B
- */
- resource_index = (u8) (resource_type - 0x70);
- } else {
- /*
- * Small Resource Type -- bits 6:3 contain the name
- * Shift range to index range 0x00-0x0F
- */
- resource_index = (u8)
- ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3);
- }
-
- /* Check validity of the resource type, zero indicates name is invalid */
-
- if (!acpi_gbl_resource_types[resource_index]) {
- return (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- /*
- * 2) Validate the resource_length field. This ensures that the length
- * is at least reasonable, and guarantees that it is non-zero.
- */
- resource_length = acpi_ut_get_resource_length(aml);
- minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index];
-
- /* Validate based upon the type of resource - fixed length or variable */
-
- switch (acpi_gbl_resource_types[resource_index]) {
- case ACPI_FIXED_LENGTH:
-
- /* Fixed length resource, length must match exactly */
-
- if (resource_length != minimum_resource_length) {
- return (AE_AML_BAD_RESOURCE_LENGTH);
- }
- break;
-
- case ACPI_VARIABLE_LENGTH:
-
- /* Variable length resource, length must be at least the minimum */
-
- if (resource_length < minimum_resource_length) {
- return (AE_AML_BAD_RESOURCE_LENGTH);
- }
- break;
-
- case ACPI_SMALL_VARIABLE_LENGTH:
-
- /* Small variable length resource, length can be (Min) or (Min-1) */
-
- if ((resource_length > minimum_resource_length) ||
- (resource_length < (minimum_resource_length - 1))) {
- return (AE_AML_BAD_RESOURCE_LENGTH);
- }
- break;
-
- default:
-
- /* Shouldn't happen (because of validation earlier), but be sure */
-
- return (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- /* Optionally return the resource table index */
-
- if (return_index) {
- *return_index = resource_index;
- }
-
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_resource_type
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: The Resource Type with no extraneous bits (except the
- * Large/Small descriptor bit -- this is left alone)
- *
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
- *
- ******************************************************************************/
-
-u8 acpi_ut_get_resource_type(void *aml)
-{
- ACPI_FUNCTION_ENTRY();
-
- /*
- * Byte 0 contains the descriptor name (Resource Type)
- * Examine the large/small bit in the resource header
- */
- if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
-
- /* Large Resource Type -- bits 6:0 contain the name */
-
- return (ACPI_GET8(aml));
- } else {
- /* Small Resource Type -- bits 6:3 contain the name */
-
- return ((u8) (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_resource_length
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: Byte Length
- *
- * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
- * definition, this does not include the size of the descriptor
- * header or the length field itself.
- *
- ******************************************************************************/
-
-u16 acpi_ut_get_resource_length(void *aml)
-{
- acpi_rs_length resource_length;
-
- ACPI_FUNCTION_ENTRY();
-
- /*
- * Byte 0 contains the descriptor name (Resource Type)
- * Examine the large/small bit in the resource header
- */
- if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
-
- /* Large Resource type -- bytes 1-2 contain the 16-bit length */
-
- ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
-
- } else {
- /* Small Resource type -- bits 2:0 of byte 0 contain the length */
-
- resource_length = (u16) (ACPI_GET8(aml) &
- ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
- }
-
- return (resource_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_resource_header_length
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: Length of the AML header (depends on large/small descriptor)
- *
- * DESCRIPTION: Get the length of the header for this resource.
- *
- ******************************************************************************/
-
-u8 acpi_ut_get_resource_header_length(void *aml)
-{
- ACPI_FUNCTION_ENTRY();
-
- /* Examine the large/small bit in the resource header */
-
- if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
- return (sizeof(struct aml_resource_large_header));
- } else {
- return (sizeof(struct aml_resource_small_header));
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_descriptor_length
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: Byte length
- *
- * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
- * length of the descriptor header and the length field itself.
- * Used to walk descriptor lists.
- *
- ******************************************************************************/
-
-u32 acpi_ut_get_descriptor_length(void *aml)
-{
- ACPI_FUNCTION_ENTRY();
-
- /*
- * Get the Resource Length (does not include header length) and add
- * the header length (depends on if this is a small or large resource)
- */
- return (acpi_ut_get_resource_length(aml) +
- acpi_ut_get_resource_header_length(aml));
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_get_resource_end_tag
- *
- * PARAMETERS: obj_desc - The resource template buffer object
- * end_tag - Where the pointer to the end_tag is returned
- *
- * RETURN: Status, pointer to the end tag
- *
- * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template
- * Note: allows a buffer length of zero.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
- u8 ** end_tag)
-{
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ut_get_resource_end_tag);
-
- /* Allow a buffer length of zero */
-
- if (!obj_desc->buffer.length) {
- *end_tag = obj_desc->buffer.pointer;
- return_ACPI_STATUS(AE_OK);
- }
-
- /* Validate the template and get a pointer to the end_tag */
-
- status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer,
- obj_desc->buffer.length, NULL,
- (void **)end_tag);
-
- return_ACPI_STATUS(status);
-}
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
deleted file mode 100644
index 54c3461e2f2..00000000000
--- a/drivers/acpi/utilities/utstate.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: utstate - state object support procedures
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utstate")
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_pkg_state_and_push
- *
- * PARAMETERS: Object - Object to be added to the new state
- * Action - Increment/Decrement
- * state_list - List the state will be added to
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-acpi_status
-acpi_ut_create_pkg_state_and_push(void *internal_object,
- void *external_object,
- u16 index,
- union acpi_generic_state **state_list)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_ENTRY();
-
- state =
- acpi_ut_create_pkg_state(internal_object, external_object, index);
- if (!state) {
- return (AE_NO_MEMORY);
- }
-
- acpi_ut_push_generic_state(state_list, state);
- return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_push_generic_state
- *
- * PARAMETERS: list_head - Head of the state stack
- * State - State object to push
- *
- * RETURN: None
- *
- * DESCRIPTION: Push a state object onto a state stack
- *
- ******************************************************************************/
-
-void
-acpi_ut_push_generic_state(union acpi_generic_state **list_head,
- union acpi_generic_state *state)
-{
- ACPI_FUNCTION_TRACE(ut_push_generic_state);
-
- /* Push the state object onto the front of the list (stack) */
-
- state->common.next = *list_head;
- *list_head = state;
-
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_pop_generic_state
- *
- * PARAMETERS: list_head - Head of the state stack
- *
- * RETURN: The popped state object
- *
- * DESCRIPTION: Pop a state object from a state stack
- *
- ******************************************************************************/
-
-union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
- **list_head)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_TRACE(ut_pop_generic_state);
-
- /* Remove the state object at the head of the list (stack) */
-
- state = *list_head;
- if (state) {
-
- /* Update the list head */
-
- *list_head = state->common.next;
- }
-
- return_PTR(state);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_generic_state
- *
- * PARAMETERS: None
- *
- * RETURN: The new state object. NULL on failure.
- *
- * DESCRIPTION: Create a generic state object. Attempt to obtain one from
- * the global state cache; If none available, create a new one.
- *
- ******************************************************************************/
-
-union acpi_generic_state *acpi_ut_create_generic_state(void)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_ENTRY();
-
- state = acpi_os_acquire_object(acpi_gbl_state_cache);
- if (state) {
-
- /* Initialize */
- memset(state, 0, sizeof(union acpi_generic_state));
- state->common.descriptor_type = ACPI_DESC_TYPE_STATE;
- }
-
- return (state);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_thread_state
- *
- * PARAMETERS: None
- *
- * RETURN: New Thread State. NULL on failure
- *
- * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
- * to track per-thread info during method execution
- *
- ******************************************************************************/
-
-struct acpi_thread_state *acpi_ut_create_thread_state(void)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_TRACE(ut_create_thread_state);
-
- /* Create the generic state object */
-
- state = acpi_ut_create_generic_state();
- if (!state) {
- return_PTR(NULL);
- }
-
- /* Init fields specific to the update struct */
-
- state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
- state->thread.thread_id = acpi_os_get_thread_id();
-
- /* Check for invalid thread ID - zero is very bad, it will break things */
-
- if (!state->thread.thread_id) {
- ACPI_ERROR((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId"));
- state->thread.thread_id = (acpi_thread_id) 1;
- }
-
- return_PTR((struct acpi_thread_state *)state);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_update_state
- *
- * PARAMETERS: Object - Initial Object to be installed in the state
- * Action - Update action to be performed
- *
- * RETURN: New state object, null on failure
- *
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- * to update reference counts and delete complex objects such
- * as packages.
- *
- ******************************************************************************/
-
-union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
- *object, u16 action)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object);
-
- /* Create the generic state object */
-
- state = acpi_ut_create_generic_state();
- if (!state) {
- return_PTR(NULL);
- }
-
- /* Init fields specific to the update struct */
-
- state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE;
- state->update.object = object;
- state->update.value = action;
-
- return_PTR(state);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_pkg_state
- *
- * PARAMETERS: Object - Initial Object to be installed in the state
- * Action - Update action to be performed
- *
- * RETURN: New state object, null on failure
- *
- * DESCRIPTION: Create a "Package State"
- *
- ******************************************************************************/
-
-union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
- void *external_object,
- u16 index)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object);
-
- /* Create the generic state object */
-
- state = acpi_ut_create_generic_state();
- if (!state) {
- return_PTR(NULL);
- }
-
- /* Init fields specific to the update struct */
-
- state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE;
- state->pkg.source_object = (union acpi_operand_object *)internal_object;
- state->pkg.dest_object = external_object;
- state->pkg.index = index;
- state->pkg.num_packages = 1;
-
- return_PTR(state);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_create_control_state
- *
- * PARAMETERS: None
- *
- * RETURN: New state object, null on failure
- *
- * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
- * to support nested IF/WHILE constructs in the AML.
- *
- ******************************************************************************/
-
-union acpi_generic_state *acpi_ut_create_control_state(void)
-{
- union acpi_generic_state *state;
-
- ACPI_FUNCTION_TRACE(ut_create_control_state);
-
- /* Create the generic state object */
-
- state = acpi_ut_create_generic_state();
- if (!state) {
- return_PTR(NULL);
- }
-
- /* Init fields specific to the control struct */
-
- state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL;
- state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
-
- return_PTR(state);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_generic_state
- *
- * PARAMETERS: State - The state object to be deleted
- *
- * RETURN: None
- *
- * DESCRIPTION: Release a state object to the state cache. NULL state objects
- * are ignored.
- *
- ******************************************************************************/
-
-void acpi_ut_delete_generic_state(union acpi_generic_state *state)
-{
- ACPI_FUNCTION_TRACE(ut_delete_generic_state);
-
- /* Ignore null state */
-
- if (state) {
- (void)acpi_os_release_object(acpi_gbl_state_cache, state);
- }
- return_VOID;
-}
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
deleted file mode 100644
index 5b27724a274..00000000000
--- a/drivers/acpi/utilities/utxface.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utxface - External interfaces for "global" ACPI functions
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2008, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <acpi/acpi.h>
-#include <acpi/accommon.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acdebug.h>
-#include <acpi/actables.h>
-
-#define _COMPONENT ACPI_UTILITIES
-ACPI_MODULE_NAME("utxface")
-
-#ifndef ACPI_ASL_COMPILER
-/*******************************************************************************
- *
- * FUNCTION: acpi_initialize_subsystem
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initializes all global variables. This is the first function
- * called, so any early initialization belongs here.
- *
- ******************************************************************************/
-acpi_status __init acpi_initialize_subsystem(void)
-{
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
-
- acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE;
- ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
-
- /* Initialize the OS-Dependent layer */
-
- status = acpi_os_initialize();
- if (ACPI_FAILURE(status)) {
- ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
- return_ACPI_STATUS(status);
- }
-
- /* Initialize all globals used by the subsystem */
-
- status = acpi_ut_init_globals();
- if (ACPI_FAILURE(status)) {
- ACPI_EXCEPTION((AE_INFO, status,
- "During initialization of globals"));
- return_ACPI_STATUS(status);
- }
-
- /* Create the default mutex objects */
-
- status = acpi_ut_mutex_initialize();
- if (ACPI_FAILURE(status)) {
- ACPI_EXCEPTION((AE_INFO, status,
- "During Global Mutex creation"));
- return_ACPI_STATUS(status);
- }
-
- /*
- * Initialize the namespace manager and
- * the root of the namespace tree
- */
- status = acpi_ns_root_initialize();
- if (ACPI_FAILURE(status)) {
- ACPI_EXCEPTION((AE_INFO, status,
- "During Namespace initialization"));
- return_ACPI_STATUS(status);
- }
-
- /* If configured, initialize the AML debugger */
-
- ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_enable_subsystem
- *
- * PARAMETERS: Flags - Init/enable Options
- *
- * RETURN: Status
- *
- * DESCRIPTION: Completes the subsystem initialization including hardware.
- * Puts system into ACPI mode if it isn't already.
- *
- ******************************************************************************/
-acpi_status acpi_enable_subsystem(u32 flags)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
-
- /* Enable ACPI mode */
-
- if (!(flags & ACPI_NO_ACPI_ENABLE)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Going into ACPI mode\n"));
-
- acpi_gbl_original_mode = acpi_hw_get_mode();
-
- status = acpi_enable();
- if (ACPI_FAILURE(status)) {
- ACPI_WARNING((AE_INFO, "AcpiEnable failed"));
- return_ACPI_STATUS(status);
- }
- }
-
- /*
- * Obtain a permanent mapping for the FACS. This is required for the
- * Global Lock and the Firmware Waking Vector
- */
- status = acpi_tb_initialize_facs();
- if (ACPI_FAILURE(status)) {
- ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
- return_ACPI_STATUS(status);
- }
-
- /*
- * Install the default op_region handlers. These are installed unless
- * other handlers have already been installed via the
- * install_address_space_handler interface.
- */
- if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Installing default address space handlers\n"));
-
- status = acpi_ev_install_region_handlers();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- /*
- * Initialize ACPI Event handling (Fixed and General Purpose)
- *
- * Note1: We must have the hardware and events initialized before we can
- * execute any control methods safely. Any control method can require
- * ACPI hardware support, so the hardware must be fully initialized before
- * any method execution!
- *
- * Note2: Fixed events are initialized and enabled here. GPEs are
- * initialized, but cannot be enabled until after the hardware is
- * completely initialized (SCI and global_lock activated)
- */
- if (!(flags & ACPI_NO_EVENT_INIT)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Initializing ACPI events\n"));
-
- status = acpi_ev_initialize_events();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- /*
- * Install the SCI handler and Global Lock handler. This completes the
- * hardware initialization.
- */
- if (!(flags & ACPI_NO_HANDLER_INIT)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Installing SCI/GL handlers\n"));
-
- status = acpi_ev_install_xrupt_handlers();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- return_ACPI_STATUS(status);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_initialize_objects
- *
- * PARAMETERS: Flags - Init/enable Options
- *
- * RETURN: Status
- *
- * DESCRIPTION: Completes namespace initialization by initializing device
- * objects and executing AML code for Regions, buffers, etc.
- *
- ******************************************************************************/
-acpi_status acpi_initialize_objects(u32 flags)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE(acpi_initialize_objects);
-
- /*
- * Run all _REG methods
- *
- * Note: Any objects accessed by the _REG methods will be automatically
- * initialized, even if they contain executable AML (see the call to
- * acpi_ns_initialize_objects below).
- */
- if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Executing _REG OpRegion methods\n"));
-
- status = acpi_ev_initialize_op_regions();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- /*
- * Initialize the objects that remain uninitialized. This runs the
- * executable AML that may be part of the declaration of these objects:
- * operation_regions, buffer_fields, Buffers, and Packages.
- */
- if (!(flags & ACPI_NO_OBJECT_INIT)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Completing Initialization of ACPI Objects\n"));
-
- status = acpi_ns_initialize_objects();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- /*
- * Initialize all device objects in the namespace. This runs the device
- * _STA and _INI methods.
- */
- if (!(flags & ACPI_NO_DEVICE_INIT)) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "[Init] Initializing ACPI Devices\n"));
-
- status = acpi_ns_initialize_devices();
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
- }
-
- /*
- * Complete the GPE initialization for the GPE blocks defined in the FADT
- * (GPE block 0 and 1).
- *
- * Note1: This is where the _PRW methods are executed for the GPEs. These
- * methods can only be executed after the SCI and Global Lock handlers are
- * installed and initialized.
- *
- * Note2: Currently, there seems to be no need to run the _REG methods
- * before execution of the _PRW methods and enabling of the GPEs.
- */
- if (!(flags & ACPI_NO_EVENT_INIT)) {
- status = acpi_ev_install_fadt_gpes();
- if (ACPI_FAILURE(status))
- return (status);
- }
-
- /*
- * Empty the caches (delete the cached objects) on the assumption that
- * the table load filled them up more than they will be at runtime --
- * thus wasting non-paged memory.
- */
- status = acpi_purge_cached_objects();
-
- acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
- return_ACPI_STATUS(status);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
-
-#endif
-/*******************************************************************************
- *
- * FUNCTION: acpi_terminate
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources.
- *
- ******************************************************************************/
-acpi_status acpi_terminate(void)
-{
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(acpi_terminate);
-
- /* Terminate the AML Debugger if present */
-
- ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
-
- /* Shutdown and free all resources */
-
- acpi_ut_subsystem_shutdown();
-
- /* Free the mutex objects */
-
- acpi_ut_mutex_terminate();
-
-#ifdef ACPI_DEBUGGER
-
- /* Shut down the debugger */
-
- acpi_db_terminate();
-#endif
-
- /* Now we can shutdown the OS-dependent layer */
-
- status = acpi_os_terminate();
- return_ACPI_STATUS(status);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_terminate)
-#ifndef ACPI_ASL_COMPILER
-#ifdef ACPI_FUTURE_USAGE
-/*******************************************************************************
- *
- * FUNCTION: acpi_subsystem_status
- *
- * PARAMETERS: None
- *
- * RETURN: Status of the ACPI subsystem
- *
- * DESCRIPTION: Other drivers that use the ACPI subsystem should call this
- * before making any other calls, to ensure the subsystem
- * initialized successfully.
- *
- ******************************************************************************/
-acpi_status acpi_subsystem_status(void)
-{
-
- if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) {
- return (AE_OK);
- } else {
- return (AE_ERROR);
- }
-}
-
-ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_get_system_info
- *
- * PARAMETERS: out_buffer - A buffer to receive the resources for the
- * device
- *
- * RETURN: Status - the status of the call
- *
- * DESCRIPTION: This function is called to get information about the current
- * state of the ACPI subsystem. It will return system information
- * in the out_buffer.
- *
- * If the function fails an appropriate status will be returned
- * and the value of out_buffer is undefined.
- *
- ******************************************************************************/
-acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
-{
- struct acpi_system_info *info_ptr;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(acpi_get_system_info);
-
- /* Parameter validation */
-
- status = acpi_ut_validate_buffer(out_buffer);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /* Validate/Allocate/Clear caller buffer */
-
- status =
- acpi_ut_initialize_buffer(out_buffer,
- sizeof(struct acpi_system_info));
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /*
- * Populate the return buffer
- */
- info_ptr = (struct acpi_system_info *)out_buffer->pointer;
-
- info_ptr->acpi_ca_version = ACPI_CA_VERSION;
-
- /* System flags (ACPI capabilities) */
-
- info_ptr->flags = ACPI_SYS_MODE_ACPI;
-
- /* Timer resolution - 24 or 32 bits */
-
- if (acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) {
- info_ptr->timer_resolution = 24;
- } else {
- info_ptr->timer_resolution = 32;
- }
-
- /* Clear the reserved fields */
-
- info_ptr->reserved1 = 0;
- info_ptr->reserved2 = 0;
-
- /* Current debug levels */
-
- info_ptr->debug_layer = acpi_dbg_layer;
- info_ptr->debug_level = acpi_dbg_level;
-
- return_ACPI_STATUS(AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_get_system_info)
-
-/*****************************************************************************
- *
- * FUNCTION: acpi_install_initialization_handler
- *
- * PARAMETERS: Handler - Callback procedure
- * Function - Not (currently) used, see below
- *
- * RETURN: Status
- *
- * DESCRIPTION: Install an initialization handler
- *
- * TBD: When a second function is added, must save the Function also.
- *
- ****************************************************************************/
-acpi_status
-acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
-{
-
- if (!handler) {
- return (AE_BAD_PARAMETER);
- }
-
- if (acpi_gbl_init_handler) {
- return (AE_ALREADY_EXISTS);
- }
-
- acpi_gbl_init_handler = handler;
- return AE_OK;
-}
-
-ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
-#endif /* ACPI_FUTURE_USAGE */
-/*****************************************************************************
- *
- * FUNCTION: acpi_purge_cached_objects
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Empty all caches (delete the cached objects)
- *
- ****************************************************************************/
-acpi_status acpi_purge_cached_objects(void)
-{
- ACPI_FUNCTION_TRACE(acpi_purge_cached_objects);
-
- (void)acpi_os_purge_cache(acpi_gbl_state_cache);
- (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
- (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
- (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
- return_ACPI_STATUS(AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
-#endif