Commit 3aac1e55 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] ACPI Component Architecture 20030918 (Bob Moore)

Found and fixed a longstanding problem with the late execution of
the various deferred AML opcodes (such as Operation Regions,
Buffer Fields, Buffers, and Packages)...
This fixes the "region size computed incorrectly" problem.

Fixed several 64-bit issues with prototypes, casting and data types.

Removed duplicate prototype from acdisasm.h
parent d9b72fae
...@@ -105,6 +105,11 @@ acpi_ds_create_buffer_field ( ...@@ -105,6 +105,11 @@ acpi_ds_create_buffer_field (
return_ACPI_STATUS (AE_AML_NO_OPERAND); return_ACPI_STATUS (AE_AML_NO_OPERAND);
} }
if (walk_state->deferred_node) {
node = walk_state->deferred_node;
status = AE_OK;
}
else {
/* /*
* During the load phase, we want to enter the name of the field into * During the load phase, we want to enter the name of the field into
* the namespace. During the execute phase (when we evaluate the size * the namespace. During the execute phase (when we evaluate the size
...@@ -127,6 +132,7 @@ acpi_ds_create_buffer_field ( ...@@ -127,6 +132,7 @@ acpi_ds_create_buffer_field (
ACPI_REPORT_NSERROR (arg->common.value.string, status); ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
}
/* We could put the returned object (Node) on the object stack for later, but /* We could put the returned object (Node) on the object stack for later, but
* for now, we will put it in the "op" object that the parser uses, so we * for now, we will put it in the "op" object that the parser uses, so we
......
...@@ -135,7 +135,7 @@ acpi_ds_init_one_object ( ...@@ -135,7 +135,7 @@ acpi_ds_init_one_object (
} }
/* /*
* Always parse methods to detect errors, we may delete * Always parse methods to detect errors, we will delete
* the parse tree below * the parse tree below
*/ */
status = acpi_ds_parse_method (obj_handle); status = acpi_ds_parse_method (obj_handle);
...@@ -150,7 +150,7 @@ acpi_ds_init_one_object ( ...@@ -150,7 +150,7 @@ acpi_ds_init_one_object (
} }
/* /*
* Delete the parse tree. We simple re-parse the method * Delete the parse tree. We simply re-parse the method
* for every execution since there isn't much overhead * for every execution since there isn't much overhead
*/ */
acpi_ns_delete_namespace_subtree (obj_handle); acpi_ns_delete_namespace_subtree (obj_handle);
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
* *
* RETURN: Status. * RETURN: Status.
* *
* DESCRIPTION: Late execution of region or field arguments * DESCRIPTION: Late (deferred) execution of region or field arguments
* *
****************************************************************************/ ****************************************************************************/
...@@ -111,7 +111,10 @@ acpi_ds_execute_arguments ( ...@@ -111,7 +111,10 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Mark this parse as a deferred opcode */
walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP; walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP;
walk_state->deferred_node = node;
/* Pass1: Parse the entire declaration */ /* Pass1: Parse the entire declaration */
...@@ -128,7 +131,7 @@ acpi_ds_execute_arguments ( ...@@ -128,7 +131,7 @@ acpi_ds_execute_arguments (
arg->common.node = node; arg->common.node = node;
acpi_ps_delete_parse_tree (op); acpi_ps_delete_parse_tree (op);
/* Evaluate the address and length arguments for the Buffer Field */ /* Evaluate the deferred arguments */
op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP); op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
if (!op) { if (!op) {
...@@ -144,6 +147,8 @@ acpi_ds_execute_arguments ( ...@@ -144,6 +147,8 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* Execute the opcode and arguments */
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, NULL, 3); aml_length, NULL, NULL, 3);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -151,6 +156,9 @@ acpi_ds_execute_arguments ( ...@@ -151,6 +156,9 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Mark this execution as a deferred opcode */
walk_state->deferred_node = node;
status = acpi_ps_parse_aml (walk_state); status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op); acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -192,7 +200,7 @@ acpi_ds_get_buffer_field_arguments ( ...@@ -192,7 +200,7 @@ acpi_ds_get_buffer_field_arguments (
node = obj_desc->buffer_field.node; node = obj_desc->buffer_field.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL)); ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] buffer_field JIT Init\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n",
node->name.ascii)); node->name.ascii));
/* Execute the AML code for the term_arg arguments */ /* Execute the AML code for the term_arg arguments */
...@@ -207,7 +215,7 @@ acpi_ds_get_buffer_field_arguments ( ...@@ -207,7 +215,7 @@ acpi_ds_get_buffer_field_arguments (
* *
* FUNCTION: acpi_ds_get_buffer_arguments * FUNCTION: acpi_ds_get_buffer_arguments
* *
* PARAMETERS: obj_desc - A valid Bufferobject * PARAMETERS: obj_desc - A valid Buffer object
* *
* RETURN: Status. * RETURN: Status.
* *
...@@ -240,7 +248,7 @@ acpi_ds_get_buffer_arguments ( ...@@ -240,7 +248,7 @@ acpi_ds_get_buffer_arguments (
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer JIT Init\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
/* Execute the AML code for the term_arg arguments */ /* Execute the AML code for the term_arg arguments */
...@@ -254,7 +262,7 @@ acpi_ds_get_buffer_arguments ( ...@@ -254,7 +262,7 @@ acpi_ds_get_buffer_arguments (
* *
* FUNCTION: acpi_ds_get_package_arguments * FUNCTION: acpi_ds_get_package_arguments
* *
* PARAMETERS: obj_desc - A valid Packageobject * PARAMETERS: obj_desc - A valid Package object
* *
* RETURN: Status. * RETURN: Status.
* *
...@@ -287,7 +295,7 @@ acpi_ds_get_package_arguments ( ...@@ -287,7 +295,7 @@ acpi_ds_get_package_arguments (
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package JIT Init\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
/* Execute the AML code for the term_arg arguments */ /* Execute the AML code for the term_arg arguments */
...@@ -335,11 +343,12 @@ acpi_ds_get_region_arguments ( ...@@ -335,11 +343,12 @@ acpi_ds_get_region_arguments (
node = obj_desc->region.node; node = obj_desc->region.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL)); ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Init at AML %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Arg Init at AML %p\n",
node->name.ascii, extra_desc->extra.aml_start)); node->name.ascii, extra_desc->extra.aml_start));
/* Execute the argument AML */
status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node), status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start); extra_desc->extra.aml_length, extra_desc->extra.aml_start);
...@@ -505,14 +514,16 @@ acpi_ds_init_buffer_field ( ...@@ -505,14 +514,16 @@ acpi_ds_init_buffer_field (
goto cleanup; goto cleanup;
} }
/* Entire field must fit within the current length of the buffer */ /* Entire field must fit within the current length of the buffer */
if ((bit_offset + bit_count) > if ((bit_offset + bit_count) >
(8 * (u32) buffer_desc->buffer.length)) { (8 * (u32) buffer_desc->buffer.length)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field size %d exceeds Buffer size %d (bits)\n", "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
bit_offset + bit_count, 8 * (u32) buffer_desc->buffer.length)); ((struct acpi_namespace_node *) result_desc)->name.ascii,
bit_offset + bit_count,
buffer_desc->buffer.node->name.ascii,
8 * (u32) buffer_desc->buffer.length));
status = AE_AML_BUFFER_LIMIT; status = AE_AML_BUFFER_LIMIT;
goto cleanup; goto cleanup;
} }
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsutils") ACPI_MODULE_NAME ("dsutils")
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
...@@ -196,7 +197,6 @@ acpi_ds_is_result_used ( ...@@ -196,7 +197,6 @@ acpi_ds_is_result_used (
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (FALSE); return_VALUE (FALSE);
} }
...@@ -239,7 +239,6 @@ acpi_ds_delete_result_if_not_used ( ...@@ -239,7 +239,6 @@ acpi_ds_delete_result_if_not_used (
return_VOID; return_VOID;
} }
if (!acpi_ds_is_result_used (op, walk_state)) { if (!acpi_ds_is_result_used (op, walk_state)) {
/* /*
* Must pop the result stack (obj_desc should be equal to result_obj) * Must pop the result stack (obj_desc should be equal to result_obj)
...@@ -389,6 +388,23 @@ acpi_ds_create_operand ( ...@@ -389,6 +388,23 @@ acpi_ds_create_operand (
* in name_string * in name_string
*/ */
/*
* Special handling for buffer_field declarations. This is a deferred
* opcode that unfortunately defines the field name as the last
* parameter instead of the first. We get here when we are performing
* the deferred execution, so the actual name of the field is already
* in the namespace. We don't want to attempt to look it up again
* because we may be executing in a different scope than where the
* actual opcode exists.
*/
if ((walk_state->deferred_node) &&
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
(arg_index != 0)) {
obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node);
status = AE_OK;
}
else /* All other opcodes */ {
/* /*
* Differentiate between a namespace "create" operation * Differentiate between a namespace "create" operation
* versus a "lookup" operation (IMODE_LOAD_PASS2 vs. * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
...@@ -405,7 +421,6 @@ acpi_ds_create_operand ( ...@@ -405,7 +421,6 @@ acpi_ds_create_operand (
interpreter_mode = ACPI_IMODE_LOAD_PASS2; interpreter_mode = ACPI_IMODE_LOAD_PASS2;
} }
else { else {
/* Return a failure if name not found */ /* Return a failure if name not found */
...@@ -432,7 +447,6 @@ acpi_ds_create_operand ( ...@@ -432,7 +447,6 @@ acpi_ds_create_operand (
obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node); obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node);
status = AE_OK; status = AE_OK;
} }
else { else {
/* /*
* We just plain didn't find it -- which is a * We just plain didn't find it -- which is a
...@@ -445,6 +459,7 @@ acpi_ds_create_operand ( ...@@ -445,6 +459,7 @@ acpi_ds_create_operand (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (name_string, status); ACPI_REPORT_NSERROR (name_string, status);
} }
}
/* Free the namestring created above */ /* Free the namestring created above */
...@@ -464,8 +479,6 @@ acpi_ds_create_operand ( ...@@ -464,8 +479,6 @@ acpi_ds_create_operand (
} }
ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
} }
else { else {
/* Check for null name case */ /* Check for null name case */
...@@ -480,7 +493,6 @@ acpi_ds_create_operand ( ...@@ -480,7 +493,6 @@ acpi_ds_create_operand (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg));
} }
else { else {
opcode = arg->common.aml_opcode; opcode = arg->common.aml_opcode;
} }
......
...@@ -248,6 +248,14 @@ acpi_ds_load1_begin_op ( ...@@ -248,6 +248,14 @@ acpi_ds_load1_begin_op (
* buffer_field, or Package), the name of the object is already * buffer_field, or Package), the name of the object is already
* in the namespace. * in the namespace.
*/ */
if (walk_state->deferred_node) {
/* This name is already in the namespace, get the node */
node = walk_state->deferred_node;
status = AE_OK;
break;
}
flags = ACPI_NS_NO_UPSEARCH; flags = ACPI_NS_NO_UPSEARCH;
if ((walk_state->opcode != AML_SCOPE_OP) && if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
...@@ -589,7 +597,17 @@ acpi_ds_load2_begin_op ( ...@@ -589,7 +597,17 @@ acpi_ds_load2_begin_op (
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve * as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later. * arguments to the opcode must be created as we go back up the parse tree later.
*
* Note: Name may already exist if we are executing a deferred opcode.
*/ */
if (walk_state->deferred_node) {
/* This name is already in the namespace, get the node */
node = walk_state->deferred_node;
status = AE_OK;
break;
}
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
break; break;
......
...@@ -121,10 +121,9 @@ acpi_ds_scope_stack_push ( ...@@ -121,10 +121,9 @@ acpi_ds_scope_stack_push (
/* Make sure object type is valid */ /* Make sure object type is valid */
if (!acpi_ut_valid_object_type (type)) { if (!acpi_ut_valid_object_type (type)) {
ACPI_REPORT_WARNING (("ds_scope_stack_push: type code out of range\n")); ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
} }
/* Allocate a new scope object */ /* Allocate a new scope object */
scope_info = acpi_ut_create_generic_state (); scope_info = acpi_ut_create_generic_state ();
...@@ -146,13 +145,13 @@ acpi_ds_scope_stack_push ( ...@@ -146,13 +145,13 @@ acpi_ds_scope_stack_push (
old_scope_info = walk_state->scope_info; old_scope_info = walk_state->scope_info;
if (old_scope_info) { if (old_scope_info) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[%4.4s] (%10s)", "[%4.4s] (%s)",
old_scope_info->scope.node->name.ascii, old_scope_info->scope.node->name.ascii,
acpi_ut_get_type_name (old_scope_info->common.value))); acpi_ut_get_type_name (old_scope_info->common.value)));
} }
else { else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (%10s)", "ROOT")); "[\\___] (%s)", "ROOT"));
} }
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
...@@ -163,7 +162,6 @@ acpi_ds_scope_stack_push ( ...@@ -163,7 +162,6 @@ acpi_ds_scope_stack_push (
/* Push new scope object onto stack */ /* Push new scope object onto stack */
acpi_ut_push_generic_state (&walk_state->scope_info, scope_info); acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
...@@ -207,7 +205,7 @@ acpi_ds_scope_stack_pop ( ...@@ -207,7 +205,7 @@ acpi_ds_scope_stack_pop (
walk_state->scope_depth--; walk_state->scope_depth--;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[%.2d] Popped scope [%4.4s] (%10s), New scope -> ", "[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
(u32) walk_state->scope_depth, (u32) walk_state->scope_depth,
scope_info->scope.node->name.ascii, scope_info->scope.node->name.ascii,
acpi_ut_get_type_name (scope_info->common.value))); acpi_ut_get_type_name (scope_info->common.value)));
...@@ -225,7 +223,6 @@ acpi_ds_scope_stack_pop ( ...@@ -225,7 +223,6 @@ acpi_ds_scope_stack_pop (
} }
acpi_ut_delete_generic_state (scope_info); acpi_ut_delete_generic_state (scope_info);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
......
...@@ -56,11 +56,12 @@ ...@@ -56,11 +56,12 @@
* FUNCTION: acpi_ds_result_insert * FUNCTION: acpi_ds_result_insert
* *
* PARAMETERS: Object - Object to push * PARAMETERS: Object - Object to push
* Index - Where to insert the object
* walk_state - Current Walk state * walk_state - Current Walk state
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Push an object onto this walk's result stack * DESCRIPTION: Insert an object onto this walk's result stack
* *
******************************************************************************/ ******************************************************************************/
...@@ -114,6 +115,7 @@ acpi_ds_result_insert ( ...@@ -114,6 +115,7 @@ acpi_ds_result_insert (
* FUNCTION: acpi_ds_result_remove * FUNCTION: acpi_ds_result_remove
* *
* PARAMETERS: Object - Where to return the popped object * PARAMETERS: Object - Where to return the popped object
* Index - Where to extract the object
* walk_state - Current Walk state * walk_state - Current Walk state
* *
* RETURN: Status * RETURN: Status
...@@ -233,6 +235,7 @@ acpi_ds_result_pop ( ...@@ -233,6 +235,7 @@ acpi_ds_result_pop (
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_result_pop_from_bottom * FUNCTION: acpi_ds_result_pop_from_bottom
...@@ -295,7 +298,6 @@ acpi_ds_result_pop_from_bottom ( ...@@ -295,7 +298,6 @@ acpi_ds_result_pop_from_bottom (
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
state, walk_state)); state, walk_state));
return (AE_OK); return (AE_OK);
} }
...@@ -358,8 +360,7 @@ acpi_ds_result_push ( ...@@ -358,8 +360,7 @@ acpi_ds_result_push (
* *
* FUNCTION: acpi_ds_result_stack_push * FUNCTION: acpi_ds_result_stack_push
* *
* PARAMETERS: Object - Object to push * PARAMETERS: walk_state - Current Walk state
* walk_state - Current Walk state
* *
* RETURN: Status * RETURN: Status
* *
...@@ -420,7 +421,6 @@ acpi_ds_result_stack_pop ( ...@@ -420,7 +421,6 @@ acpi_ds_result_stack_pop (
return (AE_AML_NO_OPERAND); return (AE_AML_NO_OPERAND);
} }
state = acpi_ut_pop_generic_state (&walk_state->results); state = acpi_ut_pop_generic_state (&walk_state->results);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
...@@ -572,6 +572,7 @@ acpi_ds_obj_stack_pop_object ( ...@@ -572,6 +572,7 @@ acpi_ds_obj_stack_pop_object (
} }
#endif #endif
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_obj_stack_pop * FUNCTION: acpi_ds_obj_stack_pop
...@@ -641,6 +642,7 @@ acpi_ds_obj_stack_pop_and_delete ( ...@@ -641,6 +642,7 @@ acpi_ds_obj_stack_pop_and_delete (
u32 i; u32 i;
union acpi_operand_object *obj_desc; union acpi_operand_object *obj_desc;
ACPI_FUNCTION_NAME ("ds_obj_stack_pop_and_delete"); ACPI_FUNCTION_NAME ("ds_obj_stack_pop_and_delete");
...@@ -883,8 +885,15 @@ acpi_ds_create_walk_state ( ...@@ -883,8 +885,15 @@ acpi_ds_create_walk_state (
* FUNCTION: acpi_ds_init_aml_walk * FUNCTION: acpi_ds_init_aml_walk
* *
* PARAMETERS: walk_state - New state to be initialized * PARAMETERS: walk_state - New state to be initialized
* Op - Current parse op
* method_node - Control method NS node, if any
* aml_start - Start of AML
* aml_length - Length of AML
* Params - Method args, if any
* return_obj_desc - Where to store a return object, if any
* pass_number - 1, 2, or 3
* *
* RETURN: None * RETURN: Status
* *
* DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk
* *
...@@ -956,6 +965,7 @@ acpi_ds_init_aml_walk ( ...@@ -956,6 +965,7 @@ acpi_ds_init_aml_walk (
while (extra_op && !extra_op->common.node) { while (extra_op && !extra_op->common.node) {
extra_op = extra_op->common.parent; extra_op = extra_op->common.parent;
} }
if (!extra_op) { if (!extra_op) {
parser_state->start_node = NULL; parser_state->start_node = NULL;
} }
......
...@@ -286,7 +286,7 @@ acpi_ex_create_region ( ...@@ -286,7 +286,7 @@ acpi_ex_create_region (
ACPI_FUNCTION_TRACE ("ex_create_region"); ACPI_FUNCTION_TRACE ("ex_create_region");
/* Get the Node from the object stack */ /* Get the Namespace Node */
node = walk_state->op->common.node; node = walk_state->op->common.node;
...@@ -311,7 +311,6 @@ acpi_ex_create_region ( ...@@ -311,7 +311,6 @@ acpi_ex_create_region (
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
acpi_ut_get_region_name (region_space), region_space)); acpi_ut_get_region_name (region_space), region_space));
/* Create the region descriptor */ /* Create the region descriptor */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
...@@ -375,6 +374,7 @@ acpi_ex_create_table_region ( ...@@ -375,6 +374,7 @@ acpi_ex_create_table_region (
ACPI_FUNCTION_TRACE ("ex_create_table_region"); ACPI_FUNCTION_TRACE ("ex_create_table_region");
/* Get the Node from the object stack */ /* Get the Node from the object stack */
node = walk_state->op->common.node; node = walk_state->op->common.node;
...@@ -392,7 +392,6 @@ acpi_ex_create_table_region ( ...@@ -392,7 +392,6 @@ acpi_ex_create_table_region (
status = acpi_tb_find_table (operand[1]->string.pointer, status = acpi_tb_find_table (operand[1]->string.pointer,
operand[2]->string.pointer, operand[2]->string.pointer,
operand[3]->string.pointer, &table); operand[3]->string.pointer, &table);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -489,7 +488,6 @@ acpi_ex_create_processor ( ...@@ -489,7 +488,6 @@ acpi_ex_create_processor (
status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
obj_desc, ACPI_TYPE_PROCESSOR); obj_desc, ACPI_TYPE_PROCESSOR);
/* Remove local reference to the object */ /* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
...@@ -540,7 +538,6 @@ acpi_ex_create_power_resource ( ...@@ -540,7 +538,6 @@ acpi_ex_create_power_resource (
status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
obj_desc, ACPI_TYPE_POWER); obj_desc, ACPI_TYPE_POWER);
/* Remove local reference to the object */ /* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
...@@ -609,7 +606,6 @@ acpi_ex_create_method ( ...@@ -609,7 +606,6 @@ acpi_ex_create_method (
obj_desc->method.concurrency = (u8) obj_desc->method.concurrency = (u8)
(((method_flags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1); (((method_flags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1);
} }
else { else {
obj_desc->method.concurrency = INFINITE_CONCURRENCY; obj_desc->method.concurrency = INFINITE_CONCURRENCY;
} }
......
...@@ -234,7 +234,7 @@ acpi_ns_dump_one_object ( ...@@ -234,7 +234,7 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
acpi_os_printf ("Notify object: %p", obj_desc); acpi_os_printf ("Notify Object: %p\n", obj_desc);
break; break;
...@@ -371,7 +371,7 @@ acpi_ns_dump_one_object ( ...@@ -371,7 +371,7 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf (" Off %.2X Len %.2X Acc %.2hd\n", acpi_os_printf ("Off %.2X Len %.2X Acc %.2hd\n",
(obj_desc->common_field.base_byte_offset * 8) (obj_desc->common_field.base_byte_offset * 8)
+ obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
......
...@@ -96,7 +96,7 @@ acpi_ns_search_node ( ...@@ -96,7 +96,7 @@ acpi_ns_search_node (
scope_name = acpi_ns_get_external_pathname (node); scope_name = acpi_ns_get_external_pathname (node);
if (scope_name) { if (scope_name) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n",
scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type))); scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type)));
ACPI_MEM_FREE (scope_name); ACPI_MEM_FREE (scope_name);
...@@ -117,9 +117,9 @@ acpi_ns_search_node ( ...@@ -117,9 +117,9 @@ acpi_ns_search_node (
* Found matching entry. * Found matching entry.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name %4.4s Type [%s] found in scope [%4.4s] %p\n", "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
(char *) &target_name, acpi_ut_get_type_name (next_node->type), (char *) &target_name, acpi_ut_get_type_name (next_node->type),
next_node->name.ascii, next_node)); next_node, node->name.ascii, node));
*return_node = next_node; *return_node = next_node;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -143,7 +143,7 @@ acpi_ns_search_node ( ...@@ -143,7 +143,7 @@ acpi_ns_search_node (
/* Searched entire namespace level, not found */ /* Searched entire namespace level, not found */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name %4.4s Type [%s] not found in search in scope [%4.4s] %p first child %p\n", "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
(char *) &target_name, acpi_ut_get_type_name (type), (char *) &target_name, acpi_ut_get_type_name (type),
node->name.ascii, node, node->child)); node->name.ascii, node, node->child));
......
...@@ -175,6 +175,11 @@ acpi_ns_print_node_pathname ( ...@@ -175,6 +175,11 @@ acpi_ns_print_node_pathname (
acpi_status status; acpi_status status;
if (!node) {
acpi_os_printf ("[NULL NAME]");
return;
}
/* Convert handle to a full pathname and print it (with supplied message) */ /* Convert handle to a full pathname and print it (with supplied message) */
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
...@@ -470,11 +475,11 @@ acpi_ns_build_internal_name ( ...@@ -470,11 +475,11 @@ acpi_ns_build_internal_name (
*result = 0; *result = 0;
if (info->fully_qualified) { if (info->fully_qualified) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (abs) \"\\%s\"\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
internal_name, internal_name)); internal_name, internal_name));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (rel) \"%s\"\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
internal_name, internal_name)); internal_name, internal_name));
} }
......
...@@ -437,7 +437,6 @@ acpi_ps_parse_loop ( ...@@ -437,7 +437,6 @@ acpi_ps_parse_loop (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
parser_state = &walk_state->parser_state; parser_state = &walk_state->parser_state;
walk_state->arg_types = 0; walk_state->arg_types = 0;
...@@ -705,10 +704,9 @@ acpi_ps_parse_loop ( ...@@ -705,10 +704,9 @@ acpi_ps_parse_loop (
walk_state->arg_types = 0; walk_state->arg_types = 0;
break; break;
default: default:
/* Op is not a constant or string, append each argument */ /* Op is not a constant or string, append each argument to the Op */
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
!walk_state->arg_count) { !walk_state->arg_count) {
...@@ -727,23 +725,23 @@ acpi_ps_parse_loop ( ...@@ -727,23 +725,23 @@ acpi_ps_parse_loop (
INCREMENT_ARG_LIST (walk_state->arg_types); INCREMENT_ARG_LIST (walk_state->arg_types);
} }
/* Special processing for certain opcodes */
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
case AML_METHOD_OP: case AML_METHOD_OP:
/* For a method, save the length and address of the body */
/* /*
* Skip parsing of control method or opregion body, * Skip parsing of control method
* because we don't have enough info in the first pass * because we don't have enough info in the first pass
* to parse them correctly. * to parse it correctly.
*
* Save the length and address of the body
*/ */
op->named.data = parser_state->aml; op->named.data = parser_state->aml;
op->named.length = (u32) (parser_state->pkg_end - parser_state->aml); op->named.length = (u32) (parser_state->pkg_end - parser_state->aml);
/*
* Skip body of method. For op_regions, we must continue /* Skip body of method */
* parsing because the opregion is not a standalone
* package (We don't know where the end is).
*/
parser_state->aml = parser_state->pkg_end; parser_state->aml = parser_state->pkg_end;
walk_state->arg_count = 0; walk_state->arg_count = 0;
break; break;
...@@ -756,15 +754,15 @@ acpi_ps_parse_loop ( ...@@ -756,15 +754,15 @@ acpi_ps_parse_loop (
(op->common.parent->common.aml_opcode == AML_NAME_OP) && (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
(walk_state->descending_callback != acpi_ds_exec_begin_op)) { (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
/* /*
* Skip parsing of * Skip parsing of Buffers and Packages
* because we don't have enough info in the first pass * because we don't have enough info in the first pass
* to parse them correctly. * to parse them correctly.
*/ */
op->named.data = aml_op_start; op->named.data = aml_op_start;
op->named.length = (u32) (parser_state->pkg_end - aml_op_start); op->named.length = (u32) (parser_state->pkg_end - aml_op_start);
/*
* Skip body /* Skip body */
*/
parser_state->aml = parser_state->pkg_end; parser_state->aml = parser_state->pkg_end;
walk_state->arg_count = 0; walk_state->arg_count = 0;
} }
...@@ -778,6 +776,7 @@ acpi_ps_parse_loop ( ...@@ -778,6 +776,7 @@ acpi_ps_parse_loop (
break; break;
default: default:
/* No action for all other opcodes */ /* No action for all other opcodes */
break; break;
} }
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20030916 #define ACPI_CA_VERSION 0x20030918
/* Maximum objects in the various object caches */ /* Maximum objects in the various object caches */
......
...@@ -152,10 +152,6 @@ void ...@@ -152,10 +152,6 @@ void
acpi_dm_decode_internal_object ( acpi_dm_decode_internal_object (
union acpi_operand_object *obj_desc); union acpi_operand_object *obj_desc);
void
acpi_dm_decode_node (
struct acpi_namespace_node *node);
u32 u32
acpi_dm_block_type ( acpi_dm_block_type (
union acpi_parse_object *op); union acpi_parse_object *op);
......
...@@ -91,11 +91,12 @@ struct acpi_walk_state ...@@ -91,11 +91,12 @@ struct acpi_walk_state
struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
union acpi_operand_object **caller_return_desc; union acpi_operand_object **caller_return_desc;
union acpi_generic_state *control_state; /* List of control states (nested IFs) */ union acpi_generic_state *control_state; /* List of control states (nested IFs) */
struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
struct acpi_namespace_node *method_call_node; /* Called method Node*/ struct acpi_namespace_node *method_call_node; /* Called method Node*/
union acpi_parse_object *method_call_op; /* method_call Op if running a method */ union acpi_parse_object *method_call_op; /* method_call Op if running a method */
union acpi_operand_object *method_desc; /* Method descriptor if running a method */ union acpi_operand_object *method_desc; /* Method descriptor if running a method */
struct acpi_namespace_node *method_node; /* Method Node if running a method */ struct acpi_namespace_node *method_node; /* Method node if running a method. */
union acpi_parse_object *op; /* Current parser op */ union acpi_parse_object *op; /* Current parser op */
union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
const struct acpi_opcode_info *op_info; /* Info on current opcode */ const struct acpi_opcode_info *op_info; /* Info on current opcode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment