Commit 3bd5d3cd authored by Andy Grover's avatar Andy Grover

Clean up code based on things flagged by lint

Improved error checking on hw accesses
Moved arch specific macros to arch/asm/acpi.h
parent 0b7b934a
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbcmds - debug commands and output routines * Module Name: dbcmds - debug commands and output routines
* $Revision: 79 $ * $Revision: 83 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,15 +25,11 @@ ...@@ -25,15 +25,11 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "acdispat.h" #include "acdispat.h"
#include "amlcode.h" #include "amlcode.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acparser.h"
#include "acevents.h" #include "acevents.h"
#include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
#include "actables.h"
#include "acresrc.h" #include "acresrc.h"
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -47,7 +43,7 @@ ...@@ -47,7 +43,7 @@
* These object types map directly to the ACPI_TYPES * These object types map directly to the ACPI_TYPES
*/ */
ARGUMENT_INFO acpi_db_object_types [] = static ARGUMENT_INFO acpi_db_object_types [] =
{ {"ANY"}, { {"ANY"},
{"NUMBERS"}, {"NUMBERS"},
{"STRINGS"}, {"STRINGS"},
...@@ -97,13 +93,13 @@ acpi_db_walk_for_references ( ...@@ -97,13 +93,13 @@ acpi_db_walk_for_references (
/* Check for match against the namespace node itself */ /* Check for match against the namespace node itself */
if (node == (void *) obj_desc) { if (node == (void *) obj_desc) {
acpi_os_printf ("Object is a Node [%4.4s]\n", &node->name); acpi_os_printf ("Object is a Node [%4.4s]\n", node->name.ascii);
} }
/* Check for match against the object attached to the node */ /* Check for match against the object attached to the node */
if (acpi_ns_get_attached_object (node) == obj_desc) { if (acpi_ns_get_attached_object (node) == obj_desc) {
acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, &node->name); acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, node->name.ascii);
} }
return (AE_OK); return (AE_OK);
...@@ -135,7 +131,7 @@ acpi_db_find_references ( ...@@ -135,7 +131,7 @@ acpi_db_find_references (
/* Search all nodes in namespace */ /* Search all nodes in namespace */
acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_references, (void *) obj_desc, NULL); acpi_db_walk_for_references, (void *) obj_desc, NULL);
} }
...@@ -275,8 +271,8 @@ acpi_db_set_method_breakpoint ( ...@@ -275,8 +271,8 @@ acpi_db_set_method_breakpoint (
/* Get and verify the breakpoint address */ /* Get and verify the breakpoint address */
address = ACPI_STRTOUL (location, NULL, 16); address = ACPI_STRTOUL (location, NULL, 16);
if (address <= op->aml_offset) { if (address <= op->common.aml_offset) {
acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->aml_offset); acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->common.aml_offset);
} }
/* Save breakpoint in current walk */ /* Save breakpoint in current walk */
...@@ -482,6 +478,7 @@ acpi_db_send_notify ( ...@@ -482,6 +478,7 @@ acpi_db_send_notify (
u32 value) u32 value)
{ {
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_status status;
/* Translate name to an Named object */ /* Translate name to an Named object */
...@@ -499,7 +496,10 @@ acpi_db_send_notify ( ...@@ -499,7 +496,10 @@ acpi_db_send_notify (
/* Send the notify */ /* Send the notify */
acpi_ev_queue_notify_request (node, value); status = acpi_ev_queue_notify_request (node, value);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not queue notify\n");
}
break; break;
default: default:
...@@ -536,6 +536,7 @@ acpi_db_set_method_data ( ...@@ -536,6 +536,7 @@ acpi_db_set_method_data (
u32 value; u32 value;
acpi_walk_state *walk_state; acpi_walk_state *walk_state;
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_status status;
/* Validate Type_arg */ /* Validate Type_arg */
...@@ -578,12 +579,16 @@ acpi_db_set_method_data ( ...@@ -578,12 +579,16 @@ acpi_db_set_method_data (
/* Set a method argument */ /* Set a method argument */
if (index > MTH_NUM_ARGS) { if (index > MTH_MAX_ARG) {
acpi_os_printf ("Arg%d - Invalid argument name\n", index); acpi_os_printf ("Arg%d - Invalid argument name\n", index);
return; return;
} }
acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state); status = acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
if (ACPI_FAILURE (status)) {
return;
}
obj_desc = walk_state->arguments[index].object; obj_desc = walk_state->arguments[index].object;
acpi_os_printf ("Arg%d: ", index); acpi_os_printf ("Arg%d: ", index);
...@@ -594,12 +599,16 @@ acpi_db_set_method_data ( ...@@ -594,12 +599,16 @@ acpi_db_set_method_data (
/* Set a method local */ /* Set a method local */
if (index > MTH_NUM_LOCALS) { if (index > MTH_MAX_LOCAL) {
acpi_os_printf ("Local%d - Invalid local variable name\n", index); acpi_os_printf ("Local%d - Invalid local variable name\n", index);
return; return;
} }
acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state); status = acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
if (ACPI_FAILURE (status)) {
return;
}
obj_desc = walk_state->local_variables[index].object; obj_desc = walk_state->local_variables[index].object;
acpi_os_printf ("Local%d: ", index); acpi_os_printf ("Local%d: ", index);
...@@ -678,6 +687,10 @@ acpi_db_walk_for_specific_objects ( ...@@ -678,6 +687,10 @@ acpi_db_walk_for_specific_objects (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
acpi_os_printf (" Length %X", obj_desc->buffer.length); acpi_os_printf (" Length %X", obj_desc->buffer.length);
break; break;
default:
/* Ignore other object types */
break;
} }
} }
...@@ -722,7 +735,7 @@ acpi_db_display_objects ( ...@@ -722,7 +735,7 @@ acpi_db_display_objects (
/* Walk the namespace from the root */ /* Walk the namespace from the root */
acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, (void) acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_specific_objects, (void *) &type, NULL); acpi_db_walk_for_specific_objects, (void *) &type, NULL);
acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
...@@ -762,7 +775,7 @@ acpi_db_walk_and_match_name ( ...@@ -762,7 +775,7 @@ acpi_db_walk_and_match_name (
/* Wildcard support */ /* Wildcard support */
if ((requested_name[i] != '?') && if ((requested_name[i] != '?') &&
(requested_name[i] != ((NATIVE_CHAR *) (&((acpi_namespace_node *) obj_handle)->name))[i])) { (requested_name[i] != ((acpi_namespace_node *) obj_handle)->name.ascii[i])) {
/* No match, just exit */ /* No match, just exit */
return (AE_OK); return (AE_OK);
...@@ -812,7 +825,7 @@ acpi_db_find_name_in_namespace ( ...@@ -812,7 +825,7 @@ acpi_db_find_name_in_namespace (
/* Walk the namespace from the root */ /* Walk the namespace from the root */
acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_and_match_name, name_arg, NULL); acpi_db_walk_and_match_name, name_arg, NULL);
acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
...@@ -899,7 +912,8 @@ void ...@@ -899,7 +912,8 @@ void
acpi_db_display_resources ( acpi_db_display_resources (
NATIVE_CHAR *object_arg) NATIVE_CHAR *object_arg)
{ {
#ifndef _IA16 #if ACPI_MACHINE_WIDTH != 16
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;
acpi_buffer return_obj; acpi_buffer return_obj;
...@@ -964,7 +978,7 @@ acpi_db_display_resources ( ...@@ -964,7 +978,7 @@ acpi_db_display_resources (
} }
else { else {
acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer); acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
} }
status = acpi_set_current_resources (obj_desc, &return_obj); status = acpi_set_current_resources (obj_desc, &return_obj);
...@@ -997,7 +1011,7 @@ acpi_db_display_resources ( ...@@ -997,7 +1011,7 @@ acpi_db_display_resources (
} }
else { else {
acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer); acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
} }
...@@ -1010,4 +1024,89 @@ acpi_db_display_resources ( ...@@ -1010,4 +1024,89 @@ acpi_db_display_resources (
} }
typedef struct
{
u32 nodes;
u32 objects;
} ACPI_INTEGRITY_INFO;
/*******************************************************************************
*
* FUNCTION: Acpi_db_integrity_walk
*
* PARAMETERS: Callback from Walk_namespace
*
* RETURN: Status
*
* DESCRIPTION: Examine one NS node for valid values.
*
******************************************************************************/
acpi_status
acpi_db_integrity_walk (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
{
ACPI_INTEGRITY_INFO *info = (ACPI_INTEGRITY_INFO *) context;
acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
acpi_operand_object *object;
info->nodes++;
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
acpi_os_printf ("Invalid Descriptor Type for Node %p, Type = %X\n",
node, ACPI_GET_DESCRIPTOR_TYPE (node));
}
if (node->type > INTERNAL_TYPE_MAX) {
acpi_os_printf ("Invalid Object Type for Node %p, Type = %X\n",
node, node->type);
}
if (!acpi_ut_valid_acpi_name (node->name.integer)) {
acpi_os_printf ("Invalid Acpi_name for Node %p\n", node);
}
object = acpi_ns_get_attached_object (node);
if (object) {
info->objects++;
if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) {
acpi_os_printf ("Invalid Descriptor Type for Object %p, Type = %X\n",
object, ACPI_GET_DESCRIPTOR_TYPE (object));
}
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_db_check_integrity
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Check entire namespace for data structure integrity
*
******************************************************************************/
void
acpi_db_check_integrity (void)
{
ACPI_INTEGRITY_INFO info = {0,0};
/* Search all nodes in namespace */
(void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_integrity_walk, (void *) &info, NULL);
acpi_os_printf ("Verified %d namespace nodes with %d Objects\n", info.nodes, info.objects);
}
#endif /* ENABLE_DEBUGGER */ #endif /* ENABLE_DEBUGGER */
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbdisply - debug display commands * Module Name: dbdisply - debug display commands
* $Revision: 67 $ * $Revision: 73 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,12 +25,10 @@ ...@@ -25,12 +25,10 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "amlcode.h" #include "amlcode.h"
#include "acdispat.h" #include "acdispat.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acparser.h" #include "acparser.h"
#include "acevents.h"
#include "acinterp.h" #include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
...@@ -61,7 +59,7 @@ acpi_db_get_pointer ( ...@@ -61,7 +59,7 @@ acpi_db_get_pointer (
void *obj_ptr; void *obj_ptr;
#ifdef _IA16 #if ACPI_MACHINE_WIDTH == 16
#include <stdio.h> #include <stdio.h>
/* Have to handle 16-bit pointers of the form segment:offset */ /* Have to handle 16-bit pointers of the form segment:offset */
...@@ -101,16 +99,16 @@ acpi_db_dump_parser_descriptor ( ...@@ -101,16 +99,16 @@ acpi_db_dump_parser_descriptor (
const acpi_opcode_info *info; const acpi_opcode_info *info;
info = acpi_ps_get_opcode_info (op->opcode); info = acpi_ps_get_opcode_info (op->common.aml_opcode);
acpi_os_printf ("Parser Op Descriptor:\n"); acpi_os_printf ("Parser Op Descriptor:\n");
acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->opcode); acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
ACPI_DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name)); ACPI_DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name));
acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->value); acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->common.value.arg);
acpi_os_printf ("%20.20s : %p\n", "Parent", op->parent); acpi_os_printf ("%20.20s : %p\n", "Parent", op->common.parent);
acpi_os_printf ("%20.20s : %p\n", "Next_op", op->next); acpi_os_printf ("%20.20s : %p\n", "Next_op", op->common.next);
} }
...@@ -190,7 +188,7 @@ acpi_db_decode_and_display_object ( ...@@ -190,7 +188,7 @@ acpi_db_decode_and_display_object (
goto dump_nte; goto dump_nte;
case ACPI_DESC_TYPE_INTERNAL: case ACPI_DESC_TYPE_OPERAND:
/* This is a ACPI OPERAND OBJECT */ /* This is a ACPI OPERAND OBJECT */
...@@ -266,7 +264,7 @@ acpi_db_decode_and_display_object ( ...@@ -266,7 +264,7 @@ acpi_db_decode_and_display_object (
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
acpi_os_printf ("\n_attached Object (%p):\n", obj_desc); acpi_os_printf ("\nAttached Object (%p):\n", obj_desc);
if (!acpi_os_readable (obj_desc, sizeof (acpi_operand_object))) { if (!acpi_os_readable (obj_desc, sizeof (acpi_operand_object))) {
acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc); acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc);
return; return;
...@@ -307,8 +305,8 @@ acpi_db_decode_internal_object ( ...@@ -307,8 +305,8 @@ acpi_db_decode_internal_object (
switch (obj_desc->common.type) { switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
acpi_os_printf (" %.8X%.8X", ACPI_HIDWORD (obj_desc->integer.value), acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value)); ACPI_LODWORD (obj_desc->integer.value));
break; break;
...@@ -335,6 +333,11 @@ acpi_db_decode_internal_object ( ...@@ -335,6 +333,11 @@ acpi_db_decode_internal_object (
acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]); acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
} }
break; break;
default:
/* No additional display for other types */
break;
} }
} }
...@@ -379,7 +382,7 @@ acpi_db_display_internal_object ( ...@@ -379,7 +382,7 @@ acpi_db_display_internal_object (
case ACPI_DESC_TYPE_NAMED: case ACPI_DESC_TYPE_NAMED:
acpi_os_printf ("<Node> Name %4.4s Type-%s", acpi_os_printf ("<Node> Name %4.4s Type-%s",
&((acpi_namespace_node *)obj_desc)->name, ((acpi_namespace_node *)obj_desc)->name.ascii,
acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type)); acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) { if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
...@@ -391,11 +394,11 @@ acpi_db_display_internal_object ( ...@@ -391,11 +394,11 @@ acpi_db_display_internal_object (
break; break;
case ACPI_DESC_TYPE_INTERNAL: case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type; type = obj_desc->common.type;
if (type > INTERNAL_TYPE_MAX) { if (type > INTERNAL_TYPE_MAX) {
acpi_os_printf (" Type %x [Invalid Type]", type); acpi_os_printf (" Type %hX [Invalid Type]", type);
return; return;
} }
...@@ -517,13 +520,13 @@ acpi_db_display_method_info ( ...@@ -517,13 +520,13 @@ acpi_db_display_method_info (
num_args = obj_desc->method.param_count; num_args = obj_desc->method.param_count;
concurrency = obj_desc->method.concurrency; concurrency = obj_desc->method.concurrency;
acpi_os_printf ("Currently executing control method is [%4.4s]\n", &node->name); acpi_os_printf ("Currently executing control method is [%4.4s]\n", node->name.ascii);
acpi_os_printf ("%X arguments, max concurrency = %X\n", num_args, concurrency); acpi_os_printf ("%X arguments, max concurrency = %X\n", num_args, concurrency);
root_op = start_op; root_op = start_op;
while (root_op->parent) { while (root_op->common.parent) {
root_op = root_op->parent; root_op = root_op->common.parent;
} }
op = root_op; op = root_op;
...@@ -540,7 +543,7 @@ acpi_db_display_method_info ( ...@@ -540,7 +543,7 @@ acpi_db_display_method_info (
/* Decode the opcode */ /* Decode the opcode */
op_info = acpi_ps_get_opcode_info (op->opcode); op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
switch (op_info->class) { switch (op_info->class) {
case AML_CLASS_ARGUMENT: case AML_CLASS_ARGUMENT:
if (count_remaining) { if (count_remaining) {
...@@ -604,7 +607,7 @@ acpi_db_display_locals (void) ...@@ -604,7 +607,7 @@ acpi_db_display_locals (void)
obj_desc = walk_state->method_desc; obj_desc = walk_state->method_desc;
node = walk_state->method_node; node = walk_state->method_node;
acpi_os_printf ("Local Variables for method [%4.4s]:\n", &node->name); acpi_os_printf ("Local Variables for method [%4.4s]:\n", node->name.ascii);
for (i = 0; i < MTH_NUM_LOCALS; i++) { for (i = 0; i < MTH_NUM_LOCALS; i++) {
obj_desc = walk_state->local_variables[i].object; obj_desc = walk_state->local_variables[i].object;
...@@ -650,7 +653,7 @@ acpi_db_display_arguments (void) ...@@ -650,7 +653,7 @@ acpi_db_display_arguments (void)
concurrency = obj_desc->method.concurrency; concurrency = obj_desc->method.concurrency;
acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
&node->name, num_args, concurrency); node->name.ascii, num_args, concurrency);
for (i = 0; i < num_args; i++) { for (i = 0; i < num_args; i++) {
obj_desc = walk_state->arguments[i].object; obj_desc = walk_state->arguments[i].object;
...@@ -696,7 +699,7 @@ acpi_db_display_results (void) ...@@ -696,7 +699,7 @@ acpi_db_display_results (void)
} }
acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n", acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n",
&node->name, num_results); node->name.ascii, num_results);
for (i = 0; i < num_results; i++) { for (i = 0; i < num_results; i++) {
obj_desc = walk_state->results->results.obj_desc[i]; obj_desc = walk_state->results->results.obj_desc[i];
...@@ -721,7 +724,6 @@ acpi_db_display_results (void) ...@@ -721,7 +724,6 @@ acpi_db_display_results (void)
void void
acpi_db_display_calling_tree (void) acpi_db_display_calling_tree (void)
{ {
u32 i;
acpi_walk_state *walk_state; acpi_walk_state *walk_state;
acpi_namespace_node *node; acpi_namespace_node *node;
...@@ -735,10 +737,10 @@ acpi_db_display_calling_tree (void) ...@@ -735,10 +737,10 @@ acpi_db_display_calling_tree (void)
node = walk_state->method_node; node = walk_state->method_node;
acpi_os_printf ("Current Control Method Call Tree\n"); acpi_os_printf ("Current Control Method Call Tree\n");
for (i = 0; walk_state; i++) { while (walk_state) {
node = walk_state->method_node; node = walk_state->method_node;
acpi_os_printf (" [%4.4s]\n", &node->name); acpi_os_printf (" [%4.4s]\n", node->name.ascii);
walk_state = walk_state->next; walk_state = walk_state->next;
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbexec - debugger control method execution * Module Name: dbexec - debugger control method execution
* $Revision: 39 $ * $Revision: 41 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,15 +25,7 @@ ...@@ -25,15 +25,7 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -41,7 +33,7 @@ ...@@ -41,7 +33,7 @@
ACPI_MODULE_NAME ("dbexec") ACPI_MODULE_NAME ("dbexec")
acpi_db_method_info acpi_gbl_db_method_info; static acpi_db_method_info acpi_gbl_db_method_info;
/******************************************************************************* /*******************************************************************************
...@@ -127,7 +119,7 @@ acpi_db_execute_method ( ...@@ -127,7 +119,7 @@ acpi_db_execute_method (
void void
acpi_db_execute_setup ( acpi_db_execute_setup (
acpi_db_method_info *info) acpi_db_method_info *info)
{ {
/* Catenate the current scope to the supplied name */ /* Catenate the current scope to the supplied name */
...@@ -172,7 +164,8 @@ acpi_db_execute_setup ( ...@@ -172,7 +164,8 @@ acpi_db_execute_setup (
******************************************************************************/ ******************************************************************************/
u32 u32
acpi_db_get_outstanding_allocations (void) acpi_db_get_outstanding_allocations (
void)
{ {
u32 outstanding = 0; u32 outstanding = 0;
...@@ -309,7 +302,10 @@ acpi_db_method_thread ( ...@@ -309,7 +302,10 @@ acpi_db_method_thread (
/* Signal our completion */ /* Signal our completion */
acpi_os_signal_semaphore (info->thread_gate, 1); status = acpi_os_signal_semaphore (info->thread_gate, 1);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not signal debugger semaphore\n");
}
} }
...@@ -373,7 +369,10 @@ acpi_db_create_execution_threads ( ...@@ -373,7 +369,10 @@ acpi_db_create_execution_threads (
acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops); acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops);
for (i = 0; i < (num_threads); i++) { for (i = 0; i < (num_threads); i++) {
acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info); status = acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
if (ACPI_FAILURE (status)) {
break;
}
} }
/* Wait for all threads to complete */ /* Wait for all threads to complete */
...@@ -386,7 +385,7 @@ acpi_db_create_execution_threads ( ...@@ -386,7 +385,7 @@ acpi_db_create_execution_threads (
/* Cleanup and exit */ /* Cleanup and exit */
acpi_os_delete_semaphore (thread_gate); (void) acpi_os_delete_semaphore (thread_gate);
acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("All threads (%X) have completed\n", num_threads); acpi_os_printf ("All threads (%X) have completed\n", num_threads);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: dbfileio - Debugger file I/O commands. These can't usually * Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode) * be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 60 $ * $Revision: 63 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include "acpi.h" #include "acpi.h"
#include "acdebug.h" #include "acdebug.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "actables.h" #include "actables.h"
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -167,7 +165,7 @@ acpi_db_open_debug_file ( ...@@ -167,7 +165,7 @@ acpi_db_open_debug_file (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_db_load_table( acpi_db_load_table(
FILE *fp, FILE *fp,
acpi_table_header **table_ptr, acpi_table_header **table_ptr,
...@@ -285,7 +283,7 @@ ae_local_load_table ( ...@@ -285,7 +283,7 @@ ae_local_load_table (
table_info.pointer = table_ptr; table_info.pointer = table_ptr;
status = acpi_tb_install_table (NULL, &table_info); status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* Free table allocated by Acpi_tb_get_table */ /* Free table allocated by Acpi_tb_get_table */
...@@ -371,7 +369,7 @@ acpi_db_load_acpi_table ( ...@@ -371,7 +369,7 @@ acpi_db_load_acpi_table (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_ALREADY_EXISTS) { if (status == AE_ALREADY_EXISTS) {
acpi_os_printf ("Table %4.4s is already installed\n", acpi_os_printf ("Table %4.4s is already installed\n",
&acpi_gbl_db_table_ptr->signature); acpi_gbl_db_table_ptr->signature);
} }
else { else {
acpi_os_printf ("Could not install table, %s\n", acpi_os_printf ("Could not install table, %s\n",
...@@ -382,7 +380,7 @@ acpi_db_load_acpi_table ( ...@@ -382,7 +380,7 @@ acpi_db_load_acpi_table (
} }
acpi_os_printf ("%4.4s at %p successfully installed and loaded\n", acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
&acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr); acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
acpi_gbl_acpi_hardware_present = FALSE; acpi_gbl_acpi_hardware_present = FALSE;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dbhistry - debugger HISTORY command * Module Name: dbhistry - debugger HISTORY command
* $Revision: 22 $ * $Revision: 24 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -25,15 +25,7 @@ ...@@ -25,15 +25,7 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -54,11 +46,11 @@ typedef struct history_info ...@@ -54,11 +46,11 @@ typedef struct history_info
} HISTORY_INFO; } HISTORY_INFO;
HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE]; static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
u16 acpi_gbl_lo_history = 0; static u16 acpi_gbl_lo_history = 0;
u16 acpi_gbl_num_history = 0; static u16 acpi_gbl_num_history = 0;
u16 acpi_gbl_next_history_index = 0; static u16 acpi_gbl_next_history_index = 0;
u32 acpi_gbl_next_cmd_num = 1; static u32 acpi_gbl_next_cmd_num = 1;
/******************************************************************************* /*******************************************************************************
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbinput - user front-end to the AML debugger * Module Name: dbinput - user front-end to the AML debugger
* $Revision: 81 $ * $Revision: 86 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "actables.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
...@@ -67,6 +63,7 @@ enum acpi_ex_debugger_commands ...@@ -67,6 +63,7 @@ enum acpi_ex_debugger_commands
CMD_HISTORY_EXE, CMD_HISTORY_EXE,
CMD_HISTORY_LAST, CMD_HISTORY_LAST,
CMD_INFORMATION, CMD_INFORMATION,
CMD_INTEGRITY,
CMD_INTO, CMD_INTO,
CMD_LEVEL, CMD_LEVEL,
CMD_LIST, CMD_LIST,
...@@ -97,7 +94,7 @@ enum acpi_ex_debugger_commands ...@@ -97,7 +94,7 @@ enum acpi_ex_debugger_commands
#define CMD_FIRST_VALID 2 #define CMD_FIRST_VALID 2
const COMMAND_INFO acpi_gbl_db_commands[] = static const COMMAND_INFO acpi_gbl_db_commands[] =
{ {"<NOT FOUND>", 0}, { {"<NOT FOUND>", 0},
{"<NULL>", 0}, {"<NULL>", 0},
{"ALLOCATIONS", 0}, {"ALLOCATIONS", 0},
...@@ -120,6 +117,7 @@ const COMMAND_INFO acpi_gbl_db_commands[] = ...@@ -120,6 +117,7 @@ const COMMAND_INFO acpi_gbl_db_commands[] =
{"!", 1}, {"!", 1},
{"!!", 0}, {"!!", 0},
{"INFORMATION", 0}, {"INFORMATION", 0},
{"INTEGRITY", 0},
{"INTO", 0}, {"INTO", 0},
{"LEVEL", 0}, {"LEVEL", 0},
{"LIST", 0}, {"LIST", 0},
...@@ -190,7 +188,7 @@ acpi_db_display_help ( ...@@ -190,7 +188,7 @@ acpi_db_display_help (
switch (help_type[0]) switch (help_type[0])
{ {
case 'G': case 'G':
acpi_os_printf ("\n_general-Purpose Commands\n\n"); acpi_os_printf ("\nGeneral-Purpose Commands\n\n");
acpi_os_printf ("Allocations Display list of current memory allocations\n"); acpi_os_printf ("Allocations Display list of current memory allocations\n");
acpi_os_printf ("Dump <Address>|<Namepath>\n"); acpi_os_printf ("Dump <Address>|<Namepath>\n");
acpi_os_printf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); acpi_os_printf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
...@@ -209,7 +207,7 @@ acpi_db_display_help ( ...@@ -209,7 +207,7 @@ acpi_db_display_help (
return; return;
case 'N': case 'N':
acpi_os_printf ("\n_namespace Access Commands\n\n"); acpi_os_printf ("\nNamespace Access Commands\n\n");
acpi_os_printf ("Debug <Namepath> [Arguments] Single Step a control method\n"); acpi_os_printf ("Debug <Namepath> [Arguments] Single Step a control method\n");
acpi_os_printf ("Event <F|G> <Value> Generate Acpi_event (Fixed/GPE)\n"); acpi_os_printf ("Event <F|G> <Value> Generate Acpi_event (Fixed/GPE)\n");
acpi_os_printf ("Execute <Namepath> [Arguments] Execute control method\n"); acpi_os_printf ("Execute <Namepath> [Arguments] Execute control method\n");
...@@ -227,7 +225,7 @@ acpi_db_display_help ( ...@@ -227,7 +225,7 @@ acpi_db_display_help (
return; return;
case 'M': case 'M':
acpi_os_printf ("\n_control Method Execution Commands\n\n"); acpi_os_printf ("\nControl Method Execution Commands\n\n");
acpi_os_printf ("Arguments (or Args) Display method arguments\n"); acpi_os_printf ("Arguments (or Args) Display method arguments\n");
acpi_os_printf ("Breakpoint <Aml_offset> Set an AML execution breakpoint\n"); acpi_os_printf ("Breakpoint <Aml_offset> Set an AML execution breakpoint\n");
acpi_os_printf ("Call Run to next control method invocation\n"); acpi_os_printf ("Call Run to next control method invocation\n");
...@@ -244,14 +242,14 @@ acpi_db_display_help ( ...@@ -244,14 +242,14 @@ acpi_db_display_help (
return; return;
case 'F': case 'F':
acpi_os_printf ("\n_file I/O Commands\n\n"); acpi_os_printf ("\nFile I/O Commands\n\n");
acpi_os_printf ("Close Close debug output file\n"); acpi_os_printf ("Close Close debug output file\n");
acpi_os_printf ("Open <Output Filename> Open a file for debug output\n"); acpi_os_printf ("Open <Output Filename> Open a file for debug output\n");
acpi_os_printf ("Load <Input Filename> Load ACPI table from a file\n"); acpi_os_printf ("Load <Input Filename> Load ACPI table from a file\n");
return; return;
default: default:
acpi_os_printf ("Unrecognized Command Class: %x\n", help_type); acpi_os_printf ("Unrecognized Command Class: %X\n", help_type);
return; return;
} }
} }
...@@ -526,7 +524,7 @@ acpi_db_command_dispatch ( ...@@ -526,7 +524,7 @@ acpi_db_command_dispatch (
break; break;
case CMD_FIND: case CMD_FIND:
acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]); status = acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]);
break; break;
case CMD_GO: case CMD_GO:
...@@ -574,6 +572,10 @@ acpi_db_command_dispatch ( ...@@ -574,6 +572,10 @@ acpi_db_command_dispatch (
acpi_db_display_method_info (op); acpi_db_display_method_info (op);
break; break;
case CMD_INTEGRITY:
acpi_db_check_integrity ();
break;
case CMD_INTO: case CMD_INTO:
if (op) if (op)
{ {
...@@ -623,7 +625,7 @@ acpi_db_command_dispatch ( ...@@ -623,7 +625,7 @@ acpi_db_command_dispatch (
break; break;
case CMD_METHODS: case CMD_METHODS:
acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]); status = acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]);
break; break;
case CMD_NAMESPACE: case CMD_NAMESPACE:
...@@ -636,7 +638,8 @@ acpi_db_command_dispatch ( ...@@ -636,7 +638,8 @@ acpi_db_command_dispatch (
break; break;
case CMD_OBJECT: case CMD_OBJECT:
acpi_db_display_objects (ACPI_STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]); ACPI_STRUPR (acpi_gbl_db_args[1]);
status = acpi_db_display_objects (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
break; break;
case CMD_OPEN: case CMD_OPEN:
...@@ -668,11 +671,11 @@ acpi_db_command_dispatch ( ...@@ -668,11 +671,11 @@ acpi_db_command_dispatch (
break; break;
case CMD_STATS: case CMD_STATS:
acpi_db_display_statistics (acpi_gbl_db_args[1]); status = acpi_db_display_statistics (acpi_gbl_db_args[1]);
break; break;
case CMD_STOP: case CMD_STOP:
return (AE_AML_ERROR); return (AE_NOT_IMPLEMENTED);
case CMD_TABLES: case CMD_TABLES:
acpi_db_display_table_info (acpi_gbl_db_args[1]); acpi_db_display_table_info (acpi_gbl_db_args[1]);
...@@ -722,6 +725,7 @@ acpi_db_command_dispatch ( ...@@ -722,6 +725,7 @@ acpi_db_command_dispatch (
return (AE_CTRL_TERMINATE); return (AE_CTRL_TERMINATE);
case CMD_NOT_FOUND: case CMD_NOT_FOUND:
default:
acpi_os_printf ("Unknown Command\n"); acpi_os_printf ("Unknown Command\n");
return (AE_CTRL_TRUE); return (AE_CTRL_TRUE);
} }
...@@ -794,13 +798,11 @@ void ...@@ -794,13 +798,11 @@ void
acpi_db_single_thread ( acpi_db_single_thread (
void) void)
{ {
acpi_status status;
acpi_gbl_method_executing = FALSE; acpi_gbl_method_executing = FALSE;
acpi_gbl_step_to_next_call = FALSE; acpi_gbl_step_to_next_call = FALSE;
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL); (void) acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
} }
...@@ -847,8 +849,7 @@ acpi_db_user_commands ( ...@@ -847,8 +849,7 @@ acpi_db_user_commands (
/* Get the user input line */ /* Get the user input line */
acpi_os_get_line (acpi_gbl_db_line_buf); (void) acpi_os_get_line (acpi_gbl_db_line_buf);
/* Check for single or multithreaded debug */ /* Check for single or multithreaded debug */
...@@ -882,7 +883,7 @@ acpi_db_user_commands ( ...@@ -882,7 +883,7 @@ acpi_db_user_commands (
* Only this thread (the original thread) should actually terminate the subsystem, * Only this thread (the original thread) should actually terminate the subsystem,
* because all the semaphores are deleted during termination * because all the semaphores are deleted during termination
*/ */
acpi_terminate (); status = acpi_terminate ();
return (status); return (status);
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbstats - Generation and display of ACPI table statistics * Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 55 $ * $Revision: 59 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <acpi.h> #include <acpi.h>
#include <acdebug.h> #include <acdebug.h>
#include <amlcode.h>
#include <acparser.h>
#include <acnamesp.h> #include <acnamesp.h>
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -38,7 +36,7 @@ ...@@ -38,7 +36,7 @@
/* /*
* Statistics subcommands * Statistics subcommands
*/ */
ARGUMENT_INFO acpi_db_stat_types [] = static ARGUMENT_INFO acpi_db_stat_types [] =
{ {"ALLOCATIONS"}, { {"ALLOCATIONS"},
{"OBJECTS"}, {"OBJECTS"},
{"MEMORY"}, {"MEMORY"},
...@@ -49,13 +47,13 @@ ARGUMENT_INFO acpi_db_stat_types [] = ...@@ -49,13 +47,13 @@ ARGUMENT_INFO acpi_db_stat_types [] =
{NULL} /* Must be null terminated */ {NULL} /* Must be null terminated */
}; };
#define CMD_ALLOCATIONS 0 #define CMD_STAT_ALLOCATIONS 0
#define CMD_OBJECTS 1 #define CMD_STAT_OBJECTS 1
#define CMD_MEMORY 2 #define CMD_STAT_MEMORY 2
#define CMD_MISC 3 #define CMD_STAT_MISC 3
#define CMD_TABLES 4 #define CMD_STAT_TABLES 4
#define CMD_SIZES 5 #define CMD_STAT_SIZES 5
#define CMD_STACK 6 #define CMD_STAT_STACK 6
/******************************************************************************* /*******************************************************************************
...@@ -143,6 +141,9 @@ acpi_db_enumerate_object ( ...@@ -143,6 +141,9 @@ acpi_db_enumerate_object (
acpi_db_enumerate_object (obj_desc->thermal_zone.drv_handler); acpi_db_enumerate_object (obj_desc->thermal_zone.drv_handler);
acpi_db_enumerate_object (obj_desc->thermal_zone.addr_handler); acpi_db_enumerate_object (obj_desc->thermal_zone.addr_handler);
break; break;
default:
break;
} }
} }
...@@ -232,7 +233,7 @@ acpi_db_classify_one_object ( ...@@ -232,7 +233,7 @@ acpi_db_classify_one_object (
* *
******************************************************************************/ ******************************************************************************/
acpi_status void
acpi_db_count_namespace_objects ( acpi_db_count_namespace_objects (
void) void)
{ {
...@@ -249,10 +250,8 @@ acpi_db_count_namespace_objects ( ...@@ -249,10 +250,8 @@ acpi_db_count_namespace_objects (
acpi_gbl_node_type_count [i] = 0; acpi_gbl_node_type_count [i] = 0;
} }
acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, (void) acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
FALSE, acpi_db_classify_one_object, NULL, NULL); FALSE, acpi_db_classify_one_object, NULL, NULL);
return (AE_OK);
} }
#endif #endif
...@@ -305,14 +304,14 @@ acpi_db_display_statistics ( ...@@ -305,14 +304,14 @@ acpi_db_display_statistics (
switch (type) switch (type)
{ {
#ifndef PARSER_ONLY #ifndef PARSER_ONLY
case CMD_ALLOCATIONS: case CMD_STAT_ALLOCATIONS:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS #ifdef ACPI_DBG_TRACK_ALLOCATIONS
acpi_ut_dump_allocation_info (); acpi_ut_dump_allocation_info ();
#endif #endif
break; break;
#endif #endif
case CMD_TABLES: case CMD_STAT_TABLES:
acpi_os_printf ("ACPI Table Information:\n\n"); acpi_os_printf ("ACPI Table Information:\n\n");
if (acpi_gbl_DSDT) if (acpi_gbl_DSDT)
...@@ -321,13 +320,13 @@ acpi_db_display_statistics ( ...@@ -321,13 +320,13 @@ acpi_db_display_statistics (
} }
break; break;
case CMD_OBJECTS: case CMD_STAT_OBJECTS:
#ifndef PARSER_ONLY #ifndef PARSER_ONLY
acpi_db_count_namespace_objects (); acpi_db_count_namespace_objects ();
acpi_os_printf ("\n_objects defined in the current namespace:\n\n"); acpi_os_printf ("\nObjects defined in the current namespace:\n\n");
acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS"); acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
...@@ -345,7 +344,7 @@ acpi_db_display_statistics ( ...@@ -345,7 +344,7 @@ acpi_db_display_statistics (
#endif #endif
break; break;
case CMD_MEMORY: case CMD_STAT_MEMORY:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS #ifdef ACPI_DBG_TRACK_ALLOCATIONS
acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n"); acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n");
...@@ -391,9 +390,9 @@ acpi_db_display_statistics ( ...@@ -391,9 +390,9 @@ acpi_db_display_statistics (
break; break;
case CMD_MISC: case CMD_STAT_MISC:
acpi_os_printf ("\n_miscellaneous Statistics:\n\n"); acpi_os_printf ("\nMiscellaneous Statistics:\n\n");
acpi_os_printf ("Calls to Acpi_ps_find:.. ........% 7ld\n", acpi_gbl_ps_find_count); acpi_os_printf ("Calls to Acpi_ps_find:.. ........% 7ld\n", acpi_gbl_ps_find_count);
acpi_os_printf ("Calls to Acpi_ns_lookup:..........% 7ld\n", acpi_gbl_ns_lookup_count); acpi_os_printf ("Calls to Acpi_ns_lookup:..........% 7ld\n", acpi_gbl_ns_lookup_count);
...@@ -407,9 +406,9 @@ acpi_db_display_statistics ( ...@@ -407,9 +406,9 @@ acpi_db_display_statistics (
break; break;
case CMD_SIZES: case CMD_STAT_SIZES:
acpi_os_printf ("\n_internal object sizes:\n\n"); acpi_os_printf ("\nInternal object sizes:\n\n");
acpi_os_printf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON)); acpi_os_printf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
acpi_os_printf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER)); acpi_os_printf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
...@@ -436,23 +435,29 @@ acpi_db_display_statistics ( ...@@ -436,23 +435,29 @@ acpi_db_display_statistics (
acpi_os_printf ("\n"); acpi_os_printf ("\n");
acpi_os_printf ("Parse_object %3d\n", sizeof (acpi_parse_object)); acpi_os_printf ("Parse_object %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
acpi_os_printf ("Parse2_object %3d\n", sizeof (acpi_parse2_object)); acpi_os_printf ("Parse_object_named %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
acpi_os_printf ("Parse_object_asl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
acpi_os_printf ("Operand_object %3d\n", sizeof (acpi_operand_object)); acpi_os_printf ("Operand_object %3d\n", sizeof (acpi_operand_object));
acpi_os_printf ("Namespace_node %3d\n", sizeof (acpi_namespace_node)); acpi_os_printf ("Namespace_node %3d\n", sizeof (acpi_namespace_node));
break; break;
case CMD_STACK: case CMD_STAT_STACK:
#if defined(ACPI_DEBUG)
size = acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer; size = (u32) (acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer);
acpi_os_printf ("\n_subsystem Stack Usage:\n\n"); acpi_os_printf ("\nSubsystem Stack Usage:\n\n");
acpi_os_printf ("Entry Stack Pointer %X\n", acpi_gbl_entry_stack_pointer); acpi_os_printf ("Entry Stack Pointer %X\n", acpi_gbl_entry_stack_pointer);
acpi_os_printf ("Lowest Stack Pointer %X\n", acpi_gbl_lowest_stack_pointer); acpi_os_printf ("Lowest Stack Pointer %X\n", acpi_gbl_lowest_stack_pointer);
acpi_os_printf ("Stack Use %X (%d)\n", size, size); acpi_os_printf ("Stack Use %X (%d)\n", size, size);
acpi_os_printf ("Deepest Procedure Nesting %d\n", acpi_gbl_deepest_nesting); acpi_os_printf ("Deepest Procedure Nesting %d\n", acpi_gbl_deepest_nesting);
#endif
break;
default:
break; break;
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbutils - AML debugger utilities * Module Name: dbutils - AML debugger utilities
* $Revision: 52 $ * $Revision: 55 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -28,9 +28,6 @@ ...@@ -28,9 +28,6 @@
#include "acparser.h" #include "acparser.h"
#include "amlcode.h" #include "amlcode.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
#include "acdispat.h" #include "acdispat.h"
...@@ -87,7 +84,7 @@ acpi_db_dump_buffer ( ...@@ -87,7 +84,7 @@ acpi_db_dump_buffer (
u32 address) u32 address)
{ {
acpi_os_printf ("\n_location %X:\n", address); acpi_os_printf ("\nLocation %X:\n", address);
acpi_dbg_level |= ACPI_LV_TABLES; acpi_dbg_level |= ACPI_LV_TABLES;
acpi_ut_dump_buffer (ACPI_TO_POINTER (address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); acpi_ut_dump_buffer (ACPI_TO_POINTER (address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
...@@ -259,7 +256,7 @@ acpi_db_second_pass_parse ( ...@@ -259,7 +256,7 @@ acpi_db_second_pass_parse (
acpi_parse_object *root) acpi_parse_object *root)
{ {
acpi_parse_object *op = root; acpi_parse_object *op = root;
acpi_parse2_object *method; acpi_parse_object *method;
acpi_parse_object *search_op; acpi_parse_object *search_op;
acpi_parse_object *start_op; acpi_parse_object *start_op;
acpi_status status = AE_OK; acpi_status status = AE_OK;
...@@ -272,10 +269,11 @@ acpi_db_second_pass_parse ( ...@@ -272,10 +269,11 @@ acpi_db_second_pass_parse (
acpi_os_printf ("Pass two parse ....\n"); acpi_os_printf ("Pass two parse ....\n");
while (op) { while (op) {
if (op->opcode == AML_METHOD_OP) { if (op->common.aml_opcode == AML_METHOD_OP) {
method = (acpi_parse2_object *) op; method = op;
/* Create a new walk state for the parse */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
NULL, NULL, NULL); NULL, NULL, NULL);
...@@ -283,32 +281,32 @@ acpi_db_second_pass_parse ( ...@@ -283,32 +281,32 @@ acpi_db_second_pass_parse (
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
/* Init the Walk State */
walk_state->parser_state.aml = walk_state->parser_state.aml =
walk_state->parser_state.aml_start = method->data; walk_state->parser_state.aml_start = method->named.data;
walk_state->parser_state.aml_end = walk_state->parser_state.aml_end =
walk_state->parser_state.pkg_end = method->data + method->length; walk_state->parser_state.pkg_end = method->named.data + method->named.length;
walk_state->parser_state.start_scope = op; walk_state->parser_state.start_scope = op;
walk_state->descending_callback = acpi_ds_load1_begin_op; walk_state->descending_callback = acpi_ds_load1_begin_op;
walk_state->ascending_callback = acpi_ds_load1_end_op; walk_state->ascending_callback = acpi_ds_load1_end_op;
/* Perform the AML parse */
status = acpi_ps_parse_aml (walk_state); status = acpi_ps_parse_aml (walk_state);
base_aml_offset = (method->common.value.arg)->common.aml_offset + 1;
base_aml_offset = (method->value.arg)->aml_offset + 1; start_op = (method->common.value.arg)->common.next;
start_op = (method->value.arg)->next;
search_op = start_op; search_op = start_op;
while (search_op) { while (search_op) {
search_op->aml_offset += base_aml_offset; search_op->common.aml_offset += base_aml_offset;
search_op = acpi_ps_get_depth_next (start_op, search_op); search_op = acpi_ps_get_depth_next (start_op, search_op);
} }
} }
if (op->opcode == AML_REGION_OP) { if (op->common.aml_opcode == AML_REGION_OP) {
/* TBD: [Investigate] this isn't quite the right thing to do! */ /* TBD: [Investigate] this isn't quite the right thing to do! */
/* /*
* *
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbxface - AML Debugger external interfaces * Module Name: dbxface - AML Debugger external interfaces
* $Revision: 55 $ * $Revision: 59 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,12 +25,7 @@ ...@@ -25,12 +25,7 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "amlcode.h" #include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
...@@ -71,11 +66,12 @@ acpi_db_single_step ( ...@@ -71,11 +66,12 @@ acpi_db_single_step (
/* Check for single-step breakpoint */ /* Check for single-step breakpoint */
if (walk_state->method_breakpoint && (walk_state->method_breakpoint <= op->aml_offset)) { if (walk_state->method_breakpoint &&
(walk_state->method_breakpoint <= op->common.aml_offset)) {
/* Check if the breakpoint has been reached or passed */ /* Check if the breakpoint has been reached or passed */
/* Hit the breakpoint, resume single step, reset breakpoint */ /* Hit the breakpoint, resume single step, reset breakpoint */
acpi_os_printf ("***Break*** at AML offset %X\n", op->aml_offset); acpi_os_printf ("***Break*** at AML offset %X\n", op->common.aml_offset);
acpi_gbl_cm_single_step = TRUE; acpi_gbl_cm_single_step = TRUE;
acpi_gbl_step_to_next_call = FALSE; acpi_gbl_step_to_next_call = FALSE;
walk_state->method_breakpoint = 0; walk_state->method_breakpoint = 0;
...@@ -83,8 +79,9 @@ acpi_db_single_step ( ...@@ -83,8 +79,9 @@ acpi_db_single_step (
/* Check for user breakpoint (Must be on exact Aml offset) */ /* Check for user breakpoint (Must be on exact Aml offset) */
else if (walk_state->user_breakpoint && (walk_state->user_breakpoint == op->aml_offset)) { else if (walk_state->user_breakpoint &&
acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->aml_offset); (walk_state->user_breakpoint == op->common.aml_offset)) {
acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->common.aml_offset);
acpi_gbl_cm_single_step = TRUE; acpi_gbl_cm_single_step = TRUE;
acpi_gbl_step_to_next_call = FALSE; acpi_gbl_step_to_next_call = FALSE;
walk_state->method_breakpoint = 0; walk_state->method_breakpoint = 0;
...@@ -95,7 +92,7 @@ acpi_db_single_step ( ...@@ -95,7 +92,7 @@ acpi_db_single_step (
* Check if this is an opcode that we are interested in -- * Check if this is an opcode that we are interested in --
* namely, opcodes that have arguments * namely, opcodes that have arguments
*/ */
if (op->opcode == AML_INT_NAMEDFIELD_OP) { if (op->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
return (AE_OK); return (AE_OK);
} }
...@@ -103,6 +100,10 @@ acpi_db_single_step ( ...@@ -103,6 +100,10 @@ acpi_db_single_step (
case AML_CLASS_UNKNOWN: case AML_CLASS_UNKNOWN:
case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */ case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
return (AE_OK); return (AE_OK);
default:
/* All other opcodes -- continue */
break;
} }
/* /*
...@@ -123,12 +124,12 @@ acpi_db_single_step ( ...@@ -123,12 +124,12 @@ acpi_db_single_step (
*/ */
original_debug_level = acpi_dbg_level; original_debug_level = acpi_dbg_level;
acpi_dbg_level &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS); acpi_dbg_level &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
next = op->next; next = op->common.next;
op->next = NULL; op->common.next = NULL;
display_op = op; display_op = op;
parent_op = op->parent; parent_op = op->common.parent;
if (parent_op) { if (parent_op) {
if ((walk_state->control_state) && if ((walk_state->control_state) &&
(walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING)) { (walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING)) {
...@@ -138,25 +139,25 @@ acpi_db_single_step ( ...@@ -138,25 +139,25 @@ acpi_db_single_step (
* entire predicate can be displayed. * entire predicate can be displayed.
*/ */
while (parent_op) { while (parent_op) {
if ((parent_op->opcode == AML_IF_OP) || if ((parent_op->common.aml_opcode == AML_IF_OP) ||
(parent_op->opcode == AML_WHILE_OP)) { (parent_op->common.aml_opcode == AML_WHILE_OP)) {
display_op = parent_op; display_op = parent_op;
break; break;
} }
parent_op = parent_op->parent; parent_op = parent_op->common.parent;
} }
} }
else { else {
while (parent_op) { while (parent_op) {
if ((parent_op->opcode == AML_IF_OP) || if ((parent_op->common.aml_opcode == AML_IF_OP) ||
(parent_op->opcode == AML_ELSE_OP) || (parent_op->common.aml_opcode == AML_ELSE_OP) ||
(parent_op->opcode == AML_SCOPE_OP) || (parent_op->common.aml_opcode == AML_SCOPE_OP) ||
(parent_op->opcode == AML_METHOD_OP) || (parent_op->common.aml_opcode == AML_METHOD_OP) ||
(parent_op->opcode == AML_WHILE_OP)) { (parent_op->common.aml_opcode == AML_WHILE_OP)) {
break; break;
} }
display_op = parent_op; display_op = parent_op;
parent_op = parent_op->parent; parent_op = parent_op->common.parent;
} }
} }
} }
...@@ -165,8 +166,8 @@ acpi_db_single_step ( ...@@ -165,8 +166,8 @@ acpi_db_single_step (
acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX); acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX);
if ((op->opcode == AML_IF_OP) || if ((op->common.aml_opcode == AML_IF_OP) ||
(op->opcode == AML_WHILE_OP)) { (op->common.aml_opcode == AML_WHILE_OP)) {
if (walk_state->control_state->common.value) { if (walk_state->control_state->common.value) {
acpi_os_printf ("Predicate = [True], IF block was executed\n"); acpi_os_printf ("Predicate = [True], IF block was executed\n");
} }
...@@ -175,13 +176,13 @@ acpi_db_single_step ( ...@@ -175,13 +176,13 @@ acpi_db_single_step (
} }
} }
else if (op->opcode == AML_ELSE_OP) { else if (op->common.aml_opcode == AML_ELSE_OP) {
acpi_os_printf ("Predicate = [False], ELSE block was executed\n"); acpi_os_printf ("Predicate = [False], ELSE block was executed\n");
} }
/* Restore everything */ /* Restore everything */
op->next = next; op->common.next = next;
acpi_os_printf ("\n"); acpi_os_printf ("\n");
acpi_dbg_level = original_debug_level; acpi_dbg_level = original_debug_level;
} }
...@@ -197,7 +198,7 @@ acpi_db_single_step ( ...@@ -197,7 +198,7 @@ acpi_db_single_step (
* Check if this is a method call. * Check if this is a method call.
*/ */
if (acpi_gbl_step_to_next_call) { if (acpi_gbl_step_to_next_call) {
if (op->opcode != AML_INT_METHODCALL_OP) { if (op->common.aml_opcode != AML_INT_METHODCALL_OP) {
/* Not a method call, just keep executing */ /* Not a method call, just keep executing */
return (AE_OK); return (AE_OK);
...@@ -212,7 +213,7 @@ acpi_db_single_step ( ...@@ -212,7 +213,7 @@ acpi_db_single_step (
* If the next opcode is a method call, we will "step over" it * If the next opcode is a method call, we will "step over" it
* by default. * by default.
*/ */
if (op->opcode == AML_INT_METHODCALL_OP) { if (op->common.aml_opcode == AML_INT_METHODCALL_OP) {
acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */ acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */
/* Set the breakpoint on/before the call, it will stop execution as soon as we return */ /* Set the breakpoint on/before the call, it will stop execution as soon as we return */
...@@ -261,7 +262,7 @@ acpi_db_single_step ( ...@@ -261,7 +262,7 @@ acpi_db_single_step (
/* Get the user input line */ /* Get the user input line */
acpi_os_get_line (acpi_gbl_db_line_buf); (void) acpi_os_get_line (acpi_gbl_db_line_buf);
} }
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, walk_state, op); status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, walk_state, op);
...@@ -287,9 +288,11 @@ acpi_db_single_step ( ...@@ -287,9 +288,11 @@ acpi_db_single_step (
* *
******************************************************************************/ ******************************************************************************/
int acpi_status
acpi_db_initialize (void) acpi_db_initialize (void)
{ {
acpi_status status;
/* Init globals */ /* Init globals */
...@@ -309,7 +312,7 @@ acpi_db_initialize (void) ...@@ -309,7 +312,7 @@ acpi_db_initialize (void)
acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE); acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
if (!acpi_gbl_db_buffer) { if (!acpi_gbl_db_buffer) {
return 0; return (AE_NO_MEMORY);
} }
ACPI_MEMSET (acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE); ACPI_MEMSET (acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE);
...@@ -327,12 +330,24 @@ acpi_db_initialize (void) ...@@ -327,12 +330,24 @@ acpi_db_initialize (void)
if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
/* These were created with one unit, grab it */ /* These were created with one unit, grab it */
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE); status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY); if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not get debugger mutex\n");
return (status);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not get debugger mutex\n");
return (status);
}
/* Create the debug execution thread to execute commands */ /* Create the debug execution thread to execute commands */
acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL); status = acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not start debugger thread\n");
return (status);
}
} }
if (!acpi_gbl_db_opt_verbose) { if (!acpi_gbl_db_opt_verbose) {
...@@ -341,7 +356,7 @@ acpi_db_initialize (void) ...@@ -341,7 +356,7 @@ acpi_db_initialize (void)
acpi_gbl_db_opt_stats = FALSE; acpi_gbl_db_opt_stats = FALSE;
} }
return (0); return (AE_OK);
} }
......
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 81 $ * $Revision: 86 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include "acdispat.h" #include "acdispat.h"
#include "acinterp.h" #include "acinterp.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "actables.h"
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
...@@ -78,7 +76,7 @@ acpi_ds_parse_method ( ...@@ -78,7 +76,7 @@ acpi_ds_parse_method (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** Named_obj=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** Named_obj=%p\n",
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle)); ((acpi_namespace_node *) obj_handle)->name.ascii, obj_handle));
/* Extract the method object from the method Node */ /* Extract the method object from the method Node */
...@@ -112,7 +110,7 @@ acpi_ds_parse_method ( ...@@ -112,7 +110,7 @@ acpi_ds_parse_method (
/* Init new op with the method name and pointer back to the Node */ /* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name (op, node->name.integer); acpi_ps_set_name (op, node->name.integer);
op->node = node; op->common.node = node;
/* /*
* Get a new Owner_id for objects created by this method. Namespace * Get a new Owner_id for objects created by this method. Namespace
...@@ -124,8 +122,7 @@ acpi_ds_parse_method ( ...@@ -124,8 +122,7 @@ acpi_ds_parse_method (
/* Create and initialize a new walk state */ /* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (owner_id, walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
NULL, NULL, NULL);
if (!walk_state) { if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -152,8 +149,9 @@ acpi_ds_parse_method ( ...@@ -152,8 +149,9 @@ acpi_ds_parse_method (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op)); "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
((acpi_namespace_node *) obj_handle)->name.ascii, obj_handle, op));
acpi_ps_delete_parse_tree (op); acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -348,8 +346,8 @@ acpi_ds_call_control_method ( ...@@ -348,8 +346,8 @@ acpi_ds_call_control_method (
this_walk_state->num_operands = 0; this_walk_state->num_operands = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
next_walk_state)); "Starting nested execution, newstate=%p\n", next_walk_state));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -357,7 +355,7 @@ acpi_ds_call_control_method ( ...@@ -357,7 +355,7 @@ acpi_ds_call_control_method (
/* On error, we must delete the new walk state */ /* On error, we must delete the new walk state */
cleanup: cleanup:
acpi_ds_terminate_control_method (next_walk_state); (void) acpi_ds_terminate_control_method (next_walk_state);
acpi_ds_delete_walk_state (next_walk_state); acpi_ds_delete_walk_state (next_walk_state);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -444,6 +442,10 @@ acpi_ds_terminate_control_method ( ...@@ -444,6 +442,10 @@ acpi_ds_terminate_control_method (
ACPI_FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state); ACPI_FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
if (!walk_state) {
return (AE_BAD_PARAMETER);
}
/* The current method object was saved in the walk state */ /* The current method object was saved in the walk state */
obj_desc = walk_state->method_desc; obj_desc = walk_state->method_desc;
...@@ -468,8 +470,14 @@ acpi_ds_terminate_control_method ( ...@@ -468,8 +470,14 @@ acpi_ds_terminate_control_method (
/* Signal completion of the execution of this method if necessary */ /* Signal completion of the execution of this method if necessary */
if (walk_state->method_desc->method.semaphore) { if (walk_state->method_desc->method.semaphore) {
acpi_os_signal_semaphore ( status = acpi_os_signal_semaphore (
walk_state->method_desc->method.semaphore, 1); walk_state->method_desc->method.semaphore, 1);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
status = AE_OK;
/* Ignore error and continue cleanup */
}
} }
/* Decrement the thread count on the method parse tree */ /* Decrement the thread count on the method parse tree */
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsmthdat - control method arguments and local variables * Module Name: dsmthdat - control method arguments and local variables
* $Revision: 59 $ * $Revision: 61 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h"
#include "acdispat.h" #include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h" #include "amlcode.h"
#include "acnamesp.h" #include "acnamesp.h"
...@@ -57,7 +55,7 @@ ...@@ -57,7 +55,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status void
acpi_ds_method_data_init ( acpi_ds_method_data_init (
acpi_walk_state *walk_state) acpi_walk_state *walk_state)
{ {
...@@ -90,7 +88,7 @@ acpi_ds_method_data_init ( ...@@ -90,7 +88,7 @@ acpi_ds_method_data_init (
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
} }
return_ACPI_STATUS (AE_OK); return_VOID;
} }
...@@ -100,14 +98,14 @@ acpi_ds_method_data_init ( ...@@ -100,14 +98,14 @@ acpi_ds_method_data_init (
* *
* PARAMETERS: Walk_state - Current walk state object * PARAMETERS: Walk_state - Current walk state object
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Delete method locals and arguments. Arguments are only * DESCRIPTION: Delete method locals and arguments. Arguments are only
* deleted if this method was called from another method. * deleted if this method was called from another method.
* *
******************************************************************************/ ******************************************************************************/
acpi_status void
acpi_ds_method_data_delete_all ( acpi_ds_method_data_delete_all (
acpi_walk_state *walk_state) acpi_walk_state *walk_state)
{ {
...@@ -127,7 +125,7 @@ acpi_ds_method_data_delete_all ( ...@@ -127,7 +125,7 @@ acpi_ds_method_data_delete_all (
/* Detach object (if present) and remove a reference */ /* Detach object (if present) and remove a reference */
acpi_ns_detach_object (&walk_state->local_variables[index]); acpi_ns_detach_object (&walk_state->local_variables[index]);
} }
} }
/* Detach the arguments */ /* Detach the arguments */
...@@ -143,7 +141,7 @@ acpi_ds_method_data_delete_all ( ...@@ -143,7 +141,7 @@ acpi_ds_method_data_delete_all (
} }
} }
return_ACPI_STATUS (AE_OK); return_VOID;
} }
...@@ -435,6 +433,9 @@ acpi_ds_method_data_get_value ( ...@@ -435,6 +433,9 @@ acpi_ds_method_data_get_value (
index, node)); index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
return_ACPI_STATUS (AE_AML_INTERNAL);
} }
} }
...@@ -457,14 +458,14 @@ acpi_ds_method_data_get_value ( ...@@ -457,14 +458,14 @@ acpi_ds_method_data_get_value (
* Index - Which local_var or argument to delete * Index - Which local_var or argument to delete
* Walk_state - Current walk state object * Walk_state - Current walk state object
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
* a null into the stack slot after the object is deleted. * a null into the stack slot after the object is deleted.
* *
******************************************************************************/ ******************************************************************************/
acpi_status void
acpi_ds_method_data_delete_value ( acpi_ds_method_data_delete_value (
u16 opcode, u16 opcode,
u32 index, u32 index,
...@@ -482,7 +483,7 @@ acpi_ds_method_data_delete_value ( ...@@ -482,7 +483,7 @@ acpi_ds_method_data_delete_value (
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_VOID;
} }
/* Get the associated object */ /* Get the associated object */
...@@ -497,7 +498,7 @@ acpi_ds_method_data_delete_value ( ...@@ -497,7 +498,7 @@ acpi_ds_method_data_delete_value (
node->object = NULL; node->object = NULL;
if ((object) && if ((object) &&
(ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_INTERNAL)) { (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
/* /*
* There is a valid object. * There is a valid object.
* Decrement the reference count by one to balance the * Decrement the reference count by one to balance the
...@@ -506,7 +507,7 @@ acpi_ds_method_data_delete_value ( ...@@ -506,7 +507,7 @@ acpi_ds_method_data_delete_value (
acpi_ut_remove_reference (object); acpi_ut_remove_reference (object);
} }
return_ACPI_STATUS (AE_OK); return_VOID;
} }
......
This diff is collapsed.
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsutils - Dispatcher utilities * Module Name: dsutils - Dispatcher utilities
* $Revision: 89 $ * $Revision: 92 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -74,14 +74,14 @@ acpi_ds_is_result_used ( ...@@ -74,14 +74,14 @@ acpi_ds_is_result_used (
* method is parsed separately) However, a method that is * method is parsed separately) However, a method that is
* invoked from another method has a parent. * invoked from another method has a parent.
*/ */
if (!op->parent) { if (!op->common.parent) {
return_VALUE (FALSE); return_VALUE (FALSE);
} }
/* /*
* Get info on the parent. The root Op is AML_SCOPE * Get info on the parent. The root Op is AML_SCOPE
*/ */
parent_info = acpi_ps_get_opcode_info (op->parent->opcode); parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) { if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
return_VALUE (FALSE); return_VALUE (FALSE);
...@@ -96,7 +96,7 @@ acpi_ds_is_result_used ( ...@@ -96,7 +96,7 @@ acpi_ds_is_result_used (
switch (parent_info->class) { switch (parent_info->class) {
case AML_CLASS_CONTROL: case AML_CLASS_CONTROL:
switch (op->parent->opcode) { switch (op->common.parent->common.aml_opcode) {
case AML_RETURN_OP: case AML_RETURN_OP:
/* Never delete the return value associated with a return opcode */ /* Never delete the return value associated with a return opcode */
...@@ -114,6 +114,11 @@ acpi_ds_is_result_used ( ...@@ -114,6 +114,11 @@ acpi_ds_is_result_used (
(walk_state->control_state->control.predicate_op == op)) { (walk_state->control_state->control.predicate_op == op)) {
goto result_used; goto result_used;
} }
break;
default:
/* Ignore other control opcodes */
break;
} }
/* The general control opcode returns no result */ /* The general control opcode returns no result */
...@@ -132,12 +137,12 @@ acpi_ds_is_result_used ( ...@@ -132,12 +137,12 @@ acpi_ds_is_result_used (
case AML_CLASS_NAMED_OBJECT: case AML_CLASS_NAMED_OBJECT:
if ((op->parent->opcode == AML_REGION_OP) || if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
(op->parent->opcode == AML_DATA_REGION_OP) || (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
(op->parent->opcode == AML_PACKAGE_OP) || (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
(op->parent->opcode == AML_VAR_PACKAGE_OP) || (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) ||
(op->parent->opcode == AML_BUFFER_OP) || (op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
(op->parent->opcode == AML_INT_EVAL_SUBTREE_OP)) { (op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) {
/* /*
* These opcodes allow Term_arg(s) as operands and therefore * These opcodes allow Term_arg(s) as operands and therefore
* the operands can be method calls. The result is used. * the operands can be method calls. The result is used.
...@@ -160,16 +165,16 @@ acpi_ds_is_result_used ( ...@@ -160,16 +165,16 @@ acpi_ds_is_result_used (
result_used: result_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->opcode), acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->parent->opcode), op)); acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (TRUE); return_VALUE (TRUE);
result_not_used: result_not_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->opcode), acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->parent->opcode), op)); acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (FALSE); return_VALUE (FALSE);
...@@ -253,6 +258,7 @@ acpi_ds_create_operand ( ...@@ -253,6 +258,7 @@ acpi_ds_create_operand (
u32 arg_index) u32 arg_index)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_status status2;
NATIVE_CHAR *name_string; NATIVE_CHAR *name_string;
u32 name_length; u32 name_length;
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
...@@ -268,13 +274,13 @@ acpi_ds_create_operand ( ...@@ -268,13 +274,13 @@ acpi_ds_create_operand (
/* A valid name must be looked up in the namespace */ /* A valid name must be looked up in the namespace */
if ((arg->opcode == AML_INT_NAMEPATH_OP) && if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
(arg->value.string)) { (arg->common.value.string)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
/* Get the entire name string from the AML stream */ /* Get the entire name string from the AML stream */
status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->value.buffer, status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
&name_string, &name_length); &name_string, &name_length);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -292,12 +298,12 @@ acpi_ds_create_operand ( ...@@ -292,12 +298,12 @@ acpi_ds_create_operand (
* IMODE_EXECUTE) in order to support the creation of * IMODE_EXECUTE) in order to support the creation of
* namespace objects during the execution of control methods. * namespace objects during the execution of control methods.
*/ */
parent_op = arg->parent; parent_op = arg->common.parent;
op_info = acpi_ps_get_opcode_info (parent_op->opcode); op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
if ((op_info->flags & AML_NSNODE) && if ((op_info->flags & AML_NSNODE) &&
(parent_op->opcode != AML_INT_METHODCALL_OP) && (parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
(parent_op->opcode != AML_REGION_OP) && (parent_op->common.aml_opcode != AML_REGION_OP) &&
(parent_op->opcode != AML_INT_NAMEPATH_OP)) { (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
/* Enter name into namespace if not found */ /* Enter name into namespace if not found */
interpreter_mode = ACPI_IMODE_LOAD_PASS2; interpreter_mode = ACPI_IMODE_LOAD_PASS2;
...@@ -313,20 +319,20 @@ acpi_ds_create_operand ( ...@@ -313,20 +319,20 @@ acpi_ds_create_operand (
ACPI_TYPE_ANY, interpreter_mode, ACPI_TYPE_ANY, interpreter_mode,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, walk_state,
(acpi_namespace_node **) &obj_desc); ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, &obj_desc));
/* /*
* The only case where we pass through (ignore) a NOT_FOUND * The only case where we pass through (ignore) a NOT_FOUND
* error is for the Cond_ref_of opcode. * error is for the Cond_ref_of opcode.
*/ */
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
if (parent_op->opcode == AML_COND_REF_OF_OP) { if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) {
/* /*
* For the Conditional Reference op, it's OK if * For the Conditional Reference op, it's OK if
* the name is not found; We just need a way to * the name is not found; We just need a way to
* indicate this to the interpreter, set the * indicate this to the interpreter, set the
* object to the root * object to the root
*/ */
obj_desc = (acpi_operand_object *) acpi_gbl_root_node; obj_desc = ACPI_CAST_PTR (acpi_operand_object, acpi_gbl_root_node);
status = AE_OK; status = AE_OK;
} }
...@@ -338,10 +344,12 @@ acpi_ds_create_operand ( ...@@ -338,10 +344,12 @@ acpi_ds_create_operand (
status = AE_AML_NAME_NOT_FOUND; status = AE_AML_NAME_NOT_FOUND;
name = NULL; name = NULL;
acpi_ns_externalize_name (ACPI_UINT32_MAX, name_string, NULL, &name); status2 = acpi_ns_externalize_name (ACPI_UINT32_MAX, name_string, NULL, &name);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, if (ACPI_SUCCESS (status2)) {
"Object name [%s] was not found in namespace\n", name)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
ACPI_MEM_FREE (name); "Object name [%s] was not found in namespace\n", name));
ACPI_MEM_FREE (name);
}
} }
} }
...@@ -368,7 +376,7 @@ acpi_ds_create_operand ( ...@@ -368,7 +376,7 @@ acpi_ds_create_operand (
else { else {
/* Check for null name case */ /* Check for null name case */
if (arg->opcode == AML_INT_NAMEPATH_OP) { if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* /*
* If the name is null, this means that this is an * If the name is null, this means that this is an
* optional result parameter that was not specified * optional result parameter that was not specified
...@@ -381,7 +389,7 @@ acpi_ds_create_operand ( ...@@ -381,7 +389,7 @@ acpi_ds_create_operand (
} }
else { else {
opcode = arg->opcode; opcode = arg->common.aml_opcode;
} }
/* Get the object type of the argument */ /* Get the object type of the argument */
...@@ -413,7 +421,6 @@ acpi_ds_create_operand ( ...@@ -413,7 +421,6 @@ acpi_ds_create_operand (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
else { else {
/* Create an ACPI_INTERNAL_OBJECT for the argument */ /* Create an ACPI_INTERNAL_OBJECT for the argument */
...@@ -430,7 +437,7 @@ acpi_ds_create_operand ( ...@@ -430,7 +437,7 @@ acpi_ds_create_operand (
acpi_ut_delete_object_desc (obj_desc); acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
/* Put the operand object on the object stack */ /* Put the operand object on the object stack */
...@@ -487,7 +494,7 @@ acpi_ds_create_operands ( ...@@ -487,7 +494,7 @@ acpi_ds_create_operands (
/* Move on to next argument, if any */ /* Move on to next argument, if any */
arg = arg->next; arg = arg->common.next;
arg_count++; arg_count++;
} }
...@@ -500,7 +507,7 @@ acpi_ds_create_operands ( ...@@ -500,7 +507,7 @@ acpi_ds_create_operands (
* pop everything off of the operand stack and delete those * pop everything off of the operand stack and delete those
* objects * objects
*/ */
acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state); (void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
(arg_count + 1), acpi_format_exception (status))); (arg_count + 1), acpi_format_exception (status)));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: dswexec - Dispatcher method execution callbacks; * Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter. * dispatch to interpreter.
* $Revision: 90 $ * $Revision: 92 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
/* /*
* Dispatch table for opcode classes * Dispatch table for opcode classes
*/ */
ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_1A_0T_0R, acpi_ex_opcode_1A_0T_0R,
acpi_ex_opcode_1A_0T_1R, acpi_ex_opcode_1A_0T_1R,
acpi_ex_opcode_1A_1T_0R, acpi_ex_opcode_1A_1T_0R,
...@@ -200,13 +200,17 @@ acpi_ds_exec_begin_op ( ...@@ -200,13 +200,17 @@ acpi_ds_exec_begin_op (
op = *out_op; op = *out_op;
walk_state->op = op; walk_state->op = op;
walk_state->op_info = acpi_ps_get_opcode_info (op->opcode); walk_state->opcode = op->common.aml_opcode;
walk_state->opcode = op->opcode; walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name (walk_state->op_info->object_type), op)); acpi_ut_get_type_name (walk_state->op_info->object_type), op));
acpi_ds_scope_stack_pop (walk_state);
status = acpi_ds_scope_stack_pop (walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
} }
} }
...@@ -241,7 +245,7 @@ acpi_ds_exec_begin_op ( ...@@ -241,7 +245,7 @@ acpi_ds_exec_begin_op (
/* We want to send namepaths to the load code */ /* We want to send namepaths to the load code */
if (op->opcode == AML_INT_NAMEPATH_OP) { if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
opcode_class = AML_CLASS_NAMED_OBJECT; opcode_class = AML_CLASS_NAMED_OBJECT;
} }
...@@ -273,7 +277,7 @@ acpi_ds_exec_begin_op ( ...@@ -273,7 +277,7 @@ acpi_ds_exec_begin_op (
status = acpi_ds_load2_begin_op (walk_state, NULL); status = acpi_ds_load2_begin_op (walk_state, NULL);
} }
if (op->opcode == AML_REGION_OP) { if (op->common.aml_opcode == AML_REGION_OP) {
status = acpi_ds_result_stack_push (walk_state); status = acpi_ds_result_stack_push (walk_state);
} }
break; break;
...@@ -336,11 +340,11 @@ acpi_ds_exec_end_op ( ...@@ -336,11 +340,11 @@ acpi_ds_exec_end_op (
op_class = walk_state->op_info->class; op_class = walk_state->op_info->class;
if (op_class == AML_CLASS_UNKNOWN) { if (op_class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->opcode)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED); return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
} }
first_arg = op->value.arg; first_arg = op->common.value.arg;
/* Init the walk state */ /* Init the walk state */
...@@ -432,8 +436,11 @@ acpi_ds_exec_end_op ( ...@@ -432,8 +436,11 @@ acpi_ds_exec_end_op (
/* 1 Operand, 0 External_result, 0 Internal_result */ /* 1 Operand, 0 External_result, 0 Internal_result */
status = acpi_ds_exec_end_control_op (walk_state, op); status = acpi_ds_exec_end_control_op (walk_state, op);
if (ACPI_FAILURE (status)) {
break;
}
acpi_ds_result_stack_pop (walk_state); status = acpi_ds_result_stack_pop (walk_state);
break; break;
...@@ -451,7 +458,7 @@ acpi_ds_exec_end_op ( ...@@ -451,7 +458,7 @@ acpi_ds_exec_end_op (
/* Next_op points to first argument op */ /* Next_op points to first argument op */
next_op = next_op->next; next_op = next_op->common.next;
/* /*
* Get the method's arguments and put them on the operand stack * Get the method's arguments and put them on the operand stack
...@@ -503,26 +510,28 @@ acpi_ds_exec_end_op ( ...@@ -503,26 +510,28 @@ acpi_ds_exec_end_op (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing Create_object (Buffer/Package) Op=%p\n", op)); "Executing Create_object (Buffer/Package) Op=%p\n", op));
switch (op->parent->opcode) { switch (op->common.parent->common.aml_opcode) {
case AML_NAME_OP: case AML_NAME_OP:
/* /*
* Put the Node on the object stack (Contains the ACPI Name of * Put the Node on the object stack (Contains the ACPI Name of
* this object) * this object)
*/ */
walk_state->operands[0] = (void *) op->parent->node; walk_state->operands[0] = (void *) op->common.parent->common.node;
walk_state->num_operands = 1; walk_state->num_operands = 1;
status = acpi_ds_create_node (walk_state, op->parent->node, op->parent); status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
break; break;
} }
/* Fall through */ /* Fall through */
/*lint -fallthrough */
case AML_INT_EVAL_SUBTREE_OP: case AML_INT_EVAL_SUBTREE_OP:
status = acpi_ds_eval_data_object_operands (walk_state, op, acpi_ns_get_attached_object (op->parent->node)); status = acpi_ds_eval_data_object_operands (walk_state, op,
acpi_ns_get_attached_object (op->common.parent->common.node));
break; break;
default: default:
...@@ -552,7 +561,7 @@ acpi_ds_exec_end_op ( ...@@ -552,7 +561,7 @@ acpi_ds_exec_end_op (
break; break;
} }
if (op->opcode == AML_REGION_OP) { if (op->common.aml_opcode == AML_REGION_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing Op_region Address/Length Op=%p\n", op)); "Executing Op_region Address/Length Op=%p\n", op));
...@@ -585,7 +594,7 @@ acpi_ds_exec_end_op ( ...@@ -585,7 +594,7 @@ acpi_ds_exec_end_op (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
op_class, op_type, op->opcode, op)); op_class, op_type, op->common.aml_opcode, op));
status = AE_NOT_IMPLEMENTED; status = AE_NOT_IMPLEMENTED;
break; break;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 62 $ * $Revision: 66 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -115,21 +115,21 @@ acpi_ds_load1_begin_op ( ...@@ -115,21 +115,21 @@ acpi_ds_load1_begin_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
if (op && (op->opcode == AML_INT_NAMEDFIELD_OP)) { if (op && (op->common.aml_opcode == AML_INT_NAMEDFIELD_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
} }
/* We are only interested in opcodes that have an associated name */ /* We are only interested in opcodes that have an associated name */
if (walk_state->op) { if (op) {
if (!(walk_state->op_info->flags & AML_NAMED)) { if (!(walk_state->op_info->flags & AML_NAMED)) {
*out_op = op; *out_op = op;
return (AE_OK); return (AE_OK);
} }
/* Check if this object has already been installed in the namespace */ /* Check if this object has already been installed in the namespace */
if (op->node) { if (op->common.node) {
*out_op = op; *out_op = op;
return (AE_OK); return (AE_OK);
} }
...@@ -142,7 +142,7 @@ acpi_ds_load1_begin_op ( ...@@ -142,7 +142,7 @@ acpi_ds_load1_begin_op (
object_type = walk_state->op_info->object_type; object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%x\n", walk_state, op, object_type)); "State=%p Op=%p Type=%X\n", walk_state, op, object_type));
/* /*
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
...@@ -167,13 +167,13 @@ acpi_ds_load1_begin_op ( ...@@ -167,13 +167,13 @@ acpi_ds_load1_begin_op (
/* Initialize */ /* Initialize */
((acpi_parse2_object *)op)->name = node->name.integer; op->named.name = node->name.integer;
/* /*
* Put the Node in the "op" object that the parser uses, so we * Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed * can get it again quickly when this scope is closed
*/ */
op->node = node; op->common.node = node;
acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op); acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op);
*out_op = op; *out_op = op;
...@@ -202,6 +202,7 @@ acpi_ds_load1_end_op ( ...@@ -202,6 +202,7 @@ acpi_ds_load1_end_op (
{ {
acpi_parse_object *op; acpi_parse_object *op;
acpi_object_type object_type; acpi_object_type object_type;
acpi_status status = AE_OK;
ACPI_FUNCTION_NAME ("Ds_load1_end_op"); ACPI_FUNCTION_NAME ("Ds_load1_end_op");
...@@ -224,24 +225,26 @@ acpi_ds_load1_end_op ( ...@@ -224,24 +225,26 @@ acpi_ds_load1_end_op (
if (walk_state->opcode == AML_FIELD_OP || if (walk_state->opcode == AML_FIELD_OP ||
walk_state->opcode == AML_BANK_FIELD_OP || walk_state->opcode == AML_BANK_FIELD_OP ||
walk_state->opcode == AML_INDEX_FIELD_OP) { walk_state->opcode == AML_INDEX_FIELD_OP) {
acpi_ds_init_field_objects (op, walk_state); status = acpi_ds_init_field_objects (op, walk_state);
} }
return (AE_OK); return (status);
} }
if (op->opcode == AML_REGION_OP) { if (op->common.aml_opcode == AML_REGION_OP) {
/*Status = */acpi_ex_create_region (((acpi_parse2_object *) op)->data, status = acpi_ex_create_region (op->named.data, op->named.length,
((acpi_parse2_object *) op)->length, (ACPI_ADR_SPACE_TYPE) ((op->common.value.arg)->common.value.integer), walk_state);
(ACPI_ADR_SPACE_TYPE) ((op->value.arg)->value.integer), walk_state); if (ACPI_FAILURE (status)) {
return (status);
}
} }
if (op->opcode == AML_NAME_OP) { if (op->common.aml_opcode == AML_NAME_OP) {
/* For Name opcode, get the object type from the argument */ /* For Name opcode, get the object type from the argument */
if (op->value.arg) { if (op->common.value.arg) {
object_type = (acpi_ps_get_opcode_info ((op->value.arg)->opcode))->object_type; object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type;
op->node->type = (u8) object_type; op->common.node->type = (u8) object_type;
} }
} }
...@@ -251,10 +254,10 @@ acpi_ds_load1_end_op ( ...@@ -251,10 +254,10 @@ acpi_ds_load1_end_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
acpi_ut_get_type_name (object_type), op)); acpi_ut_get_type_name (object_type), op));
acpi_ds_scope_stack_pop (walk_state); status = acpi_ds_scope_stack_pop (walk_state);
} }
return (AE_OK); return (status);
} }
...@@ -282,7 +285,6 @@ acpi_ds_load2_begin_op ( ...@@ -282,7 +285,6 @@ acpi_ds_load2_begin_op (
acpi_status status; acpi_status status;
acpi_object_type object_type; acpi_object_type object_type;
NATIVE_CHAR *buffer_ptr; NATIVE_CHAR *buffer_ptr;
void *original = NULL;
ACPI_FUNCTION_NAME ("Ds_load2_begin_op"); ACPI_FUNCTION_NAME ("Ds_load2_begin_op");
...@@ -305,7 +307,7 @@ acpi_ds_load2_begin_op ( ...@@ -305,7 +307,7 @@ acpi_ds_load2_begin_op (
if (walk_state->opcode == AML_INT_NAMEPATH_OP) { if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/* For Namepath op, get the path string */ /* For Namepath op, get the path string */
buffer_ptr = op->value.string; buffer_ptr = op->common.value.string;
if (!buffer_ptr) { if (!buffer_ptr) {
/* No name, just exit */ /* No name, just exit */
...@@ -315,7 +317,7 @@ acpi_ds_load2_begin_op ( ...@@ -315,7 +317,7 @@ acpi_ds_load2_begin_op (
else { else {
/* Get name from the op */ /* Get name from the op */
buffer_ptr = (NATIVE_CHAR *) &((acpi_parse2_object *)op)->name; buffer_ptr = (NATIVE_CHAR *) &op->named.name;
} }
} }
else { else {
...@@ -329,7 +331,7 @@ acpi_ds_load2_begin_op ( ...@@ -329,7 +331,7 @@ acpi_ds_load2_begin_op (
object_type = walk_state->op_info->object_type; object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%x\n", walk_state, op, object_type)); "State=%p Op=%p Type=%X\n", walk_state, op, object_type));
if (walk_state->opcode == AML_FIELD_OP || if (walk_state->opcode == AML_FIELD_OP ||
...@@ -347,9 +349,12 @@ acpi_ds_load2_begin_op ( ...@@ -347,9 +349,12 @@ acpi_ds_load2_begin_op (
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
} }
else { else {
if (op && op->node) { /* All other opcodes */
original = op->node;
node = op->node; if (op && op->common.node) {
/* This op/node was previously entered into the namespace */
node = op->common.node;
if (acpi_ns_opens_scope (object_type)) { if (acpi_ns_opens_scope (object_type)) {
status = acpi_ds_scope_stack_push (node, object_type, walk_state); status = acpi_ds_scope_stack_push (node, object_type, walk_state);
...@@ -381,24 +386,19 @@ acpi_ds_load2_begin_op ( ...@@ -381,24 +386,19 @@ acpi_ds_load2_begin_op (
/* Initialize the new op */ /* Initialize the new op */
((acpi_parse2_object *)op)->name = node->name.integer; if (node) {
*out_op = op; op->named.name = node->name.integer;
}
if (out_op) {
*out_op = op;
}
} }
/* /*
* Put the Node in the "op" object that the parser uses, so we * Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed * can get it again quickly when this scope is closed
*/ */
op->node = node; op->common.node = node;
if (original) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", original, node));
if (original != node) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Lookup match error: old %p new %p\n", original, node));
}
}
} }
return (status); return (status);
...@@ -445,11 +445,11 @@ acpi_ds_load2_end_op ( ...@@ -445,11 +445,11 @@ acpi_ds_load2_end_op (
return (AE_OK); return (AE_OK);
} }
if (op->opcode == AML_SCOPE_OP) { if (op->common.aml_opcode == AML_SCOPE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Ending scope Op=%p State=%p\n", op, walk_state)); "Ending scope Op=%p State=%p\n", op, walk_state));
if (((acpi_parse2_object *)op)->name == ACPI_UINT16_MAX) { if (op->named.name == ACPI_UINT16_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
op, walk_state)); op, walk_state));
return (AE_OK); return (AE_OK);
...@@ -463,7 +463,7 @@ acpi_ds_load2_end_op ( ...@@ -463,7 +463,7 @@ acpi_ds_load2_end_op (
* Get the Node/name from the earlier lookup * Get the Node/name from the earlier lookup
* (It was saved in the *op structure) * (It was saved in the *op structure)
*/ */
node = op->node; node = op->common.node;
/* /*
* Put the Node on the object stack (Contains the ACPI Name of * Put the Node on the object stack (Contains the ACPI Name of
...@@ -477,7 +477,11 @@ acpi_ds_load2_end_op ( ...@@ -477,7 +477,11 @@ acpi_ds_load2_end_op (
if (acpi_ns_opens_scope (object_type)) { if (acpi_ns_opens_scope (object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name (object_type), op)); acpi_ut_get_type_name (object_type), op));
acpi_ds_scope_stack_pop (walk_state);
status = acpi_ds_scope_stack_pop (walk_state);
if (ACPI_FAILURE (status)) {
return (status);
}
} }
/* /*
...@@ -510,11 +514,11 @@ acpi_ds_load2_end_op ( ...@@ -510,11 +514,11 @@ acpi_ds_load2_end_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Create-Load [%s] State=%p Op=%p Named_obj=%p\n", "Create-Load [%s] State=%p Op=%p Named_obj=%p\n",
acpi_ps_get_opcode_name (op->opcode), walk_state, op, node)); acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node));
/* Decode the opcode */ /* Decode the opcode */
arg = op->value.arg; arg = op->common.value.arg;
switch (walk_state->op_info->type) { switch (walk_state->op_info->type) {
case AML_TYPE_CREATE_FIELD: case AML_TYPE_CREATE_FIELD:
...@@ -529,21 +533,25 @@ acpi_ds_load2_end_op ( ...@@ -529,21 +533,25 @@ acpi_ds_load2_end_op (
case AML_TYPE_NAMED_FIELD: case AML_TYPE_NAMED_FIELD:
switch (op->opcode) { switch (op->common.aml_opcode) {
case AML_INDEX_FIELD_OP: case AML_INDEX_FIELD_OP:
status = acpi_ds_create_index_field (op, (acpi_handle) arg->node, status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
walk_state); walk_state);
break; break;
case AML_BANK_FIELD_OP: case AML_BANK_FIELD_OP:
status = acpi_ds_create_bank_field (op, arg->node, walk_state); status = acpi_ds_create_bank_field (op, arg->common.node, walk_state);
break; break;
case AML_FIELD_OP: case AML_FIELD_OP:
status = acpi_ds_create_field (op, arg->node, walk_state); status = acpi_ds_create_field (op, arg->common.node, walk_state);
break;
default:
/* All NAMED_FIELD opcodes must be handled above */
break; break;
} }
break; break;
...@@ -556,7 +564,7 @@ acpi_ds_load2_end_op ( ...@@ -556,7 +564,7 @@ acpi_ds_load2_end_op (
goto cleanup; goto cleanup;
} }
switch (op->opcode) { switch (op->common.aml_opcode) {
case AML_PROCESSOR_OP: case AML_PROCESSOR_OP:
status = acpi_ex_create_processor (walk_state); status = acpi_ex_create_processor (walk_state);
...@@ -606,7 +614,7 @@ acpi_ds_load2_end_op ( ...@@ -606,7 +614,7 @@ acpi_ds_load2_end_op (
case AML_TYPE_NAMED_COMPLEX: case AML_TYPE_NAMED_COMPLEX:
switch (op->opcode) { switch (op->common.aml_opcode) {
case AML_METHOD_OP: case AML_METHOD_OP:
/* /*
* Method_op Pkg_length Name_string Method_flags Term_list * Method_op Pkg_length Name_string Method_flags Term_list
...@@ -621,9 +629,8 @@ acpi_ds_load2_end_op ( ...@@ -621,9 +629,8 @@ acpi_ds_load2_end_op (
goto cleanup; goto cleanup;
} }
status = acpi_ex_create_method (((acpi_parse2_object *) op)->data, status = acpi_ex_create_method (op->named.data,
((acpi_parse2_object *) op)->length, op->named.length, walk_state);
walk_state);
} }
break; break;
...@@ -655,6 +662,11 @@ acpi_ds_load2_end_op ( ...@@ -655,6 +662,11 @@ acpi_ds_load2_end_op (
status = acpi_ds_create_node (walk_state, node, op); status = acpi_ds_create_node (walk_state, node, op);
break; break;
default:
/* All NAMED_COMPLEX opcodes must be handled above */
break;
} }
break; break;
...@@ -674,7 +686,7 @@ acpi_ds_load2_end_op ( ...@@ -674,7 +686,7 @@ acpi_ds_load2_end_op (
/* /*
* Lookup the method name and save the Node * Lookup the method name and save the Node
*/ */
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string, status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &(new_node)); walk_state, &(new_node));
...@@ -691,7 +703,7 @@ acpi_ds_load2_end_op ( ...@@ -691,7 +703,7 @@ acpi_ds_load2_end_op (
* 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
* can get it again at the end of this scope * can get it again at the end of this scope
*/ */
op->node = new_node; op->common.node = new_node;
} }
break; break;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswstate - Dispatcher parse tree walk management routines * Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 59 $ * $Revision: 64 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -25,11 +25,9 @@ ...@@ -25,11 +25,9 @@
#include "acpi.h" #include "acpi.h"
#include "amlcode.h"
#include "acparser.h" #include "acparser.h"
#include "acdispat.h" #include "acdispat.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dswstate") ACPI_MODULE_NAME ("dswstate")
...@@ -126,13 +124,12 @@ acpi_ds_result_remove ( ...@@ -126,13 +124,12 @@ acpi_ds_result_remove (
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (index >= OBJ_NUM_OPERANDS) { if (index >= OBJ_MAX_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X State=%p Num=%X\n", "Index out of range: %X State=%p Num=%X\n",
index, walk_state, state->results.num_results)); index, walk_state, state->results.num_results));
} }
/* Check for a valid result object */ /* Check for a valid result object */
if (!state->results.obj_desc [index]) { if (!state->results.obj_desc [index]) {
...@@ -237,7 +234,7 @@ acpi_ds_result_pop_from_bottom ( ...@@ -237,7 +234,7 @@ acpi_ds_result_pop_from_bottom (
acpi_operand_object **object, acpi_operand_object **object,
acpi_walk_state *walk_state) acpi_walk_state *walk_state)
{ {
u32 index; NATIVE_UINT index;
acpi_generic_state *state; acpi_generic_state *state;
...@@ -251,7 +248,6 @@ acpi_ds_result_pop_from_bottom ( ...@@ -251,7 +248,6 @@ acpi_ds_result_pop_from_bottom (
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (!state->results.num_results) { if (!state->results.num_results) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
...@@ -273,7 +269,7 @@ acpi_ds_result_pop_from_bottom ( ...@@ -273,7 +269,7 @@ acpi_ds_result_pop_from_bottom (
if (!*object) { if (!*object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
walk_state, state->results.num_results, index)); walk_state, state->results.num_results, (u32) index));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
...@@ -329,7 +325,6 @@ acpi_ds_result_push ( ...@@ -329,7 +325,6 @@ acpi_ds_result_push (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
state->results.obj_desc [state->results.num_results] = object; state->results.obj_desc [state->results.num_results] = object;
state->results.num_results++; state->results.num_results++;
...@@ -694,7 +689,6 @@ acpi_ds_obj_stack_get_value ( ...@@ -694,7 +689,6 @@ acpi_ds_obj_stack_get_value (
return_PTR (NULL); return_PTR (NULL);
} }
return_PTR (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) - return_PTR (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) -
index]); index]);
} }
...@@ -728,7 +722,6 @@ acpi_ds_get_current_walk_state ( ...@@ -728,7 +722,6 @@ acpi_ds_get_current_walk_state (
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",
thread->walk_state_list)); thread->walk_state_list));
return (thread->walk_state_list); return (thread->walk_state_list);
} }
...@@ -918,7 +911,6 @@ acpi_ds_init_aml_walk ( ...@@ -918,7 +911,6 @@ acpi_ds_init_aml_walk (
walk_state->method_node = method_node; walk_state->method_node = method_node;
walk_state->method_desc = acpi_ns_get_attached_object (method_node); walk_state->method_desc = acpi_ns_get_attached_object (method_node);
/* Push start scope on scope stack and make it current */ /* Push start scope on scope stack and make it current */
status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state); status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
...@@ -928,13 +920,15 @@ acpi_ds_init_aml_walk ( ...@@ -928,13 +920,15 @@ acpi_ds_init_aml_walk (
/* Init the method arguments */ /* Init the method arguments */
acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state); status = acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
} }
else { else {
/* Setup the current scope */ /* Setup the current scope */
parser_state->start_node = parser_state->start_op->node; parser_state->start_node = parser_state->start_op->common.node;
if (parser_state->start_node) { if (parser_state->start_node) {
/* Push start scope on scope stack and make it current */ /* Push start scope on scope stack and make it current */
...@@ -946,9 +940,8 @@ acpi_ds_init_aml_walk ( ...@@ -946,9 +940,8 @@ acpi_ds_init_aml_walk (
} }
} }
acpi_ds_init_callbacks (walk_state, pass_number); status = acpi_ds_init_callbacks (walk_state, pass_number);
return_ACPI_STATUS (status);
return_ACPI_STATUS (AE_OK);
} }
#endif #endif
...@@ -984,7 +977,6 @@ acpi_ds_delete_walk_state ( ...@@ -984,7 +977,6 @@ acpi_ds_delete_walk_state (
return; return;
} }
if (walk_state->parser_state.scope) { if (walk_state->parser_state.scope) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state));
} }
......
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* Module Name: evmisc - Miscellaneous event manager support functions * Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 48 $ * $Revision: 53 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "acevents.h" #include "acevents.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h" #include "acinterp.h"
#include "achware.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evmisc") ACPI_MODULE_NAME ("evmisc")
...@@ -178,7 +177,7 @@ acpi_ev_queue_notify_request ( ...@@ -178,7 +177,7 @@ acpi_ev_queue_notify_request (
} }
/* /*
* Get the notify object attached to the device Node * Get the notify object attached to the NS Node
*/ */
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
...@@ -186,25 +185,21 @@ acpi_ev_queue_notify_request ( ...@@ -186,25 +185,21 @@ acpi_ev_queue_notify_request (
switch (node->type) { switch (node->type) {
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
handler_obj = obj_desc->device.sys_handler;
}
else {
handler_obj = obj_desc->device.drv_handler;
}
break;
case ACPI_TYPE_THERMAL: case ACPI_TYPE_THERMAL:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
if (notify_value <= ACPI_MAX_SYS_NOTIFY) { if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
handler_obj = obj_desc->thermal_zone.sys_handler; handler_obj = obj_desc->common_notify.sys_handler;
} }
else { else {
handler_obj = obj_desc->thermal_zone.drv_handler; handler_obj = obj_desc->common_notify.drv_handler;
} }
break; break;
default:
/* All other types are not supported */
return (AE_TYPE);
} }
} }
...@@ -323,14 +318,19 @@ static void ACPI_SYSTEM_XFACE ...@@ -323,14 +318,19 @@ static void ACPI_SYSTEM_XFACE
acpi_ev_global_lock_thread ( acpi_ev_global_lock_thread (
void *context) void *context)
{ {
acpi_status status;
/* Signal threads that are waiting for the lock */ /* Signal threads that are waiting for the lock */
if (acpi_gbl_global_lock_thread_count) { if (acpi_gbl_global_lock_thread_count) {
/* Send sufficient units to the semaphore */ /* Send sufficient units to the semaphore */
acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore, status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
acpi_gbl_global_lock_thread_count); acpi_gbl_global_lock_thread_count);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
}
} }
} }
...@@ -352,6 +352,7 @@ acpi_ev_global_lock_handler ( ...@@ -352,6 +352,7 @@ acpi_ev_global_lock_handler (
void *context) void *context)
{ {
u8 acquired = FALSE; u8 acquired = FALSE;
acpi_status status;
/* /*
...@@ -367,8 +368,14 @@ acpi_ev_global_lock_handler ( ...@@ -367,8 +368,14 @@ acpi_ev_global_lock_handler (
/* Run the Global Lock thread which will signal all waiting threads */ /* Run the Global Lock thread which will signal all waiting threads */
acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, acpi_ev_global_lock_thread, status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
context); acpi_ev_global_lock_thread, context);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
acpi_format_exception (status)));
return (ACPI_INTERRUPT_NOT_HANDLED);
}
} }
return (ACPI_INTERRUPT_HANDLED); return (ACPI_INTERRUPT_HANDLED);
...@@ -487,10 +494,11 @@ acpi_ev_acquire_global_lock ( ...@@ -487,10 +494,11 @@ acpi_ev_acquire_global_lock (
* *
******************************************************************************/ ******************************************************************************/
void acpi_status
acpi_ev_release_global_lock (void) acpi_ev_release_global_lock (void)
{ {
u8 pending = FALSE; u8 pending = FALSE;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Ev_release_global_lock"); ACPI_FUNCTION_TRACE ("Ev_release_global_lock");
...@@ -498,7 +506,7 @@ acpi_ev_release_global_lock (void) ...@@ -498,7 +506,7 @@ acpi_ev_release_global_lock (void)
if (!acpi_gbl_global_lock_thread_count) { if (!acpi_gbl_global_lock_thread_count) {
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
return_VOID; return_ACPI_STATUS (AE_NOT_ACQUIRED);
} }
/* One fewer thread has the global lock */ /* One fewer thread has the global lock */
...@@ -507,7 +515,7 @@ acpi_ev_release_global_lock (void) ...@@ -507,7 +515,7 @@ acpi_ev_release_global_lock (void)
if (acpi_gbl_global_lock_thread_count) { if (acpi_gbl_global_lock_thread_count) {
/* There are still some threads holding the lock, cannot release */ /* There are still some threads holding the lock, cannot release */
return_VOID; return_ACPI_STATUS (AE_OK);
} }
/* /*
...@@ -522,10 +530,10 @@ acpi_ev_release_global_lock (void) ...@@ -522,10 +530,10 @@ acpi_ev_release_global_lock (void)
* register * register
*/ */
if (pending) { if (pending) {
acpi_hw_bit_register_write (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
} }
return_VOID; return_ACPI_STATUS (status);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
* $Revision: 128 $ * $Revision: 133 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "acevents.h" #include "acevents.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h" #include "acinterp.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evregion") ACPI_MODULE_NAME ("evregion")
...@@ -36,7 +35,7 @@ ...@@ -36,7 +35,7 @@
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ev_install_default_address_space_handlers * FUNCTION: Acpi_ev_init_address_spaces
* *
* PARAMETERS: * PARAMETERS:
* *
...@@ -47,13 +46,13 @@ ...@@ -47,13 +46,13 @@
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_install_default_address_space_handlers ( acpi_ev_init_address_spaces (
void) void)
{ {
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_install_default_address_space_handlers"); ACPI_FUNCTION_TRACE ("Ev_init_address_spaces");
/* /*
...@@ -166,7 +165,7 @@ acpi_ev_execute_reg_method ( ...@@ -166,7 +165,7 @@ acpi_ev_execute_reg_method (
/* /*
* Set up the parameter objects * Set up the parameter objects
*/ */
params[0]->integer.value = region_obj->region.space_id; params[0]->integer.value = region_obj->region.space_id;
params[1]->integer.value = function; params[1]->integer.value = function;
params[2] = NULL; params[2] = NULL;
...@@ -209,9 +208,10 @@ acpi_ev_address_space_dispatch ( ...@@ -209,9 +208,10 @@ acpi_ev_address_space_dispatch (
u32 function, u32 function,
ACPI_PHYSICAL_ADDRESS address, ACPI_PHYSICAL_ADDRESS address,
u32 bit_width, u32 bit_width,
acpi_integer *value) void *value)
{ {
acpi_status status; acpi_status status;
acpi_status status2;
acpi_adr_space_handler handler; acpi_adr_space_handler handler;
acpi_adr_space_setup region_setup; acpi_adr_space_setup region_setup;
acpi_operand_object *handler_desc; acpi_operand_object *handler_desc;
...@@ -267,7 +267,10 @@ acpi_ev_address_space_dispatch ( ...@@ -267,7 +267,10 @@ acpi_ev_address_space_dispatch (
/* Re-enter the interpreter */ /* Re-enter the interpreter */
acpi_ex_enter_interpreter (); status2 = acpi_ex_enter_interpreter ();
if (ACPI_FAILURE (status2)) {
return_ACPI_STATUS (status2);
}
/* /*
* Init routine may fail * Init routine may fail
...@@ -325,7 +328,10 @@ acpi_ev_address_space_dispatch ( ...@@ -325,7 +328,10 @@ acpi_ev_address_space_dispatch (
* We just returned from a non-default handler, we must re-enter the * We just returned from a non-default handler, we must re-enter the
* interpreter * interpreter
*/ */
acpi_ex_enter_interpreter (); status2 = acpi_ex_enter_interpreter ();
if (ACPI_FAILURE (status2)) {
return_ACPI_STATUS (status2);
}
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -333,7 +339,7 @@ acpi_ev_address_space_dispatch ( ...@@ -333,7 +339,7 @@ acpi_ev_address_space_dispatch (
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ev_disassociate_region_from_handler * FUNCTION: Acpi_ev_detach_region
* *
* PARAMETERS: Region_obj - Region Object * PARAMETERS: Region_obj - Region Object
* Acpi_ns_is_locked - Namespace Region Already Locked? * Acpi_ns_is_locked - Namespace Region Already Locked?
...@@ -346,7 +352,7 @@ acpi_ev_address_space_dispatch ( ...@@ -346,7 +352,7 @@ acpi_ev_address_space_dispatch (
******************************************************************************/ ******************************************************************************/
void void
acpi_ev_disassociate_region_from_handler( acpi_ev_detach_region(
acpi_operand_object *region_obj, acpi_operand_object *region_obj,
u8 acpi_ns_is_locked) u8 acpi_ns_is_locked)
{ {
...@@ -359,12 +365,12 @@ acpi_ev_disassociate_region_from_handler( ...@@ -359,12 +365,12 @@ acpi_ev_disassociate_region_from_handler(
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_disassociate_region_from_handler"); ACPI_FUNCTION_TRACE ("Ev_detach_region");
region_obj2 = acpi_ns_get_secondary_object (region_obj); region_obj2 = acpi_ns_get_secondary_object (region_obj);
if (!region_obj2) { if (!region_obj2) {
return; return_VOID;
} }
region_context = region_obj2->extra.region_context; region_context = region_obj2->extra.region_context;
...@@ -410,7 +416,12 @@ acpi_ev_disassociate_region_from_handler( ...@@ -410,7 +416,12 @@ acpi_ev_disassociate_region_from_handler(
/* /*
* Now stop region accesses by executing the _REG method * Now stop region accesses by executing the _REG method
*/ */
acpi_ev_execute_reg_method (region_obj, 0); status = acpi_ev_execute_reg_method (region_obj, 0);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
acpi_format_exception (status),
acpi_ut_get_region_name (region_obj->region.space_id)));
}
if (acpi_ns_is_locked) { if (acpi_ns_is_locked) {
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
...@@ -473,7 +484,7 @@ acpi_ev_disassociate_region_from_handler( ...@@ -473,7 +484,7 @@ acpi_ev_disassociate_region_from_handler(
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ev_associate_region_and_handler * FUNCTION: Acpi_ev_attach_region
* *
* PARAMETERS: Handler_obj - Handler Object * PARAMETERS: Handler_obj - Handler Object
* Region_obj - Region Object * Region_obj - Region Object
...@@ -487,15 +498,16 @@ acpi_ev_disassociate_region_from_handler( ...@@ -487,15 +498,16 @@ acpi_ev_disassociate_region_from_handler(
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_associate_region_and_handler ( acpi_ev_attach_region (
acpi_operand_object *handler_obj, acpi_operand_object *handler_obj,
acpi_operand_object *region_obj, acpi_operand_object *region_obj,
u8 acpi_ns_is_locked) u8 acpi_ns_is_locked)
{ {
acpi_status status; acpi_status status;
acpi_status status2;
ACPI_FUNCTION_TRACE ("Ev_associate_region_and_handler"); ACPI_FUNCTION_TRACE ("Ev_attach_region");
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
...@@ -519,13 +531,19 @@ acpi_ev_associate_region_and_handler ( ...@@ -519,13 +531,19 @@ acpi_ev_associate_region_and_handler (
* method * method
*/ */
if (acpi_ns_is_locked) { if (acpi_ns_is_locked) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); status2 = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status2)) {
return_ACPI_STATUS (status2);
}
} }
status = acpi_ev_execute_reg_method (region_obj, 1); status = acpi_ev_execute_reg_method (region_obj, 1);
if (acpi_ns_is_locked) { if (acpi_ns_is_locked) {
(void) acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); status2 = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status2)) {
return_ACPI_STATUS (status2);
}
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -665,12 +683,12 @@ acpi_ev_addr_handler_helper ( ...@@ -665,12 +683,12 @@ acpi_ev_addr_handler_helper (
* *
* First disconnect region for any previous handler (if any) * First disconnect region for any previous handler (if any)
*/ */
acpi_ev_disassociate_region_from_handler (obj_desc, FALSE); acpi_ev_detach_region (obj_desc, FALSE);
/* /*
* Then connect the region to the new handler * Then connect the region to the new handler
*/ */
status = acpi_ev_associate_region_and_handler (handler_obj, obj_desc, FALSE); status = acpi_ev_attach_region (handler_obj, obj_desc, FALSE);
return (status); return (status);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evrgnini- ACPI Address_space (Op_region) init * Module Name: evrgnini- ACPI Address_space (Op_region) init
* $Revision: 57 $ * $Revision: 61 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include "acpi.h" #include "acpi.h"
#include "acevents.h" #include "acevents.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evrgnini") ACPI_MODULE_NAME ("evrgnini")
...@@ -205,12 +203,12 @@ acpi_ev_pci_config_region_setup ( ...@@ -205,12 +203,12 @@ acpi_ev_pci_config_region_setup (
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp); status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
/* /*
* The default is zero, since the allocation above zeroed the data, just * The default is zero, and since the allocation above zeroed
* do nothing on failures. * the data, just do nothing on failure.
*/ */
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
pci_id->device = ACPI_HIWORD (temp); pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp));
pci_id->function = ACPI_LOWORD (temp); pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp));
} }
/* /*
...@@ -235,9 +233,13 @@ acpi_ev_pci_config_region_setup ( ...@@ -235,9 +233,13 @@ acpi_ev_pci_config_region_setup (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
if (!(ACPI_STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING, if (!(ACPI_STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING)))) { sizeof (PCI_ROOT_HID_STRING)))) {
acpi_install_address_space_handler ((acpi_handle) node, status = acpi_install_address_space_handler ((acpi_handle) node,
ACPI_ADR_SPACE_PCI_CONFIG, ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL); ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install handler for %4.4s, %s\n",
node->name.ascii, acpi_format_exception (status)));
}
break; break;
} }
} }
...@@ -457,7 +459,7 @@ acpi_ev_initialize_region ( ...@@ -457,7 +459,7 @@ acpi_ev_initialize_region (
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
/* /*
* can only be a handler if the object exists * Can only be a handler if the object exists
*/ */
switch (node->type) { switch (node->type) {
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
...@@ -474,6 +476,10 @@ acpi_ev_initialize_region ( ...@@ -474,6 +476,10 @@ acpi_ev_initialize_region (
handler_obj = obj_desc->thermal_zone.addr_handler; handler_obj = obj_desc->thermal_zone.addr_handler;
break; break;
default:
/* Ignore other objects */
break;
} }
while (handler_obj) { while (handler_obj) {
...@@ -489,8 +495,8 @@ acpi_ev_initialize_region ( ...@@ -489,8 +495,8 @@ acpi_ev_initialize_region (
/* /*
* Found it! Now update the region and the handler * Found it! Now update the region and the handler
*/ */
acpi_ev_associate_region_and_handler (handler_obj, region_obj, status = acpi_ev_attach_region (handler_obj, region_obj,
acpi_ns_locked); acpi_ns_locked);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: evsci - System Control Interrupt configuration and * Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions * legacy to ACPI mode state transition functions
* $Revision: 83 $ * $Revision: 86 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
*/ */
#include "acpi.h" #include "acpi.h"
#include "acnamesp.h"
#include "achware.h"
#include "acevents.h" #include "acevents.h"
...@@ -53,6 +51,8 @@ acpi_ev_sci_handler ( ...@@ -53,6 +51,8 @@ acpi_ev_sci_handler (
void *context) void *context)
{ {
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
u32 value;
acpi_status status;
ACPI_FUNCTION_TRACE("Ev_sci_handler"); ACPI_FUNCTION_TRACE("Ev_sci_handler");
...@@ -62,7 +62,12 @@ acpi_ev_sci_handler ( ...@@ -62,7 +62,12 @@ acpi_ev_sci_handler (
* Make sure that ACPI is enabled by checking SCI_EN. Note that we are * Make sure that ACPI is enabled by checking SCI_EN. Note that we are
* required to treat the SCI interrupt as sharable, level, active low. * required to treat the SCI interrupt as sharable, level, active low.
*/ */
if (!acpi_hw_bit_register_read (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_DO_NOT_LOCK)) { status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (status)) {
return (ACPI_INTERRUPT_NOT_HANDLED);
}
if (!value) {
/* ACPI is not enabled; this interrupt cannot be for us */ /* ACPI is not enabled; this interrupt cannot be for us */
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
...@@ -135,15 +140,18 @@ acpi_ev_install_sci_handler (void) ...@@ -135,15 +140,18 @@ acpi_ev_install_sci_handler (void)
acpi_status acpi_status
acpi_ev_remove_sci_handler (void) acpi_ev_remove_sci_handler (void)
{ {
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_remove_sci_handler"); ACPI_FUNCTION_TRACE ("Ev_remove_sci_handler");
/* Just let the OS remove the handler and disable the level */ /* Just let the OS remove the handler and disable the level */
acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int, status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
acpi_ev_sci_handler); acpi_ev_sci_handler);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (status);
} }
/****************************************************************************** /******************************************************************************
* *
* Module Name: evxface - External interfaces for ACPI events * Module Name: evxface - External interfaces for ACPI events
* $Revision: 126 $ * $Revision: 128 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
#include "acpi.h" #include "acpi.h"
#include "achware.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acevents.h" #include "acevents.h"
#include "amlcode.h"
#include "acinterp.h" #include "acinterp.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
...@@ -516,8 +514,12 @@ acpi_install_gpe_handler ( ...@@ -516,8 +514,12 @@ acpi_install_gpe_handler (
/* Clear the GPE (of stale events), the enable it */ /* Clear the GPE (of stale events), the enable it */
acpi_hw_clear_gpe (gpe_number); status = acpi_hw_clear_gpe (gpe_number);
acpi_hw_enable_gpe (gpe_number); if (ACPI_FAILURE (status)) {
goto cleanup;
}
status = acpi_hw_enable_gpe (gpe_number);
cleanup: cleanup:
...@@ -566,7 +568,10 @@ acpi_remove_gpe_handler ( ...@@ -566,7 +568,10 @@ acpi_remove_gpe_handler (
/* Disable the GPE before removing the handler */ /* Disable the GPE before removing the handler */
acpi_hw_disable_gpe (gpe_number); status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -576,7 +581,7 @@ acpi_remove_gpe_handler ( ...@@ -576,7 +581,7 @@ acpi_remove_gpe_handler (
/* Make sure that the installed handler is the same */ /* Make sure that the installed handler is the same */
if (acpi_gbl_gpe_number_info[gpe_number_index].handler != handler) { if (acpi_gbl_gpe_number_info[gpe_number_index].handler != handler) {
acpi_hw_enable_gpe (gpe_number); (void) acpi_hw_enable_gpe (gpe_number);
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto cleanup; goto cleanup;
} }
...@@ -651,13 +656,15 @@ acpi_status ...@@ -651,13 +656,15 @@ acpi_status
acpi_release_global_lock ( acpi_release_global_lock (
u32 handle) u32 handle)
{ {
acpi_status status;
if (handle != acpi_gbl_global_lock_handle) { if (handle != acpi_gbl_global_lock_handle) {
return (AE_NOT_ACQUIRED); return (AE_NOT_ACQUIRED);
} }
acpi_ev_release_global_lock (); status = acpi_ev_release_global_lock ();
return (AE_OK); return (status);
} }
/****************************************************************************** /******************************************************************************
* *
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 51 $ * $Revision: 55 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -25,11 +25,7 @@ ...@@ -25,11 +25,7 @@
#include "acpi.h" #include "acpi.h"
#include "achware.h"
#include "acnamesp.h"
#include "acevents.h" #include "acevents.h"
#include "amlcode.h"
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt") ACPI_MODULE_NAME ("evxfevnt")
...@@ -118,7 +114,7 @@ acpi_disable (void) ...@@ -118,7 +114,7 @@ acpi_disable (void)
/* Unload the SCI interrupt handler */ /* Unload the SCI interrupt handler */
acpi_ev_remove_sci_handler (); status = acpi_ev_remove_sci_handler ();
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -144,6 +140,7 @@ acpi_enable_event ( ...@@ -144,6 +140,7 @@ acpi_enable_event (
u32 flags) u32 flags)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 value;
ACPI_FUNCTION_TRACE ("Acpi_enable_event"); ACPI_FUNCTION_TRACE ("Acpi_enable_event");
...@@ -156,7 +153,7 @@ acpi_enable_event ( ...@@ -156,7 +153,7 @@ acpi_enable_event (
/* Decode the Fixed Event */ /* Decode the Fixed Event */
if (event > ACPI_NUM_FIXED_EVENTS) { if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
...@@ -164,13 +161,21 @@ acpi_enable_event ( ...@@ -164,13 +161,21 @@ acpi_enable_event (
* Enable the requested fixed event (by writing a one to the * Enable the requested fixed event (by writing a one to the
* enable register bit) * enable register bit)
*/ */
acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id, status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
1, ACPI_MTX_LOCK); 1, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Make sure that the hardware responded */ /* Make sure that the hardware responded */
if (1 != acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].enable_register_id, status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
ACPI_MTX_LOCK)) { &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
if (value != 1) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not enable %s event\n", acpi_ut_get_event_name (event))); "Could not enable %s event\n", acpi_ut_get_event_name (event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
...@@ -188,7 +193,10 @@ acpi_enable_event ( ...@@ -188,7 +193,10 @@ acpi_enable_event (
/* Enable the requested GPE number */ /* Enable the requested GPE number */
acpi_hw_enable_gpe (event); status = acpi_hw_enable_gpe (event);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
if (flags & ACPI_EVENT_WAKE_ENABLE) { if (flags & ACPI_EVENT_WAKE_ENABLE) {
acpi_hw_enable_gpe_for_wakeup (event); acpi_hw_enable_gpe_for_wakeup (event);
...@@ -226,6 +234,7 @@ acpi_disable_event ( ...@@ -226,6 +234,7 @@ acpi_disable_event (
u32 flags) u32 flags)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 value;
ACPI_FUNCTION_TRACE ("Acpi_disable_event"); ACPI_FUNCTION_TRACE ("Acpi_disable_event");
...@@ -238,7 +247,7 @@ acpi_disable_event ( ...@@ -238,7 +247,7 @@ acpi_disable_event (
/* Decode the Fixed Event */ /* Decode the Fixed Event */
if (event > ACPI_NUM_FIXED_EVENTS) { if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
...@@ -246,11 +255,19 @@ acpi_disable_event ( ...@@ -246,11 +255,19 @@ acpi_disable_event (
* Disable the requested fixed event (by writing a zero to the * Disable the requested fixed event (by writing a zero to the
* enable register bit) * enable register bit)
*/ */
acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id, status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
0, ACPI_MTX_LOCK); 0, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
&value, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
if (0 != acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].enable_register_id, if (value != 0) {
ACPI_MTX_LOCK)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not disable %s events\n", acpi_ut_get_event_name (event))); "Could not disable %s events\n", acpi_ut_get_event_name (event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
...@@ -275,7 +292,7 @@ acpi_disable_event ( ...@@ -275,7 +292,7 @@ acpi_disable_event (
acpi_hw_disable_gpe_for_wakeup (event); acpi_hw_disable_gpe_for_wakeup (event);
} }
else { else {
acpi_hw_disable_gpe (event); status = acpi_hw_disable_gpe (event);
} }
break; break;
...@@ -319,7 +336,7 @@ acpi_clear_event ( ...@@ -319,7 +336,7 @@ acpi_clear_event (
/* Decode the Fixed Event */ /* Decode the Fixed Event */
if (event > ACPI_NUM_FIXED_EVENTS) { if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
...@@ -327,7 +344,7 @@ acpi_clear_event ( ...@@ -327,7 +344,7 @@ acpi_clear_event (
* Clear the requested fixed event (By writing a one to the * Clear the requested fixed event (By writing a one to the
* status register bit) * status register bit)
*/ */
acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].status_register_id, status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
1, ACPI_MTX_LOCK); 1, ACPI_MTX_LOCK);
break; break;
...@@ -340,7 +357,7 @@ acpi_clear_event ( ...@@ -340,7 +357,7 @@ acpi_clear_event (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
acpi_hw_clear_gpe (event); status = acpi_hw_clear_gpe (event);
break; break;
...@@ -393,14 +410,14 @@ acpi_get_event_status ( ...@@ -393,14 +410,14 @@ acpi_get_event_status (
/* Decode the Fixed Event */ /* Decode the Fixed Event */
if (event > ACPI_NUM_FIXED_EVENTS) { if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
/* Get the status of the requested fixed event */ /* Get the status of the requested fixed event */
*event_status = acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].status_register_id, status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
ACPI_MTX_LOCK); event_status, ACPI_MTX_LOCK);
break; break;
...@@ -414,7 +431,7 @@ acpi_get_event_status ( ...@@ -414,7 +431,7 @@ acpi_get_event_status (
/* Obtain status on the requested GPE number */ /* Obtain status on the requested GPE number */
acpi_hw_get_gpe_status (event, event_status); status = acpi_hw_get_gpe_status (event, event_status);
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces. * Address Spaces.
* $Revision: 48 $ * $Revision: 50 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
#include "acpi.h" #include "acpi.h"
#include "achware.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acevents.h" #include "acevents.h"
#include "amlcode.h"
#include "acinterp.h" #include "acinterp.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
...@@ -356,7 +354,7 @@ acpi_remove_address_space_handler ( ...@@ -356,7 +354,7 @@ acpi_remove_address_space_handler (
* The region is just inaccessible as indicated to * The region is just inaccessible as indicated to
* the _REG method * the _REG method
*/ */
acpi_ev_disassociate_region_from_handler(region_obj, TRUE); acpi_ev_detach_region (region_obj, TRUE);
/* /*
* Walk the list, since we took the first region and it * Walk the list, since we took the first region and it
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 105 $ * $Revision: 106 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -26,11 +26,9 @@ ...@@ -26,11 +26,9 @@
#include "acpi.h" #include "acpi.h"
#include "acparser.h" #include "acparser.h"
#include "acnamesp.h"
#include "acinterp.h" #include "acinterp.h"
#include "acevents.h" #include "acevents.h"
#include "amlcode.h" #include "amlcode.h"
#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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