Commit 28d35e95 authored by Andy Grover's avatar Andy Grover

ACPI: Interpreter update to (20021101)

- Fix namespace ordering, which was causing breakage
- Enhance some error messages
parent 8c6c92d1
......@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
* $Revision: 51 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -210,8 +210,8 @@ acpi_install_address_space_handler (
}
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Installing address handler for region %s(%X) on Device %p(%p)\n",
acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
"Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
acpi_ut_get_region_name (space_id), space_id, node->name.ascii, node, obj_desc));
/*
* Now we can install the handler
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 114 $
* $Revision: 115 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20021022
#define ACPI_CA_VERSION 0x20021101
/* Version of ACPI supported */
......
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
* $Revision: 62 $
* $Revision: 63 $
*
*****************************************************************************/
......@@ -89,9 +89,9 @@ acpi_ps_get_next_simple_arg (
acpi_status
acpi_ps_get_next_namepath (
acpi_walk_state *walk_state,
acpi_parse_state *parser_state,
acpi_parse_object *arg,
u32 *arg_count,
u8 method_call);
acpi_parse_object *
......@@ -100,9 +100,9 @@ acpi_ps_get_next_field (
acpi_status
acpi_ps_get_next_arg (
acpi_walk_state *walk_state,
acpi_parse_state *parser_state,
u32 arg_type,
u32 *arg_count,
acpi_parse_object **return_arg);
......
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 75 $
* $Revision: 77 $
*
******************************************************************************/
......@@ -125,6 +125,7 @@ acpi_ns_delete_node (
}
#ifdef ACPI_ALPHABETIC_NAMESPACE
/*******************************************************************************
*
* FUNCTION: Acpi_ns_compare_names
......@@ -170,8 +171,9 @@ acpi_ns_compare_names (
}
}
return (*(s32 *) reversed_name1 - *(s32 *) reversed_name2);
return (*(int *) reversed_name1 - *(int *) reversed_name2);
}
#endif
/*******************************************************************************
......@@ -204,7 +206,10 @@ acpi_ns_install_node (
{
u16 owner_id = TABLE_ID_DSDT;
acpi_namespace_node *child_node;
#ifdef ACPI_ALPHABETIC_NAMESPACE
acpi_namespace_node *previous_child_node;
#endif
ACPI_FUNCTION_TRACE ("Ns_install_node");
......@@ -228,6 +233,7 @@ acpi_ns_install_node (
node->peer = parent_node;
}
else {
#ifdef ACPI_ALPHABETIC_NAMESPACE
/*
* Walk the list whilst searching for the the correct
* alphabetic placement.
......@@ -276,6 +282,19 @@ acpi_ns_install_node (
parent_node->child = node;
}
}
#else
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
}
child_node->peer = node;
/* Clear end-of-list flag */
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
#endif
}
/* Init the new entry */
......
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
* $Revision: 64 $
* $Revision: 65 $
*
*****************************************************************************/
......@@ -95,6 +95,7 @@ acpi_ps_get_next_package_length (
break;
default:
/* Can't get here, only 2 bits / 4 cases */
break;
}
......@@ -127,6 +128,8 @@ acpi_ps_get_next_package_end (
ACPI_FUNCTION_TRACE ("Ps_get_next_package_end");
/* Function below changes Parser_state->Aml */
length = (NATIVE_UINT) acpi_ps_get_next_package_length (parser_state);
return_PTR (start + length); /* end of package */
......@@ -184,21 +187,21 @@ acpi_ps_get_next_namestring (
/* Two name segments */
end += 9;
end += 1 + (2 * ACPI_NAME_SIZE);
break;
case AML_MULTI_NAME_PREFIX_OP:
/* Multiple name segments, 4 chars each */
end += 2 + ((ACPI_SIZE) ACPI_GET8 (end + 1) * 4);
end += 2 + ((ACPI_SIZE) ACPI_GET8 (end + 1) * ACPI_NAME_SIZE);
break;
default:
/* Single name segment */
end += 4;
end += ACPI_NAME_SIZE;
break;
}
......@@ -215,8 +218,8 @@ acpi_ps_get_next_namestring (
* Arg - Where the namepath will be stored
* Arg_count - If the namepath points to a control method
* the method's argument is returned here.
* Method_call - Whether the namepath can be the start
* of a method call
* Method_call - Whether the namepath can possibly be the
* start of a method call
*
* RETURN: Status
*
......@@ -230,9 +233,9 @@ acpi_ps_get_next_namestring (
acpi_status
acpi_ps_get_next_namepath (
acpi_walk_state *walk_state,
acpi_parse_state *parser_state,
acpi_parse_object *arg,
u32 *arg_count,
u8 method_call)
{
NATIVE_CHAR *path;
......@@ -267,12 +270,15 @@ acpi_ps_get_next_namepath (
* object (MUST BE mode EXECUTE to perform upsearch)
*/
status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
&node);
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
if (ACPI_SUCCESS (status) && method_call) {
if (node->type == ACPI_TYPE_METHOD) {
/*
* This name is actually a control method invocation
*/
method_desc = acpi_ns_get_attached_object (node);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Control Method - %p Desc %p Path=%p\n",
node, method_desc, path));
name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
......@@ -283,7 +289,6 @@ acpi_ps_get_next_namepath (
/* Change arg into a METHOD CALL and attach name to it */
acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
name_op->common.value.name = path;
/* Point METHODCALL/NAME to the METHOD Node */
......@@ -292,15 +297,19 @@ acpi_ps_get_next_namepath (
acpi_ps_append_arg (arg, name_op);
if (!method_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p has no attached object\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Control Method - %p has no attached object\n",
node));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Args %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Control Method - %p Args %X\n",
node, method_desc->method.param_count));
*arg_count = method_desc->method.param_count;
/* Get the number of arguments to expect */
walk_state->arg_count = method_desc->method.param_count;
return_ACPI_STATUS (AE_OK);
}
......@@ -310,6 +319,29 @@ acpi_ps_get_next_namepath (
* (See code below)
*/
}
if (ACPI_FAILURE (status)) {
/*
* 1) Any error other than NOT_FOUND is always severe
* 2) NOT_FOUND is only important if we are executing a method.
* 3) If executing a Cond_ref_of opcode, NOT_FOUND is ok.
*/
if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
(status == AE_NOT_FOUND) &&
(walk_state->op->common.aml_opcode != AML_COND_REF_OF_OP)) ||
(status != AE_NOT_FOUND)) {
ACPI_REPORT_NSERROR (path, status);
}
else {
/*
* We got a NOT_FOUND during table load or we encountered
* a Cond_ref_of(x) where the target does not exist.
* -- either case is ok
*/
status = AE_OK;
}
}
}
/*
......@@ -410,6 +442,7 @@ acpi_ps_get_next_simple_arg (
default:
ACPI_REPORT_ERROR (("Invalid Arg_type %X\n", arg_type));
break;
}
......@@ -435,7 +468,7 @@ acpi_ps_get_next_field (
acpi_parse_state *parser_state)
{
u32 aml_offset = ACPI_PTR_DIFF (parser_state->aml,
parser_state->aml_start);
parser_state->aml_start);
acpi_parse_object *field;
u16 opcode;
u32 name;
......@@ -484,7 +517,7 @@ acpi_ps_get_next_field (
ACPI_MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml);
acpi_ps_set_name (field, name);
parser_state->aml += 4;
parser_state->aml += ACPI_NAME_SIZE;
/* Get the length which is encoded as a package length */
......@@ -513,6 +546,7 @@ acpi_ps_get_next_field (
break;
default:
/* Opcode was set in previous switch */
break;
}
......@@ -539,9 +573,9 @@ acpi_ps_get_next_field (
acpi_status
acpi_ps_get_next_arg (
acpi_walk_state *walk_state,
acpi_parse_state *parser_state,
u32 arg_type,
u32 *arg_count,
acpi_parse_object **return_arg)
{
acpi_parse_object *arg = NULL;
......@@ -620,7 +654,8 @@ acpi_ps_get_next_arg (
/* Fill in bytelist data */
arg->common.value.size = ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
arg->common.value.size = ACPI_PTR_DIFF (parser_state->pkg_end,
parser_state->aml);
arg->named.data = parser_state->aml;
/* Skip to End of byte data */
......@@ -645,12 +680,12 @@ acpi_ps_get_next_arg (
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ps_get_next_namepath (parser_state, arg, arg_count, 0);
status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
}
else {
/* single complex argument, nothing returned */
*arg_count = 1;
walk_state->arg_count = 1;
}
break;
......@@ -660,7 +695,7 @@ acpi_ps_get_next_arg (
/* single complex argument, nothing returned */
*arg_count = 1;
walk_state->arg_count = 1;
break;
......@@ -671,7 +706,7 @@ acpi_ps_get_next_arg (
if (parser_state->aml < parser_state->pkg_end) {
/* non-empty list of variable arguments, nothing returned */
*arg_count = ACPI_VAR_ARGS;
walk_state->arg_count = ACPI_VAR_ARGS;
}
break;
......
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 133 $
* $Revision: 134 $
*
*****************************************************************************/
......@@ -460,7 +460,8 @@ acpi_ps_parse_loop (
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_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) {
......@@ -480,7 +481,8 @@ acpi_ps_parse_loop (
if (!op) {
/* Get the next opcode from the AML stream */
walk_state->aml_offset = ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
walk_state->aml_offset = ACPI_PTR_DIFF (parser_state->aml,
parser_state->aml_start);
walk_state->opcode = acpi_ps_peek_opcode (parser_state);
/*
......@@ -537,9 +539,8 @@ acpi_ps_parse_loop (
*/
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 (parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types),
&walk_state->arg_count, &arg);
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;
}
......@@ -593,7 +594,7 @@ acpi_ps_parse_loop (
* 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.
* calls within the Term_arg elements of the body.)
*
* However, we must continue parsing because
* the opregion is not a standalone package --
......@@ -673,20 +674,14 @@ acpi_ps_parse_loop (
/* Fill in constant or string argument directly */
acpi_ps_get_next_simple_arg (parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
break;
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
status = acpi_ps_get_next_namepath (parser_state, op, &walk_state->arg_count, 1);
status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
if (ACPI_FAILURE (status)) {
/* NOT_FOUND is an error only if we are actually executing a method */
if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
(status == AE_NOT_FOUND)) ||
(status != AE_NOT_FOUND)) {
goto close_this_op;
}
goto close_this_op;
}
walk_state->arg_types = 0;
......@@ -697,21 +692,14 @@ acpi_ps_parse_loop (
/* Op is not a constant or string, append each argument */
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && !walk_state->arg_count) {
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
!walk_state->arg_count) {
walk_state->aml_offset = ACPI_PTR_DIFF (parser_state->aml,
parser_state->aml_start);
status = acpi_ps_get_next_arg (parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types),
&walk_state->arg_count, &arg);
status = acpi_ps_get_next_arg (walk_state, parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
if (ACPI_FAILURE (status)) {
/* NOT_FOUND is an error only if we are actually executing a method */
if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
(status == AE_NOT_FOUND) &&
(op->common.aml_opcode != AML_COND_REF_OF_OP)) ||
(status != AE_NOT_FOUND)) {
goto close_this_op;
}
goto close_this_op;
}
if (arg) {
......@@ -784,7 +772,8 @@ acpi_ps_parse_loop (
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);
status = acpi_ps_push_scope (parser_state, op,
walk_state->arg_types, walk_state->arg_count);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -866,7 +855,8 @@ acpi_ps_parse_loop (
case AE_CTRL_END:
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
if (op) {
walk_state->op = op;
......@@ -889,7 +879,8 @@ acpi_ps_parse_loop (
/* 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);
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
}
/* Close this iteration of the While loop */
......@@ -917,7 +908,8 @@ acpi_ps_parse_loop (
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);
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
} while (op);
......@@ -930,7 +922,8 @@ acpi_ps_parse_loop (
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);
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
} while (op);
......@@ -940,7 +933,8 @@ acpi_ps_parse_loop (
*/
#if 0
if (op == NULL) {
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
}
#endif
walk_state->prev_op = op;
......@@ -951,7 +945,8 @@ acpi_ps_parse_loop (
/* 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_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 {
......@@ -991,7 +986,8 @@ acpi_ps_parse_loop (
acpi_ps_complete_this_op (walk_state, op);
}
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
} while (op);
......@@ -1007,7 +1003,8 @@ acpi_ps_parse_loop (
acpi_ps_complete_this_op (walk_state, op);
}
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
&walk_state->arg_count);
} while (op);
......@@ -1117,7 +1114,8 @@ acpi_ps_parse_aml (
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
terminate_status = acpi_ds_terminate_control_method (walk_state);
if (ACPI_FAILURE (terminate_status)) {
ACPI_REPORT_ERROR (("Could not terminate control method properly\n"));
ACPI_REPORT_ERROR ((
"Could not terminate control method properly\n"));
/* Ignore error and continue */
}
......@@ -1142,7 +1140,8 @@ acpi_ps_parse_aml (
* If the method return value is not used by the parent,
* The object is deleted
*/
status = acpi_ds_restart_control_method (walk_state, previous_walk_state->return_desc);
status = acpi_ds_restart_control_method (walk_state,
previous_walk_state->return_desc);
if (ACPI_SUCCESS (status)) {
walk_state->walk_type |= ACPI_WALK_METHOD_RESTART;
}
......@@ -1152,7 +1151,8 @@ acpi_ps_parse_aml (
acpi_ut_remove_reference (previous_walk_state->return_desc);
ACPI_REPORT_ERROR (("Method execution failed, %s\n", acpi_format_exception (status)));
ACPI_REPORT_ERROR (("Method execution failed, %s\n",
acpi_format_exception (status)));
ACPI_DUMP_PATHNAME (walk_state->method_node, "Method pathname: ",
ACPI_LV_ERROR, _COMPONENT);
}
......
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
* $Revision: 56 $
* $Revision: 57 $
*
*****************************************************************************/
......@@ -175,8 +175,8 @@ acpi_tb_verify_table_checksum (
/* Return the appropriate exception */
if (checksum) {
ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
(u32) checksum, table_header->signature));
ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
table_header->signature, (u32) table_header->checksum, (u32) checksum));
status = AE_BAD_CHECKSUM;
}
......
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