summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-04 18:09:09 -0400
committerLen Brown <len.brown@intel.com>2005-08-04 18:09:09 -0400
commit5d2a22079c825669d91a3a200332f1053b4b61b0 (patch)
tree2e6e88bbcc3e17535fdf3103540b246b3658e20b
parent1c5ad84516ae7ea4ec868436a910a6bd8d20215a (diff)
parentbd6dbdf3c7b9784fbf5d8500e427a954e27a976a (diff)
downloadlinux-stable-5d2a22079c825669d91a3a200332f1053b4b61b0.tar.gz
linux-stable-5d2a22079c825669d91a3a200332f1053b4b61b0.tar.bz2
linux-stable-5d2a22079c825669d91a3a200332f1053b4b61b0.zip
/home/lenb/src/to-akpm branch 'acpi-2.6.12'
-rw-r--r--Documentation/acpi-hotkey.txt3
-rw-r--r--drivers/acpi/dispatcher/dsinit.c26
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c67
-rw-r--r--drivers/acpi/dispatcher/dsmthdat.c15
-rw-r--r--drivers/acpi/dispatcher/dsobject.c3
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c15
-rw-r--r--drivers/acpi/dispatcher/dswload.c63
-rw-r--r--drivers/acpi/dispatcher/dswstate.c40
-rw-r--r--drivers/acpi/events/evgpe.c5
-rw-r--r--drivers/acpi/events/evgpeblk.c63
-rw-r--r--drivers/acpi/events/evmisc.c7
-rw-r--r--drivers/acpi/events/evrgnini.c10
-rw-r--r--drivers/acpi/events/evxface.c10
-rw-r--r--drivers/acpi/events/evxfevnt.c6
-rw-r--r--drivers/acpi/executer/exconfig.c48
-rw-r--r--drivers/acpi/executer/exconvrt.c2
-rw-r--r--drivers/acpi/executer/exdump.c189
-rw-r--r--drivers/acpi/executer/exfield.c5
-rw-r--r--drivers/acpi/executer/exmisc.c2
-rw-r--r--drivers/acpi/executer/exnames.c7
-rw-r--r--drivers/acpi/executer/exoparg1.c29
-rw-r--r--drivers/acpi/executer/exoparg3.c63
-rw-r--r--drivers/acpi/executer/exresop.c16
-rw-r--r--drivers/acpi/executer/exstore.c6
-rw-r--r--drivers/acpi/executer/exstoren.c4
-rw-r--r--drivers/acpi/executer/exutils.c2
-rw-r--r--drivers/acpi/hardware/hwgpe.c20
-rw-r--r--drivers/acpi/hardware/hwregs.c2
-rw-r--r--drivers/acpi/hardware/hwsleep.c12
-rw-r--r--drivers/acpi/namespace/nsaccess.c13
-rw-r--r--drivers/acpi/namespace/nsalloc.c130
-rw-r--r--drivers/acpi/namespace/nsdump.c80
-rw-r--r--drivers/acpi/namespace/nseval.c10
-rw-r--r--drivers/acpi/namespace/nsload.c42
-rw-r--r--drivers/acpi/namespace/nsparse.c6
-rw-r--r--drivers/acpi/osl.c196
-rw-r--r--drivers/acpi/parser/Makefile2
-rw-r--r--drivers/acpi/parser/psloop.c781
-rw-r--r--drivers/acpi/parser/psopcode.c30
-rw-r--r--drivers/acpi/parser/psparse.c723
-rw-r--r--drivers/acpi/parser/psutils.c37
-rw-r--r--drivers/acpi/parser/psxface.c241
-rw-r--r--drivers/acpi/resources/rsdump.c4
-rw-r--r--drivers/acpi/tables/tbconvrt.c8
-rw-r--r--drivers/acpi/tables/tbinstal.c34
-rw-r--r--drivers/acpi/tables/tbrsdt.c59
-rw-r--r--drivers/acpi/tables/tbutils.c67
-rw-r--r--drivers/acpi/tables/tbxface.c17
-rw-r--r--drivers/acpi/tables/tbxfroot.c120
-rw-r--r--drivers/acpi/utilities/Makefile2
-rw-r--r--drivers/acpi/utilities/utalloc.c304
-rw-r--r--drivers/acpi/utilities/utcache.c328
-rw-r--r--drivers/acpi/utilities/utcopy.c46
-rw-r--r--drivers/acpi/utilities/utdebug.c228
-rw-r--r--drivers/acpi/utilities/utdelete.c140
-rw-r--r--drivers/acpi/utilities/utglobal.c108
-rw-r--r--drivers/acpi/utilities/utinit.c2
-rw-r--r--drivers/acpi/utilities/utmisc.c799
-rw-r--r--drivers/acpi/utilities/utmutex.c380
-rw-r--r--drivers/acpi/utilities/utobject.c34
-rw-r--r--drivers/acpi/utilities/utstate.c376
-rw-r--r--drivers/acpi/utilities/utxface.c23
-rw-r--r--include/acpi/acconfig.h9
-rw-r--r--include/acpi/acdebug.h6
-rw-r--r--include/acpi/acdisasm.h3
-rw-r--r--include/acpi/acdispat.h10
-rw-r--r--include/acpi/acevents.h5
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acglobal.h29
-rw-r--r--include/acpi/achware.h6
-rw-r--r--include/acpi/aclocal.h84
-rw-r--r--include/acpi/acmacros.h102
-rw-r--r--include/acpi/acnames.h5
-rw-r--r--include/acpi/acnamesp.h6
-rw-r--r--include/acpi/acobject.h2
-rw-r--r--include/acpi/acopcode.h2
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/acparser.h33
-rw-r--r--include/acpi/acpiosxf.h35
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/acstruct.h15
-rw-r--r--include/acpi/actables.h10
-rw-r--r--include/acpi/actbl.h58
-rw-r--r--include/acpi/actbl1.h52
-rw-r--r--include/acpi/actbl2.h109
-rw-r--r--include/acpi/actypes.h15
-rw-r--r--include/acpi/acutils.h121
-rw-r--r--include/acpi/amlcode.h4
-rw-r--r--include/acpi/platform/acenv.h37
-rw-r--r--include/acpi/platform/acgcc.h8
-rw-r--r--include/acpi/platform/aclinux.h11
91 files changed, 3882 insertions, 3015 deletions
diff --git a/Documentation/acpi-hotkey.txt b/Documentation/acpi-hotkey.txt
index 4c115a7bb826..d57b02a4746b 100644
--- a/Documentation/acpi-hotkey.txt
+++ b/Documentation/acpi-hotkey.txt
@@ -33,3 +33,6 @@ The result of the execution of this aml method is
attached to /proc/acpi/hotkey/poll_method, which is dnyamically
created. Please use command "cat /proc/acpi/hotkey/polling_method"
to retrieve it.
+
+Note: Use cmdline "acpi_specific_hotkey" to enable legacy platform
+specific drivers.
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index d7790db50178..bcd1d472b90f 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -86,20 +86,20 @@ acpi_ds_init_one_object (
void *context,
void **return_value)
{
+ struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
+ struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
acpi_object_type type;
acpi_status status;
- struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
ACPI_FUNCTION_NAME ("ds_init_one_object");
/*
- * We are only interested in objects owned by the table that
+ * We are only interested in NS nodes owned by the table that
* was just loaded
*/
- if (((struct acpi_namespace_node *) obj_handle)->owner_id !=
- info->table_desc->table_id) {
+ if (node->owner_id != info->table_desc->owner_id) {
return (AE_OK);
}
@@ -126,8 +126,6 @@ acpi_ds_init_one_object (
case ACPI_TYPE_METHOD:
- info->method_count++;
-
/*
* Print a dot for each method unless we are going to print
* the entire pathname
@@ -143,7 +141,7 @@ acpi_ds_init_one_object (
* on a per-table basis. Currently, we just use a global for the width.
*/
if (info->table_desc->pointer->revision == 1) {
- ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
+ node->flags |= ANOBJ_DATA_WIDTH_32;
}
/*
@@ -153,22 +151,14 @@ acpi_ds_init_one_object (
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Method %p [%4.4s] - parse failure, %s\n",
+ "\n+Method %p [%4.4s] - parse failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */
-
- break;
}
- /*
- * Delete the parse tree. We simply re-parse the method
- * for every execution since there isn't much overhead
- */
- acpi_ns_delete_namespace_subtree (obj_handle);
- acpi_ns_delete_namespace_by_owner (
- ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
+ info->method_count++;
break;
@@ -237,7 +227,7 @@ acpi_ds_initialize_objects (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
- table_desc->pointer->signature, table_desc->table_id, info.object_count,
+ table_desc->pointer->signature, table_desc->owner_id, info.object_count,
info.device_count, info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 9fc3f4c033eb..e344c06ed33f 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -58,12 +58,11 @@
*
* FUNCTION: acpi_ds_parse_method
*
- * PARAMETERS: obj_handle - Method node
+ * PARAMETERS: Node - Method node
*
* RETURN: Status
*
- * DESCRIPTION: Call the parser and parse the AML that is associated with the
- * method.
+ * DESCRIPTION: Parse the AML that is associated with the method.
*
* MUTEX: Assumes parser is locked
*
@@ -71,31 +70,28 @@
acpi_status
acpi_ds_parse_method (
- acpi_handle obj_handle)
+ struct acpi_namespace_node *node)
{
acpi_status status;
union acpi_operand_object *obj_desc;
union acpi_parse_object *op;
- struct acpi_namespace_node *node;
- acpi_owner_id owner_id;
struct acpi_walk_state *walk_state;
- ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle);
+ ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);
/* Parameter Validation */
- if (!obj_handle) {
+ if (!node) {
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
- acpi_ut_get_node_name (obj_handle), obj_handle));
+ acpi_ut_get_node_name (node), node));
/* Extract the method object from the method Node */
- node = (struct acpi_namespace_node *) obj_handle;
obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
return_ACPI_STATUS (AE_NULL_OBJECT);
@@ -132,14 +128,18 @@ acpi_ds_parse_method (
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
- owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
- obj_desc->method.owning_id = owner_id;
+ status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
+ walk_state = acpi_ds_create_walk_state (
+ obj_desc->method.owner_id, NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto cleanup2;
}
status = acpi_ds_init_aml_walk (walk_state, op, node,
@@ -147,7 +147,7 @@ acpi_ds_parse_method (
obj_desc->method.aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto cleanup2;
}
/*
@@ -161,13 +161,25 @@ acpi_ds_parse_method (
*/
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto cleanup2;
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
- acpi_ut_get_node_name (obj_handle), obj_handle, op));
+ acpi_ut_get_node_name (node), node, op));
+
+ /*
+ * Delete the parse tree. We simply re-parse the method for every
+ * execution since there isn't much overhead (compared to keeping lots
+ * of parse trees around)
+ */
+ acpi_ns_delete_namespace_subtree (node);
+ acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);
+
+cleanup2:
+ acpi_ut_release_owner_id (&obj_desc->method.owner_id);
+cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
@@ -263,7 +275,7 @@ acpi_ds_call_control_method (
{
acpi_status status;
struct acpi_namespace_node *method_node;
- struct acpi_walk_state *next_walk_state;
+ struct acpi_walk_state *next_walk_state = NULL;
union acpi_operand_object *obj_desc;
struct acpi_parameter_info info;
u32 i;
@@ -287,20 +299,23 @@ acpi_ds_call_control_method (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
- obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
+ status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Init for new method, wait on concurrency semaphore */
status = acpi_ds_begin_method_execution (method_node, obj_desc,
this_walk_state->method_node);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto cleanup;
}
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
/* 1) Parse: Create a new walk state for the preempting walk */
- next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
op, obj_desc, NULL);
if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -330,7 +345,7 @@ acpi_ds_call_control_method (
/* 2) Execute: Create a new state for the preempting walk */
- next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
NULL, obj_desc, thread);
if (!next_walk_state) {
status = AE_NO_MEMORY;
@@ -381,6 +396,7 @@ acpi_ds_call_control_method (
/* On error, we must delete the new walk state */
cleanup:
+ acpi_ut_release_owner_id (&obj_desc->method.owner_id);
if (next_walk_state && (next_walk_state->method_desc)) {
/* Decrement the thread count on the method parse tree */
@@ -552,8 +568,7 @@ acpi_ds_terminate_control_method (
*/
if ((walk_state->method_desc->method.concurrency == 1) &&
(!walk_state->method_desc->method.semaphore)) {
- status = acpi_os_create_semaphore (1,
- 1,
+ status = acpi_os_create_semaphore (1, 1,
&walk_state->method_desc->method.semaphore);
}
@@ -582,8 +597,10 @@ acpi_ds_terminate_control_method (
* Delete any namespace entries created anywhere else within
* the namespace
*/
- acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
+ acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id);
+
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c
index f7998306f756..c83d53fd6398 100644
--- a/drivers/acpi/dispatcher/dsmthdat.c
+++ b/drivers/acpi/dispatcher/dsmthdat.c
@@ -633,22 +633,11 @@ acpi_ds_store_object_to_local (
*/
if (opcode == AML_ARG_OP) {
/*
- * Make sure that the object is the correct type. This may be
- * overkill, butit is here because references were NS nodes in
- * the past. Now they are operand objects of type Reference.
- */
- if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
- ACPI_REPORT_ERROR ((
- "Invalid descriptor type while storing to method arg: [%s]\n",
- acpi_ut_get_descriptor_name (current_obj_desc)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /*
* If we have a valid reference object that came from ref_of(),
* do the indirect store
*/
- if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
+ (current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an obj_ref(Node), storing in node %p\n",
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index bfbae4e4c667..1eee2d54180f 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -547,6 +547,9 @@ acpi_ds_init_object_from_op (
case AML_TYPE_LITERAL:
obj_desc->integer.value = op->common.value.integer;
+#ifndef ACPI_NO_METHOD_EXECUTION
+ acpi_ex_truncate_for32bit_table (obj_desc);
+#endif
break;
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index ba13bca28bee..750bdb1ac344 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -119,14 +119,15 @@ acpi_ds_execute_arguments (
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto cleanup;
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto cleanup;
}
/* Mark this parse as a deferred opcode */
@@ -138,8 +139,7 @@ acpi_ds_execute_arguments (
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
- acpi_ps_delete_parse_tree (op);
- return_ACPI_STATUS (status);
+ goto cleanup;
}
/* Get and init the Op created above */
@@ -160,7 +160,8 @@ acpi_ds_execute_arguments (
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto cleanup;
}
/* Execute the opcode and arguments */
@@ -169,13 +170,15 @@ acpi_ds_execute_arguments (
aml_length, NULL, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto cleanup;
}
/* Mark this execution as a deferred opcode */
walk_state->deferred_node = node;
status = acpi_ps_parse_aml (walk_state);
+
+cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index d11620018421..9100c0bda470 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -50,7 +50,7 @@
#include <acpi/acnamesp.h>
#include <acpi/acevents.h>
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
#include <acpi/acdisasm.h>
#endif
@@ -145,15 +145,6 @@ acpi_ds_load1_begin_op (
if (op) {
if (!(walk_state->op_info->flags & AML_NAMED)) {
-#if 0
- if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
- (walk_state->op_info->class == AML_CLASS_CONTROL)) {
- acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
- walk_state->op_info->name);
- *out_op = op;
- return (AE_CTRL_SKIP);
- }
-#endif
*out_op = op;
return (AE_OK);
}
@@ -185,7 +176,7 @@ acpi_ds_load1_begin_op (
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
/*
* Table disassembly:
@@ -486,11 +477,31 @@ acpi_ds_load2_begin_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
if (op) {
+ if ((walk_state->control_state) &&
+ (walk_state->control_state->common.state ==
+ ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+ /* We are executing a while loop outside of a method */
+
+ status = acpi_ds_exec_begin_op (walk_state, out_op);
+ return_ACPI_STATUS (status);
+ }
+
/* We only care about Namespace opcodes here */
if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
(walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
(!(walk_state->op_info->flags & AML_NAMED))) {
+ if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+ (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
+ walk_state->op_info->flags));
+
+ /* Executing a type1 or type2 opcode outside of a method */
+
+ status = acpi_ds_exec_begin_op (walk_state, out_op);
+ return_ACPI_STATUS (status);
+ }
return_ACPI_STATUS (AE_OK);
}
@@ -558,7 +569,7 @@ acpi_ds_load2_begin_op (
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
if (ACPI_FAILURE (status)) {
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
}
@@ -651,8 +662,10 @@ acpi_ds_load2_begin_op (
break;
}
+ /* Add new entry into namespace */
+
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
walk_state, &(node));
break;
}
@@ -662,7 +675,6 @@ acpi_ds_load2_begin_op (
return_ACPI_STATUS (status);
}
-
if (!op) {
/* Create a new op */
@@ -676,9 +688,7 @@ acpi_ds_load2_begin_op (
if (node) {
op->named.name = node->name.integer;
}
- if (out_op) {
- *out_op = op;
- }
+ *out_op = op;
}
/*
@@ -725,9 +735,24 @@ acpi_ds_load2_end_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
walk_state->op_info->name, op, walk_state));
- /* Only interested in opcodes that have namespace objects */
+ /* Check if opcode had an associated namespace object */
if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
+#ifndef ACPI_NO_METHOD_EXECUTION
+ /* No namespace object. Executable opcode? */
+
+ if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+ (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
+ walk_state->op_info->flags));
+
+ /* Executing a type1 or type2 opcode outside of a method */
+
+ status = acpi_ds_exec_end_op (walk_state);
+ return_ACPI_STATUS (status);
+ }
+#endif
return_ACPI_STATUS (AE_OK);
}
@@ -736,7 +761,6 @@ acpi_ds_load2_end_op (
"Ending scope Op=%p State=%p\n", op, walk_state));
}
-
object_type = walk_state->op_info->object_type;
/*
@@ -959,6 +983,7 @@ acpi_ds_load2_end_op (
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &(new_node));
if (ACPI_SUCCESS (status)) {
+
/*
* Make sure that what we found is indeed a method
* We didn't search for a method on purpose, to see if the name
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
index 9cd3db652b31..5621665991b5 100644
--- a/drivers/acpi/dispatcher/dswstate.c
+++ b/drivers/acpi/dispatcher/dswstate.c
@@ -261,12 +261,12 @@ acpi_ds_result_pop_from_bottom (
if (!*object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X, Index=%X\n",
+ "Null operand! State=%p #Ops=%X Index=%X\n",
walk_state, state->results.num_results, (u32) index));
return (AE_AML_NO_RETURN_VALUE);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
state, walk_state));
@@ -681,7 +681,7 @@ acpi_ds_create_walk_state (
ACPI_FUNCTION_TRACE ("ds_create_walk_state");
- walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
+ walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state));
if (!walk_state) {
return_PTR (NULL);
}
@@ -704,7 +704,7 @@ acpi_ds_create_walk_state (
status = acpi_ds_result_stack_push (walk_state);
if (ACPI_FAILURE (status)) {
- acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
+ ACPI_MEM_FREE (walk_state);
return_PTR (NULL);
}
@@ -744,7 +744,7 @@ acpi_ds_init_aml_walk (
u8 *aml_start,
u32 aml_length,
struct acpi_parameter_info *info,
- u32 pass_number)
+ u8 pass_number)
{
acpi_status status;
struct acpi_parse_state *parser_state = &walk_state->parser_state;
@@ -762,6 +762,7 @@ acpi_ds_init_aml_walk (
/* The next_op of the next_walk will be the beginning of the method */
walk_state->next_op = NULL;
+ walk_state->pass_number = pass_number;
if (info) {
if (info->parameter_type == ACPI_PARAM_GPE) {
@@ -899,38 +900,11 @@ acpi_ds_delete_walk_state (
acpi_ut_delete_generic_state (state);
}
- acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
+ ACPI_MEM_FREE (walk_state);
return_VOID;
}
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/******************************************************************************
- *
- * FUNCTION: acpi_ds_delete_walk_state_cache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-acpi_ds_delete_walk_state_cache (
- void)
-{
- ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache");
-
-
- acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
- return_VOID;
-}
-#endif
-
-
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index 081120b109ba..ede834df4f69 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -396,6 +396,7 @@ acpi_ev_gpe_detect (
struct acpi_gpe_register_info *gpe_register_info;
u32 status_reg;
u32 enable_reg;
+ u32 flags;
acpi_status status;
struct acpi_gpe_block_info *gpe_block;
acpi_native_uint i;
@@ -412,7 +413,7 @@ acpi_ev_gpe_detect (
/* Examine all GPE blocks attached to this interrupt level */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
gpe_block = gpe_xrupt_list->gpe_block_list_head;
while (gpe_block) {
/*
@@ -476,7 +477,7 @@ acpi_ev_gpe_detect (
unlock_and_exit:
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
return (int_status);
}
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 84186a7d17b2..dfc54692b127 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -66,7 +66,7 @@ acpi_ev_match_prw_and_gpe (
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
- u32 interrupt_level);
+ u32 interrupt_number);
static acpi_status
acpi_ev_delete_gpe_xrupt (
@@ -75,7 +75,7 @@ acpi_ev_delete_gpe_xrupt (
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
- u32 interrupt_level);
+ u32 interrupt_number);
static acpi_status
acpi_ev_create_gpe_info_blocks (
@@ -138,7 +138,6 @@ acpi_ev_valid_gpe_event (
* FUNCTION: acpi_ev_walk_gpe_list
*
* PARAMETERS: gpe_walk_callback - Routine called for each GPE block
- * Flags - ACPI_NOT_ISR or ACPI_ISR
*
* RETURN: Status
*
@@ -148,18 +147,18 @@ acpi_ev_valid_gpe_event (
acpi_status
acpi_ev_walk_gpe_list (
- ACPI_GPE_CALLBACK gpe_walk_callback,
- u32 flags)
+ ACPI_GPE_CALLBACK gpe_walk_callback)
{
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
acpi_status status = AE_OK;
+ u32 flags;
ACPI_FUNCTION_TRACE ("ev_walk_gpe_list");
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
/* Walk the interrupt level descriptor list */
@@ -482,7 +481,7 @@ cleanup:
*
* FUNCTION: acpi_ev_get_gpe_xrupt_block
*
- * PARAMETERS: interrupt_level - Interrupt for a GPE block
+ * PARAMETERS: interrupt_number - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*
@@ -495,11 +494,12 @@ cleanup:
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
- u32 interrupt_level)
+ u32 interrupt_number)
{
struct acpi_gpe_xrupt_info *next_gpe_xrupt;
struct acpi_gpe_xrupt_info *gpe_xrupt;
acpi_status status;
+ u32 flags;
ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
@@ -509,7 +509,7 @@ acpi_ev_get_gpe_xrupt_block (
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt) {
- if (next_gpe_xrupt->interrupt_level == interrupt_level) {
+ if (next_gpe_xrupt->interrupt_number == interrupt_number) {
return_PTR (next_gpe_xrupt);
}
@@ -523,11 +523,11 @@ acpi_ev_get_gpe_xrupt_block (
return_PTR (NULL);
}
- gpe_xrupt->interrupt_level = interrupt_level;
+ gpe_xrupt->interrupt_number = interrupt_number;
/* Install new interrupt descriptor with spin lock */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (acpi_gbl_gpe_xrupt_list_head) {
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt->next) {
@@ -540,17 +540,17 @@ acpi_ev_get_gpe_xrupt_block (
else {
acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
}
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
/* Install new interrupt handler if not SCI_INT */
- if (interrupt_level != acpi_gbl_FADT->sci_int) {
- status = acpi_os_install_interrupt_handler (interrupt_level,
+ if (interrupt_number != acpi_gbl_FADT->sci_int) {
+ status = acpi_os_install_interrupt_handler (interrupt_number,
acpi_ev_gpe_xrupt_handler, gpe_xrupt);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not install GPE interrupt handler at level 0x%X\n",
- interrupt_level));
+ interrupt_number));
return_PTR (NULL);
}
}
@@ -577,6 +577,7 @@ acpi_ev_delete_gpe_xrupt (
struct acpi_gpe_xrupt_info *gpe_xrupt)
{
acpi_status status;
+ u32 flags;
ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt");
@@ -584,14 +585,14 @@ acpi_ev_delete_gpe_xrupt (
/* We never want to remove the SCI interrupt handler */
- if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) {
+ if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
gpe_xrupt->gpe_block_list_head = NULL;
return_ACPI_STATUS (AE_OK);
}
/* Disable this interrupt */
- status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level,
+ status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number,
acpi_ev_gpe_xrupt_handler);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
@@ -599,7 +600,7 @@ acpi_ev_delete_gpe_xrupt (
/* Unlink the interrupt block with lock */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_xrupt->previous) {
gpe_xrupt->previous->next = gpe_xrupt->next;
}
@@ -607,7 +608,7 @@ acpi_ev_delete_gpe_xrupt (
if (gpe_xrupt->next) {
gpe_xrupt->next->previous = gpe_xrupt->previous;
}
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
/* Free the block */
@@ -621,7 +622,7 @@ acpi_ev_delete_gpe_xrupt (
* FUNCTION: acpi_ev_install_gpe_block
*
* PARAMETERS: gpe_block - New GPE block
- * interrupt_level - Level to be associated with this GPE block
+ * interrupt_number - Xrupt to be associated with this GPE block
*
* RETURN: Status
*
@@ -632,11 +633,12 @@ acpi_ev_delete_gpe_xrupt (
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
- u32 interrupt_level)
+ u32 interrupt_number)
{
struct acpi_gpe_block_info *next_gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
acpi_status status;
+ u32 flags;
ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
@@ -647,7 +649,7 @@ acpi_ev_install_gpe_block (
return_ACPI_STATUS (status);
}
- gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level);
+ gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number);
if (!gpe_xrupt_block) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
@@ -655,7 +657,7 @@ acpi_ev_install_gpe_block (
/* Install the new block at the end of the list with lock */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_xrupt_block->gpe_block_list_head) {
next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
while (next_gpe_block->next) {
@@ -670,7 +672,7 @@ acpi_ev_install_gpe_block (
}
gpe_block->xrupt_block = gpe_xrupt_block;
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
unlock_and_exit:
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
@@ -695,6 +697,7 @@ acpi_ev_delete_gpe_block (
struct acpi_gpe_block_info *gpe_block)
{
acpi_status status;
+ u32 flags;
ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
@@ -720,7 +723,7 @@ acpi_ev_delete_gpe_block (
else {
/* Remove the block on this interrupt with lock */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_block->previous) {
gpe_block->previous->next = gpe_block->next;
}
@@ -731,7 +734,7 @@ acpi_ev_delete_gpe_block (
if (gpe_block->next) {
gpe_block->next->previous = gpe_block->previous;
}
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
}
/* Free the gpe_block */
@@ -887,7 +890,7 @@ error_exit:
* gpe_block_address - Address and space_iD
* register_count - Number of GPE register pairs in the block
* gpe_block_base_number - Starting GPE number for the block
- * interrupt_level - H/W interrupt for the block
+ * interrupt_number - H/W interrupt for the block
* return_gpe_block - Where the new block descriptor is returned
*
* RETURN: Status
@@ -902,7 +905,7 @@ acpi_ev_create_gpe_block (
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u8 gpe_block_base_number,
- u32 interrupt_level,
+ u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block)
{
struct acpi_gpe_block_info *gpe_block;
@@ -948,7 +951,7 @@ acpi_ev_create_gpe_block (
/* Install the new block in the global list(s) */
- status = acpi_ev_install_gpe_block (gpe_block, interrupt_level);
+ status = acpi_ev_install_gpe_block (gpe_block, interrupt_number);
if (ACPI_FAILURE (status)) {
ACPI_MEM_FREE (gpe_block);
return_ACPI_STATUS (status);
@@ -1013,7 +1016,7 @@ acpi_ev_create_gpe_block (
((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)),
gpe_device->name.ascii,
gpe_block->register_count,
- interrupt_level));
+ interrupt_number));
/* Enable all valid GPEs found above */
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 659e90956112..3df3ada4b9e7 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -411,6 +411,9 @@ acpi_ev_init_global_lock_handler (
* with an error.
*/
if (status == AE_NO_HARDWARE_RESPONSE) {
+ ACPI_REPORT_ERROR ((
+ "No response from Global Lock hardware, disabling lock\n"));
+
acpi_gbl_global_lock_present = FALSE;
status = AE_OK;
}
@@ -589,7 +592,7 @@ acpi_ev_terminate (
/* Disable all GPEs in all GPE blocks */
- status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, ACPI_NOT_ISR);
+ status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
/* Remove SCI handler */
@@ -602,7 +605,7 @@ acpi_ev_terminate (
/* Deallocate all handler objects installed within GPE info structs */
- status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers, ACPI_NOT_ISR);
+ status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);
/* Return to original mode if necessary */
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index 95bc09c73a6a..f2d53af97610 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -218,10 +218,14 @@ acpi_ev_pci_config_region_setup (
while (pci_root_node != acpi_gbl_root_node) {
status = acpi_ut_execute_HID (pci_root_node, &object_hID);
if (ACPI_SUCCESS (status)) {
- /* Got a valid _HID, check if this is a PCI root */
-
+ /*
+ * Got a valid _HID string, check if this is a PCI root.
+ * New for ACPI 3.0: check for a PCI Express root also.
+ */
if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
- sizeof (PCI_ROOT_HID_STRING)))) {
+ sizeof (PCI_ROOT_HID_STRING)) ||
+ !(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING,
+ sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) {
/* Install a handler for this PCI root bridge */
status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 4092d47f6758..4c1c25e316a8 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -591,6 +591,7 @@ acpi_install_gpe_handler (
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
+ u32 flags;
ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
@@ -643,7 +644,7 @@ acpi_install_gpe_handler (
/* Install the handler */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
gpe_event_info->dispatch.handler = handler;
/* Setup up dispatch flags to indicate handler (vs. method) */
@@ -651,7 +652,7 @@ acpi_install_gpe_handler (
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
unlock_and_exit:
@@ -685,6 +686,7 @@ acpi_remove_gpe_handler (
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
+ u32 flags;
ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
@@ -741,7 +743,7 @@ acpi_remove_gpe_handler (
/* Remove the handler */
- acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
handler = gpe_event_info->dispatch.handler;
/* Restore Method node (if any), set dispatch flags */
@@ -751,7 +753,7 @@ acpi_remove_gpe_handler (
if (handler->method_node) {
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
}
- acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+ acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
/* Now we can free the handler object */
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
index f337dc2cc569..c5f74d7b64d8 100644
--- a/drivers/acpi/events/evxfevnt.c
+++ b/drivers/acpi/events/evxfevnt.c
@@ -635,7 +635,7 @@ unlock_and_exit:
* PARAMETERS: gpe_device - Handle to the parent GPE Block Device
* gpe_block_address - Address and space_iD
* register_count - Number of GPE register pairs in the block
- * interrupt_level - H/W interrupt for the block
+ * interrupt_number - H/W interrupt for the block
*
* RETURN: Status
*
@@ -648,7 +648,7 @@ acpi_install_gpe_block (
acpi_handle gpe_device,
struct acpi_generic_address *gpe_block_address,
u32 register_count,
- u32 interrupt_level)
+ u32 interrupt_number)
{
acpi_status status;
union acpi_operand_object *obj_desc;
@@ -681,7 +681,7 @@ acpi_install_gpe_block (
* is always zero
*/
status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
- 0, interrupt_level, &gpe_block);
+ 0, interrupt_number, &gpe_block);
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 734b2f24af48..d11e9ec827f1 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -99,6 +99,11 @@ acpi_ex_add_table (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Init the table handle */
+
+ obj_desc->reference.opcode = AML_LOAD_OP;
+ *ddb_handle = obj_desc;
+
/* Install the new table into the local data structures */
ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
@@ -109,7 +114,14 @@ acpi_ex_add_table (
table_info.allocation = ACPI_MEM_ALLOCATED;
status = acpi_tb_install_table (&table_info);
+ obj_desc->reference.object = table_info.installed_desc;
+
if (ACPI_FAILURE (status)) {
+ if (status == AE_ALREADY_EXISTS) {
+ /* Table already exists, just return the handle */
+
+ return_ACPI_STATUS (AE_OK);
+ }
goto cleanup;
}
@@ -123,16 +135,12 @@ acpi_ex_add_table (
goto cleanup;
}
- /* Init the table handle */
-
- obj_desc->reference.opcode = AML_LOAD_OP;
- obj_desc->reference.object = table_info.installed_desc;
- *ddb_handle = obj_desc;
return_ACPI_STATUS (AE_OK);
cleanup:
acpi_ut_remove_reference (obj_desc);
+ *ddb_handle = NULL;
return_ACPI_STATUS (status);
}
@@ -376,16 +384,22 @@ acpi_ex_load_op (
*/
status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ return_ACPI_STATUS (status);
}
table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
buffer_desc->buffer.pointer);
- /* Sanity check the table length */
+ /* All done with the buffer_desc, delete it */
+
+ buffer_desc->buffer.pointer = NULL;
+ acpi_ut_remove_reference (buffer_desc);
+
+ /* Sanity check the table length */
if (table_ptr->length < sizeof (struct acpi_table_header)) {
- return_ACPI_STATUS (AE_BAD_HEADER);
+ status = AE_BAD_HEADER;
+ goto cleanup;
}
break;
@@ -413,7 +427,9 @@ acpi_ex_load_op (
status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ /* On error, table_ptr was deallocated above */
+
+ return_ACPI_STATUS (status);
}
/* Store the ddb_handle into the Target operand */
@@ -421,17 +437,14 @@ acpi_ex_load_op (
status = acpi_ex_store (ddb_handle, target, walk_state);
if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle);
- }
- return_ACPI_STATUS (status);
+ /* table_ptr was deallocated above */
+ return_ACPI_STATUS (status);
+ }
cleanup:
-
- if (buffer_desc) {
- acpi_ut_remove_reference (buffer_desc);
- }
- else {
+ if (ACPI_FAILURE (status)) {
ACPI_MEM_FREE (table_ptr);
}
return_ACPI_STATUS (status);
@@ -482,7 +495,8 @@ acpi_ex_unload_table (
* Delete the entire namespace under this table Node
* (Offset contains the table_id)
*/
- acpi_ns_delete_namespace_by_owner (table_info->table_id);
+ acpi_ns_delete_namespace_by_owner (table_info->owner_id);
+ acpi_ut_release_owner_id (&table_info->owner_id);
/* Delete the table itself */
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index 97856c48bd74..21331625e66e 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -367,7 +367,7 @@ acpi_ex_convert_to_ascii (
/* hex_length: 2 ascii hex chars per data byte */
- hex_length = ACPI_MUL_2 (data_width);
+ hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width);
for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index 408500648114..4f98dceed39a 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -51,6 +51,11 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
+/*
+ * The following routines are used for debug output only
+ */
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
/* Local prototypes */
#ifdef ACPI_FUTURE_USAGE
@@ -73,13 +78,17 @@ static void
acpi_ex_out_address (
char *title,
acpi_physical_address value);
-#endif /* ACPI_FUTURE_USAGE */
+static void
+acpi_ex_dump_reference (
+ union acpi_operand_object *obj_desc);
-/*
- * The following routines are used for debug output only
- */
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+static void
+acpi_ex_dump_package (
+ union acpi_operand_object *obj_desc,
+ u32 level,
+ u32 index);
+#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
@@ -118,7 +127,7 @@ acpi_ex_dump_operand (
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc));
ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
return;
}
@@ -467,7 +476,7 @@ acpi_ex_dump_operands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "************* Stack dump from %s(%d), %s\n",
+ "************* Operand Stack dump from %s(%d), %s\n",
module_name, line_number, note));
return;
}
@@ -508,7 +517,7 @@ acpi_ex_out_integer (
char *title,
u32 value)
{
- acpi_os_printf ("%20s : %X\n", title, value);
+ acpi_os_printf ("%20s : %.2X\n", title, value);
}
static void
@@ -565,9 +574,144 @@ acpi_ex_dump_node (
/*******************************************************************************
*
+ * FUNCTION: acpi_ex_dump_reference
+ *
+ * PARAMETERS: Object - Descriptor to dump
+ *
+ * DESCRIPTION: Dumps a reference object
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_dump_reference (
+ union acpi_operand_object *obj_desc)
+{
+ struct acpi_buffer ret_buf;
+ acpi_status status;
+
+
+ if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
+ acpi_os_printf ("Named Object %p ", obj_desc->reference.node);
+ ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Could not convert name to pathname\n");
+ }
+ else {
+ acpi_os_printf ("%s\n", (char *) ret_buf.pointer);
+ ACPI_MEM_FREE (ret_buf.pointer);
+ }
+ }
+ else if (obj_desc->reference.object) {
+ acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ex_dump_package
+ *
+ * PARAMETERS: Object - Descriptor to dump
+ * Level - Indentation Level
+ * Index - Package index for this object
+ *
+ * DESCRIPTION: Dumps the elements of the package
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_dump_package (
+ union acpi_operand_object *obj_desc,
+ u32 level,
+ u32 index)
+{
+ u32 i;
+
+
+ /* Indentation and index output */
+
+ if (level > 0) {
+ for (i = 0; i < level; i++) {
+ acpi_os_printf (" ");
+ }
+
+ acpi_os_printf ("[%.2d] ", index);
+ }
+
+ acpi_os_printf ("%p ", obj_desc);
+
+ /* Null package elements are allowed */
+
+ if (!obj_desc) {
+ acpi_os_printf ("[Null Object]\n");
+ return;
+ }
+
+ /* Packages may only contain a few object types */
+
+ switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+ case ACPI_TYPE_INTEGER:
+
+ acpi_os_printf ("[Integer] = %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ acpi_os_printf ("[String] Value: ");
+ for (i = 0; i < obj_desc->string.length; i++) {
+ acpi_os_printf ("%c", obj_desc->string.pointer[i]);
+ }
+ acpi_os_printf ("\n");
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length);
+ if (obj_desc->buffer.length) {
+ acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer,
+ obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
+ }
+ else {
+ acpi_os_printf ("\n");
+ }
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ acpi_os_printf ("[Package] Contains %d Elements: \n",
+ obj_desc->package.count);
+
+ for (i = 0; i < obj_desc->package.count; i++) {
+ acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i);
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ acpi_os_printf ("[Object Reference] ");
+ acpi_ex_dump_reference (obj_desc);
+ break;
+
+
+ default:
+
+ acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_ex_dump_object_descriptor
*
- * PARAMETERS: *Object - Descriptor to dump
+ * PARAMETERS: Object - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the object descriptor given.
@@ -579,9 +723,6 @@ acpi_ex_dump_object_descriptor (
union acpi_operand_object *obj_desc,
u32 flags)
{
- u32 i;
-
-
ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
@@ -648,22 +789,13 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_PACKAGE:
acpi_ex_out_integer ("Flags", obj_desc->package.flags);
- acpi_ex_out_integer ("Count", obj_desc->package.count);
- acpi_ex_out_pointer ("Elements", obj_desc->package.elements);
+ acpi_ex_out_integer ("Elements", obj_desc->package.count);
+ acpi_ex_out_pointer ("Element List", obj_desc->package.elements);
/* Dump the package contents */
- if (obj_desc->package.count > 0) {
- acpi_os_printf ("\nPackage Contents:\n");
- for (i = 0; i < obj_desc->package.count; i++) {
- acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
- if (obj_desc->package.elements[i]) {
- acpi_os_printf (" %s",
- acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
- }
- acpi_os_printf ("\n");
- }
- }
+ acpi_os_printf ("\nPackage Contents:\n");
+ acpi_ex_dump_package (obj_desc, 0, 0);
break;
@@ -686,7 +818,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("param_count", obj_desc->method.param_count);
acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore);
- acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id);
+ acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id);
acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length);
acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start);
break;
@@ -790,10 +922,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_pointer ("Node", obj_desc->reference.node);
acpi_ex_out_pointer ("Where", obj_desc->reference.where);
- if (obj_desc->reference.object) {
- acpi_os_printf ("\nReferenced Object:\n");
- acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
- }
+ acpi_ex_dump_reference (obj_desc);
break;
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index 22c8fa480f60..a690c9250990 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -87,6 +87,9 @@ acpi_ex_read_data_from_field (
if (!obj_desc) {
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
+ if (!ret_buffer_desc) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
/*
@@ -182,7 +185,7 @@ exit:
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (buffer_desc);
}
- else if (ret_buffer_desc) {
+ else {
*ret_buffer_desc = buffer_desc;
}
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index 022f281345b8..237ef28c8132 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -302,7 +302,7 @@ acpi_ex_do_concatenate (
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
- return_desc = acpi_ut_create_buffer_object (
+ return_desc = acpi_ut_create_buffer_object ((acpi_size)
ACPI_MUL_2 (acpi_gbl_integer_byte_width));
if (!return_desc) {
status = AE_NO_MEMORY;
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 639f0bd3f6d8..b6ba1a7a677a 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -438,6 +438,13 @@ acpi_ex_get_name_string (
status = AE_AML_BAD_NAME;
}
+ if (ACPI_FAILURE (status)) {
+ if (name_string) {
+ ACPI_MEM_FREE (name_string);
+ }
+ return_ACPI_STATUS (status);
+ }
+
*out_name_string = name_string;
*out_name_length = (u32) (aml_address - in_aml_address);
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index dbdf8262ba00..48c30f800083 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -113,8 +113,9 @@ acpi_ex_opcode_0A_0T_1R (
status = AE_NO_MEMORY;
goto cleanup;
}
-
+#if ACPI_MACHINE_WIDTH != 16
return_desc->integer.value = acpi_os_get_timer ();
+#endif
break;
default: /* Unknown opcode */
@@ -127,15 +128,16 @@ acpi_ex_opcode_0A_0T_1R (
cleanup:
- if (!walk_state->result_obj) {
- walk_state->result_obj = return_desc;
- }
-
/* Delete return object on error */
- if (ACPI_FAILURE (status)) {
+ if ((ACPI_FAILURE (status)) || walk_state->result_obj) {
acpi_ut_remove_reference (return_desc);
}
+ else {
+ /* Save the return value */
+
+ walk_state->result_obj = return_desc;
+ }
return_ACPI_STATUS (status);
}
@@ -902,6 +904,7 @@ acpi_ex_opcode_1A_0T_1R (
*/
return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) operand[0]);
+ acpi_ut_add_reference (return_desc);
}
else {
/*
@@ -951,20 +954,10 @@ acpi_ex_opcode_1A_0T_1R (
* add another reference to the referenced object, however.
*/
return_desc = *(operand[0]->reference.where);
- if (!return_desc) {
- /*
- * We can't return a NULL dereferenced value. This is
- * an uninitialized package element and is thus a
- * severe error.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "NULL package element obj %p\n",
- operand[0]));
- status = AE_AML_UNINITIALIZED_ELEMENT;
- goto cleanup;
+ if (return_desc) {
+ acpi_ut_add_reference (return_desc);
}
- acpi_ut_add_reference (return_desc);
break;
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
index 23b068adbf58..197890f443b5 100644
--- a/drivers/acpi/executer/exoparg3.c
+++ b/drivers/acpi/executer/exoparg3.c
@@ -160,7 +160,7 @@ acpi_ex_opcode_3A_1T_1R (
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
- char *buffer;
+ char *buffer = NULL;
acpi_status status = AE_OK;
acpi_integer index;
acpi_size length;
@@ -193,34 +193,63 @@ acpi_ex_opcode_3A_1T_1R (
* If the index is beyond the length of the String/Buffer, or if the
* requested length is zero, return a zero-length String/Buffer
*/
- if ((index < operand[0]->string.length) &&
- (length > 0)) {
- /* Truncate request if larger than the actual String/Buffer */
-
- if ((index + length) >
- operand[0]->string.length) {
- length = (acpi_size) operand[0]->string.length -
- (acpi_size) index;
- }
+ if (index >= operand[0]->string.length) {
+ length = 0;
+ }
+
+ /* Truncate request if larger than the actual String/Buffer */
+
+ else if ((index + length) > operand[0]->string.length) {
+ length = (acpi_size) operand[0]->string.length -
+ (acpi_size) index;
+ }
- /* Allocate a new buffer for the String/Buffer */
+ /* Strings always have a sub-pointer, not so for buffers */
+
+ switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
+ case ACPI_TYPE_STRING:
+
+ /* Always allocate a new buffer for the String */
buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1);
if (!buffer) {
status = AE_NO_MEMORY;
goto cleanup;
}
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ /* If the requested length is zero, don't allocate a buffer */
+
+ if (length > 0) {
+ /* Allocate a new buffer for the Buffer */
+
+ buffer = ACPI_MEM_CALLOCATE (length);
+ if (!buffer) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+ }
+ break;
+ default: /* Should not happen */
+
+ status = AE_AML_OPERAND_TYPE;
+ goto cleanup;
+ }
+
+ if (length > 0) {
/* Copy the portion requested */
ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
length);
+ }
- /* Set the length of the new String/Buffer */
+ /* Set the length of the new String/Buffer */
- return_desc->string.pointer = buffer;
- return_desc->string.length = (u32) length;
- }
+ return_desc->string.pointer = buffer;
+ return_desc->string.length = (u32) length;
/* Mark buffer initialized */
@@ -244,13 +273,13 @@ cleanup:
/* Delete return object on error */
- if (ACPI_FAILURE (status)) {
+ if (ACPI_FAILURE (status) || walk_state->result_obj) {
acpi_ut_remove_reference (return_desc);
}
/* Set the return object and exit */
- if (!walk_state->result_obj) {
+ else {
walk_state->result_obj = return_desc;
}
return_ACPI_STATUS (status);
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index d8b470eefe7a..aaba7abcb52d 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -426,6 +426,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
+
+ if (obj_desc != *stack_ptr) {
+ acpi_ut_remove_reference (obj_desc);
+ }
goto next_operand;
@@ -448,6 +452,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
+
+ if (obj_desc != *stack_ptr) {
+ acpi_ut_remove_reference (obj_desc);
+ }
goto next_operand;
@@ -471,6 +479,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
+
+ if (obj_desc != *stack_ptr) {
+ acpi_ut_remove_reference (obj_desc);
+ }
goto next_operand;
@@ -515,6 +527,10 @@ acpi_ex_resolve_operands (
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
+
+ if (obj_desc != *stack_ptr) {
+ acpi_ut_remove_reference (obj_desc);
+ }
break;
default:
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index 2725db0901b8..59dbfeaa54c0 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.c
@@ -147,7 +147,7 @@ acpi_ex_do_debug_object (
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
(u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
@@ -574,7 +574,7 @@ acpi_ex_store_object_to_node (
/* If no implicit conversion, drop into the default case below */
- if (!implicit_conversion) {
+ if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
/* Force execution of default (no implicit conversion) */
target_type = ACPI_TYPE_ANY;
@@ -634,7 +634,7 @@ acpi_ex_store_object_to_node (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Storing %s (%p) directly into node (%p), no implicit conversion\n",
+ "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
acpi_ut_get_object_type_name (source_desc), source_desc, node));
/* No conversions for all other types. Just attach the source object */
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
index 120f30ed0bd4..433588ab432a 100644
--- a/drivers/acpi/executer/exstoren.c
+++ b/drivers/acpi/executer/exstoren.c
@@ -265,10 +265,6 @@ acpi_ex_store_object_to_object (
case ACPI_TYPE_BUFFER:
- /*
- * Note: There is different store behavior depending on the original
- * source type
- */
status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
break;
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 5c7ec0c04177..d00b0dcba96a 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -369,7 +369,7 @@ acpi_ex_eisa_id_to_string (
*
* RETURN: None, string
*
- * DESCRIPTOIN: Convert a number to string representation. Assumes string
+ * DESCRIPTION: Convert a number to string representation. Assumes string
* buffer is large enough to hold the string.
*
******************************************************************************/
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c
index 8daeabb2fc7a..3536bbb990c3 100644
--- a/drivers/acpi/hardware/hwgpe.c
+++ b/drivers/acpi/hardware/hwgpe.c
@@ -374,7 +374,7 @@ acpi_hw_enable_wakeup_gpe_block (
*
* FUNCTION: acpi_hw_disable_all_gpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -384,7 +384,7 @@ acpi_hw_enable_wakeup_gpe_block (
acpi_status
acpi_hw_disable_all_gpes (
- u32 flags)
+ void)
{
acpi_status status;
@@ -392,8 +392,8 @@ acpi_hw_disable_all_gpes (
ACPI_FUNCTION_TRACE ("hw_disable_all_gpes");
- status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, flags);
- status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, flags);
+ status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
+ status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
return_ACPI_STATUS (status);
}
@@ -402,7 +402,7 @@ acpi_hw_disable_all_gpes (
*
* FUNCTION: acpi_hw_enable_all_runtime_gpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -412,7 +412,7 @@ acpi_hw_disable_all_gpes (
acpi_status
acpi_hw_enable_all_runtime_gpes (
- u32 flags)
+ void)
{
acpi_status status;
@@ -420,7 +420,7 @@ acpi_hw_enable_all_runtime_gpes (
ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes");
- status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block, flags);
+ status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block);
return_ACPI_STATUS (status);
}
@@ -429,7 +429,7 @@ acpi_hw_enable_all_runtime_gpes (
*
* FUNCTION: acpi_hw_enable_all_wakeup_gpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -439,7 +439,7 @@ acpi_hw_enable_all_runtime_gpes (
acpi_status
acpi_hw_enable_all_wakeup_gpes (
- u32 flags)
+ void)
{
acpi_status status;
@@ -447,7 +447,7 @@ acpi_hw_enable_all_wakeup_gpes (
ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes");
- status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block, flags);
+ status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block);
return_ACPI_STATUS (status);
}
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 6d9e4eb84836..04a058565d8d 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -106,7 +106,7 @@ acpi_hw_clear_acpi_status (
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
- status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, ACPI_ISR);
+ status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
unlock_and_exit:
if (flags & ACPI_MTX_LOCK) {
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 415d342aeab5..cedee0c43b5f 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -274,13 +274,13 @@ acpi_enter_sleep_state (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
- status = acpi_hw_disable_all_gpes (ACPI_ISR);
+ status = acpi_hw_disable_all_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_system_awake_and_running = FALSE;
- status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
+ status = acpi_hw_enable_all_wakeup_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
@@ -424,13 +424,13 @@ acpi_enter_sleep_state_s4bios (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
- status = acpi_hw_disable_all_gpes (ACPI_ISR);
+ status = acpi_hw_disable_all_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_system_awake_and_running = FALSE;
- status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
+ status = acpi_hw_enable_all_wakeup_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
@@ -557,13 +557,13 @@ acpi_leave_sleep_state (
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
*/
- status = acpi_hw_disable_all_gpes (ACPI_NOT_ISR);
+ status = acpi_hw_disable_all_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_system_awake_and_running = TRUE;
- status = acpi_hw_enable_all_runtime_gpes (ACPI_NOT_ISR);
+ status = acpi_hw_enable_all_runtime_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index ece7a9dedd5c..7589e1fdf25a 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -159,19 +159,20 @@ acpi_ns_root_initialize (
obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
-#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App)
+#if defined (ACPI_ASL_COMPILER)
- /*
- * i_aSL Compiler cheats by putting parameter count
- * in the owner_iD
- */
- new_node->owner_id = obj_desc->method.param_count;
+ /* save the parameter count for the i_aSL compiler */
+
+ new_node->value = obj_desc->method.param_count;
#else
/* Mark this as a very SPECIAL method */
obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
+
+#ifndef ACPI_DUMP_APP
obj_desc->method.implementation = acpi_ut_osi_implementation;
#endif
+#endif
break;
case ACPI_TYPE_INTEGER:
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index 5653a19d7172..21d560decbf9 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -83,7 +83,7 @@ acpi_ns_create_node (
return_PTR (NULL);
}
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
+ ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++);
node->name.integer = name;
node->reference_count = 1;
@@ -151,7 +151,7 @@ acpi_ns_delete_node (
}
}
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+ ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
/*
* Detach an object if there is one then delete the node
@@ -176,10 +176,9 @@ acpi_ns_delete_node (
* DESCRIPTION: Initialize a new namespace node and install it amongst
* its peers.
*
- * Note: Current namespace lookup is linear search. However, the
- * nodes are linked in alphabetical order to 1) put all reserved
- * names (start with underscore) first, and to 2) make a readable
- * namespace dump.
+ * Note: Current namespace lookup is linear search. This appears
+ * to be sufficient as namespace searches consume only a small
+ * fraction of the execution time of the ACPI subsystem.
*
******************************************************************************/
@@ -190,12 +189,8 @@ acpi_ns_install_node (
struct acpi_namespace_node *node, /* New Child*/
acpi_object_type type)
{
- u16 owner_id = 0;
+ acpi_owner_id owner_id = 0;
struct acpi_namespace_node *child_node;
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-
- struct acpi_namespace_node *previous_child_node;
-#endif
ACPI_FUNCTION_TRACE ("ns_install_node");
@@ -219,57 +214,6 @@ acpi_ns_install_node (
node->peer = parent_node;
}
else {
-#ifdef ACPI_ALPHABETIC_NAMESPACE
- /*
- * Walk the list whilst searching for the correct
- * alphabetic placement.
- */
- previous_child_node = NULL;
- while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
- acpi_ut_get_node_name (node)) < 0) {
- if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
- /* Last peer; Clear end-of-list flag */
-
- child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
-
- /* This node is the new peer to the child node */
-
- child_node->peer = node;
-
- /* This node is the new end-of-list */
-
- node->flags |= ANOBJ_END_OF_PEER_LIST;
- node->peer = parent_node;
- break;
- }
-
- /* Get next peer */
-
- previous_child_node = child_node;
- child_node = child_node->peer;
- }
-
- /* Did the node get inserted at the end-of-list? */
-
- if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
- /*
- * Loop above terminated without reaching the end-of-list.
- * Insert the new node at the current location
- */
- if (previous_child_node) {
- /* Insert node alphabetically */
-
- node->peer = child_node;
- previous_child_node->peer = node;
- }
- else {
- /* Insert node alphabetically at start of list */
-
- node->peer = child_node;
- parent_node->child = node;
- }
- }
-#else
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
}
@@ -279,9 +223,8 @@ acpi_ns_install_node (
/* Clear end-of-list flag */
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
- node->flags |= ANOBJ_END_OF_PEER_LIST;
+ node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
-#endif
}
/* Init the new entry */
@@ -362,7 +305,7 @@ acpi_ns_delete_children (
/* Now we can free this child object */
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+ ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
child_node, acpi_gbl_current_node_count));
@@ -559,7 +502,7 @@ acpi_ns_remove_reference (
void
acpi_ns_delete_namespace_by_owner (
- u16 owner_id)
+ acpi_owner_id owner_id)
{
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *deletion_node;
@@ -570,6 +513,10 @@ acpi_ns_delete_namespace_by_owner (
ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
+ if (owner_id == 0) {
+ return_VOID;
+ }
+
parent_node = acpi_gbl_root_node;
child_node = NULL;
deletion_node = NULL;
@@ -639,54 +586,3 @@ acpi_ns_delete_namespace_by_owner (
}
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-/*******************************************************************************
- *
- * FUNCTION: acpi_ns_compare_names
- *
- * PARAMETERS: Name1 - First name to compare
- * Name2 - Second name to compare
- *
- * RETURN: value from strncmp
- *
- * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
- * underscore are forced to be alphabetically first.
- *
- ******************************************************************************/
-
-int
-acpi_ns_compare_names (
- char *name1,
- char *name2)
-{
- char reversed_name1[ACPI_NAME_SIZE];
- char reversed_name2[ACPI_NAME_SIZE];
- u32 i;
- u32 j;
-
-
- /*
- * Replace all instances of "underscore" with a value that is smaller so
- * that all names that are prefixed with underscore(s) are alphabetically
- * first.
- *
- * Reverse the name bytewise so we can just do a 32-bit compare instead
- * of a strncmp.
- */
- for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
- reversed_name1[j] = name1[i];
- if (name1[i] == '_') {
- reversed_name1[j] = '*';
- }
-
- reversed_name2[j] = name2[i];
- if (name2[i] == '_') {
- reversed_name2[j] = '*';
- }
- }
-
- return (*(int *) reversed_name1 - *(int *) reversed_name2);
-}
-#endif
-
-
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index 6c2aef0e0dd4..5d25add6b031 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -85,6 +85,9 @@ acpi_ns_print_pathname (
u32 num_segments,
char *pathname)
{
+ acpi_native_uint i;
+
+
ACPI_FUNCTION_NAME ("ns_print_pathname");
@@ -97,9 +100,13 @@ acpi_ns_print_pathname (
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
while (num_segments) {
- acpi_os_printf ("%4.4s", pathname);
- pathname += ACPI_NAME_SIZE;
+ for (i = 0; i < 4; i++) {
+ ACPI_IS_PRINT (pathname[i]) ?
+ acpi_os_printf ("%c", pathname[i]) :
+ acpi_os_printf ("?");
+ }
+ pathname += ACPI_NAME_SIZE;
num_segments--;
if (num_segments) {
acpi_os_printf (".");
@@ -203,38 +210,42 @@ acpi_ns_dump_one_object (
/* Check if the owner matches */
- if ((info->owner_id != ACPI_UINT32_MAX) &&
+ if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
(info->owner_id != this_node->owner_id)) {
return (AE_OK);
}
- /* Indent the object according to the level */
+ if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
+ /* Indent the object according to the level */
- acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
+ acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
- /* Check the node type and name */
+ /* Check the node type and name */
- if (type > ACPI_TYPE_LOCAL_MAX) {
- ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
- }
+ if (type > ACPI_TYPE_LOCAL_MAX) {
+ ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
+ }
- if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
- ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
- this_node->name.integer));
+ if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
+ ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
+ this_node->name.integer));
+ }
+
+ acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node));
}
/*
* Now we can print out the pertinent information
*/
- acpi_os_printf ("%4.4s %-12s %p ",
- acpi_ut_get_node_name (this_node), acpi_ut_get_type_name (type), this_node);
+ acpi_os_printf (" %-12s %p ",
+ acpi_ut_get_type_name (type), this_node);
dbg_level = acpi_dbg_level;
acpi_dbg_level = 0;
obj_desc = acpi_ns_get_attached_object (this_node);
acpi_dbg_level = dbg_level;
- switch (info->display_type) {
+ switch (info->display_type & ACPI_DISPLAY_MASK) {
case ACPI_DISPLAY_SUMMARY:
if (!obj_desc) {
@@ -475,7 +486,7 @@ acpi_ns_dump_one_object (
while (obj_desc) {
obj_type = ACPI_TYPE_INVALID;
- acpi_os_printf (" Attached Object %p: ", obj_desc);
+ acpi_os_printf ("Attached Object %p: ", obj_desc);
/* Decode the type of attached object and dump the contents */
@@ -484,9 +495,9 @@ acpi_ns_dump_one_object (
acpi_os_printf ("(Ptr to Node)\n");
bytes_to_dump = sizeof (struct acpi_namespace_node);
+ ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
break;
-
case ACPI_DESC_TYPE_OPERAND:
obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
@@ -497,24 +508,19 @@ acpi_ns_dump_one_object (
bytes_to_dump = 32;
}
else {
- acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n",
- acpi_ut_get_type_name (obj_type), obj_type);
+ acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n",
+ obj_type, acpi_ut_get_type_name (obj_type));
bytes_to_dump = sizeof (union acpi_operand_object);
}
- break;
+ ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+ break;
default:
- acpi_os_printf (
- "(String or Buffer ptr - not an object descriptor) [%s]\n",
- acpi_ut_get_descriptor_name (obj_desc));
- bytes_to_dump = 16;
break;
}
- ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
-
/* If value is NOT an internal object, we are done */
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
@@ -525,13 +531,17 @@ acpi_ns_dump_one_object (
* Valid object, get the pointer to next level, if any
*/
switch (obj_type) {
+ case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
+ /*
+ * NOTE: takes advantage of common fields between string/buffer
+ */
+ bytes_to_dump = obj_desc->string.length;
obj_desc = (void *) obj_desc->string.pointer;
- break;
-
- case ACPI_TYPE_BUFFER:
- obj_desc = (void *) obj_desc->buffer.pointer;
- break;
+ acpi_os_printf ( "(Buffer/String pointer %p length %X)\n",
+ obj_desc, bytes_to_dump);
+ ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+ goto cleanup;
case ACPI_TYPE_BUFFER_FIELD:
obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
@@ -595,7 +605,7 @@ acpi_ns_dump_objects (
acpi_object_type type,
u8 display_type,
u32 max_depth,
- u32 owner_id,
+ acpi_owner_id owner_id,
acpi_handle start_handle)
{
struct acpi_walk_info info;
@@ -640,14 +650,14 @@ acpi_ns_dump_entry (
info.debug_level = debug_level;
- info.owner_id = ACPI_UINT32_MAX;
+ info.owner_id = ACPI_OWNER_ID_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
(void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
}
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_tables
@@ -691,7 +701,7 @@ acpi_ns_dump_tables (
}
acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
- ACPI_UINT32_MAX, search_handle);
+ ACPI_OWNER_ID_MAX, search_handle);
return_VOID;
}
#endif /* _ACPI_ASL_COMPILER */
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index 1ae89a1c8826..908cffd5e720 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -365,6 +365,7 @@ acpi_ns_evaluate_by_handle (
*
* PARAMETERS: Info - Method info block, contains:
* Node - Method Node to execute
+ * obj_desc - Method object
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
@@ -387,7 +388,6 @@ acpi_ns_execute_control_method (
struct acpi_parameter_info *info)
{
acpi_status status;
- union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE ("ns_execute_control_method");
@@ -395,8 +395,8 @@ acpi_ns_execute_control_method (
/* Verify that there is a method associated with this object */
- obj_desc = acpi_ns_get_attached_object (info->node);
- if (!obj_desc) {
+ info->obj_desc = acpi_ns_get_attached_object (info->node);
+ if (!info->obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
@@ -407,7 +407,7 @@ acpi_ns_execute_control_method (
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
- obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
+ info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1));
/*
* Unlock the namespace before execution. This allows namespace access
@@ -430,7 +430,7 @@ acpi_ns_execute_control_method (
return_ACPI_STATUS (status);
}
- status = acpi_psx_execute (info);
+ status = acpi_ps_execute_method (info);
acpi_ex_exit_interpreter ();
return_ACPI_STATUS (status);
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
index 34e497016601..1428a84a31e6 100644
--- a/drivers/acpi/namespace/nsload.c
+++ b/drivers/acpi/namespace/nsload.c
@@ -198,7 +198,7 @@ acpi_ns_load_table_by_type (
switch (table_type) {
case ACPI_TABLE_DSDT:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n"));
table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
@@ -218,17 +218,18 @@ acpi_ns_load_table_by_type (
case ACPI_TABLE_SSDT:
+ case ACPI_TABLE_PSDT:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
- acpi_gbl_table_lists[ACPI_TABLE_SSDT].count));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
+ acpi_gbl_table_lists[table_type].count));
/*
- * Traverse list of SSDT tables
+ * Traverse list of SSDT or PSDT tables
*/
- table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next;
- for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) {
+ table_desc = acpi_gbl_table_lists[table_type].next;
+ for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) {
/*
- * Only attempt to load table if it is not
+ * Only attempt to load table into namespace if it is not
* already loaded!
*/
if (!table_desc->loaded_into_namespace) {
@@ -245,33 +246,6 @@ acpi_ns_load_table_by_type (
break;
- case ACPI_TABLE_PSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
- acpi_gbl_table_lists[ACPI_TABLE_PSDT].count));
-
- /*
- * Traverse list of PSDT tables
- */
- table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next;
-
- for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) {
- /* Only attempt to load table if it is not already loaded! */
-
- if (!table_desc->loaded_into_namespace) {
- status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
- if (ACPI_FAILURE (status)) {
- break;
- }
-
- table_desc->loaded_into_namespace = TRUE;
- }
-
- table_desc = table_desc->next;
- }
- break;
-
-
default:
status = AE_SUPPORT;
break;
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c
index a0e13e8d3764..24bed931d39d 100644
--- a/drivers/acpi/namespace/nsparse.c
+++ b/drivers/acpi/namespace/nsparse.c
@@ -67,7 +67,7 @@
acpi_status
acpi_ns_one_complete_parse (
- u32 pass_number,
+ u8 pass_number,
struct acpi_table_desc *table_desc)
{
union acpi_parse_object *parse_root;
@@ -87,7 +87,7 @@ acpi_ns_one_complete_parse (
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (table_desc->table_id,
+ walk_state = acpi_ds_create_walk_state (table_desc->owner_id,
NULL, NULL, NULL);
if (!walk_state) {
acpi_ps_free_op (parse_root);
@@ -146,6 +146,7 @@ acpi_ns_parse_table (
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
status = acpi_ns_one_complete_parse (1, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
@@ -160,6 +161,7 @@ acpi_ns_parse_table (
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
status = acpi_ns_one_complete_parse (2, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 7289da3c4db6..f3a807c342c0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -782,54 +782,6 @@ acpi_os_delete_lock (
return_VOID;
}
-/*
- * Acquire a spinlock.
- *
- * handle is a pointer to the spinlock_t.
- * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
- * that indicates whether we are at interrupt level.
- */
-void
-acpi_os_acquire_lock (
- acpi_handle handle,
- u32 flags)
-{
- ACPI_FUNCTION_TRACE ("os_acquire_lock");
-
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle,
- ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
-
- if (flags & ACPI_NOT_ISR)
- ACPI_DISABLE_IRQS();
-
- spin_lock((spinlock_t *)handle);
-
- return_VOID;
-}
-
-
-/*
- * Release a spinlock. See above.
- */
-void
-acpi_os_release_lock (
- acpi_handle handle,
- u32 flags)
-{
- ACPI_FUNCTION_TRACE ("os_release_lock");
-
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle,
- ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
-
- spin_unlock((spinlock_t *)handle);
-
- if (flags & ACPI_NOT_ISR)
- ACPI_ENABLE_IRQS();
-
- return_VOID;
-}
-
-
acpi_status
acpi_os_create_semaphore(
u32 max_units,
@@ -1176,3 +1128,151 @@ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
EXPORT_SYMBOL(max_cstate);
+
+/*
+ * Acquire a spinlock.
+ *
+ * handle is a pointer to the spinlock_t.
+ * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
+ * that indicates whether we are at interrupt level.
+ */
+
+unsigned long
+acpi_os_acquire_lock (
+ acpi_handle handle)
+{
+ unsigned long flags;
+ spin_lock_irqsave((spinlock_t *)handle, flags);
+ return flags;
+}
+
+/*
+ * Release a spinlock. See above.
+ */
+
+void
+acpi_os_release_lock (
+ acpi_handle handle,
+ unsigned long flags)
+{
+ spin_unlock_irqrestore((spinlock_t *)handle, flags);
+}
+
+
+#ifndef ACPI_USE_LOCAL_CACHE
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_create_cache
+ *
+ * PARAMETERS: CacheName - Ascii name for the cache
+ * ObjectSize - Size of each cached object
+ * MaxDepth - Maximum depth of the cache (in objects)
+ * ReturnCache - Where the new cache object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a cache object
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_create_cache (
+ char *name,
+ u16 size,
+ u16 depth,
+ acpi_cache_t **cache)
+{
+ *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL);
+ return AE_OK;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_purge_cache
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_purge_cache (
+ acpi_cache_t *cache)
+{
+ (void) kmem_cache_shrink(cache);
+ return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_delete_cache
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache and delete the
+ * cache object.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_delete_cache (
+ acpi_cache_t *cache)
+{
+ (void)kmem_cache_destroy(cache);
+ return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_release_object
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ * Object - The object to be released
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Release an object to the specified cache. If cache is full,
+ * the object is deleted.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_release_object (
+ acpi_cache_t *cache,
+ void *object)
+{
+ kmem_cache_free(cache, object);
+ return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_acquire_object
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ * ReturnObject - Where the object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an object from the specified cache. If cache is empty,
+ * the object is allocated.
+ *
+ ******************************************************************************/
+
+void *
+acpi_os_acquire_object (
+ acpi_cache_t *cache)
+{
+ void *object = kmem_cache_alloc(cache, GFP_KERNEL);
+ WARN_ON(!object);
+ return object;
+}
+
+#endif
+
diff --git a/drivers/acpi/parser/Makefile b/drivers/acpi/parser/Makefile
index bbdd286c660d..db24ee09cf11 100644
--- a/drivers/acpi/parser/Makefile
+++ b/drivers/acpi/parser/Makefile
@@ -2,7 +2,7 @@
# Makefile for all Linux ACPI interpreter subdirectories
#
-obj-y := psargs.o psparse.o pstree.o pswalk.o \
+obj-y := psargs.o psparse.o psloop.o pstree.o pswalk.o \
psopcode.o psscope.o psutils.o psxface.o
EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
new file mode 100644
index 000000000000..551d54bdbec3
--- /dev/null
+++ b/drivers/acpi/parser/psloop.c
@@ -0,0 +1,781 @@
+/******************************************************************************
+ *
+ * Module Name: psloop - Main AML parse loop
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * 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.
+ */
+
+
+/*
+ * Parse the AML and build an operation tree as most interpreters,
+ * like Perl, do. Parsing is done by hand rather than with a YACC
+ * generated parser to tightly constrain stack and dynamic memory
+ * usage. At the same time, parsing is kept flexible and the code
+ * fairly compact by parsing based on a list of AML opcode
+ * templates in aml_op_info[]
+ */
+
+#include <acpi/acpi.h>
+#include <acpi/acparser.h>
+#include <acpi/acdispat.h>
+#include <acpi/amlcode.h>
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psloop")
+
+static u32 acpi_gbl_depth = 0;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ps_parse_loop
+ *
+ * PARAMETERS: walk_state - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
+ * a tree of ops.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ps_parse_loop (
+ struct acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_OK;
+ acpi_status status2;
+ union acpi_parse_object *op = NULL; /* current op */
+ union acpi_parse_object *arg = NULL;
+ union acpi_parse_object *pre_op = NULL;
+ struct acpi_parse_state *parser_state;
+ u8 *aml_op_start = NULL;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
+
+ if (walk_state->descending_callback == NULL) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ parser_state = &walk_state->parser_state;
+ walk_state->arg_types = 0;
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
+ if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
+ /* We are restarting a preempted control method */
+
+ if (acpi_ps_has_completed_scope (parser_state)) {
+ /*
+ * We must check if a predicate to an IF or WHILE statement
+ * was just completed
+ */
+ if ((parser_state->scope->parse_scope.op) &&
+ ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
+ (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
+ (walk_state->control_state) &&
+ (walk_state->control_state->common.state ==
+ ACPI_CONTROL_PREDICATE_EXECUTING)) {
+ /*
+ * A predicate was just completed, get the value of the
+ * predicate and branch based on that value
+ */
+ walk_state->op = NULL;
+ status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
+ if (ACPI_FAILURE (status) &&
+ ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
+ if (status == AE_AML_NO_RETURN_VALUE) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invoked method did not return a value, %s\n",
+ acpi_format_exception (status)));
+
+ }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "get_predicate Failed, %s\n",
+ acpi_format_exception (status)));
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ }
+
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
+ }
+ else if (walk_state->prev_op) {
+ /* We were in the middle of an op */
+
+ op = walk_state->prev_op;
+ walk_state->arg_types = walk_state->prev_arg_types;
+ }
+ }
+#endif
+
+ /* Iterative parsing loop, while there is more AML to process: */
+
+ while ((parser_state->aml < parser_state->aml_end) || (op)) {
+ aml_op_start = parser_state->aml;
+ if (!op) {
+ /* Get the next opcode from the AML stream */
+
+ walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
+ parser_state->aml_start);
+ walk_state->opcode = acpi_ps_peek_opcode (parser_state);
+
+ /*
+ * First cut to determine what we have found:
+ * 1) A valid AML opcode
+ * 2) A name string
+ * 3) An unknown/invalid opcode
+ */
+ walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+ switch (walk_state->op_info->class) {
+ case AML_CLASS_ASCII:
+ case AML_CLASS_PREFIX:
+ /*
+ * Starts with a valid prefix or ASCII char, this is a name
+ * string. Convert the bare name string to a namepath.
+ */
+ walk_state->opcode = AML_INT_NAMEPATH_OP;
+ walk_state->arg_types = ARGP_NAMESTRING;
+ break;
+
+ case AML_CLASS_UNKNOWN:
+
+ /* The opcode is unrecognized. Just skip unknown opcodes */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
+ walk_state->opcode, parser_state->aml, walk_state->aml_offset));
+
+ ACPI_DUMP_BUFFER (parser_state->aml, 128);
+
+ /* Assume one-byte bad opcode */
+
+ parser_state->aml++;
+ continue;
+
+ default:
+
+ /* Found opcode info, this is a normal opcode */
+
+ parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
+ walk_state->arg_types = walk_state->op_info->parse_args;
+ break;
+ }
+
+ /* Create Op structure and append to parent's argument list */
+
+ if (walk_state->op_info->flags & AML_NAMED) {
+ /* Allocate a new pre_op if necessary */
+
+ if (!pre_op) {
+ pre_op = acpi_ps_alloc_op (walk_state->opcode);
+ if (!pre_op) {
+ status = AE_NO_MEMORY;
+ goto close_this_op;
+ }
+ }
+
+ pre_op->common.value.arg = NULL;
+ pre_op->common.aml_opcode = walk_state->opcode;
+
+ /*
+ * Get and append arguments until we find the node that contains
+ * the name (the type ARGP_NAME).
+ */
+ while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
+ (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
+ status = acpi_ps_get_next_arg (walk_state, parser_state,
+ GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
+ }
+
+ acpi_ps_append_arg (pre_op, arg);
+ INCREMENT_ARG_LIST (walk_state->arg_types);
+ }
+
+ /*
+ * Make sure that we found a NAME and didn't run out of
+ * arguments
+ */
+ if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
+ status = AE_AML_NO_OPERAND;
+ goto close_this_op;
+ }
+
+ /* We know that this arg is a name, move to next arg */
+
+ INCREMENT_ARG_LIST (walk_state->arg_types);
+
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ walk_state->op = NULL;
+
+ status = walk_state->descending_callback (walk_state, &op);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "During name lookup/catalog, %s\n",
+ acpi_format_exception (status)));
+ goto close_this_op;
+ }
+
+ if (!op) {
+ continue;
+ }
+
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ if (status == AE_CTRL_PENDING) {
+ status = AE_OK;
+ goto close_this_op;
+ }
+
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
+ }
+
+ acpi_ps_append_arg (op, pre_op->common.value.arg);
+ acpi_gbl_depth++;
+
+ if (op->common.aml_opcode == AML_REGION_OP) {
+ /*
+ * Defer final parsing of an operation_region body,
+ * because we don't have enough info in the first pass
+ * to parse it correctly (i.e., there may be method
+ * calls within the term_arg elements of the body.)
+ *
+ * However, we must continue parsing because
+ * the opregion is not a standalone package --
+ * we don't know where the end is at this point.
+ *
+ * (Length is unknown until parse of the body complete)
+ */
+ op->named.data = aml_op_start;
+ op->named.length = 0;
+ }
+ }
+ else {
+ /* Not a named opcode, just allocate Op and append to parent */
+
+ walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+ op = acpi_ps_alloc_op (walk_state->opcode);
+ if (!op) {
+ status = AE_NO_MEMORY;
+ goto close_this_op;
+ }
+
+ if (walk_state->op_info->flags & AML_CREATE) {
+ /*
+ * Backup to beginning of create_xXXfield declaration
+ * body_length is unknown until we parse the body
+ */
+ op->named.data = aml_op_start;
+ op->named.length = 0;
+ }
+
+ acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
+
+ if ((walk_state->descending_callback != NULL)) {
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ walk_state->op = op;
+
+ status = walk_state->descending_callback (walk_state, &op);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ if (status == AE_CTRL_PENDING) {
+ status = AE_OK;
+ goto close_this_op;
+ }
+
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
+ }
+ }
+ }
+
+ op->common.aml_offset = walk_state->aml_offset;
+
+ if (walk_state->op_info) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
+ (u32) op->common.aml_opcode, walk_state->op_info->name,
+ op, parser_state->aml, op->common.aml_offset));
+ }
+ }
+
+
+ /*
+ * Start arg_count at zero because we don't know if there are
+ * any args yet
+ */
+ walk_state->arg_count = 0;
+
+ /* Are there any arguments that must be processed? */
+
+ if (walk_state->arg_types) {
+ /* Get arguments */
+
+ switch (op->common.aml_opcode) {
+ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
+ case AML_WORD_OP: /* AML_WORDDATA_ARG */
+ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
+ case AML_QWORD_OP: /* AML_QWORDATA_ARG */
+ case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
+
+ /* Fill in constant or string argument directly */
+
+ acpi_ps_get_next_simple_arg (parser_state,
+ GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
+ break;
+
+ case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
+
+ status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
+ }
+
+ walk_state->arg_types = 0;
+ break;
+
+ default:
+ /*
+ * Op is not a constant or string, append each argument
+ * to the Op
+ */
+ while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
+ !walk_state->arg_count) {
+ walk_state->aml_offset = (u32)
+ ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
+
+ status = acpi_ps_get_next_arg (walk_state, parser_state,
+ GET_CURRENT_ARG_TYPE (walk_state->arg_types),
+ &arg);
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
+ }
+
+ if (arg) {
+ arg->common.aml_offset = walk_state->aml_offset;
+ acpi_ps_append_arg (op, arg);
+ }
+ INCREMENT_ARG_LIST (walk_state->arg_types);
+ }
+
+
+ /* Special processing for certain opcodes */
+
+ /* TBD (remove): Temporary mechanism to disable this code if needed */
+
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+
+ if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
+ ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
+ /*
+ * We want to skip If/Else/While constructs during Pass1
+ * because we want to actually conditionally execute the
+ * code during Pass2.
+ *
+ * Except for disassembly, where we always want to
+ * walk the If/Else/While packages
+ */
+ switch (op->common.aml_opcode) {
+ case AML_IF_OP:
+ case AML_ELSE_OP:
+ case AML_WHILE_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Pass1: Skipping an If/Else/While body\n"));
+
+ /* Skip body of if/else/while in pass 1 */
+
+ parser_state->aml = parser_state->pkg_end;
+ walk_state->arg_count = 0;
+ break;
+
+ default:
+ break;
+ }
+ }
+#endif
+ switch (op->common.aml_opcode) {
+ case AML_METHOD_OP:
+
+ /*
+ * Skip parsing of control method
+ * because we don't have enough info in the first pass
+ * to parse it correctly.
+ *
+ * Save the length and address of the body
+ */
+ op->named.data = parser_state->aml;
+ op->named.length = (u32) (parser_state->pkg_end -
+ parser_state->aml);
+
+ /* Skip body of method */
+
+ parser_state->aml = parser_state->pkg_end;
+ walk_state->arg_count = 0;
+ break;
+
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ if ((op->common.parent) &&
+ (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
+ (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
+ /*
+ * Skip parsing of Buffers and Packages
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ */
+ op->named.data = aml_op_start;
+ op->named.length = (u32) (parser_state->pkg_end -
+ aml_op_start);
+
+ /* Skip body */
+
+ parser_state->aml = parser_state->pkg_end;
+ walk_state->arg_count = 0;
+ }
+ break;
+
+ case AML_WHILE_OP:
+
+ if (walk_state->control_state) {
+ walk_state->control_state->control.package_end =
+ parser_state->pkg_end;
+ }
+ break;
+
+ default:
+
+ /* No action for all other opcodes */
+ break;
+ }
+ break;
+ }
+ }
+
+ /* Check for arguments that need to be processed */
+
+ if (walk_state->arg_count) {
+ /*
+ * There are arguments (complex ones), push Op and
+ * prepare for argument
+ */
+ status = acpi_ps_push_scope (parser_state, op,
+ walk_state->arg_types, walk_state->arg_count);
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
+ }
+ op = NULL;
+ continue;
+ }
+
+ /*
+ * All arguments have been processed -- Op is complete,
+ * prepare for next
+ */
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ if (walk_state->op_info->flags & AML_NAMED) {
+ if (acpi_gbl_depth) {
+ acpi_gbl_depth--;
+ }
+
+ if (op->common.aml_opcode == AML_REGION_OP) {
+ /*
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ *
+ * Completed parsing an op_region declaration, we now
+ * know the length.
+ */
+ op->named.length = (u32) (parser_state->aml - op->named.data);
+ }
+ }
+
+ if (walk_state->op_info->flags & AML_CREATE) {
+ /*
+ * Backup to beginning of create_xXXfield declaration (1 for
+ * Opcode)
+ *
+ * body_length is unknown until we parse the body
+ */
+ op->named.length = (u32) (parser_state->aml - op->named.data);
+ }
+
+ /* This op complete, notify the dispatcher */
+
+ if (walk_state->ascending_callback != NULL) {
+ walk_state->op = op;
+ walk_state->opcode = op->common.aml_opcode;
+
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ if (status == AE_CTRL_PENDING) {
+ status = AE_OK;
+ goto close_this_op;
+ }
+ }
+
+
+close_this_op:
+ /*
+ * Finished one argument of the containing scope
+ */
+ parser_state->scope->parse_scope.arg_count--;
+
+ /* Finished with pre_op */
+
+ if (pre_op) {
+ acpi_ps_free_op (pre_op);
+ pre_op = NULL;
+ }
+
+ /* Close this Op (will result in parse subtree deletion) */
+
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ op = NULL;
+
+ switch (status) {
+ case AE_OK:
+ break;
+
+
+ case AE_CTRL_TRANSFER:
+
+ /* We are about to transfer to a called method. */
+
+ walk_state->prev_op = op;
+ walk_state->prev_arg_types = walk_state->arg_types;
+ return_ACPI_STATUS (status);
+
+
+ case AE_CTRL_END:
+
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+
+ if (op) {
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
+
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ op = NULL;
+ }
+ status = AE_OK;
+ break;
+
+
+ case AE_CTRL_BREAK:
+ case AE_CTRL_CONTINUE:
+
+ /* Pop off scopes until we find the While */
+
+ while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+ }
+
+ /* Close this iteration of the While loop */
+
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
+
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ op = NULL;
+
+ status = AE_OK;
+ break;
+
+
+ case AE_CTRL_TERMINATE:
+
+ status = AE_OK;
+
+ /* Clean up */
+ do {
+ if (op) {
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ }
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+
+ } while (op);
+
+ return_ACPI_STATUS (status);
+
+
+ default: /* All other non-AE_OK status */
+
+ do {
+ if (op) {
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ }
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+
+ } while (op);
+
+
+ /*
+ * TBD: Cleanup parse ops on error
+ */
+#if 0
+ if (op == NULL) {
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+ }
+#endif
+ walk_state->prev_op = op;
+ walk_state->prev_arg_types = walk_state->arg_types;
+ return_ACPI_STATUS (status);
+ }
+
+ /* This scope complete? */
+
+ if (acpi_ps_has_completed_scope (parser_state)) {
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
+ }
+ else {
+ op = NULL;
+ }
+
+ } /* while parser_state->Aml */
+
+
+ /*
+ * Complete the last Op (if not completed), and clear the scope stack.
+ * It is easily possible to end an AML "package" with an unbounded number
+ * of open scopes (such as when several ASL blocks are closed with
+ * sequential closing braces). We want to terminate each one cleanly.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
+ do {
+ if (op) {
+ if (walk_state->ascending_callback != NULL) {
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
+
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ if (status == AE_CTRL_PENDING) {
+ status = AE_OK;
+ goto close_this_op;
+ }
+
+ if (status == AE_CTRL_TERMINATE) {
+ status = AE_OK;
+
+ /* Clean up */
+ do {
+ if (op) {
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ }
+
+ acpi_ps_pop_scope (parser_state, &op,
+ &walk_state->arg_types, &walk_state->arg_count);
+
+ } while (op);
+
+ return_ACPI_STATUS (status);
+ }
+
+ else if (ACPI_FAILURE (status)) {
+ /* First error is most important */
+
+ (void) acpi_ps_complete_this_op (walk_state, op);
+ return_ACPI_STATUS (status);
+ }
+ }
+
+ status2 = acpi_ps_complete_this_op (walk_state, op);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
+ }
+
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
+ &walk_state->arg_count);
+
+ } while (op);
+
+ return_ACPI_STATUS (status);
+}
+
+
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
index 5744673568c0..6f7594a516d2 100644
--- a/drivers/acpi/parser/psopcode.c
+++ b/drivers/acpi/parser/psopcode.c
@@ -311,7 +311,7 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
-/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
+/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
@@ -428,33 +428,23 @@ acpi_ps_get_opcode_info (
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
- switch ((u8) (opcode >> 8)) {
- case 0:
-
+ if (!(opcode & 0xFF00)) {
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
+ }
- case AML_EXTOP:
-
- /* Extended (16-bit, prefix+opcode) opcode */
-
- if (((u8) opcode) <= MAX_EXTENDED_OPCODE) {
- return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
- }
-
- /* Else fall through to error case below */
- /*lint -fallthrough */
-
- default:
+ if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
+ (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
+ /* Valid extended (16-bit) opcode */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown AML opcode [%4.4X]\n", opcode));
- break;
+ return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
}
+ /* Unknown AML opcode */
- /* Default is "unknown opcode" */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown AML opcode [%4.4X]\n", opcode));
return (&acpi_gbl_aml_op_info [_UNK]);
}
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index bbfdc1a58c27..16b84a3d0436 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -62,26 +62,6 @@
ACPI_MODULE_NAME ("psparse")
-static u32 acpi_gbl_depth = 0;
-
-/* Local prototypes */
-
-static void
-acpi_ps_complete_this_op (
- struct acpi_walk_state *walk_state,
- union acpi_parse_object *op);
-
-static acpi_status
-acpi_ps_next_parse_state (
- struct acpi_walk_state *walk_state,
- union acpi_parse_object *op,
- acpi_status callback_status);
-
-static acpi_status
-acpi_ps_parse_loop (
- struct acpi_walk_state *walk_state);
-
-
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_opcode_size
@@ -134,8 +114,8 @@ acpi_ps_peek_opcode (
aml = parser_state->aml;
opcode = (u16) ACPI_GET8 (aml);
- if (opcode == AML_EXTOP) {
- /* Extended opcode */
+ if (opcode == AML_EXTENDED_OP_PREFIX) {
+ /* Extended opcode, get the second opcode byte */
aml++;
opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml));
@@ -152,13 +132,13 @@ acpi_ps_peek_opcode (
* PARAMETERS: walk_state - Current State
* Op - Op to complete
*
- * RETURN: None.
+ * RETURN: Status
*
* DESCRIPTION: Perform any cleanup at the completion of an Op.
*
******************************************************************************/
-static void
+acpi_status
acpi_ps_complete_this_op (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op)
@@ -175,19 +155,26 @@ acpi_ps_complete_this_op (
/* Check for null Op, can happen if AML code is corrupt */
if (!op) {
- return_VOID;
+ return_ACPI_STATUS (AE_OK); /* OK for now */
}
/* Delete this op and the subtree below it if asked to */
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
(walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
- return_VOID;
+ return_ACPI_STATUS (AE_OK);
}
/* Make sure that we only delete this subtree */
if (op->common.parent) {
+ prev = op->common.parent->common.value.arg;
+ if (!prev) {
+ /* Nothing more to do */
+
+ goto cleanup;
+ }
+
/*
* Check if we need to replace the operator and its subtree
* with a return value op (placeholder op)
@@ -206,7 +193,7 @@ acpi_ps_complete_this_op (
*/
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
- goto cleanup;
+ goto allocate_error;
}
break;
@@ -223,18 +210,17 @@ acpi_ps_complete_this_op (
(op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
- goto cleanup;
+ goto allocate_error;
}
}
-
- if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
- (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
+ else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
+ (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
if ((op->common.aml_opcode == AML_BUFFER_OP) ||
(op->common.aml_opcode == AML_PACKAGE_OP) ||
(op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
if (!replacement_op) {
- goto cleanup;
+ goto allocate_error;
}
replacement_op->named.data = op->named.data;
@@ -244,15 +230,15 @@ acpi_ps_complete_this_op (
break;
default:
+
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
- goto cleanup;
+ goto allocate_error;
}
}
/* We must unlink this op from the parent tree */
- prev = op->common.parent->common.value.arg;
if (prev == op) {
/* This op is the first in the list */
@@ -298,7 +284,15 @@ cleanup:
/* Now we can actually delete the subtree rooted at Op */
acpi_ps_delete_parse_tree (op);
- return_VOID;
+ return_ACPI_STATUS (AE_OK);
+
+
+allocate_error:
+
+ /* Always delete the subtree, even on error */
+
+ acpi_ps_delete_parse_tree (op);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -317,7 +311,7 @@ cleanup:
*
******************************************************************************/
-static acpi_status
+acpi_status
acpi_ps_next_parse_state (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
@@ -427,663 +421,6 @@ acpi_ps_next_parse_state (
/*******************************************************************************
*
- * FUNCTION: acpi_ps_parse_loop
- *
- * PARAMETERS: walk_state - Current state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
- * a tree of ops.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ps_parse_loop (
- struct acpi_walk_state *walk_state)
-{
- acpi_status status = AE_OK;
- union acpi_parse_object *op = NULL; /* current op */
- union acpi_parse_object *arg = NULL;
- union acpi_parse_object *pre_op = NULL;
- struct acpi_parse_state *parser_state;
- u8 *aml_op_start = NULL;
-
-
- ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
-
- if (walk_state->descending_callback == NULL) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- parser_state = &walk_state->parser_state;
- walk_state->arg_types = 0;
-
-#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
-
- if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
- /* We are restarting a preempted control method */
-
- if (acpi_ps_has_completed_scope (parser_state)) {
- /*
- * We must check if a predicate to an IF or WHILE statement
- * was just completed
- */
- if ((parser_state->scope->parse_scope.op) &&
- ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
- (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
- (walk_state->control_state) &&
- (walk_state->control_state->common.state ==
- ACPI_CONTROL_PREDICATE_EXECUTING)) {
- /*
- * A predicate was just completed, get the value of the
- * predicate and branch based on that value
- */
- walk_state->op = NULL;
- status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
- if (ACPI_FAILURE (status) &&
- ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
- if (status == AE_AML_NO_RETURN_VALUE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invoked method did not return a value, %s\n",
- acpi_format_exception (status)));
-
- }
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "get_predicate Failed, %s\n",
- acpi_format_exception (status)));
- return_ACPI_STATUS (status);
- }
-
- status = acpi_ps_next_parse_state (walk_state, op, status);
- }
-
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
- }
- else if (walk_state->prev_op) {
- /* We were in the middle of an op */
-
- op = walk_state->prev_op;
- walk_state->arg_types = walk_state->prev_arg_types;
- }
- }
-#endif
-
- /* Iterative parsing loop, while there is more AML to process: */
-
- while ((parser_state->aml < parser_state->aml_end) || (op)) {
- aml_op_start = parser_state->aml;
- if (!op) {
- /* Get the next opcode from the AML stream */
-
- walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
- parser_state->aml_start);
- walk_state->opcode = acpi_ps_peek_opcode (parser_state);
-
- /*
- * First cut to determine what we have found:
- * 1) A valid AML opcode
- * 2) A name string
- * 3) An unknown/invalid opcode
- */
- walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
- switch (walk_state->op_info->class) {
- case AML_CLASS_ASCII:
- case AML_CLASS_PREFIX:
- /*
- * Starts with a valid prefix or ASCII char, this is a name
- * string. Convert the bare name string to a namepath.
- */
- walk_state->opcode = AML_INT_NAMEPATH_OP;
- walk_state->arg_types = ARGP_NAMESTRING;
- break;
-
- case AML_CLASS_UNKNOWN:
-
- /* The opcode is unrecognized. Just skip unknown opcodes */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
- walk_state->opcode, parser_state->aml, walk_state->aml_offset));
-
- ACPI_DUMP_BUFFER (parser_state->aml, 128);
-
- /* Assume one-byte bad opcode */
-
- parser_state->aml++;
- continue;
-
- default:
-
- /* Found opcode info, this is a normal opcode */
-
- parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
- walk_state->arg_types = walk_state->op_info->parse_args;
- break;
- }
-
- /* Create Op structure and append to parent's argument list */
-
- if (walk_state->op_info->flags & AML_NAMED) {
- /* Allocate a new pre_op if necessary */
-
- if (!pre_op) {
- pre_op = acpi_ps_alloc_op (walk_state->opcode);
- if (!pre_op) {
- status = AE_NO_MEMORY;
- goto close_this_op;
- }
- }
-
- pre_op->common.value.arg = NULL;
- pre_op->common.aml_opcode = walk_state->opcode;
-
- /*
- * Get and append arguments until we find the node that contains
- * the name (the type ARGP_NAME).
- */
- while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
- (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
- status = acpi_ps_get_next_arg (walk_state, parser_state,
- GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
-
- acpi_ps_append_arg (pre_op, arg);
- INCREMENT_ARG_LIST (walk_state->arg_types);
- }
-
- /*
- * Make sure that we found a NAME and didn't run out of
- * arguments
- */
- if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
- status = AE_AML_NO_OPERAND;
- goto close_this_op;
- }
-
- /* We know that this arg is a name, move to next arg */
-
- INCREMENT_ARG_LIST (walk_state->arg_types);
-
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- walk_state->op = NULL;
-
- status = walk_state->descending_callback (walk_state, &op);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "During name lookup/catalog, %s\n",
- acpi_format_exception (status)));
- goto close_this_op;
- }
-
- if (!op) {
- continue;
- }
-
- status = acpi_ps_next_parse_state (walk_state, op, status);
- if (status == AE_CTRL_PENDING) {
- status = AE_OK;
- goto close_this_op;
- }
-
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
-
- acpi_ps_append_arg (op, pre_op->common.value.arg);
- acpi_gbl_depth++;
-
- if (op->common.aml_opcode == AML_REGION_OP) {
- /*
- * Defer final parsing of an operation_region body,
- * because we don't have enough info in the first pass
- * to parse it correctly (i.e., there may be method
- * calls within the term_arg elements of the body.)
- *
- * However, we must continue parsing because
- * the opregion is not a standalone package --
- * we don't know where the end is at this point.
- *
- * (Length is unknown until parse of the body complete)
- */
- op->named.data = aml_op_start;
- op->named.length = 0;
- }
- }
- else {
- /* Not a named opcode, just allocate Op and append to parent */
-
- walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
- op = acpi_ps_alloc_op (walk_state->opcode);
- if (!op) {
- status = AE_NO_MEMORY;
- goto close_this_op;
- }
-
- if (walk_state->op_info->flags & AML_CREATE) {
- /*
- * Backup to beginning of create_xXXfield declaration
- * body_length is unknown until we parse the body
- */
- op->named.data = aml_op_start;
- op->named.length = 0;
- }
-
- acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
-
- if ((walk_state->descending_callback != NULL)) {
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- walk_state->op = op;
-
- status = walk_state->descending_callback (walk_state, &op);
- status = acpi_ps_next_parse_state (walk_state, op, status);
- if (status == AE_CTRL_PENDING) {
- status = AE_OK;
- goto close_this_op;
- }
-
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
- }
- }
-
- op->common.aml_offset = walk_state->aml_offset;
-
- if (walk_state->op_info) {
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
- (u32) op->common.aml_opcode, walk_state->op_info->name,
- op, parser_state->aml, op->common.aml_offset));
- }
- }
-
-
- /*
- * Start arg_count at zero because we don't know if there are
- * any args yet
- */
- walk_state->arg_count = 0;
-
- /* Are there any arguments that must be processed? */
-
- if (walk_state->arg_types) {
- /* Get arguments */
-
- switch (op->common.aml_opcode) {
- case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
- case AML_WORD_OP: /* AML_WORDDATA_ARG */
- case AML_DWORD_OP: /* AML_DWORDATA_ARG */
- case AML_QWORD_OP: /* AML_QWORDATA_ARG */
- case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
-
- /* Fill in constant or string argument directly */
-
- acpi_ps_get_next_simple_arg (parser_state,
- GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
- break;
-
- case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
-
- status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
-
- walk_state->arg_types = 0;
- break;
-
- default:
-
- /*
- * Op is not a constant or string, append each argument
- * to the Op
- */
- while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
- !walk_state->arg_count) {
- walk_state->aml_offset = (u32)
- ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
-
- status = acpi_ps_get_next_arg (walk_state, parser_state,
- GET_CURRENT_ARG_TYPE (walk_state->arg_types),
- &arg);
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
-
- if (arg) {
- arg->common.aml_offset = walk_state->aml_offset;
- acpi_ps_append_arg (op, arg);
- }
- INCREMENT_ARG_LIST (walk_state->arg_types);
- }
-
- /* Special processing for certain opcodes */
-
- switch (op->common.aml_opcode) {
- case AML_METHOD_OP:
-
- /*
- * Skip parsing of control method
- * because we don't have enough info in the first pass
- * to parse it correctly.
- *
- * Save the length and address of the body
- */
- op->named.data = parser_state->aml;
- op->named.length = (u32) (parser_state->pkg_end -
- parser_state->aml);
-
- /* Skip body of method */
-
- parser_state->aml = parser_state->pkg_end;
- walk_state->arg_count = 0;
- break;
-
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- if ((op->common.parent) &&
- (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
- (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
- /*
- * Skip parsing of Buffers and Packages
- * because we don't have enough info in the first pass
- * to parse them correctly.
- */
- op->named.data = aml_op_start;
- op->named.length = (u32) (parser_state->pkg_end -
- aml_op_start);
-
- /* Skip body */
-
- parser_state->aml = parser_state->pkg_end;
- walk_state->arg_count = 0;
- }
- break;
-
- case AML_WHILE_OP:
-
- if (walk_state->control_state) {
- walk_state->control_state->control.package_end =
- parser_state->pkg_end;
- }
- break;
-
- default:
-
- /* No action for all other opcodes */
- break;
- }
- break;
- }
- }
-
- /* Check for arguments that need to be processed */
-
- if (walk_state->arg_count) {
- /*
- * There are arguments (complex ones), push Op and
- * prepare for argument
- */
- status = acpi_ps_push_scope (parser_state, op,
- walk_state->arg_types, walk_state->arg_count);
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
- op = NULL;
- continue;
- }
-
- /*
- * All arguments have been processed -- Op is complete,
- * prepare for next
- */
- walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- if (walk_state->op_info->flags & AML_NAMED) {
- if (acpi_gbl_depth) {
- acpi_gbl_depth--;
- }
-
- if (op->common.aml_opcode == AML_REGION_OP) {
- /*
- * Skip parsing of control method or opregion body,
- * because we don't have enough info in the first pass
- * to parse them correctly.
- *
- * Completed parsing an op_region declaration, we now
- * know the length.
- */
- op->named.length = (u32) (parser_state->aml - op->named.data);
- }
- }
-
- if (walk_state->op_info->flags & AML_CREATE) {
- /*
- * Backup to beginning of create_xXXfield declaration (1 for
- * Opcode)
- *
- * body_length is unknown until we parse the body
- */
- op->named.length = (u32) (parser_state->aml - op->named.data);
- }
-
- /* This op complete, notify the dispatcher */
-
- if (walk_state->ascending_callback != NULL) {
- walk_state->op = op;
- walk_state->opcode = op->common.aml_opcode;
-
- status = walk_state->ascending_callback (walk_state);
- status = acpi_ps_next_parse_state (walk_state, op, status);
- if (status == AE_CTRL_PENDING) {
- status = AE_OK;
- goto close_this_op;
- }
- }
-
-
-close_this_op:
- /*
- * Finished one argument of the containing scope
- */
- parser_state->scope->parse_scope.arg_count--;
-
- /* Close this Op (will result in parse subtree deletion) */
-
- acpi_ps_complete_this_op (walk_state, op);
- op = NULL;
- if (pre_op) {
- acpi_ps_free_op (pre_op);
- pre_op = NULL;
- }
-
- switch (status) {
- case AE_OK:
- break;
-
-
- case AE_CTRL_TRANSFER:
-
- /* We are about to transfer to a called method. */
-
- walk_state->prev_op = op;
- walk_state->prev_arg_types = walk_state->arg_types;
- return_ACPI_STATUS (status);
-
-
- case AE_CTRL_END:
-
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
-
- if (op) {
- walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- walk_state->opcode = op->common.aml_opcode;
-
- status = walk_state->ascending_callback (walk_state);
- status = acpi_ps_next_parse_state (walk_state, op, status);
-
- acpi_ps_complete_this_op (walk_state, op);
- op = NULL;
- }
- status = AE_OK;
- break;
-
-
- case AE_CTRL_BREAK:
- case AE_CTRL_CONTINUE:
-
- /* Pop off scopes until we find the While */
-
- while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
- }
-
- /* Close this iteration of the While loop */
-
- walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- walk_state->opcode = op->common.aml_opcode;
-
- status = walk_state->ascending_callback (walk_state);
- status = acpi_ps_next_parse_state (walk_state, op, status);
-
- acpi_ps_complete_this_op (walk_state, op);
- op = NULL;
-
- status = AE_OK;
- break;
-
-
- case AE_CTRL_TERMINATE:
-
- status = AE_OK;
-
- /* Clean up */
- do {
- if (op) {
- acpi_ps_complete_this_op (walk_state, op);
- }
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
-
- } while (op);
-
- return_ACPI_STATUS (status);
-
-
- default: /* All other non-AE_OK status */
-
- do {
- if (op) {
- acpi_ps_complete_this_op (walk_state, op);
- }
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
-
- } while (op);
-
-
- /*
- * TBD: Cleanup parse ops on error
- */
-#if 0
- if (op == NULL) {
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
- }
-#endif
- walk_state->prev_op = op;
- walk_state->prev_arg_types = walk_state->arg_types;
- return_ACPI_STATUS (status);
- }
-
- /* This scope complete? */
-
- if (acpi_ps_has_completed_scope (parser_state)) {
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
- }
- else {
- op = NULL;
- }
-
- } /* while parser_state->Aml */
-
-
- /*
- * Complete the last Op (if not completed), and clear the scope stack.
- * It is easily possible to end an AML "package" with an unbounded number
- * of open scopes (such as when several ASL blocks are closed with
- * sequential closing braces). We want to terminate each one cleanly.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
- do {
- if (op) {
- if (walk_state->ascending_callback != NULL) {
- walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- walk_state->opcode = op->common.aml_opcode;
-
- status = walk_state->ascending_callback (walk_state);
- status = acpi_ps_next_parse_state (walk_state, op, status);
- if (status == AE_CTRL_PENDING) {
- status = AE_OK;
- goto close_this_op;
- }
-
- if (status == AE_CTRL_TERMINATE) {
- status = AE_OK;
-
- /* Clean up */
- do {
- if (op) {
- acpi_ps_complete_this_op (walk_state, op);
- }
-
- acpi_ps_pop_scope (parser_state, &op,
- &walk_state->arg_types, &walk_state->arg_count);
-
- } while (op);
-
- return_ACPI_STATUS (status);
- }
-
- else if (ACPI_FAILURE (status)) {
- acpi_ps_complete_this_op (walk_state, op);
- return_ACPI_STATUS (status);
- }
- }
-
- acpi_ps_complete_this_op (walk_state, op);
- }
-
- acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
- &walk_state->arg_count);
-
- } while (op);
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: acpi_ps_parse_aml
*
* PARAMETERS: walk_state - Current state
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index a10f88715d43..4221b41ae1a6 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -154,12 +154,14 @@ acpi_ps_alloc_op (
if (flags == ACPI_PARSEOP_GENERIC) {
/* The generic op (default) is by far the most common (16 to 1) */
- op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
+ op = acpi_os_acquire_object (acpi_gbl_ps_node_cache);
+ memset(op, 0, sizeof(struct acpi_parse_obj_common));
}
else {
/* Extended parseop */
- op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
+ op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache);
+ memset(op, 0, sizeof(struct acpi_parse_obj_named));
}
/* Initialize the Op */
@@ -198,41 +200,14 @@ acpi_ps_free_op (
}
if (op->common.flags & ACPI_PARSEOP_GENERIC) {
- acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
+ (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op);
}
else {
- acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
+ (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
}
}
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION: acpi_ps_delete_parse_cache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Free all objects that are on the parse cache list.
- *
- ******************************************************************************/
-
-void
-acpi_ps_delete_parse_cache (
- void)
-{
- ACPI_FUNCTION_TRACE ("ps_delete_parse_cache");
-
-
- acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
- acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT);
- return_VOID;
-}
-#endif
-
-
/*******************************************************************************
*
* FUNCTION: Utility functions
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index dba893648e84..d1541fabaf0a 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -46,19 +46,30 @@
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psxface")
+/* Local Prototypes */
+
+static acpi_status
+acpi_ps_execute_pass (
+ struct acpi_parameter_info *info);
+
+static void
+acpi_ps_update_parameter_list (
+ struct acpi_parameter_info *info,
+ u16 action);
+
/*******************************************************************************
*
- * FUNCTION: acpi_psx_execute
+ * FUNCTION: acpi_ps_execute_method
*
* PARAMETERS: Info - Method info block, contains:
* Node - Method Node to execute
+ * obj_desc - Method object
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
@@ -67,6 +78,7 @@
* parameter_type - Type of Parameter list
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
+ * pass_number - Parse or execute pass
*
* RETURN: Status
*
@@ -75,171 +87,194 @@
******************************************************************************/
acpi_status
-acpi_psx_execute (
+acpi_ps_execute_method (
struct acpi_parameter_info *info)
{
acpi_status status;
- union acpi_operand_object *obj_desc;
- u32 i;
- union acpi_parse_object *op;
- struct acpi_walk_state *walk_state;
- ACPI_FUNCTION_TRACE ("psx_execute");
+ ACPI_FUNCTION_TRACE ("ps_execute_method");
- /* Validate the Node and get the attached object */
+ /* Validate the Info and method Node */
if (!info || !info->node) {
return_ACPI_STATUS (AE_NULL_ENTRY);
}
- obj_desc = acpi_ns_get_attached_object (info->node);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
-
/* Init for new method, wait on concurrency semaphore */
- status = acpi_ds_begin_method_execution (info->node, obj_desc, NULL);
+ status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- if ((info->parameter_type == ACPI_PARAM_ARGS) &&
- (info->parameters)) {
- /*
- * The caller "owns" the parameters, so give each one an extra
- * reference
- */
- for (i = 0; info->parameters[i]; i++) {
- acpi_ut_add_reference (info->parameters[i]);
- }
- }
-
- /*
- * 1) Perform the first pass parse of the method to enter any
- * named objects that it creates into the namespace
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** Begin Method Parse **** Entry=%p obj=%p\n",
- info->node, obj_desc));
-
- /* Create and init a Root Node */
-
- op = acpi_ps_create_scope_op ();
- if (!op) {
- status = AE_NO_MEMORY;
- goto cleanup1;
- }
-
/*
* Get a new owner_id for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
- obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
-
- /* Create and initialize a new walk state */
-
- walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
- NULL, NULL, NULL);
- if (!walk_state) {
- status = AE_NO_MEMORY;
- goto cleanup2;
- }
-
- status = acpi_ds_init_aml_walk (walk_state, op, info->node,
- obj_desc->method.aml_start,
- obj_desc->method.aml_length, NULL, 1);
+ status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
- goto cleanup3;
+ return_ACPI_STATUS (status);
}
- /* Parse the AML */
+ /*
+ * The caller "owns" the parameters, so give each one an extra
+ * reference
+ */
+ acpi_ps_update_parameter_list (info, REF_INCREMENT);
- status = acpi_ps_parse_aml (walk_state);
- acpi_ps_delete_parse_tree (op);
+ /*
+ * 1) Perform the first pass parse of the method to enter any
+ * named objects that it creates into the namespace
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "**** Begin Method Parse **** Entry=%p obj=%p\n",
+ info->node, info->obj_desc));
+
+ info->pass_number = 1;
+ status = acpi_ps_execute_pass (info);
if (ACPI_FAILURE (status)) {
- goto cleanup1; /* Walk state is already deleted */
+ goto cleanup;
}
/*
- * 2) Execute the method. Performs second pass parse simultaneously
+ * 2) Execute the method. Performs second pass parse simultaneously
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Execution **** Entry=%p obj=%p\n",
- info->node, obj_desc));
+ info->node, info->obj_desc));
- /* Create and init a Root Node */
+ info->pass_number = 3;
+ status = acpi_ps_execute_pass (info);
- op = acpi_ps_create_scope_op ();
- if (!op) {
- status = AE_NO_MEMORY;
- goto cleanup1;
+
+cleanup:
+ if (info->obj_desc->method.owner_id) {
+ acpi_ut_release_owner_id (&info->obj_desc->method.owner_id);
}
- /* Init new op with the method name and pointer back to the NS node */
+ /* Take away the extra reference that we gave the parameters above */
- acpi_ps_set_name (op, info->node->name.integer);
- op->common.node = info->node;
+ acpi_ps_update_parameter_list (info, REF_DECREMENT);
- /* Create and initialize a new walk state */
+ /* Exit now if error above */
- walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
- if (!walk_state) {
- status = AE_NO_MEMORY;
- goto cleanup2;
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- status = acpi_ds_init_aml_walk (walk_state, op, info->node,
- obj_desc->method.aml_start,
- obj_desc->method.aml_length, info, 3);
- if (ACPI_FAILURE (status)) {
- goto cleanup3;
+ /*
+ * If the method has returned an object, signal this to the caller with
+ * a control exception code
+ */
+ if (info->return_object) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
+ info->return_object));
+ ACPI_DUMP_STACK_ENTRY (info->return_object);
+
+ status = AE_CTRL_RETURN_VALUE;
}
- /* The walk of the parse tree is where we actually execute the method */
+ return_ACPI_STATUS (status);
+}
- status = acpi_ps_parse_aml (walk_state);
- goto cleanup2; /* Walk state already deleted */
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ps_update_parameter_list
+ *
+ * PARAMETERS: Info - See struct acpi_parameter_info
+ * (Used: parameter_type and Parameters)
+ * Action - Add or Remove reference
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Update reference count on all method parameter objects
+ *
+ ******************************************************************************/
-cleanup3:
- acpi_ds_delete_walk_state (walk_state);
+static void
+acpi_ps_update_parameter_list (
+ struct acpi_parameter_info *info,
+ u16 action)
+{
+ acpi_native_uint i;
-cleanup2:
- acpi_ps_delete_parse_tree (op);
-cleanup1:
if ((info->parameter_type == ACPI_PARAM_ARGS) &&
(info->parameters)) {
- /* Take away the extra reference that we gave the parameters above */
+ /* Update reference count for each parameter */
for (i = 0; info->parameters[i]; i++) {
/* Ignore errors, just do them all */
- (void) acpi_ut_update_object_reference (
- info->parameters[i], REF_DECREMENT);
+ (void) acpi_ut_update_object_reference (info->parameters[i], action);
}
}
+}
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ps_execute_pass
+ *
+ * PARAMETERS: Info - See struct acpi_parameter_info
+ * (Used: pass_number, Node, and obj_desc)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Single AML pass: Parse or Execute a control method
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ps_execute_pass (
+ struct acpi_parameter_info *info)
+{
+ acpi_status status;
+ union acpi_parse_object *op;
+ struct acpi_walk_state *walk_state;
+
+
+ ACPI_FUNCTION_TRACE ("ps_execute_pass");
+
+
+ /* Create and init a Root Node */
+
+ op = acpi_ps_create_scope_op ();
+ if (!op) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /*
- * If the method has returned an object, signal this to the caller with
- * a control exception code
- */
- if (info->return_object) {
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
- info->return_object));
- ACPI_DUMP_STACK_ENTRY (info->return_object);
+ /* Create and initialize a new walk state */
- status = AE_CTRL_RETURN_VALUE;
+ walk_state = acpi_ds_create_walk_state (
+ info->obj_desc->method.owner_id, NULL, NULL, NULL);
+ if (!walk_state) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ status = acpi_ds_init_aml_walk (walk_state, op, info->node,
+ info->obj_desc->method.aml_start,
+ info->obj_desc->method.aml_length,
+ info->pass_number == 1 ? NULL : info,
+ info->pass_number);
+ if (ACPI_FAILURE (status)) {
+ acpi_ds_delete_walk_state (walk_state);
+ goto cleanup;
}
+ /* Parse the AML */
+
+ status = acpi_ps_parse_aml (walk_state);
+
+ /* Walk state was deleted by parse_aml */
+
+cleanup:
+ acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index 1935dab2ab51..2c3bb8c35741 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -48,6 +48,9 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsdump")
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
/* Local prototypes */
static void
@@ -103,7 +106,6 @@ acpi_rs_dump_vendor_specific (
union acpi_resource_data *data);
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_irq
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
index 92e0c31539be..d4ff71f5fe5d 100644
--- a/drivers/acpi/tables/tbconvrt.c
+++ b/drivers/acpi/tables/tbconvrt.c
@@ -97,7 +97,9 @@ acpi_tb_get_table_count (
ACPI_FUNCTION_ENTRY ();
- if (RSDP->revision < 2) {
+ /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
pointer_size = sizeof (u32);
}
else {
@@ -158,7 +160,9 @@ acpi_tb_convert_to_xsdt (
/* Copy the table pointers */
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
- if (acpi_gbl_RSDP->revision < 2) {
+ /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
(ACPI_CAST_PTR (struct rsdt_descriptor_rev1,
table_info->pointer))->table_offset_entry[i]);
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 629b64c8193d..698799901f55 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -124,9 +124,7 @@ acpi_tb_match_signature (
*
* RETURN: Status
*
- * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must
- * already be loaded and validated.
- * Install the table into the global data structs.
+ * DESCRIPTION: Install the table into the global data structures.
*
******************************************************************************/
@@ -136,6 +134,7 @@ acpi_tb_install_table (
{
acpi_status status;
+
ACPI_FUNCTION_TRACE ("tb_install_table");
@@ -143,22 +142,33 @@ acpi_tb_install_table (
status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
- table_info->pointer->signature, acpi_format_exception (status)));
+ ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
+ /*
+ * Ignore a table that is already installed. For example, some BIOS
+ * ASL code will repeatedly attempt to load the same SSDT.
+ */
+ status = acpi_tb_is_table_installed (table_info);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
/* Install the table into the global data structure */
status = acpi_tb_init_table_descriptor (table_info->type, table_info);
if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n",
+ ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n",
table_info->pointer->signature, acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
acpi_gbl_table_data[table_info->type].name, table_info->pointer));
+
+unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (status);
}
@@ -251,6 +261,7 @@ acpi_tb_init_table_descriptor (
{
struct acpi_table_list *list_head;
struct acpi_table_desc *table_desc;
+ acpi_status status;
ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
@@ -263,6 +274,13 @@ acpi_tb_init_table_descriptor (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Get a new owner ID for the table */
+
+ status = acpi_ut_allocate_owner_id (&table_desc->owner_id);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
/* Install the table into the global data structure */
list_head = &acpi_gbl_table_lists[table_type];
@@ -325,8 +343,6 @@ acpi_tb_init_table_descriptor (
table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
table_desc->aml_length = (u32) (table_desc->length -
(u32) sizeof (struct acpi_table_header));
- table_desc->table_id = acpi_ut_allocate_owner_id (
- ACPI_OWNER_TYPE_TABLE);
table_desc->loaded_into_namespace = FALSE;
/*
@@ -339,7 +355,7 @@ acpi_tb_init_table_descriptor (
/* Return Data */
- table_info->table_id = table_desc->table_id;
+ table_info->owner_id = table_desc->owner_id;
table_info->installed_desc = table_desc;
return_ACPI_STATUS (AE_OK);
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index b7ffe39c3626..069d498465d0 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -96,32 +96,13 @@ acpi_tb_verify_rsdp (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /*
- * The signature and checksum must both be correct
- */
- if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
- /* Nope, BAD Signature */
-
- status = AE_BAD_SIGNATURE;
- goto cleanup;
- }
-
- /* Check the standard checksum */
+ /* Verify RSDP signature and checksum */
- if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
- status = AE_BAD_CHECKSUM;
+ status = acpi_tb_validate_rsdp (rsdp);
+ if (ACPI_FAILURE (status)) {
goto cleanup;
}
- /* Check extended checksum if table version >= 2 */
-
- if (rsdp->revision >= 2) {
- if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
- status = AE_BAD_CHECKSUM;
- goto cleanup;
- }
- }
-
/* The RSDP supplied is OK */
table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp);
@@ -159,8 +140,8 @@ cleanup:
*
* RETURN: None, Address
*
- * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
- * version of the RSDP
+ * DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the
+ * version of the RSDP and whether the XSDT pointer is valid
*
******************************************************************************/
@@ -174,16 +155,19 @@ acpi_tb_get_rsdt_address (
out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
- /*
- * For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 (and above), we use the XSDT
- */
- if (acpi_gbl_RSDP->revision < 2) {
- out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
- }
- else {
+ /* Use XSDT if it is present */
+
+ if ((acpi_gbl_RSDP->revision >= 2) &&
+ acpi_gbl_RSDP->xsdt_physical_address) {
out_address->pointer.value =
acpi_gbl_RSDP->xsdt_physical_address;
+ acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT;
+ }
+ else {
+ /* No XSDT, use the RSDT */
+
+ out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
+ acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT;
}
}
@@ -211,10 +195,9 @@ acpi_tb_validate_rsdt (
/*
- * For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 and above, we use the XSDT
+ * Search for appropriate signature, RSDT or XSDT
*/
- if (acpi_gbl_RSDP->revision < 2) {
+ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG,
sizeof (RSDT_SIG) -1);
}
@@ -236,11 +219,11 @@ acpi_tb_validate_rsdt (
acpi_gbl_RSDP->rsdt_physical_address,
(void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address));
- if (acpi_gbl_RSDP->revision < 2) {
- ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n"))
+ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+ ACPI_REPORT_ERROR (("Looking for RSDT\n"))
}
else {
- ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n"))
+ ACPI_REPORT_ERROR (("Looking for XSDT\n"))
}
ACPI_DUMP_BUFFER ((char *) table_ptr, 48);
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index e69d01d443d2..6fc1e36e6042 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -61,6 +61,67 @@ acpi_tb_handle_to_object (
/*******************************************************************************
*
+ * FUNCTION: acpi_tb_is_table_installed
+ *
+ * PARAMETERS: new_table_desc - Descriptor for new table being installed
+ *
+ * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed
+ *
+ * DESCRIPTION: Determine if an ACPI table is already installed
+ *
+ * MUTEX: Table data structures should be locked
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_is_table_installed (
+ struct acpi_table_desc *new_table_desc)
+{
+ struct acpi_table_desc *table_desc;
+
+
+ ACPI_FUNCTION_TRACE ("tb_is_table_installed");
+
+
+ /* Get the list descriptor and first table descriptor */
+
+ table_desc = acpi_gbl_table_lists[new_table_desc->type].next;
+
+ /* Examine all installed tables of this type */
+
+ while (table_desc) {
+ /* Compare Revision and oem_table_id */
+
+ if ((table_desc->loaded_into_namespace) &&
+ (table_desc->pointer->revision ==
+ new_table_desc->pointer->revision) &&
+ (!ACPI_MEMCMP (table_desc->pointer->oem_table_id,
+ new_table_desc->pointer->oem_table_id, 8))) {
+ /* This table is already installed */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+ "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n",
+ new_table_desc->pointer->signature,
+ new_table_desc->pointer->revision,
+ new_table_desc->pointer->oem_table_id));
+
+ new_table_desc->owner_id = table_desc->owner_id;
+ new_table_desc->installed_desc = table_desc;
+
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
+ /* Get next table on the list */
+
+ table_desc = table_desc->next;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_tb_validate_table_header
*
* PARAMETERS: table_header - Logical pointer to the table
@@ -157,7 +218,7 @@ acpi_tb_verify_table_checksum (
/* Compute the checksum on the table */
- checksum = acpi_tb_checksum (table_header, table_header->length);
+ checksum = acpi_tb_generate_checksum (table_header, table_header->length);
/* Return the appropriate exception */
@@ -175,7 +236,7 @@ acpi_tb_verify_table_checksum (
/*******************************************************************************
*
- * FUNCTION: acpi_tb_checksum
+ * FUNCTION: acpi_tb_generate_checksum
*
* PARAMETERS: Buffer - Buffer to checksum
* Length - Size of the buffer
@@ -187,7 +248,7 @@ acpi_tb_verify_table_checksum (
******************************************************************************/
u8
-acpi_tb_checksum (
+acpi_tb_generate_checksum (
void *buffer,
u32 length)
{
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 0c0b9085dbeb..e18a05d1b9b3 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -182,10 +182,23 @@ acpi_load_table (
return_ACPI_STATUS (status);
}
+ /* Check signature for a valid table type */
+
+ status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
/* Install the new table into the local data structures */
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
+ if (status == AE_ALREADY_EXISTS) {
+ /* Table already exists, no error */
+
+ status = AE_OK;
+ }
+
/* Free table allocated by acpi_tb_get_table_body */
acpi_tb_delete_single_table (&table_info);
@@ -260,8 +273,8 @@ acpi_unload_table (
* "Scope" operator. Thus, we need to track ownership by an ID, not
* simply a position within the hierarchy
*/
- acpi_ns_delete_namespace_by_owner (table_desc->table_id);
-
+ acpi_ns_delete_namespace_by_owner (table_desc->owner_id);
+ acpi_ut_release_owner_id (&table_desc->owner_id);
table_desc = table_desc->next;
}
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index dc3c3f6a9f62..87dccdda9ae2 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -65,6 +65,51 @@ acpi_tb_scan_memory_for_rsdp (
/*******************************************************************************
*
+ * FUNCTION: acpi_tb_validate_rsdp
+ *
+ * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate the RSDP (ptr)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_validate_rsdp (
+ struct rsdp_descriptor *rsdp)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+ /* Nope, BAD Signature */
+
+ return (AE_BAD_SIGNATURE);
+ }
+
+ /* Check the standard checksum */
+
+ if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
+ return (AE_BAD_CHECKSUM);
+ }
+
+ /* Check extended checksum if table version >= 2 */
+
+ if ((rsdp->revision >= 2) &&
+ (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
+ return (AE_BAD_CHECKSUM);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_tb_find_table
*
* PARAMETERS: Signature - String with ACPI table signature
@@ -218,19 +263,11 @@ acpi_get_firmware_table (
acpi_gbl_RSDP = address.pointer.logical;
}
- /* The signature and checksum must both be correct */
-
- if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
- sizeof (RSDP_SIG)-1) != 0) {
- /* Nope, BAD Signature */
-
- return_ACPI_STATUS (AE_BAD_SIGNATURE);
- }
-
- if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
- /* Nope, BAD Checksum */
+ /* The RDSP signature and checksum must both be correct */
- return_ACPI_STATUS (AE_BAD_CHECKSUM);
+ status = acpi_tb_validate_rsdp (acpi_gbl_RSDP);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
}
@@ -287,9 +324,11 @@ acpi_get_firmware_table (
* requested table
*/
for (i = 0, j = 0; i < table_count; i++) {
- /* Get the next table pointer, handle RSDT vs. XSDT */
-
- if (acpi_gbl_RSDP->revision < 2) {
+ /*
+ * Get the next table pointer, handle RSDT vs. XSDT
+ * RSDT pointers are 32 bits, XSDT pointers are 64 bits
+ */
+ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
address.pointer.value = (ACPI_CAST_PTR (
RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i];
}
@@ -331,8 +370,10 @@ acpi_get_firmware_table (
cleanup:
- acpi_os_unmap_memory (rsdt_info->pointer,
- (acpi_size) rsdt_info->pointer->length);
+ if (rsdt_info->pointer) {
+ acpi_os_unmap_memory (rsdt_info->pointer,
+ (acpi_size) rsdt_info->pointer->length);
+ }
ACPI_MEM_FREE (rsdt_info);
if (header) {
@@ -410,9 +451,9 @@ acpi_tb_scan_memory_for_rsdp (
u8 *start_address,
u32 length)
{
+ acpi_status status;
u8 *mem_rover;
u8 *end_address;
- u8 checksum;
ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
@@ -424,45 +465,25 @@ acpi_tb_scan_memory_for_rsdp (
for (mem_rover = start_address; mem_rover < end_address;
mem_rover += ACPI_RSDP_SCAN_STEP) {
- /* The signature and checksum must both be correct */
-
- if (ACPI_STRNCMP ((char *) mem_rover,
- RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
- /* No signature match, keep looking */
-
- continue;
- }
-
- /* Signature matches, check the appropriate checksum */
-
- if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
- /* ACPI version 1.0 */
+ /* The RSDP signature and checksum must both be correct */
- checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
- }
- else {
- /* Post ACPI 1.0, use extended_checksum */
-
- checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
- }
-
- if (checksum == 0) {
- /* Checksum valid, we have found a valid RSDP */
+ status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover));
+ if (ACPI_SUCCESS (status)) {
+ /* Sig and checksum valid, we have found a real RSDP */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at physical address %p\n", mem_rover));
return_PTR (mem_rover);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Found an RSDP at physical address %p, but it has a bad checksum\n",
- mem_rover));
+ /* No sig match or bad checksum, keep searching */
}
/* Searched entire block, no RSDP was found */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Searched entire block, no valid RSDP was found.\n"));
+ "Searched entire block from %p, valid RSDP was not found\n",
+ start_address));
return_PTR (NULL);
}
@@ -550,7 +571,7 @@ acpi_tb_find_rsdp (
acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) {
- /* Found it, return the physical address */
+ /* Return the physical address */
physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -579,7 +600,7 @@ acpi_tb_find_rsdp (
acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
- /* Found it, return the physical address */
+ /* Return the physical address */
physical_address =
ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -610,7 +631,7 @@ acpi_tb_find_rsdp (
ACPI_PHYSADDR_TO_PTR (physical_address),
ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) {
- /* Found it, return the physical address */
+ /* Return the physical address */
table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
return_ACPI_STATUS (AE_OK);
@@ -630,8 +651,9 @@ acpi_tb_find_rsdp (
}
}
- /* RSDP signature was not found */
+ /* A valid RSDP was not found */
+ ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
return_ACPI_STATUS (AE_NOT_FOUND);
}
diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile
index 939c447dd52a..e87108b7338a 100644
--- a/drivers/acpi/utilities/Makefile
+++ b/drivers/acpi/utilities/Makefile
@@ -3,6 +3,6 @@
#
obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
- utcopy.o utdelete.o utglobal.o utmath.o utobject.o
+ utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o
EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index c4e7f989a2bd..78270f50e625 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -1,6 +1,6 @@
/******************************************************************************
*
- * Module Name: utalloc - local cache and memory allocation routines
+ * Module Name: utalloc - local memory allocation routines
*
*****************************************************************************/
@@ -52,12 +52,10 @@
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
static struct acpi_debug_mem_block *
acpi_ut_find_allocation (
- u32 list_id,
void *allocation);
static acpi_status
acpi_ut_track_allocation (
- u32 list_id,
struct acpi_debug_mem_block *address,
acpi_size size,
u8 alloc_type,
@@ -67,206 +65,118 @@ acpi_ut_track_allocation (
static acpi_status
acpi_ut_remove_allocation (
- u32 list_id,
struct acpi_debug_mem_block *address,
u32 component,
char *module,
u32 line);
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_release_to_cache
- *
- * PARAMETERS: list_id - Memory list/cache ID
- * Object - The object to be released
- *
- * RETURN: None
- *
- * DESCRIPTION: Release an object to the specified cache. If cache is full,
- * the object is deleted.
- *
- ******************************************************************************/
-
-void
-acpi_ut_release_to_cache (
- u32 list_id,
- void *object)
-{
- struct acpi_memory_list *cache_info;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- cache_info = &acpi_gbl_memory_lists[list_id];
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-
- /* If walk cache is full, just free this wallkstate object */
-
- if (cache_info->cache_depth >= cache_info->max_cache_depth) {
- ACPI_MEM_FREE (object);
- ACPI_MEM_TRACKING (cache_info->total_freed++);
- }
-
- /* Otherwise put this object back into the cache */
-
- else {
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
- return;
- }
-
- /* Mark the object as cached */
-
- ACPI_MEMSET (object, 0xCA, cache_info->object_size);
- ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED);
-
- /* Put the object at the head of the cache list */
-
- * (ACPI_CAST_INDIRECT_PTR (char,
- &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
- cache_info->list_head = object;
- cache_info->cache_depth++;
-
- (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
- }
-
-#else
-
- /* Object cache is disabled; just free the object */
-
- ACPI_MEM_FREE (object);
- ACPI_MEM_TRACKING (cache_info->total_freed++);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+static acpi_status
+acpi_ut_create_list (
+ char *list_name,
+ u16 object_size,
+ struct acpi_memory_list **return_cache);
#endif
-}
/*******************************************************************************
*
- * FUNCTION: acpi_ut_acquire_from_cache
+ * FUNCTION: acpi_ut_create_caches
*
- * PARAMETERS: list_id - Memory list ID
+ * PARAMETERS: None
*
- * RETURN: A requested object. NULL if the object could not be
- * allocated.
+ * RETURN: Status
*
- * DESCRIPTION: Get an object from the specified cache. If cache is empty,
- * the object is allocated.
+ * DESCRIPTION: Create all local caches
*
******************************************************************************/
-void *
-acpi_ut_acquire_from_cache (
- u32 list_id)
+acpi_status
+acpi_ut_create_caches (
+ void)
{
- struct acpi_memory_list *cache_info;
- void *object;
-
-
- ACPI_FUNCTION_NAME ("ut_acquire_from_cache");
+ acpi_status status;
- cache_info = &acpi_gbl_memory_lists[list_id];
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-#ifdef ACPI_ENABLE_OBJECT_CACHE
+ /* Memory allocation lists */
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
- return (NULL);
+ status = acpi_ut_create_list ("Acpi-Global", 0,
+ &acpi_gbl_global_list);
+ if (ACPI_FAILURE (status)) {
+ return (status);
}
- ACPI_MEM_TRACKING (cache_info->cache_requests++);
-
- /* Check the cache first */
-
- if (cache_info->list_head) {
- /* There is an object available, use it */
-
- object = cache_info->list_head;
- cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char,
- &(((char *) object)[cache_info->link_offset])));
-
- ACPI_MEM_TRACKING (cache_info->cache_hits++);
- cache_info->cache_depth--;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
- object, acpi_gbl_memory_lists[list_id].list_name));
+ status = acpi_ut_create_list ("Acpi-Namespace", sizeof (struct acpi_namespace_node),
+ &acpi_gbl_ns_node_list);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
#endif
- if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
- return (NULL);
- }
-
- /* Clear (zero) the previously used Object */
+ /* Object Caches, for frequently used objects */
- ACPI_MEMSET (object, 0, cache_info->object_size);
+ 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);
}
- else {
- /* The cache is empty, create a new object */
-
- /* Avoid deadlock with ACPI_MEM_CALLOCATE */
-
- if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
- return (NULL);
- }
-
- object = ACPI_MEM_CALLOCATE (cache_info->object_size);
- ACPI_MEM_TRACKING (cache_info->total_allocated++);
+ 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);
}
-#else
-
- /* Object cache is disabled; just allocate the object */
+ status = acpi_os_create_cache ("acpi_parse_ext", sizeof (struct acpi_parse_obj_named),
+ ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
- object = ACPI_MEM_CALLOCATE (cache_info->object_size);
- ACPI_MEM_TRACKING (cache_info->total_allocated++);
-#endif
+ 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);
+ }
- return (object);
+ return (AE_OK);
}
-#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
- * FUNCTION: acpi_ut_delete_generic_cache
+ * FUNCTION: acpi_ut_delete_caches
*
- * PARAMETERS: list_id - Memory list ID
+ * PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
- * DESCRIPTION: Free all objects within the requested cache.
+ * DESCRIPTION: Purge and delete all local caches
*
******************************************************************************/
-void
-acpi_ut_delete_generic_cache (
- u32 list_id)
+acpi_status
+acpi_ut_delete_caches (
+ void)
{
- struct acpi_memory_list *cache_info;
- char *next;
+ (void) acpi_os_delete_cache (acpi_gbl_state_cache);
+ acpi_gbl_state_cache = NULL;
- ACPI_FUNCTION_ENTRY ();
-
+ (void) acpi_os_delete_cache (acpi_gbl_operand_cache);
+ acpi_gbl_operand_cache = NULL;
- cache_info = &acpi_gbl_memory_lists[list_id];
- while (cache_info->list_head) {
- /* Delete one cached state object */
+ (void) acpi_os_delete_cache (acpi_gbl_ps_node_cache);
+ acpi_gbl_ps_node_cache = NULL;
- next = *(ACPI_CAST_INDIRECT_PTR (char,
- &(((char *) cache_info->list_head)[cache_info->link_offset])));
- ACPI_MEM_FREE (cache_info->list_head);
+ (void) acpi_os_delete_cache (acpi_gbl_ps_node_ext_cache);
+ acpi_gbl_ps_node_ext_cache = NULL;
- cache_info->list_head = next;
- cache_info->cache_depth--;
- }
+ return (AE_OK);
}
-#endif
-
/*******************************************************************************
*
@@ -500,6 +410,43 @@ acpi_ut_callocate (
* occurs in the body of acpi_ut_free.
*/
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_create_list
+ *
+ * PARAMETERS: cache_name - Ascii name for the cache
+ * object_size - Size of each cached object
+ * return_cache - Where the new cache object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a local memory list for tracking purposed
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ut_create_list (
+ char *list_name,
+ u16 object_size,
+ struct acpi_memory_list **return_cache)
+{
+ struct acpi_memory_list *cache;
+
+
+ cache = acpi_os_allocate (sizeof (struct acpi_memory_list));
+ if (!cache) {
+ return (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list));
+
+ cache->list_name = list_name;
+ cache->object_size = object_size;
+
+ *return_cache = cache;
+ return (AE_OK);
+}
+
/*******************************************************************************
*
@@ -533,15 +480,15 @@ acpi_ut_allocate_and_track (
return (NULL);
}
- status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size,
+ status = acpi_ut_track_allocation (allocation, size,
ACPI_MEM_MALLOC, component, module, line);
if (ACPI_FAILURE (status)) {
acpi_os_free (allocation);
return (NULL);
}
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size;
+ acpi_gbl_global_list->total_allocated++;
+ acpi_gbl_global_list->current_total_size += (u32) size;
return ((void *) &allocation->user_space);
}
@@ -583,15 +530,15 @@ acpi_ut_callocate_and_track (
return (NULL);
}
- status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size,
+ status = acpi_ut_track_allocation (allocation, size,
ACPI_MEM_CALLOC, component, module, line);
if (ACPI_FAILURE (status)) {
acpi_os_free (allocation);
return (NULL);
}
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size;
+ acpi_gbl_global_list->total_allocated++;
+ acpi_gbl_global_list->current_total_size += (u32) size;
return ((void *) &allocation->user_space);
}
@@ -636,10 +583,10 @@ acpi_ut_free_and_track (
debug_block = ACPI_CAST_PTR (struct acpi_debug_mem_block,
(((char *) allocation) - sizeof (struct acpi_debug_mem_header)));
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size;
+ acpi_gbl_global_list->total_freed++;
+ acpi_gbl_global_list->current_total_size -= debug_block->size;
- status = acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block,
+ status = acpi_ut_remove_allocation (debug_block,
component, module, line);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n",
@@ -658,8 +605,7 @@ acpi_ut_free_and_track (
*
* FUNCTION: acpi_ut_find_allocation
*
- * PARAMETERS: list_id - Memory list to search
- * Allocation - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
*
* RETURN: A list element if found; NULL otherwise.
*
@@ -669,7 +615,6 @@ acpi_ut_free_and_track (
static struct acpi_debug_mem_block *
acpi_ut_find_allocation (
- u32 list_id,
void *allocation)
{
struct acpi_debug_mem_block *element;
@@ -678,11 +623,7 @@ acpi_ut_find_allocation (
ACPI_FUNCTION_ENTRY ();
- if (list_id > ACPI_MEM_LIST_MAX) {
- return (NULL);
- }
-
- element = acpi_gbl_memory_lists[list_id].list_head;
+ element = acpi_gbl_global_list->list_head;
/* Search for the address. */
@@ -702,8 +643,7 @@ acpi_ut_find_allocation (
*
* FUNCTION: acpi_ut_track_allocation
*
- * PARAMETERS: list_id - Memory list to search
- * Allocation - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Size - Size of the allocation
* alloc_type - MEM_MALLOC or MEM_CALLOC
* Component - Component type of caller
@@ -718,7 +658,6 @@ acpi_ut_find_allocation (
static acpi_status
acpi_ut_track_allocation (
- u32 list_id,
struct acpi_debug_mem_block *allocation,
acpi_size size,
u8 alloc_type,
@@ -734,11 +673,7 @@ acpi_ut_track_allocation (
ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation);
- if (list_id > ACPI_MEM_LIST_MAX) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- mem_list = &acpi_gbl_memory_lists[list_id];
+ mem_list = acpi_gbl_global_list;
status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
@@ -748,8 +683,7 @@ acpi_ut_track_allocation (
* Search list for this address to make sure it is not already on the list.
* This will catch several kinds of problems.
*/
-
- element = acpi_ut_find_allocation (list_id, allocation);
+ element = acpi_ut_find_allocation (allocation);
if (element) {
ACPI_REPORT_ERROR ((
"ut_track_allocation: Allocation already present in list! (%p)\n",
@@ -793,8 +727,7 @@ unlock_and_exit:
*
* FUNCTION: acpi_ut_remove_allocation
*
- * PARAMETERS: list_id - Memory list to search
- * Allocation - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
@@ -807,7 +740,6 @@ unlock_and_exit:
static acpi_status
acpi_ut_remove_allocation (
- u32 list_id,
struct acpi_debug_mem_block *allocation,
u32 component,
char *module,
@@ -820,11 +752,7 @@ acpi_ut_remove_allocation (
ACPI_FUNCTION_TRACE ("ut_remove_allocation");
- if (list_id > ACPI_MEM_LIST_MAX) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- mem_list = &acpi_gbl_memory_lists[list_id];
+ mem_list = acpi_gbl_global_list;
if (NULL == mem_list->list_head) {
/* No allocations! */
@@ -959,7 +887,7 @@ acpi_ut_dump_allocations (
return;
}
- element = acpi_gbl_memory_lists[0].list_head;
+ element = acpi_gbl_global_list->list_head;
while (element) {
if ((element->component & component) &&
((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) {
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
new file mode 100644
index 000000000000..c0df0585c683
--- /dev/null
+++ b/drivers/acpi/utilities/utcache.c
@@ -0,0 +1,328 @@
+/******************************************************************************
+ *
+ * Module Name: utcache - local cache allocation routines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * 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>
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utcache")
+
+
+#ifdef ACPI_USE_LOCAL_CACHE
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_create_cache
+ *
+ * PARAMETERS: cache_name - Ascii name for the cache
+ * object_size - Size of each cached object
+ * max_depth - Maximum depth of the cache (in objects)
+ * return_cache - Where the new cache object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a cache object
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_create_cache (
+ char *cache_name,
+ u16 object_size,
+ u16 max_depth,
+ struct acpi_memory_list **return_cache)
+{
+ struct acpi_memory_list *cache;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!cache_name || !return_cache || (object_size < 16)) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Create the cache object */
+
+ cache = acpi_os_allocate (sizeof (struct acpi_memory_list));
+ if (!cache) {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Populate the cache object and return it */
+
+ ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list));
+ cache->link_offset = 8;
+ cache->list_name = cache_name;
+ cache->object_size = object_size;
+ cache->max_depth = max_depth;
+
+ *return_cache = cache;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_purge_cache
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_purge_cache (
+ struct acpi_memory_list *cache)
+{
+ char *next;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!cache) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Walk the list of objects in this cache */
+
+ while (cache->list_head) {
+ /* Delete and unlink one cached state object */
+
+ next = *(ACPI_CAST_INDIRECT_PTR (char,
+ &(((char *) cache->list_head)[cache->link_offset])));
+ ACPI_MEM_FREE (cache->list_head);
+
+ cache->list_head = next;
+ cache->current_depth--;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_delete_cache
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache and delete the
+ * cache object.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_delete_cache (
+ struct acpi_memory_list *cache)
+{
+ acpi_status status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Purge all objects in the cache */
+
+ status = acpi_os_purge_cache (cache);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Now we can delete the cache object */
+
+ acpi_os_free (cache);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_release_object
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ * Object - The object to be released
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Release an object to the specified cache. If cache is full,
+ * the object is deleted.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_release_object (
+ struct acpi_memory_list *cache,
+ void *object)
+{
+ acpi_status status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!cache || !object) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* If cache is full, just free this object */
+
+ if (cache->current_depth >= cache->max_depth) {
+ ACPI_MEM_FREE (object);
+ ACPI_MEM_TRACKING (cache->total_freed++);
+ }
+
+ /* Otherwise put this object back into the cache */
+
+ else {
+ status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Mark the object as cached */
+
+ ACPI_MEMSET (object, 0xCA, cache->object_size);
+ ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED);
+
+ /* Put the object at the head of the cache list */
+
+ * (ACPI_CAST_INDIRECT_PTR (char,
+ &(((char *) object)[cache->link_offset]))) = cache->list_head;
+ cache->list_head = object;
+ cache->current_depth++;
+
+ (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_os_acquire_object
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: the acquired object. NULL on error
+ *
+ * DESCRIPTION: Get an object from the specified cache. If cache is empty,
+ * the object is allocated.
+ *
+ ******************************************************************************/
+
+void *
+acpi_os_acquire_object (
+ struct acpi_memory_list *cache)
+{
+ acpi_status status;
+ void *object;
+
+
+ ACPI_FUNCTION_NAME ("os_acquire_object");
+
+
+ if (!cache) {
+ return (NULL);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (status)) {
+ return (NULL);
+ }
+
+ ACPI_MEM_TRACKING (cache->requests++);
+
+ /* Check the cache first */
+
+ if (cache->list_head) {
+ /* There is an object available, use it */
+
+ object = cache->list_head;
+ cache->list_head = *(ACPI_CAST_INDIRECT_PTR (char,
+ &(((char *) object)[cache->link_offset])));
+
+ cache->current_depth--;
+
+ ACPI_MEM_TRACKING (cache->hits++);
+ ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Object %p from %s cache\n", object, cache->list_name)));
+
+ status = acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (status)) {
+ return (NULL);
+ }
+
+ /* Clear (zero) the previously used Object */
+
+ ACPI_MEMSET (object, 0, cache->object_size);
+ }
+ else {
+ /* The cache is empty, create a new object */
+
+ ACPI_MEM_TRACKING (cache->total_allocated++);
+
+ /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+
+ status = acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (status)) {
+ return (NULL);
+ }
+
+ object = ACPI_MEM_CALLOCATE (cache->object_size);
+ if (!object) {
+ return (NULL);
+ }
+ }
+
+ return (object);
+}
+#endif /* ACPI_USE_LOCAL_CACHE */
+
+
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 11e884957162..31c30a32e5c9 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -694,58 +694,50 @@ acpi_ut_copy_simple_object (
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:
-
- dest_desc->buffer.node = NULL;
- dest_desc->common.flags = source_desc->common.flags;
-
/*
* Allocate and copy the actual buffer if and only if:
* 1) There is a valid buffer pointer
- * 2) The buffer is not static (not in an ACPI table) (in this case,
- * the actual pointer was already copied above)
+ * 2) The buffer has a length > 0
*/
if ((source_desc->buffer.pointer) &&
- (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
- dest_desc->buffer.pointer = NULL;
-
- /* Create an actual buffer only if length > 0 */
-
- if (source_desc->buffer.length) {
- dest_desc->buffer.pointer =
- ACPI_MEM_ALLOCATE (source_desc->buffer.length);
- if (!dest_desc->buffer.pointer) {
- return (AE_NO_MEMORY);
- }
+ (source_desc->buffer.length)) {
+ dest_desc->buffer.pointer =
+ ACPI_MEM_ALLOCATE (source_desc->buffer.length);
+ if (!dest_desc->buffer.pointer) {
+ return (AE_NO_MEMORY);
+ }
- /* Copy the actual buffer data */
+ /* Copy the actual buffer data */
- ACPI_MEMCPY (dest_desc->buffer.pointer,
- source_desc->buffer.pointer,
- source_desc->buffer.length);
- }
+ 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
- * 2) The string is not static (not in an ACPI table) (in this case,
- * the actual pointer was already copied above)
+ * (Pointer to a NULL string is allowed)
*/
- if ((source_desc->string.pointer) &&
- (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+ if (source_desc->string.pointer) {
dest_desc->string.pointer =
ACPI_MEM_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);
}
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 794c7df3f2ad..c27cbb7f5c54 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -55,6 +55,12 @@ static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
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);
+
/*******************************************************************************
*
@@ -72,7 +78,7 @@ void
acpi_ut_init_stack_ptr_trace (
void)
{
- u32 current_sp;
+ u32 current_sp;
acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (&current_sp, NULL);
@@ -95,7 +101,7 @@ void
acpi_ut_track_stack_ptr (
void)
{
- acpi_size current_sp;
+ acpi_size current_sp;
current_sp = ACPI_PTR_DIFF (&current_sp, NULL);
@@ -112,14 +118,50 @@ acpi_ut_track_stack_ptr (
/*******************************************************************************
*
+ * 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 __FUNCTION__ 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_FUNCTION_PREFIX1) {
+ /* This is the case where the original source has not been modified */
+
+ return (function_name + 4);
+ }
+
+ if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX2) {
+ /* This is the case where the source has been 'linuxized' */
+
+ return (function_name + 5);
+ }
+
+ return (function_name);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_ut_debug_print
*
* PARAMETERS: requested_debug_level - Requested debug print level
* line_number - Caller's line number (for error output)
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * 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
*
@@ -134,7 +176,9 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
char *format,
...)
{
@@ -146,7 +190,7 @@ acpi_ut_debug_print (
* Stay silent if the debug level or component ID is disabled
*/
if (!(requested_debug_level & acpi_dbg_level) ||
- !(dbg_info->component_id & acpi_dbg_layer)) {
+ !(component_id & acpi_dbg_layer)) {
return;
}
@@ -169,14 +213,14 @@ acpi_ut_debug_print (
* 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 ", dbg_info->module_name, line_number);
+ acpi_os_printf ("%8s-%04ld ", module_name, line_number);
if (ACPI_LV_THREADS & acpi_dbg_level) {
acpi_os_printf ("[%04lX] ", thread_id);
}
acpi_os_printf ("[%02ld] %-22.22s: ",
- acpi_gbl_nesting_level, dbg_info->proc_name);
+ acpi_gbl_nesting_level, acpi_ut_trim_function_name (function_name));
va_start (args, format);
acpi_os_vprintf (format, args);
@@ -190,10 +234,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
*
* PARAMETERS: requested_debug_level - Requested debug print level
* line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * 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
*
@@ -208,7 +251,9 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print_raw (
u32 requested_debug_level,
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
char *format,
...)
{
@@ -216,7 +261,7 @@ acpi_ut_debug_print_raw (
if (!(requested_debug_level & acpi_dbg_level) ||
- !(dbg_info->component_id & acpi_dbg_layer)) {
+ !(component_id & acpi_dbg_layer)) {
return;
}
@@ -231,10 +276,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
* FUNCTION: acpi_ut_trace
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * function_name - Caller's procedure name
+ * module_name - Caller's module name
+ * component_id - Caller's component ID
*
* RETURN: None
*
@@ -246,14 +290,17 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
void
acpi_ut_trace (
u32 line_number,
- struct acpi_debug_print_info *dbg_info)
+ const char *function_name,
+ char *module_name,
+ u32 component_id)
{
acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr ();
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s\n", acpi_gbl_fn_entry_str);
+ acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+ line_number, function_name, module_name, component_id,
+ "%s\n", acpi_gbl_fn_entry_str);
}
EXPORT_SYMBOL(acpi_ut_trace);
@@ -263,10 +310,9 @@ EXPORT_SYMBOL(acpi_ut_trace);
* FUNCTION: acpi_ut_trace_ptr
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * function_name - Caller's procedure name
+ * module_name - Caller's module name
+ * component_id - Caller's component ID
* Pointer - Pointer to display
*
* RETURN: None
@@ -279,14 +325,17 @@ EXPORT_SYMBOL(acpi_ut_trace);
void
acpi_ut_trace_ptr (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
void *pointer)
{
acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr ();
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %p\n", acpi_gbl_fn_entry_str, pointer);
+ acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+ line_number, function_name, module_name, component_id,
+ "%s %p\n", acpi_gbl_fn_entry_str, pointer);
}
@@ -295,10 +344,9 @@ acpi_ut_trace_ptr (
* FUNCTION: acpi_ut_trace_str
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * 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
@@ -311,15 +359,18 @@ acpi_ut_trace_ptr (
void
acpi_ut_trace_str (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
char *string)
{
acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr ();
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %s\n", acpi_gbl_fn_entry_str, string);
+ acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+ line_number, function_name, module_name, component_id,
+ "%s %s\n", acpi_gbl_fn_entry_str, string);
}
@@ -328,10 +379,9 @@ acpi_ut_trace_str (
* FUNCTION: acpi_ut_trace_u32
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * function_name - Caller's procedure name
+ * module_name - Caller's module name
+ * component_id - Caller's component ID
* Integer - Integer to display
*
* RETURN: None
@@ -344,15 +394,18 @@ acpi_ut_trace_str (
void
acpi_ut_trace_u32 (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
u32 integer)
{
acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr ();
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %08X\n", acpi_gbl_fn_entry_str, integer);
+ acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+ line_number, function_name, module_name, component_id,
+ "%s %08X\n", acpi_gbl_fn_entry_str, integer);
}
@@ -361,10 +414,9 @@ acpi_ut_trace_u32 (
* FUNCTION: acpi_ut_exit
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * function_name - Caller's procedure name
+ * module_name - Caller's module name
+ * component_id - Caller's component ID
*
* RETURN: None
*
@@ -376,11 +428,14 @@ acpi_ut_trace_u32 (
void
acpi_ut_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info)
+ const char *function_name,
+ char *module_name,
+ u32 component_id)
{
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s\n", acpi_gbl_fn_exit_str);
+ acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+ line_number, function_name, module_name, component_id,
+ "%s\n", acpi_gbl_fn_exit_str);
acpi_gbl_nesting_level--;
}
@@ -392,10 +447,9 @@ EXPORT_SYMBOL(acpi_ut_exit);
* FUNCTION: acpi_ut_status_exit
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * function_name - Caller's procedure name
+ * module_name - Caller's module name
+ * component_id - Caller's component ID
* Status - Exit status code
*
* RETURN: None
@@ -408,19 +462,23 @@ EXPORT_SYMBOL(acpi_ut_exit);
void
acpi_ut_status_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
acpi_status status)
{
if (ACPI_SUCCESS (status)) {
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %s\n", acpi_gbl_fn_exit_str,
- acpi_format_exception (status));
+ acpi_ut_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_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
- acpi_format_exception (status));
+ acpi_ut_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--;
@@ -433,10 +491,9 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
* FUNCTION: acpi_ut_value_exit
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * 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
@@ -449,13 +506,16 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
void
acpi_ut_value_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
acpi_integer value)
{
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
- ACPI_FORMAT_UINT64 (value));
+ acpi_ut_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--;
}
@@ -467,10 +527,9 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
* FUNCTION: acpi_ut_ptr_exit
*
* PARAMETERS: line_number - Caller's line number
- * dbg_info - Contains:
- * proc_name - Caller's procedure name
- * module_name - Caller's module name
- * component_id - Caller's component ID
+ * function_name - Caller's procedure name
+ * module_name - Caller's module name
+ * component_id - Caller's component ID
* Ptr - Pointer to display
*
* RETURN: None
@@ -483,12 +542,15 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
void
acpi_ut_ptr_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
u8 *ptr)
{
- acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %p\n", acpi_gbl_fn_exit_str, ptr);
+ acpi_ut_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--;
}
@@ -549,7 +611,7 @@ acpi_ut_dump_buffer (
/* Dump fill spaces */
acpi_os_printf ("%*s", ((display * 2) + 1), " ");
- j += display;
+ j += (acpi_native_uint) display;
continue;
}
@@ -584,12 +646,12 @@ acpi_ut_dump_buffer (
break;
}
- j += display;
+ j += (acpi_native_uint) display;
}
/*
- * Print the ASCII equivalent characters
- * But watch out for the bad unprintable ones...
+ * 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++) {
@@ -599,9 +661,7 @@ acpi_ut_dump_buffer (
}
buf_char = buffer[i + j];
- if ((buf_char > 0x1F && buf_char < 0x2E) ||
- (buf_char > 0x2F && buf_char < 0x61) ||
- (buf_char > 0x60 && buf_char < 0x7F)) {
+ if (ACPI_IS_PRINT (buf_char)) {
acpi_os_printf ("%c", buf_char);
}
else {
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index bc5403022681..eeafb324c504 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -435,35 +435,24 @@ acpi_ut_update_object_reference (
union acpi_operand_object *object,
u16 action)
{
- acpi_status status;
- u32 i;
- union acpi_generic_state *state_list = NULL;
- union acpi_generic_state *state;
- union acpi_operand_object *tmp;
-
- ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object);
+ acpi_status status = AE_OK;
+ union acpi_generic_state *state_list = NULL;
+ union acpi_operand_object *next_object = NULL;
+ union acpi_generic_state *state;
+ acpi_native_uint i;
- /* Ignore a null object ptr */
-
- if (!object) {
- return_ACPI_STATUS (AE_OK);
- }
+ ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", 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);
- }
+ while (object) {
+ /* Make sure that this isn't a namespace handle */
- state = acpi_ut_create_update_state (object, action);
-
- while (state) {
- object = state->update.object;
- action = state->update.value;
- acpi_ut_delete_generic_state (state);
+ 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.
@@ -472,24 +461,14 @@ acpi_ut_update_object_reference (
switch (ACPI_GET_OBJECT_TYPE (object)) {
case ACPI_TYPE_DEVICE:
- tmp = object->device.system_notify;
- if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->device.system_notify = NULL;
- acpi_ut_update_ref_count (tmp, action);
-
- tmp = object->device.device_notify;
- if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->device.device_notify = NULL;
- acpi_ut_update_ref_count (tmp, action);
-
+ acpi_ut_update_ref_count (object->device.system_notify, action);
+ acpi_ut_update_ref_count (object->device.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, etc.
+ * 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++) {
/*
@@ -502,111 +481,52 @@ acpi_ut_update_object_reference (
if (ACPI_FAILURE (status)) {
goto error_exit;
}
-
- tmp = object->package.elements[i];
- if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->package.elements[i] = NULL;
}
break;
-
case ACPI_TYPE_BUFFER_FIELD:
- status = acpi_ut_create_update_state_and_push (
- object->buffer_field.buffer_obj, action, &state_list);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
-
- tmp = object->buffer_field.buffer_obj;
- if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->buffer_field.buffer_obj = NULL;
+ next_object = object->buffer_field.buffer_obj;
break;
-
case ACPI_TYPE_LOCAL_REGION_FIELD:
- status = acpi_ut_create_update_state_and_push (
- object->field.region_obj, action, &state_list);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
-
- tmp = object->field.region_obj;
- if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->field.region_obj = NULL;
- break;
-
+ next_object = object->field.region_obj;
+ break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
- status = acpi_ut_create_update_state_and_push (
- object->bank_field.bank_obj, action, &state_list);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
-
- tmp = object->bank_field.bank_obj;
- if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->bank_field.bank_obj = NULL;
-
+ 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;
}
-
- tmp = object->bank_field.region_obj;
- if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->bank_field.region_obj = NULL;
break;
-
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- status = acpi_ut_create_update_state_and_push (
- object->index_field.index_obj, action, &state_list);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
-
- tmp = object->index_field.index_obj;
- if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->index_field.index_obj = NULL;
-
+ 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;
}
-
- tmp = object->index_field.data_obj;
- if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
- object->index_field.data_obj = NULL;
break;
-
case ACPI_TYPE_LOCAL_REFERENCE:
-
/*
* The target of an Index (a package, string, or buffer) must track
* changes to the ref count of the index.
*/
if (object->reference.opcode == AML_INDEX_OP) {
- status = acpi_ut_create_update_state_and_push (
- object->reference.object, action, &state_list);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
+ next_object = object->reference.object;
}
break;
-
case ACPI_TYPE_REGION:
default:
-
- /* No subobjects */
- break;
+ break;/* No subobjects */
}
/*
@@ -615,15 +535,23 @@ acpi_ut_update_object_reference (
* main object to be deleted.
*/
acpi_ut_update_ref_count (object, action);
+ object = NULL;
/* Move on to the next object to be updated */
- state = acpi_ut_pop_generic_state (&state_list);
+ 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_REPORT_ERROR (("Could not update object reference count, %s\n",
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 4146019b543f..0e4161c81076 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -738,73 +738,6 @@ acpi_ut_valid_object_type (
/*******************************************************************************
*
- * FUNCTION: acpi_ut_allocate_owner_id
- *
- * PARAMETERS: id_type - Type of ID (method or table)
- *
- * DESCRIPTION: Allocate a table or method owner id
- *
- * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and
- * should be revisited (TBD)
- *
- ******************************************************************************/
-
-acpi_owner_id
-acpi_ut_allocate_owner_id (
- u32 id_type)
-{
- acpi_owner_id owner_id = 0xFFFF;
-
-
- ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
-
-
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES)))
- {
- return (0);
- }
-
- switch (id_type)
- {
- case ACPI_OWNER_TYPE_TABLE:
-
- owner_id = acpi_gbl_next_table_owner_id;
- acpi_gbl_next_table_owner_id++;
-
- /* Check for wraparound */
-
- if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID)
- {
- acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
- ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
- }
- break;
-
-
- case ACPI_OWNER_TYPE_METHOD:
-
- owner_id = acpi_gbl_next_method_owner_id;
- acpi_gbl_next_method_owner_id++;
-
- if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID)
- {
- /* Check for wraparound */
-
- acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
- }
- break;
-
- default:
- break;
- }
-
- (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
- return_VALUE (owner_id);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: acpi_ut_init_globals
*
* PARAMETERS: None
@@ -820,42 +753,20 @@ void
acpi_ut_init_globals (
void)
{
+ acpi_status status;
u32 i;
ACPI_FUNCTION_TRACE ("ut_init_globals");
- /* Memory allocation and cache lists */
-
- ACPI_MEMSET (acpi_gbl_memory_lists, 0, sizeof (struct acpi_memory_list) * ACPI_NUM_MEM_LISTS);
+ /* Create all memory caches */
- acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_generic_state *) NULL)->common.next), NULL);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_parse_object *) NULL)->common.next), NULL);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_parse_object *) NULL)->common.next), NULL);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_operand_object *) NULL)->cache.next), NULL);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset = (u16) ACPI_PTR_DIFF (&(((struct acpi_walk_state *) NULL)->next), NULL);
-
- acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].object_size = sizeof (struct acpi_namespace_node);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].object_size = sizeof (union acpi_generic_state);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].object_size = sizeof (struct acpi_parse_obj_common);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].object_size = sizeof (struct acpi_parse_obj_named);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size = sizeof (union acpi_operand_object);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size = sizeof (struct acpi_walk_state);
-
- acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth = ACPI_MAX_STATE_CACHE_DEPTH;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = ACPI_MAX_PARSE_CACHE_DEPTH;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = ACPI_MAX_OBJECT_CACHE_DEPTH;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth = ACPI_MAX_WALK_CACHE_DEPTH;
-
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name = "Global Memory Allocation");
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name = "Namespace Nodes");
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].list_name = "State Object Cache");
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].list_name = "Parse Node Cache");
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].list_name = "Extended Parse Node Cache");
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].list_name = "Operand Object Cache");
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].list_name = "Tree Walk Node Cache");
+ status = acpi_ut_create_caches ();
+ if (ACPI_FAILURE (status))
+ {
+ return;
+ }
/* ACPI table structure */
@@ -870,7 +781,7 @@ acpi_ut_init_globals (
for (i = 0; i < NUM_MUTEX; i++)
{
acpi_gbl_mutex_info[i].mutex = NULL;
- acpi_gbl_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
+ acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
acpi_gbl_mutex_info[i].use_count = 0;
}
@@ -911,8 +822,7 @@ acpi_ut_init_globals (
acpi_gbl_ns_lookup_count = 0;
acpi_gbl_ps_find_count = 0;
acpi_gbl_acpi_hardware_present = TRUE;
- acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
- acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
+ acpi_gbl_owner_id_mask = 0;
acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index 7f3713889ff0..fd7ceba83229 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -264,7 +264,7 @@ acpi_ut_subsystem_shutdown (
/* Purge the local caches */
- (void) acpi_purge_cached_objects ();
+ (void) acpi_ut_delete_caches ();
/* Debug only - display leftover memory allocation, if any */
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index f6de4ed3d527..1d350b302a34 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -49,15 +49,121 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utmisc")
-/* Local prototypes */
-static acpi_status
-acpi_ut_create_mutex (
- acpi_mutex_handle mutex_id);
+/*******************************************************************************
+ *
+ * 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)
+{
+ acpi_native_uint i;
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
-static acpi_status
-acpi_ut_delete_mutex (
- acpi_mutex_handle mutex_id);
+
+ /* 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 */
+
+ for (i = 0; i < 32; i++) {
+ if (!(acpi_gbl_owner_id_mask & (1 << i))) {
+ acpi_gbl_owner_id_mask |= (1 << i);
+ *owner_id = (acpi_owner_id) (i + 1);
+ goto exit;
+ }
+ }
+
+ /*
+ * If we are here, all owner_ids have been allocated. This probably should
+ * not happen since the IDs are reused after deallocation. The IDs are
+ * allocated upon table load (one per table) and method execution, and
+ * they are released when a table is unloaded or a method completes
+ * execution.
+ */
+ *owner_id = 0;
+ status = AE_OWNER_ID_LIMIT;
+ ACPI_REPORT_ERROR ((
+ "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
+
+exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_release_owner_id
+ *
+ * PARAMETERS: owner_id_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 - 32
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_release_owner_id (
+ acpi_owner_id *owner_id_ptr)
+{
+ acpi_owner_id owner_id = *owner_id_ptr;
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("ut_release_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) || (owner_id > 32)) {
+ ACPI_REPORT_ERROR (("Invalid owner_id: %2.2X\n", owner_id));
+ return_VOID;
+ }
+
+ /* Mutex for the global ID mask */
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (status)) {
+ return_VOID;
+ }
+
+ owner_id--; /* Normalize to zero */
+
+ /* Free the owner ID only if it is valid */
+
+ if (acpi_gbl_owner_id_mask & (1 << owner_id)) {
+ acpi_gbl_owner_id_mask ^= (1 << owner_id);
+ }
+
+ (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ return_VOID;
+}
/*******************************************************************************
@@ -66,7 +172,7 @@ acpi_ut_delete_mutex (
*
* PARAMETERS: src_string - The source string to convert
*
- * RETURN: Converted src_string (same as input pointer)
+ * RETURN: None
*
* DESCRIPTION: Convert string to uppercase
*
@@ -74,7 +180,7 @@ acpi_ut_delete_mutex (
*
******************************************************************************/
-char *
+void
acpi_ut_strupr (
char *src_string)
{
@@ -84,13 +190,17 @@ acpi_ut_strupr (
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 (src_string);
+ return;
}
@@ -543,320 +653,6 @@ error_exit:
/*******************************************************************************
*
- * 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 < NUM_MUTEX; i++) {
- status = acpi_ut_create_mutex (i);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
- }
-
- status = acpi_os_create_lock (&acpi_gbl_gpe_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 < NUM_MUTEX; i++) {
- (void) acpi_ut_delete_mutex (i);
- }
-
- acpi_os_delete_lock (acpi_gbl_gpe_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 > MAX_MUTEX) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (!acpi_gbl_mutex_info[mutex_id].mutex) {
- status = acpi_os_create_semaphore (1, 1,
- &acpi_gbl_mutex_info[mutex_id].mutex);
- acpi_gbl_mutex_info[mutex_id].owner_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_status status;
-
-
- ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id);
-
-
- if (mutex_id > MAX_MUTEX) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex);
-
- acpi_gbl_mutex_info[mutex_id].mutex = NULL;
- acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * 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;
- u32 this_thread_id;
-
-
- ACPI_FUNCTION_NAME ("ut_acquire_mutex");
-
-
- if (mutex_id > 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 < MAX_MUTEX; i++) {
- if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
- if (i == mutex_id) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] already acquired by this thread [%X]\n",
- acpi_ut_get_mutex_name (mutex_id), this_thread_id));
-
- return (AE_ALREADY_ACQUIRED);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
- this_thread_id, acpi_ut_get_mutex_name (i),
- acpi_ut_get_mutex_name (mutex_id)));
-
- return (AE_ACQUIRE_DEADLOCK);
- }
- }
- }
-#endif
-
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %X attempting to acquire Mutex [%s]\n",
- this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
-
- status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex,
- 1, ACPI_WAIT_FOREVER);
- if (ACPI_SUCCESS (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
- this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
-
- acpi_gbl_mutex_info[mutex_id].use_count++;
- acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id;
- }
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Thread %X could not acquire Mutex [%s] %s\n",
- this_thread_id, acpi_ut_get_mutex_name (mutex_id),
- acpi_format_exception (status)));
- }
-
- 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_status status;
- u32 i;
- u32 this_thread_id;
-
-
- ACPI_FUNCTION_NAME ("ut_release_mutex");
-
-
- this_thread_id = acpi_os_get_thread_id ();
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %X releasing Mutex [%s]\n", this_thread_id,
- acpi_ut_get_mutex_name (mutex_id)));
-
- if (mutex_id > MAX_MUTEX) {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Mutex must be acquired in order to release it!
- */
- if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] is not acquired, cannot release\n",
- acpi_ut_get_mutex_name (mutex_id)));
-
- return (AE_NOT_ACQUIRED);
- }
-
- /*
- * 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 < MAX_MUTEX; i++) {
- if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
- if (i == mutex_id) {
- continue;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid release order: owns [%s], releasing [%s]\n",
- acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id)));
-
- return (AE_RELEASE_DEADLOCK);
- }
- }
-
- /* Mark unlocked FIRST */
-
- acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
-
- status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
-
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Thread %X could not release Mutex [%s] %s\n",
- this_thread_id, acpi_ut_get_mutex_name (mutex_id),
- acpi_format_exception (status)));
- }
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
- this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
- }
-
- return (status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: acpi_ut_create_update_state_and_push
*
* PARAMETERS: Object - Object to be added to the new state
@@ -899,361 +695,6 @@ acpi_ut_create_update_state_and_push (
/*******************************************************************************
*
- * 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
- *
- ******************************************************************************/
-
-#ifdef ACPI_FUTURE_USAGE
-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);
-}
-#endif /* ACPI_FUTURE_USAGE */
-
-/*******************************************************************************
- *
- * 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_ut_acquire_from_cache (ACPI_MEM_LIST_STATE);
-
- /* Initialize */
-
- if (state) {
- state->common.data_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.data_type = ACPI_DESC_TYPE_STATE_THREAD;
- state->thread.thread_id = acpi_os_get_thread_id ();
-
- 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.data_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.data_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.data_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: Put a state object back into the global state cache. The object
- * is not actually freed at this time.
- *
- ******************************************************************************/
-
-void
-acpi_ut_delete_generic_state (
- union acpi_generic_state *state)
-{
- ACPI_FUNCTION_TRACE ("ut_delete_generic_state");
-
-
- acpi_ut_release_to_cache (ACPI_MEM_LIST_STATE, state);
- return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_generic_state_cache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-acpi_ut_delete_generic_state_cache (
- void)
-{
- ACPI_FUNCTION_TRACE ("ut_delete_generic_state_cache");
-
-
- acpi_ut_delete_generic_cache (ACPI_MEM_LIST_STATE);
- return_VOID;
-}
-#endif
-
-
-/*******************************************************************************
- *
* FUNCTION: acpi_ut_walk_package_tree
*
* PARAMETERS: source_object - The package to walk
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
new file mode 100644
index 000000000000..0699b6be62b6
--- /dev/null
+++ b/drivers/acpi/utilities/utmutex.c
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ *
+ * Module Name: utmutex - local mutex support
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * 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>
+
+#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 < NUM_MUTEX; i++) {
+ status = acpi_ut_create_mutex (i);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+
+ status = acpi_os_create_lock (&acpi_gbl_gpe_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 < NUM_MUTEX; i++) {
+ (void) acpi_ut_delete_mutex (i);
+ }
+
+ acpi_os_delete_lock (acpi_gbl_gpe_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 > MAX_MUTEX) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (!acpi_gbl_mutex_info[mutex_id].mutex) {
+ status = acpi_os_create_semaphore (1, 1,
+ &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_status status;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id);
+
+
+ if (mutex_id > MAX_MUTEX) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_os_delete_semaphore (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 (status);
+}
+
+
+/*******************************************************************************
+ *
+ * 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;
+ u32 this_thread_id;
+
+
+ ACPI_FUNCTION_NAME ("ut_acquire_mutex");
+
+
+ if (mutex_id > 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 < MAX_MUTEX; i++) {
+ if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
+ if (i == mutex_id) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Mutex [%s] already acquired by this thread [%X]\n",
+ acpi_ut_get_mutex_name (mutex_id), this_thread_id));
+
+ return (AE_ALREADY_ACQUIRED);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
+ this_thread_id, acpi_ut_get_mutex_name (i),
+ acpi_ut_get_mutex_name (mutex_id)));
+
+ return (AE_ACQUIRE_DEADLOCK);
+ }
+ }
+ }
+#endif
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %X attempting to acquire Mutex [%s]\n",
+ this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
+
+ status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex,
+ 1, ACPI_WAIT_FOREVER);
+ if (ACPI_SUCCESS (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
+ 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_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Thread %X could not acquire Mutex [%s] %s\n",
+ this_thread_id, acpi_ut_get_mutex_name (mutex_id),
+ acpi_format_exception (status)));
+ }
+
+ 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_status status;
+ u32 this_thread_id;
+
+
+ ACPI_FUNCTION_NAME ("ut_release_mutex");
+
+
+ this_thread_id = acpi_os_get_thread_id ();
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %X releasing Mutex [%s]\n", this_thread_id,
+ acpi_ut_get_mutex_name (mutex_id)));
+
+ if (mutex_id > 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_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Mutex [%s] is not acquired, cannot release\n",
+ acpi_ut_get_mutex_name (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 < MAX_MUTEX; i++) {
+ if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
+ if (i == mutex_id) {
+ continue;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid release order: owns [%s], releasing [%s]\n",
+ 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;
+
+ status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
+
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Thread %X could not release Mutex [%s] %s\n",
+ this_thread_id, acpi_ut_get_mutex_name (mutex_id),
+ acpi_format_exception (status)));
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
+ this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
+ }
+
+ return (status);
+}
+
+
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index cd3899b9cc5a..19178e142951 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -338,7 +338,7 @@ acpi_ut_allocate_object_desc_dbg (
ACPI_FUNCTION_TRACE ("ut_allocate_object_desc_dbg");
- object = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_OPERAND);
+ object = acpi_os_acquire_object (acpi_gbl_operand_cache);
if (!object) {
_ACPI_REPORT_ERROR (module_name, line_number, component_id,
("Could not allocate an object descriptor\n"));
@@ -347,7 +347,7 @@ acpi_ut_allocate_object_desc_dbg (
}
/* 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",
@@ -385,37 +385,9 @@ acpi_ut_delete_object_desc (
return_VOID;
}
- acpi_ut_release_to_cache (ACPI_MEM_LIST_OPERAND, object);
-
- return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_delete_object_cache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-acpi_ut_delete_object_cache (
- void)
-{
- ACPI_FUNCTION_TRACE ("ut_delete_object_cache");
-
-
- acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
+ (void) acpi_os_release_object (acpi_gbl_operand_cache, object);
return_VOID;
}
-#endif
/*******************************************************************************
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
new file mode 100644
index 000000000000..192e7ac95690
--- /dev/null
+++ b/drivers/acpi/utilities/utstate.c
@@ -0,0 +1,376 @@
+/*******************************************************************************
+ *
+ * Module Name: utstate - state object support procedures
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * 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>
+
+#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.data_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.data_type = ACPI_DESC_TYPE_STATE_THREAD;
+ state->thread.thread_id = acpi_os_get_thread_id ();
+
+ 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.data_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.data_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.data_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: Put a state object back into the global state cache. The object
+ * is not actually freed at this time.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_generic_state (
+ union acpi_generic_state *state)
+{
+ ACPI_FUNCTION_TRACE ("ut_delete_generic_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
index e8803d810656..850da6817423 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -46,8 +46,6 @@
#include <acpi/acpi.h>
#include <acpi/acevents.h>
#include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
-#include <acpi/acdispat.h>
#include <acpi/acdebug.h>
#define _COMPONENT ACPI_UTILITIES
@@ -79,11 +77,6 @@ acpi_initialize_subsystem (
ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ());
-
- /* Initialize all globals used by the subsystem */
-
- acpi_ut_init_globals ();
-
/* Initialize the OS-Dependent layer */
status = acpi_os_initialize ();
@@ -93,6 +86,10 @@ acpi_initialize_subsystem (
return_ACPI_STATUS (status);
}
+ /* Initialize all globals used by the subsystem */
+
+ acpi_ut_init_globals ();
+
/* Create the default mutex objects */
status = acpi_ut_mutex_initialize ();
@@ -522,13 +519,9 @@ acpi_purge_cached_objects (
{
ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects");
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
- acpi_ut_delete_generic_state_cache ();
- acpi_ut_delete_object_cache ();
- acpi_ds_delete_walk_state_cache ();
- acpi_ps_delete_parse_cache ();
-#endif
-
+ (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);
}
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 2f6ab189fc6f..d62af7293923 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -64,7 +64,7 @@
/* Version string */
-#define ACPI_CA_VERSION 0x20050408
+#define ACPI_CA_VERSION 0x20050729
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -78,11 +78,10 @@
/* Maximum objects in the various object caches */
-#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */
+#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
-#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
/*
* Should the subystem abort the loading of an ACPI table if the
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index 8ba372b0f245..f8fa2227583d 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -114,6 +114,10 @@ acpi_db_set_method_call_breakpoint (
union acpi_parse_object *op);
void
+acpi_db_get_bus_info (
+ void);
+
+void
acpi_db_disassemble_aml (
char *statements,
union acpi_parse_object *op);
@@ -327,7 +331,7 @@ acpi_db_set_output_destination (
u32 where);
void
-acpi_db_dump_object (
+acpi_db_dump_external_object (
union acpi_object *obj_desc,
u32 level);
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index dbfa877121ba..26325430db80 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -90,6 +90,7 @@ struct acpi_op_walk_info
{
u32 level;
u32 bit_offset;
+ struct acpi_walk_state *walk_state;
};
typedef
@@ -210,7 +211,7 @@ acpi_dm_byte_list (
union acpi_parse_object *op);
void
-acpi_is_eisa_id (
+acpi_dm_is_eisa_id (
union acpi_parse_object *op);
void
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 8f5f2f71b1de..90b7d30bd255 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -236,7 +236,7 @@ acpi_ds_method_data_init (
*/
acpi_status
acpi_ds_parse_method (
- acpi_handle obj_handle);
+ struct acpi_namespace_node *node);
acpi_status
acpi_ds_call_control_method (
@@ -391,7 +391,7 @@ acpi_ds_init_aml_walk (
u8 *aml_start,
u32 aml_length,
struct acpi_parameter_info *info,
- u32 pass_number);
+ u8 pass_number);
acpi_status
acpi_ds_obj_stack_pop_and_delete (
@@ -450,10 +450,4 @@ acpi_ds_result_pop_from_bottom (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ds_delete_walk_state_cache (
- void);
-#endif
-
#endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index 61a27c8c5079..33ae2ca997b7 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -122,8 +122,7 @@ acpi_ev_valid_gpe_event (
acpi_status
acpi_ev_walk_gpe_list (
- ACPI_GPE_CALLBACK gpe_walk_callback,
- u32 flags);
+ ACPI_GPE_CALLBACK gpe_walk_callback);
acpi_status
acpi_ev_delete_gpe_handlers (
@@ -136,7 +135,7 @@ acpi_ev_create_gpe_block (
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u8 gpe_block_base_number,
- u32 interrupt_level,
+ u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block);
acpi_status
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 60d737b2d70f..0a6f492f3c8e 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -95,8 +95,9 @@
#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
#define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL)
+#define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL)
-#define AE_CODE_ENV_MAX 0x001E
+#define AE_CODE_ENV_MAX 0x001F
/*
@@ -226,7 +227,8 @@ char const *acpi_gbl_exception_names_env[] =
"AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
- "AE_WAKE_ONLY_GPE"
+ "AE_WAKE_ONLY_GPE",
+ "AE_OWNER_ID_LIMIT"
};
char const *acpi_gbl_exception_names_pgm[] =
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 4946696088c3..e3cf16eadbed 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -151,6 +151,13 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
*/
+/* The root table can be either an RSDT or an XSDT */
+
+ACPI_EXTERN u8 acpi_gbl_root_table_type;
+#define ACPI_TABLE_TYPE_RSDT 'R'
+#define ACPI_TABLE_TYPE_XSDT 'X'
+
+
/*
* Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
* If we are executing a method that exists in a 32-bit ACPI table,
@@ -180,8 +187,23 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
*
****************************************************************************/
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Lists for tracking memory allocations */
+
+ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
+ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
+#endif
+
+/* Object caches */
+
+ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
+ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
+ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
+ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
+
+/* Global handlers */
-ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
@@ -189,14 +211,15 @@ ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
+/* Misc */
+
ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count;
ACPI_EXTERN u32 acpi_gbl_original_mode;
ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
ACPI_EXTERN u32 acpi_gbl_ps_find_count;
+ACPI_EXTERN u32 acpi_gbl_owner_id_mask;
ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
-ACPI_EXTERN u16 acpi_gbl_next_table_owner_id;
-ACPI_EXTERN u16 acpi_gbl_next_method_owner_id;
ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 9d63641b8e7d..cf5de4625a71 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -143,15 +143,15 @@ acpi_hw_get_gpe_status (
acpi_status
acpi_hw_disable_all_gpes (
- u32 flags);
+ void);
acpi_status
acpi_hw_enable_all_runtime_gpes (
- u32 flags);
+ void);
acpi_status
acpi_hw_enable_all_wakeup_gpes (
- u32 flags);
+ void);
acpi_status
acpi_hw_enable_runtime_gpe_block (
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 030e641115cb..4d2635698e10 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -56,6 +56,13 @@ typedef u32 acpi_mutex_handle;
#define AML_NUM_OPCODES 0x7F
+/* Forward declarations */
+
+struct acpi_walk_state ;
+struct acpi_obj_mutex;
+union acpi_parse_object ;
+
+
/*****************************************************************************
*
* Mutex typedefs and structs
@@ -116,19 +123,24 @@ static char *acpi_gbl_mutex_names[] =
#endif
+/* Owner IDs are used to track namespace nodes for selective deletion */
+
+typedef u8 acpi_owner_id;
+#define ACPI_OWNER_ID_MAX 0xFF
+
+/* This Thread ID means that the mutex is not in use (unlocked) */
+
+#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1
+
/* Table for the global mutexes */
struct acpi_mutex_info
{
acpi_mutex mutex;
u32 use_count;
- u32 owner_id;
+ u32 thread_id;
};
-/* This owner ID means that the mutex is not in use (unlocked) */
-
-#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1)
-
/* Lock flag parameter for various interfaces */
@@ -136,13 +148,6 @@ struct acpi_mutex_info
#define ACPI_MTX_LOCK 1
-typedef u16 acpi_owner_id;
-#define ACPI_OWNER_TYPE_TABLE 0x0
-#define ACPI_OWNER_TYPE_METHOD 0x1
-#define ACPI_FIRST_METHOD_ID 0x0001
-#define ACPI_FIRST_TABLE_ID 0xF000
-
-
/* Field access granularities */
#define ACPI_FIELD_BYTE_GRANULARITY 1
@@ -185,13 +190,20 @@ struct acpi_namespace_node
{
u8 descriptor; /* Used to differentiate object descriptor types */
u8 type; /* Type associated with this name */
- u16 owner_id;
+ u16 reference_count; /* Current count of references and children */
union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
struct acpi_namespace_node *child; /* First child */
struct acpi_namespace_node *peer; /* Next peer*/
- u16 reference_count; /* Current count of references and children */
+ u8 owner_id; /* Who created this node */
u8 flags;
+
+ /* Fields used by the ASL compiler only */
+
+#ifdef ACPI_ASL_COMPILER
+ u32 value;
+ union acpi_parse_object *op;
+#endif
};
@@ -222,7 +234,7 @@ struct acpi_table_desc
u64 physical_address;
u32 aml_length;
acpi_size length;
- acpi_owner_id table_id;
+ acpi_owner_id owner_id;
u8 type;
u8 allocation;
u8 loaded_into_namespace;
@@ -365,7 +377,7 @@ struct acpi_gpe_xrupt_info
struct acpi_gpe_xrupt_info *previous;
struct acpi_gpe_xrupt_info *next;
struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
- u32 interrupt_level; /* System interrupt level */
+ u32 interrupt_number; /* System interrupt number */
};
@@ -420,13 +432,6 @@ struct acpi_field_info
#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
-/* Forward declarations */
-
-struct acpi_walk_state ;
-struct acpi_obj_mutex;
-union acpi_parse_object ;
-
-
#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
u8 data_type; /* To differentiate various internal objs */\
u8 flags; \
@@ -737,6 +742,7 @@ struct acpi_parse_state
****************************************************************************/
#define PCI_ROOT_HID_STRING "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
struct acpi_bit_register_info
{
@@ -915,14 +921,6 @@ struct acpi_integrity_info
*
****************************************************************************/
-struct acpi_debug_print_info
-{
- u32 component_id;
- char *proc_name;
- char *module_name;
-};
-
-
/* Entry for a memory allocation (debug only) */
#define ACPI_MEM_MALLOC 0
@@ -952,24 +950,18 @@ struct acpi_debug_mem_block
#define ACPI_MEM_LIST_GLOBAL 0
#define ACPI_MEM_LIST_NSNODE 1
-
-#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2
-#define ACPI_MEM_LIST_STATE 2
-#define ACPI_MEM_LIST_PSNODE 3
-#define ACPI_MEM_LIST_PSNODE_EXT 4
-#define ACPI_MEM_LIST_OPERAND 5
-#define ACPI_MEM_LIST_WALK 6
-#define ACPI_MEM_LIST_MAX 6
-#define ACPI_NUM_MEM_LISTS 7
+#define ACPI_MEM_LIST_MAX 1
+#define ACPI_NUM_MEM_LISTS 2
struct acpi_memory_list
{
+ char *list_name;
void *list_head;
- u16 link_offset;
- u16 max_cache_depth;
- u16 cache_depth;
u16 object_size;
+ u16 max_depth;
+ u16 current_depth;
+ u16 link_offset;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
@@ -978,11 +970,9 @@ struct acpi_memory_list
u32 total_allocated;
u32 total_freed;
u32 current_total_size;
- u32 cache_requests;
- u32 cache_hits;
- char *list_name;
+ u32 requests;
+ u32 hits;
#endif
};
-
#endif /* __ACLOCAL_H__ */
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 09be937d2c39..fcdef0a4b01b 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -437,21 +437,22 @@
#define ACPI_PARAM_LIST(pl) pl
/*
- * Error reporting. These versions add callers module and line#. Since
- * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only
- * use it in debug mode.
+ * Error reporting. These versions add callers module and line#.
+ *
+ * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT
+ * isn't defined, only use it in debug mode.
*/
#ifdef ACPI_DEBUG_OUTPUT
-#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
+#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e);
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e);
#else
@@ -480,36 +481,58 @@
* Debug macros that are conditionally compiled
*/
#ifdef ACPI_DEBUG_OUTPUT
+#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name;
-#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
+/*
+ * Common parameters used for debug output functions:
+ * line number, function name, module(file) name, component ID
+ */
+#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
/*
- * Function entry tracing.
- * The first parameter should be the procedure name as a quoted string. This is declared
- * as a local string ("_proc_name) so that it can be also used by the function exit macros below.
+ * Function entry tracing
*/
-#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \
- _debug_info.component_id = _COMPONENT; \
- _debug_info.proc_name = a; \
- _debug_info.module_name = _THIS_MODULE;
-
-#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
- acpi_ut_trace(__LINE__,&_debug_info)
-#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
- acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
- acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b)
-#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
- acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b)
-
-#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
+
+/*
+ * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
+ * define it now. This is the case where there the compiler does not support
+ * a __FUNCTION__ macro or equivalent. We save the function name on the
+ * local stack.
+ */
+#ifndef ACPI_GET_FUNCTION_NAME
+#define ACPI_GET_FUNCTION_NAME _acpi_function_name
+/*
+ * The Name parameter should be the procedure name as a quoted string.
+ * This is declared as a local string ("my_function_name") so that it can
+ * be also used by the function exit macros below.
+ * Note: (const char) is used to be compatible with the debug interfaces
+ * and macros such as __FUNCTION__.
+ */
+#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name;
+
+#else
+/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
+
+#define ACPI_FUNCTION_NAME(name)
+#endif
+
+#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
+ acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
+#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
+ acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
+ acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
+ acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
/*
* Function exit tracing.
* WARNING: These macros include a return statement. This is usually considered
* bad form, but having a separate exit macro is very ugly and difficult to maintain.
* One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_proc_name" is defined.
+ * so that "_acpi_function_name" is defined.
*/
#ifdef ACPI_USE_DO_WHILE_0
#define ACPI_DO_WHILE0(a) do a while(0)
@@ -517,10 +540,10 @@
#define ACPI_DO_WHILE0(a) a
#endif
-#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;})
-#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));})
-#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));})
-#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));})
+#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;})
+#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));})
+#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));})
+#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));})
/* Conditional execution */
@@ -535,7 +558,7 @@
/* Stack and buffer dumping */
#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0)
-#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__)
#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
@@ -572,7 +595,7 @@
* leaving no executable debug code!
*/
#define ACPI_MODULE_NAME(name)
-#define _THIS_MODULE ""
+#define _acpi_module_name ""
#define ACPI_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
@@ -648,19 +671,18 @@
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_MEM_FREE(a) acpi_os_free(a)
#define ACPI_MEM_TRACKING(a)
-
#else
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index deb7cb06f5f0..280e9ed76674 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -78,6 +78,11 @@
#define ACPI_NS_ROOT_PATH "\\"
#define ACPI_NS_SYSTEM_BUS "_SB_"
+/*! [Begin] no source code translation (not handled by acpisrc) */
+#define ACPI_FUNCTION_PREFIX1 'ipcA'
+#define ACPI_FUNCTION_PREFIX2 'ipca'
+/*! [End] no source code translation !*/
+
#endif /* __ACNAMES_H__ */
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index d1b3ce80056f..0c9ba707925b 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -124,7 +124,7 @@ acpi_ns_parse_table (
acpi_status
acpi_ns_one_complete_parse (
- u32 pass_number,
+ u8 pass_number,
struct acpi_table_desc *table_desc);
@@ -163,7 +163,7 @@ acpi_ns_delete_namespace_subtree (
void
acpi_ns_delete_namespace_by_owner (
- u16 table_id);
+ acpi_owner_id owner_id);
void
acpi_ns_detach_object (
@@ -219,7 +219,7 @@ acpi_ns_dump_objects (
acpi_object_type type,
u8 display_type,
u32 max_depth,
- u32 ownder_id,
+ acpi_owner_id owner_id,
acpi_handle start_handle);
#endif /* ACPI_FUTURE_USAGE */
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index e079b94e4fce..34f9d1f1f79b 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -199,7 +199,7 @@ struct acpi_object_method
ACPI_INTERNAL_METHOD implementation;
u8 concurrency;
u8 thread_count;
- acpi_owner_id owning_id;
+ acpi_owner_id owner_id;
};
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
index 118ecba4cf05..093f697e8c54 100644
--- a/include/acpi/acopcode.h
+++ b/include/acpi/acopcode.h
@@ -246,7 +246,7 @@
#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_IF_OP ARGI_INVALID_OPCODE
#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 2fbe180fee6b..d7e828cb84b3 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -136,7 +136,7 @@
/*
* Debug level macros that are used in the DEBUG_PRINT macros
*/
-#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_debug_info
+#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
/* Exception level -- used in the global "debug_level" */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index 698276571818..f692ad56cd82 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -63,6 +63,7 @@
#define ACPI_PARSE_MODE_MASK 0x0030
#define ACPI_PARSE_DEFERRED_OP 0x0100
+#define ACPI_PARSE_DISASSEMBLE 0x0200
/******************************************************************************
@@ -76,12 +77,7 @@
* psxface - Parser external interfaces
*/
acpi_status
-acpi_psx_load_table (
- u8 *pcode_addr,
- u32 pcode_length);
-
-acpi_status
-acpi_psx_execute (
+acpi_ps_execute_method (
struct acpi_parameter_info *info);
@@ -158,6 +154,25 @@ u16
acpi_ps_peek_opcode (
struct acpi_parse_state *state);
+acpi_status
+acpi_ps_complete_this_op (
+ struct acpi_walk_state *walk_state,
+ union acpi_parse_object *op);
+
+acpi_status
+acpi_ps_next_parse_state (
+ struct acpi_walk_state *walk_state,
+ union acpi_parse_object *op,
+ acpi_status callback_status);
+
+
+/*
+ * psloop - main parse loop
+ */
+acpi_status
+acpi_ps_parse_loop (
+ struct acpi_walk_state *walk_state);
+
/*
* psscope - Scope stack management routines
@@ -291,12 +306,6 @@ acpi_ps_set_name(
union acpi_parse_object *op,
u32 name);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ps_delete_parse_cache (
- void);
-#endif
-
/*
* psdump - display parser tree
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index ea489f235216..819a53f83cfa 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -139,15 +139,14 @@ void
acpi_os_delete_lock (
acpi_handle handle);
-void
+unsigned long
acpi_os_acquire_lock (
- acpi_handle handle,
- u32 flags);
+ acpi_handle handle);
void
acpi_os_release_lock (
acpi_handle handle,
- u32 flags);
+ unsigned long flags);
/*
@@ -180,6 +179,34 @@ acpi_os_get_physical_address (
#endif
+
+/*
+ * Memory/Object Cache
+ */
+acpi_status
+acpi_os_create_cache (
+ char *cache_name,
+ u16 object_size,
+ u16 max_depth,
+ acpi_cache_t **return_cache);
+
+acpi_status
+acpi_os_delete_cache (
+ acpi_cache_t *cache);
+
+acpi_status
+acpi_os_purge_cache (
+ acpi_cache_t *cache);
+
+void *
+acpi_os_acquire_object (
+ acpi_cache_t *cache);
+
+acpi_status
+acpi_os_release_object (
+ acpi_cache_t *cache,
+ void *object);
+
/*
* Interrupt handlers
*/
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index f8f619f8e4f8..9ca212d73fb5 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -387,7 +387,7 @@ acpi_install_gpe_block (
acpi_handle gpe_device,
struct acpi_generic_address *gpe_block_address,
u32 register_count,
- u32 interrupt_level);
+ u32 interrupt_number);
acpi_status
acpi_remove_gpe_block (
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index e6b9e36a2eda..27b22bb3d229 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -71,14 +71,13 @@ struct acpi_walk_state
u8 walk_type;
acpi_owner_id owner_id; /* Owner of objects created during the walk */
u8 last_predicate; /* Result of last predicate */
- u8 reserved; /* For alignment */
u8 current_result; /* */
u8 next_op_info; /* Info about next_op */
u8 num_operands; /* Stack pointer for Operands[] array */
u8 return_used;
u16 opcode; /* Current AML opcode */
u8 scope_depth;
- u8 reserved1;
+ u8 pass_number; /* Parse pass during table load */
u32 arg_count; /* push for fixed or var args */
u32 aml_offset;
u32 arg_types;
@@ -154,14 +153,18 @@ struct acpi_device_walk_info
struct acpi_walk_info
{
u32 debug_level;
- u32 owner_id;
+ u32 count;
+ acpi_owner_id owner_id;
u8 display_type;
};
/* Display Types */
-#define ACPI_DISPLAY_SUMMARY 0
-#define ACPI_DISPLAY_OBJECTS 1
+#define ACPI_DISPLAY_SUMMARY (u8) 0
+#define ACPI_DISPLAY_OBJECTS (u8) 1
+#define ACPI_DISPLAY_MASK (u8) 1
+
+#define ACPI_DISPLAY_SHORT (u8) 2
struct acpi_get_devices_info
{
@@ -207,8 +210,10 @@ union acpi_aml_operands
struct acpi_parameter_info
{
struct acpi_namespace_node *node;
+ union acpi_operand_object *obj_desc;
union acpi_operand_object **parameters;
union acpi_operand_object *return_object;
+ u8 pass_number;
u8 parameter_type;
u8 return_object_type;
};
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index 39df92e21a0d..e6ceb1819643 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -169,16 +169,24 @@ acpi_status
acpi_tb_get_table_rsdt (
void);
+acpi_status
+acpi_tb_validate_rsdp (
+ struct rsdp_descriptor *rsdp);
+
/*
* tbutils - common table utilities
*/
acpi_status
+acpi_tb_is_table_installed (
+ struct acpi_table_desc *new_table_desc);
+
+acpi_status
acpi_tb_verify_table_checksum (
struct acpi_table_header *table_header);
u8
-acpi_tb_checksum (
+acpi_tb_generate_checksum (
void *buffer,
u32 length);
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index b5cdcca444c8..c1e9110c3661 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -86,15 +86,15 @@
*/
struct rsdp_descriptor /* Root System Descriptor Pointer */
{
- char signature [8]; /* ACPI signature, contains "RSD PTR " */
- u8 checksum; /* To make sum of struct == 0 */
- char oem_id [6]; /* OEM identification */
- u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */
- u32 rsdt_physical_address; /* 32-bit physical address of RSDT */
- u32 length; /* XSDT Length in bytes including hdr */
- u64 xsdt_physical_address; /* 64-bit physical address of XSDT */
- u8 extended_checksum; /* Checksum of entire table */
- char reserved [3]; /* Reserved field must be 0 */
+ char signature[8]; /* ACPI signature, contains "RSD PTR " */
+ u8 checksum; /* ACPI 1.0 checksum */
+ char oem_id[6]; /* OEM identification */
+ u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
+ u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
+ u32 length; /* XSDT Length in bytes, including header */
+ u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */
+ u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */
+ char reserved[3]; /* Reserved, must be zero */
};
@@ -107,15 +107,15 @@ struct acpi_common_facs /* Common FACS for internal use */
#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
- char signature [4]; /* ACPI signature (4 ASCII characters) */\
- u32 length; /* Length of table, in bytes, including header */\
+ char signature[4]; /* ASCII table signature */\
+ u32 length; /* Length of table in bytes, including this header */\
u8 revision; /* ACPI Specification minor version # */\
u8 checksum; /* To make sum of entire table == 0 */\
- char oem_id [6]; /* OEM identification */\
- char oem_table_id [8]; /* OEM table identification */\
+ char oem_id[6]; /* ASCII OEM identification */\
+ char oem_table_id[8]; /* ASCII OEM table identification */\
u32 oem_revision; /* OEM revision number */\
- char asl_compiler_id [4]; /* ASL compiler vendor ID */\
- u32 asl_compiler_revision; /* ASL compiler revision number */
+ char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\
+ u32 asl_compiler_revision; /* ASL compiler version */
struct acpi_table_header /* ACPI common table header */
@@ -139,8 +139,12 @@ struct multiple_apic_table
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 local_apic_address; /* Physical address of local APIC */
- u32 PCATcompat : 1; /* A one indicates system also has dual 8259s */
- u32 reserved1 : 31;
+
+ /* Flags (32 bits) */
+
+ u8 PCATcompat : 1; /* 00: System also has dual 8259s */
+ u8 : 7; /* 01-07: Reserved, must be zero */
+ u8 reserved1[3]; /* 08-31: Reserved, must be zero */
};
/* Values for Type in APIC_HEADER_DEF */
@@ -180,16 +184,18 @@ struct apic_header
#define TRIGGER_RESERVED 2
#define TRIGGER_LEVEL 3
-/* Common flag definitions */
+/* Common flag definitions (16 bits each) */
#define MPS_INTI_FLAGS \
- u16 polarity : 2; /* Polarity of APIC I/O input signals */\
- u16 trigger_mode : 2; /* Trigger mode of APIC input signals */\
- u16 reserved1 : 12; /* Reserved, must be zero */
+ u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
+ u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
+ u8 : 4; /* 04-07: Reserved, must be zero */\
+ u8 reserved1; /* 08-15: Reserved, must be zero */
#define LOCAL_APIC_FLAGS \
- u32 processor_enabled: 1; /* Processor is usable if set */\
- u32 reserved2 : 31; /* Reserved, must be zero */
+ u8 processor_enabled: 1; /* 00: Processor is usable if set */\
+ u8 : 7; /* 01-07: Reserved, must be zero */\
+ u8 reserved2; /* 08-15: Reserved, must be zero */
/* Sub-structures for MADT */
@@ -238,7 +244,7 @@ struct madt_local_apic_nmi
struct madt_address_override
{
APIC_HEADER_DEF
- u16 reserved; /* Reserved - must be zero */
+ u16 reserved; /* Reserved, must be zero */
u64 address; /* APIC physical address */
};
@@ -246,7 +252,7 @@ struct madt_io_sapic
{
APIC_HEADER_DEF
u8 io_sapic_id; /* I/O SAPIC ID */
- u8 reserved; /* Reserved - must be zero */
+ u8 reserved; /* Reserved, must be zero */
u32 interrupt_base; /* Glocal interrupt for SAPIC start */
u64 address; /* SAPIC physical address */
};
@@ -257,7 +263,7 @@ struct madt_local_sapic
u8 processor_id; /* ACPI processor id */
u8 local_sapic_id; /* SAPIC ID */
u8 local_sapic_eid; /* SAPIC EID */
- u8 reserved [3]; /* Reserved - must be zero */
+ u8 reserved[3]; /* Reserved, must be zero */
LOCAL_APIC_FLAGS
u32 processor_uID; /* Numeric UID - ACPI 3.0 */
char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 33de5f4d2ccc..93c175a4f446 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -52,8 +52,7 @@
struct rsdt_descriptor_rev1
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- u32 table_offset_entry [1]; /* Array of pointers to other */
- /* ACPI tables */
+ u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
};
@@ -62,14 +61,19 @@ struct rsdt_descriptor_rev1
*/
struct facs_descriptor_rev1
{
- char signature[4]; /* ACPI Signature */
- u32 length; /* Length of structure, in bytes */
+ char signature[4]; /* ASCII table signature */
+ u32 length; /* Length of structure in bytes */
u32 hardware_signature; /* Hardware configuration signature */
u32 firmware_waking_vector; /* ACPI OS waking vector */
u32 global_lock; /* Global Lock */
- u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
- u32 reserved1 : 31; /* Must be 0 */
- u8 resverved3 [40]; /* Reserved - must be zero */
+
+ /* Flags (32 bits) */
+
+ u8 S4bios_f : 1; /* 00: S4BIOS support is present */
+ u8 : 7; /* 01-07: Reserved, must be zero */
+ u8 reserved1[3]; /* 08-31: Reserved, must be zero */
+
+ u8 reserved2[40]; /* Reserved, must be zero */
};
@@ -82,13 +86,13 @@ struct fadt_descriptor_rev1
u32 firmware_ctrl; /* Physical address of FACS */
u32 dsdt; /* Physical address of DSDT */
u8 model; /* System Interrupt Model */
- u8 reserved1; /* Reserved */
+ u8 reserved1; /* Reserved, must be zero */
u16 sci_int; /* System vector of SCI interrupt */
u32 smi_cmd; /* Port address of SMI command port */
u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
- u8 reserved2; /* Reserved - must be zero */
+ u8 reserved2; /* Reserved, must be zero */
u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */
u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */
u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
@@ -104,7 +108,7 @@ struct fadt_descriptor_rev1
u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
u8 gpe1_base; /* Offset in gpe model where gpe1 events start */
- u8 reserved3; /* Reserved */
+ u8 reserved3; /* Reserved, must be zero */
u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */
u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */
u16 flush_size; /* Size of area read to flush caches */
@@ -114,19 +118,21 @@ struct fadt_descriptor_rev1
u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */
u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */
u8 century; /* Index to century in RTC CMOS RAM */
- u8 reserved4; /* Reserved */
- u8 reserved4a; /* Reserved */
- u8 reserved4b; /* Reserved */
- u32 wb_invd : 1; /* The wbinvd instruction works properly */
- u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */
- u32 proc_c1 : 1; /* All processors support C1 state */
- u32 plvl2_up : 1; /* C2 state works on MP system */
- u32 pwr_button : 1; /* Power button is handled as a generic feature */
- u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */
- u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */
- u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
- u32 reserved5 : 23; /* Reserved - must be zero */
+ u8 reserved4[3]; /* Reserved, must be zero */
+
+ /* Flags (32 bits) */
+
+ u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */
+ u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */
+ u8 proc_c1 : 1; /* 02: All processors support C1 state */
+ u8 plvl2_up : 1; /* 03: C2 state works on MP system */
+ u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */
+ u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */
+ u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */
+ u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */
+ u8 tmr_val_ext : 1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */
+ u8 : 7; /* 09-15: Reserved, must be zero */
+ u8 reserved5[2]; /* 16-31: Reserved, must be zero */
};
#pragma pack()
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index e1729c967e05..84ce5abbd6f6 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -73,8 +73,7 @@
struct rsdt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- u32 table_offset_entry [1]; /* Array of pointers to */
- /* ACPI table headers */
+ u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
};
@@ -84,8 +83,7 @@ struct rsdt_descriptor_rev2
struct xsdt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- u64 table_offset_entry [1]; /* Array of pointers to */
- /* ACPI table headers */
+ u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
};
@@ -94,16 +92,21 @@ struct xsdt_descriptor_rev2
*/
struct facs_descriptor_rev2
{
- char signature[4]; /* ACPI signature */
+ char signature[4]; /* ASCII table signature */
u32 length; /* Length of structure, in bytes */
u32 hardware_signature; /* Hardware configuration signature */
- u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
+ u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */
u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
- u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */
- u32 reserved1 : 31; /* Must be 0 */
- u64 xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
+
+ /* Flags (32 bits) */
+
+ u8 S4bios_f : 1; /* 00: S4BIOS support is present */
+ u8 : 7; /* 01-07: Reserved, must be zero */
+ u8 reserved1[3]; /* 08-31: Reserved, must be zero */
+
+ u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */
u8 version; /* Version of this table */
- u8 reserved3 [31]; /* Reserved - must be zero */
+ u8 reserved3[31]; /* Reserved, must be zero */
};
@@ -165,35 +168,37 @@ struct fadt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
FADT_REV2_COMMON
- u8 reserved2; /* Reserved */
- u32 wb_invd : 1; /* The wbinvd instruction works properly */
- u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */
- u32 proc_c1 : 1; /* All processors support C1 state */
- u32 plvl2_up : 1; /* C2 state works on MP system */
- u32 pwr_button : 1; /* Power button is handled as a generic feature */
- u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */
- u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */
- u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits */
- u32 dock_cap : 1; /* Supports Docking */
- u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG */
- u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed */
- u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices */
- u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */
- /* must be executed after writing the SLP_TYPx register */
- /* ACPI 3.0 flag bits */
-
- u32 pci_exp_wak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */
- u32 use_platform_clock : 1; /* OSPM should use platform-provided timer */
- u32 S4rtc_sts_valid : 1; /* Contents of RTC_STS valid after S4 wake */
- u32 remote_power_on_capable : 1; /* System is compatible with remote power on */
- u32 force_apic_cluster_model : 1; /* All local APICs must use cluster model */
- u32 force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */
- u32 reserved6 : 12;/* Reserved - must be zero */
+ u8 reserved2; /* Reserved, must be zero */
+
+ /* Flags (32 bits) */
+
+ u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */
+ u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */
+ u8 proc_c1 : 1; /* 02: All processors support C1 state */
+ u8 plvl2_up : 1; /* 03: C2 state works on MP system */
+ u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */
+ u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */
+ u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */
+ u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */
+ u8 tmr_val_ext : 1; /* 08: tmr_val is 32 bits 0=24-bits */
+ u8 dock_cap : 1; /* 09: Docking supported */
+ u8 reset_reg_sup : 1; /* 10: System reset via the FADT RESET_REG supported */
+ u8 sealed_case : 1; /* 11: No internal expansion capabilities and case is sealed */
+ u8 headless : 1; /* 12: No local video capabilities or local input devices */
+ u8 cpu_sw_sleep : 1; /* 13: Must execute native instruction after writing SLP_TYPx register */
+
+ u8 pci_exp_wak : 1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
+ u8 use_platform_clock : 1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
+ u8 S4rtc_sts_valid : 1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
+ u8 remote_power_on_capable : 1; /* 17: System is compatible with remote power on (ACPI 3.0) */
+ u8 force_apic_cluster_model : 1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
+ u8 force_apic_physical_destination_mode : 1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */
+ u8 : 4; /* 20-23: Reserved, must be zero */
+ u8 reserved3; /* 24-31: Reserved, must be zero */
struct acpi_generic_address reset_register; /* Reset register address in GAS format */
u8 reset_value; /* Value to write to the reset_register port to reset the system */
- u8 reserved7[3]; /* These three bytes must be zero */
+ u8 reserved4[3]; /* These three bytes must be zero */
u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
u64 Xdsdt; /* 64-bit physical address of DSDT */
struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
@@ -213,11 +218,11 @@ struct fadt_descriptor_rev2_minus
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
FADT_REV2_COMMON
- u8 reserved2; /* Reserved */
+ u8 reserved2; /* Reserved, must be zero */
u32 flags;
struct acpi_generic_address reset_register; /* Reset register address in GAS format */
u8 reset_value; /* Value to write to the reset_register port to reset the system. */
- u8 reserved7[3]; /* These three bytes must be zero */
+ u8 reserved7[3]; /* Reserved, must be zero */
};
@@ -242,11 +247,16 @@ struct static_resource_alloc
u8 length;
u8 proximity_domain_lo;
u8 apic_id;
- u32 enabled :1;
- u32 reserved3 :31;
+
+ /* Flags (32 bits) */
+
+ u8 enabled :1; /* 00: Use affinity structure */
+ u8 :7; /* 01-07: Reserved, must be zero */
+ u8 reserved3[3]; /* 08-31: Reserved, must be zero */
+
u8 local_sapic_eid;
u8 proximity_domain_hi[3];
- u32 reserved4;
+ u32 reserved4; /* Reserved, must be zero */
};
struct memory_affinity
@@ -258,18 +268,23 @@ struct memory_affinity
u64 base_address;
u64 address_length;
u32 reserved4;
- u32 enabled :1;
- u32 hot_pluggable :1;
- u32 non_volatile :1;
- u32 reserved5 :29;
- u64 reserved6;
+
+ /* Flags (32 bits) */
+
+ u8 enabled :1; /* 00: Use affinity structure */
+ u8 hot_pluggable :1; /* 01: Memory region is hot pluggable */
+ u8 non_volatile :1; /* 02: Memory is non-volatile */
+ u8 :5; /* 03-07: Reserved, must be zero */
+ u8 reserved5[3]; /* 08-31: Reserved, must be zero */
+
+ u64 reserved6; /* Reserved, must be zero */
};
struct system_resource_affinity
{
ACPI_TABLE_HEADER_DEF
u32 reserved1; /* Must be value '1' */
- u64 reserved2;
+ u64 reserved2; /* Reserved, must be zero */
};
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3a451dc48ac8..1895b862ce0d 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -205,10 +205,11 @@ typedef u32 acpi_size;
/*
- * Miscellaneous common types
+ * This type is used for bitfields in ACPI tables. The only type that is
+ * even remotely portable is u8. Anything else is not portable, so
+ * do not add any more bitfield types.
*/
-typedef u16 UINT16_BIT;
-typedef u32 UINT32_BIT;
+typedef u8 UINT8_BIT;
typedef acpi_native_uint ACPI_PTRDIFF;
/*
@@ -243,6 +244,14 @@ struct acpi_pointer
#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
+/*
+ * If acpi_cache_t was not defined in the OS-dependent header,
+ * define it now. This is typically the case where the local cache
+ * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
+ */
+#ifndef acpi_cache_t
+#define acpi_cache_t struct acpi_memory_list
+#endif
/*
* Useful defines
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 192d0bea3884..0e7b0a3e3b5e 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -120,10 +120,6 @@ u8
acpi_ut_valid_object_type (
acpi_object_type type);
-acpi_owner_id
-acpi_ut_allocate_owner_id (
- u32 id_type);
-
/*
* utinit - miscellaneous initialization and shutdown
@@ -306,47 +302,63 @@ acpi_ut_track_stack_ptr (
void
acpi_ut_trace (
u32 line_number,
- struct acpi_debug_print_info *dbg_info);
+ const char *function_name,
+ char *module_name,
+ u32 component_id);
void
acpi_ut_trace_ptr (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
void *pointer);
void
acpi_ut_trace_u32 (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
u32 integer);
void
acpi_ut_trace_str (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
char *string);
void
acpi_ut_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info);
+ const char *function_name,
+ char *module_name,
+ u32 component_id);
void
acpi_ut_status_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
acpi_status status);
void
acpi_ut_value_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
acpi_integer value);
void
acpi_ut_ptr_exit (
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
u8 *ptr);
void
@@ -378,7 +390,9 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
char *format,
...) ACPI_PRINTF_LIKE_FUNC;
@@ -386,7 +400,9 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print_raw (
u32 requested_debug_level,
u32 line_number,
- struct acpi_debug_print_info *dbg_info,
+ const char *function_name,
+ char *module_name,
+ u32 component_id,
char *format,
...) ACPI_PRINTF_LIKE_FUNC;
@@ -477,8 +493,8 @@ acpi_ut_allocate_object_desc_dbg (
u32 line_number,
u32 component_id);
-#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
-#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT)
+#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
+#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
void
acpi_ut_delete_object_desc (
@@ -557,16 +573,6 @@ void
acpi_ut_delete_generic_state (
union acpi_generic_state *state);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ut_delete_generic_state_cache (
- void);
-
-void
-acpi_ut_delete_object_cache (
- void);
-#endif
-
/*
* utmath
@@ -589,13 +595,21 @@ acpi_ut_short_divide (
* utmisc
*/
acpi_status
+acpi_ut_allocate_owner_id (
+ acpi_owner_id *owner_id);
+
+void
+acpi_ut_release_owner_id (
+ acpi_owner_id *owner_id);
+
+acpi_status
acpi_ut_walk_package_tree (
union acpi_operand_object *source_object,
void *target_object,
acpi_pkg_callback walk_callback,
void *context);
-char *
+void
acpi_ut_strupr (
char *src_string);
@@ -622,22 +636,6 @@ acpi_ut_strtoul64 (
#define ACPI_ANY_BASE 0
-acpi_status
-acpi_ut_mutex_initialize (
- void);
-
-void
-acpi_ut_mutex_terminate (
- void);
-
-acpi_status
-acpi_ut_acquire_mutex (
- acpi_mutex_handle mutex_id);
-
-acpi_status
-acpi_ut_release_mutex (
- acpi_mutex_handle mutex_id);
-
u8 *
acpi_ut_get_resource_end_tag (
union acpi_operand_object *obj_desc);
@@ -666,22 +664,35 @@ acpi_ut_display_init_pathname (
/*
- * utalloc - memory allocation and object caching
+ * utmutex - mutex support
*/
-void *
-acpi_ut_acquire_from_cache (
- u32 list_id);
+acpi_status
+acpi_ut_mutex_initialize (
+ void);
void
-acpi_ut_release_to_cache (
- u32 list_id,
- void *object);
+acpi_ut_mutex_terminate (
+ void);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ut_delete_generic_cache (
- u32 list_id);
-#endif
+acpi_status
+acpi_ut_acquire_mutex (
+ acpi_mutex_handle mutex_id);
+
+acpi_status
+acpi_ut_release_mutex (
+ acpi_mutex_handle mutex_id);
+
+
+/*
+ * utalloc - memory allocation and object caching
+ */
+acpi_status
+acpi_ut_create_caches (
+ void);
+
+acpi_status
+acpi_ut_delete_caches (
+ void);
acpi_status
acpi_ut_validate_buffer (
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 55e97ed29190..50a088901196 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -69,7 +69,7 @@
#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f
#define AML_NAME_CHAR_SUBSEQ (u16) 0x30
#define AML_NAME_CHAR_FIRST (u16) 0x41
-#define AML_OP_PREFIX (u16) 0x5b
+#define AML_EXTENDED_OP_PREFIX (u16) 0x5b
#define AML_ROOT_PREFIX (u16) 0x5c
#define AML_PARENT_PREFIX (u16) 0x5e
#define AML_LOCAL_OP (u16) 0x60
@@ -146,7 +146,7 @@
/* prefixed opcodes */
-#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */
+#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */
#define AML_MUTEX_OP (u16) 0x5b01
#define AML_EVENT_OP (u16) 0x5b02
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index adf969efa510..bae1fbed097a 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -49,35 +49,38 @@
* Configuration for ACPI tools and utilities
*/
-#ifdef _ACPI_DUMP_APP
+#ifdef ACPI_LIBRARY
+#define ACPI_USE_LOCAL_CACHE
+#endif
+
+#ifdef ACPI_DUMP_APP
#ifndef MSDOS
#define ACPI_DEBUG_OUTPUT
#endif
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_NO_METHOD_EXECUTION
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
#endif
-#ifdef _ACPI_EXEC_APP
+#ifdef ACPI_EXEC_APP
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
#define ACPI_DISASSEMBLER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
#endif
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
+#endif
+
+#ifdef ACPI_APPLICATION
#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
+#define ACPI_USE_LOCAL_CACHE
#endif
/*
@@ -238,15 +241,15 @@
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n))
-#define ACPI_TOUPPER toupper
-#define ACPI_TOLOWER tolower
-#define ACPI_IS_XDIGIT isxdigit
-#define ACPI_IS_DIGIT isdigit
-#define ACPI_IS_SPACE isspace
-#define ACPI_IS_UPPER isupper
-#define ACPI_IS_PRINT isprint
-#define ACPI_IS_ALPHA isalpha
-#define ACPI_IS_ASCII isascii
+#define ACPI_TOUPPER(i) toupper((int) (i))
+#define ACPI_TOLOWER(i) tolower((int) (i))
+#define ACPI_IS_XDIGIT(i) isxdigit((int) (i))
+#define ACPI_IS_DIGIT(i) isdigit((int) (i))
+#define ACPI_IS_SPACE(i) isspace((int) (i))
+#define ACPI_IS_UPPER(i) isupper((int) (i))
+#define ACPI_IS_PRINT(i) isprint((int) (i))
+#define ACPI_IS_ALPHA(i) isalpha((int) (i))
+#define ACPI_IS_ASCII(i) isascii((int) (i))
#else
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 91fda36b042b..39264127574c 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -44,13 +44,17 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
+/* Function name is used for debug output. Non-ANSI, compiler-dependent */
+
+#define ACPI_GET_FUNCTION_NAME __FUNCTION__
+
/* This macro is used to tag functions as "printf-like" because
* some compilers (like GCC) can catch printf format string problems.
*/
-#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7)))
/* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * use all the variables (for example, _acpi_module_name). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused.
*/
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a3de0db85694..4fbc0fd52a27 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -62,6 +62,17 @@
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
+/* Type(s) for the OSL */
+
+#ifdef ACPI_USE_LOCAL_CACHE
+#define acpi_cache_t struct acpi_memory_list
+#else
+#include <linux/slab.h>
+#define acpi_cache_t kmem_cache_t
+#endif
+
+
+
#else /* !__KERNEL__ */
#include <stdarg.h>